Skip to content

Commit

Permalink
add attr wheelItemRotate
Browse files Browse the repository at this point in the history
  • Loading branch information
BCsl committed Oct 4, 2016
1 parent 691c5ea commit 9469ec0
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ You can also receive a callback for when an item is clicked, and whether it is s

### Gradle

`compile 'github.hellocsl:CursorWheelLayout:1.0.1'`
`compile 'github.hellocsl:CursorWheelLayout:1.0.2'`

### Maven

```xml
<dependency>
<groupId>github.hellocsl</groupId>
<artifactId>CursorWheelLayout</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<type>pom</type>
</dependency>
```
Expand Down Expand Up @@ -111,6 +111,7 @@ public class SimpleTextAdapter implements CursorWheelLayout.CycleWheelAdapter{
* wheelCursorHeight
* wheelCursorColor
* wheelBackgroundColor
* wheelRotateItem


## Refer to
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
android:layout_gravity="center_horizontal|top"
app:wheelCursorColor="#009688"
app:wheelCursorHeight="19dip"
app:wheelRotateItem="false"
app:wheelSelectedAngle="270">

<TextView
Expand Down
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'

classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.novoda:bintray-release:0.3.4'

// NOTE: Do not place your application dependencies here; they belong
Expand Down
Binary file removed demo/app-debug.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ publish {
userOrg = 'bcsl'
groupId = 'github.hellocsl'
artifactId = 'CursorWheelLayout'
publishVersion = '1.0.1'
publishVersion = '1.0.2'
desc = 'An Android Widget for selecting items that rotate on a wheel'
website = 'https://github.com/BCsl/CursorWheelLayout'
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
* @attr ref wheelFlingValue
* @attr ref wheelCursorColor
* @attr ref wheelCursorHeight
* @see github.hellocsl.cursorwheel.R.attr
* @attr ref wheelRotateItem
* @see R.github.hellocsl.cursorwheel.R.attr
*/
public class CursorWheelLayout extends ViewGroup {
private static final String TAG = "CircleMenuLayout";
Expand Down Expand Up @@ -174,6 +175,7 @@ public class CursorWheelLayout extends ViewGroup {

private int mTriangleHeight;


/**
* callback on menu item being click
*/
Expand All @@ -197,6 +199,8 @@ public class CursorWheelLayout extends ViewGroup {
private float mCenterRadioDimension;
private float mPaddingRadio;

private boolean mRotateItem;

public CursorWheelLayout(Context context) {
this(context, null);
}
Expand Down Expand Up @@ -234,6 +238,7 @@ private void initWheel(Context context, AttributeSet attrs) {
mMenuRadioDimension = ta.getFloat(R.styleable.CursorWheelLayout_wheelItemRadio, RADIO_DEFAULT_CHILD_DIMENSION);
mCenterRadioDimension = ta.getFloat(R.styleable.CursorWheelLayout_wheelCenterRadio, RADIO_DEFAULT_CENTER_DIMENSION);
mPaddingRadio = ta.getFloat(R.styleable.CursorWheelLayout_wheelPaddingRadio, RADIO_PADDING_LAYOUT);
mRotateItem = ta.getBoolean(R.styleable.CursorWheelLayout_wheelRotateItem, true);
ta.recycle();
}
init(context);
Expand Down Expand Up @@ -417,9 +422,11 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
* cWidth);

child.layout(left, top, left + cWidth, top + cWidth);
child.setPivotX(cWidth / 2.0f);
child.setPivotY(cWidth / 2.0f);
child.setRotation((float) (90 + mStartAngle));
if (mRotateItem) {
child.setPivotX(cWidth / 2.0f);
child.setPivotY(cWidth / 2.0f);
child.setRotation((float) (90 + mStartAngle));
}
mStartAngle += angleDelay;

}
Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values-wheel/attrs-wheel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<attr name="wheelCursorHeight" format="dimension"></attr>
<attr name="wheelCursorColor" format="color"></attr>
<attr name="wheelBackgroundColor" format="color"></attr>
<attr name="wheelRotateItem" format="boolean"></attr>
</declare-styleable>
</resources>

0 comments on commit 9469ec0

Please sign in to comment.