Fixed SeekBar not animating after device rotation

This commit is contained in:
Phillip Hsu
2016-08-28 22:32:16 -07:00
parent b03c6123e9
commit 2daf03b754
6 changed files with 104 additions and 47 deletions
@@ -17,14 +17,12 @@ import com.philliphsu.clock2.util.ProgressBarUtils;
import butterknife.Bind;
import butterknife.OnClick;
import butterknife.OnTouch;
/**
* Created by Phillip Hsu on 7/25/2016.
*/
public class TimerViewHolder extends BaseViewHolder<Timer> {
private static final String TAG = "TimerViewHolder";
private static final int MAX_PROGRESS = 100000;
private final AsyncTimersTableUpdateHandler mAsyncTimersTableUpdateHandler;
private TimerController mController;
@@ -71,11 +69,6 @@ public class TimerViewHolder extends BaseViewHolder<Timer> {
mController.stop();
}
@OnTouch(R.id.seek_bar)
boolean captureTouchOnSeekBar() {
return true; // Do nothing when the user touches the seek bar
}
private void bindLabel(String label) {
if (!label.isEmpty()) {
mLabel.setText(label);
@@ -137,9 +130,10 @@ public class TimerViewHolder extends BaseViewHolder<Timer> {
if (!timer.isRunning()) {
// If our scale were 1, then casting ratio to an int will ALWAYS
// truncate down to zero.
mSeekBar.setMax(100);
final int progress = (int) (100 * ratio);
mSeekBar.setProgress(progress);
// mSeekBar.setMax(100);
// final int progress = (int) (100 * ratio);
// mSeekBar.setProgress(progress);
ProgressBarUtils.setProgress(mSeekBar, ratio);
// mSeekBar.getThumb().mutate().setAlpha(progress == 0 ? 0 : 255);
} else {
// mSeekBar.getThumb().mutate().setAlpha(255);