Skip to content

Commit

Permalink
# fixed view selection when anger > 360
Browse files Browse the repository at this point in the history
# fixed selector centering
  • Loading branch information
sbra0902 committed Oct 16, 2017
1 parent 9b6bff3 commit 03932df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,27 @@ public class AngleRange {

private Float mUpperAngle;

private boolean isUpperBreak;

public AngleRange(Float lowerAngle, Float upperAngle) {
mLowerAngle = lowerAngle;
mUpperAngle = upperAngle;
if (upperAngle > 360) {
isUpperBreak = true;
}
}

public boolean matches(Float angle){
public boolean matches(Float angle) {

if (isUpperBreak && angle + 360 <= mUpperAngle) {
angle += 360;
}

return angle >= mLowerAngle && angle <= mUpperAngle;
}

public Float getCenter(){
public Float getCenter() {
return (mLowerAngle + mUpperAngle) / 2;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.support.annotation.Nullable;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

import kaufland.com.andcircularselect.R;
Expand Down Expand Up @@ -65,7 +66,7 @@ protected void dispatchDraw(Canvas canvas) {
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
mFuldrawingRectF = new RectF(left + mCircleSize, top + mCircleSize, right - mCircleSize, bottom- - mCircleSize);
mFuldrawingRectF = new RectF(left + mCircleSize, top + mCircleSize, right - mCircleSize, bottom - mCircleSize);


}
Expand Down

0 comments on commit 03932df

Please sign in to comment.