mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-12-01 12:31:45 +00:00
Show blue arc around whole circle when sleep timer set to “always” (#8077)
This commit is contained in:
@ -118,7 +118,11 @@ public class TimeRangeDialog extends MaterialAlertDialogBuilder {
|
||||
float angleDistance = (float) ((to - from + 24) % 24) / 24 * 360;
|
||||
paintSelected.setStrokeWidth(padding / 6);
|
||||
paintSelected.setStyle(Paint.Style.STROKE);
|
||||
canvas.drawArc(bounds, angleFrom, angleDistance, false, paintSelected);
|
||||
if (from == to) {
|
||||
canvas.drawArc(bounds, 0, 360, false, paintSelected);
|
||||
} else {
|
||||
canvas.drawArc(bounds, angleFrom, angleDistance, false, paintSelected);
|
||||
}
|
||||
paintSelected.setStyle(Paint.Style.FILL);
|
||||
Point p1 = radToPoint(angleFrom + 90, size / 2 - padding);
|
||||
canvas.drawCircle(p1.x, p1.y, padding / 2, paintSelected);
|
||||
@ -169,8 +173,8 @@ public class TimeRangeDialog extends MaterialAlertDialogBuilder {
|
||||
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
int newTime = (int) (24 * (angle / 360.0));
|
||||
if (from == to && touching != 0) {
|
||||
// Switch which handle is focussed such that selection is the smaller arc
|
||||
touching = (((newTime - to + 24) % 24) < 12) ? 2 : 1;
|
||||
// Switch which handle is focused such that selection is the longer arc
|
||||
touching = (((newTime - to + 24) % 24) < 12) ? 1 : 2;
|
||||
}
|
||||
if (touching == 1) {
|
||||
from = newTime;
|
||||
@ -181,9 +185,11 @@ public class TimeRangeDialog extends MaterialAlertDialogBuilder {
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
} else if (touching != 0) {
|
||||
touching = 0;
|
||||
return true;
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
|
||||
if (touching != 0) {
|
||||
touching = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user