summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Wei Liew <zhaoweiliew@gmail.com>2017-01-16 19:11:23 +0800
committerZhao Wei Liew <zhaoweiliew@gmail.com>2017-01-16 21:19:25 +0800
commit0cfb58bd75a916ac529b7df676b22af357bc1c03 (patch)
tree0f61e9102c3eb00ebcc06e3bd8428890947e67a5
parent8586c215c77da79e8e2b08e813442a702a3aa747 (diff)
downloadpackages_apps_Settings-0cfb58bd75a916ac529b7df676b22af357bc1c03.tar.gz
packages_apps_Settings-0cfb58bd75a916ac529b7df676b22af357bc1c03.tar.bz2
packages_apps_Settings-0cfb58bd75a916ac529b7df676b22af357bc1c03.zip
ButtonBacklight: Preview timeout once user stops dragging
Change-Id: I0abebe1041b6ad42b10e7d24f76ea17046e64666
-rw-r--r--src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java b/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java
index 96f60207f..ab3ee3f22 100644
--- a/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java
+++ b/src/com/android/settings/cyanogenmod/ButtonBacklightBrightness.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013 The CyanogenMod Project
+ * 2017 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,6 +60,8 @@ public class ButtonBacklightBrightness extends DialogPreference implements
private ContentResolver mResolver;
+ private int mOriginalTimeout;
+
public ButtonBacklightBrightness(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -105,7 +108,8 @@ public class ButtonBacklightBrightness extends DialogPreference implements
mTimeoutValue = (TextView) view.findViewById(R.id.timeout_value);
mTimeoutBar.setMax(30);
mTimeoutBar.setOnSeekBarChangeListener(this);
- mTimeoutBar.setProgress(getTimeout());
+ mOriginalTimeout = getTimeout();
+ mTimeoutBar.setProgress(mOriginalTimeout);
handleTimeoutUpdate(mTimeoutBar.getProgress());
ViewGroup buttonContainer = (ViewGroup) view.findViewById(R.id.button_container);
@@ -140,6 +144,7 @@ public class ButtonBacklightBrightness extends DialogPreference implements
@Override
public void onClick(View v) {
mTimeoutBar.setProgress(DEFAULT_BUTTON_TIMEOUT);
+ applyTimeout(DEFAULT_BUTTON_TIMEOUT);
if (mButtonBrightness != null) {
mButtonBrightness.reset();
}
@@ -156,6 +161,7 @@ public class ButtonBacklightBrightness extends DialogPreference implements
super.onDialogClosed(positiveResult);
if (!positiveResult) {
+ applyTimeout(mOriginalTimeout);
return;
}
@@ -316,7 +322,7 @@ public class ButtonBacklightBrightness extends DialogPreference implements
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
- // Do nothing here
+ applyTimeout(seekBar.getProgress());
}
private static class SavedState extends BaseSavedState {