Skip to content

Commit

Permalink
added setOnlyPositiveValues()
Browse files Browse the repository at this point in the history
  • Loading branch information
shchurov committed Jul 15, 2016
1 parent 1feaffc commit 21106e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 4
versionName "0.9.3"
versionCode 5
versionName "0.9.4"
}
buildTypes {
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class HorizontalWheelView extends View {
private Drawer drawer;
private TouchHandler touchHandler;
private double angle;
private boolean onlyPositiveValues;
private Listener listener;

public HorizontalWheelView(Context context, AttributeSet attrs) {
Expand All @@ -35,7 +36,10 @@ public void setListener(Listener listener) {
}

public void setRadiansAngle(double radians) {
this.angle = radians % (2 * PI);
angle = radians % (2 * PI);
if (onlyPositiveValues && angle < 0) {
angle += 2 * PI;
}
invalidate();
if (listener != null) {
listener.onRotationChanged(this.angle);
Expand Down Expand Up @@ -64,6 +68,10 @@ public double getCompleteTurnFraction() {
return getRadiansAngle() / (2 * PI);
}

public void setOnlyPositiveValues(boolean onlyPositiveValues) {
this.onlyPositiveValues = onlyPositiveValues;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
return touchHandler.onTouchEvent(event);
Expand Down

0 comments on commit 21106e2

Please sign in to comment.