summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjt1134 <jt1134@gmail.com>2012-11-11 03:07:34 -0600
committerPawit Pornkitprasan <p.pawit@gmail.com>2012-11-16 18:11:09 +0700
commit66786a5173bc24dc596733617b34726a5b0cf031 (patch)
treeb7c9b9f62bdd7d1d6a7f717fcc6e517d504296d2
parent3e961fd8a5bb65414ba8013aedb4e8552da8fe5d (diff)
downloaddevice_samsung_aries-common-66786a5173bc24dc596733617b34726a5b0cf031.zip
device_samsung_aries-common-66786a5173bc24dc596733617b34726a5b0cf031.tar.gz
device_samsung_aries-common-66786a5173bc24dc596733617b34726a5b0cf031.tar.bz2
AriesParts: add a reset button for all seekbar preferences
Change-Id: Ie554b1a1b2e0a6e907843882c978bfeae075eaff
-rw-r--r--AriesParts/res/layout/preference_dialog_color_tuning.xml20
-rw-r--r--AriesParts/res/layout/preference_dialog_vibration.xml15
-rw-r--r--AriesParts/res/layout/preference_dialog_volume_boost.xml16
-rw-r--r--AriesParts/res/values/strings.xml2
-rw-r--r--AriesParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java37
-rw-r--r--AriesParts/src/com/cyanogenmod/settings/device/VibrationPreference.java11
-rw-r--r--AriesParts/src/com/cyanogenmod/settings/device/VolumeBoostPreference.java31
7 files changed, 123 insertions, 9 deletions
diff --git a/AriesParts/res/layout/preference_dialog_color_tuning.xml b/AriesParts/res/layout/preference_dialog_color_tuning.xml
index 2c52b62..5f53fa2 100644
--- a/AriesParts/res/layout/preference_dialog_color_tuning.xml
+++ b/AriesParts/res/layout/preference_dialog_color_tuning.xml
@@ -160,6 +160,22 @@
android:paddingTop="2dip"
android:paddingLeft="20dip"
android:paddingRight="20dip" />
-
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:layout_below="@+id/color_blue_gamma_seekbar"
+ android:paddingTop="5dip" >
+
+ <Button android:id="@+id/color_reset"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="20dip"
+ android:paddingRight="20dip"
+ android:text="@string/button_reset_title" />
+
+ </LinearLayout>
+
</RelativeLayout>
-</ScrollView> \ No newline at end of file
+</ScrollView>
diff --git a/AriesParts/res/layout/preference_dialog_vibration.xml b/AriesParts/res/layout/preference_dialog_vibration.xml
index 02cca16..131092b 100644
--- a/AriesParts/res/layout/preference_dialog_vibration.xml
+++ b/AriesParts/res/layout/preference_dialog_vibration.xml
@@ -32,7 +32,7 @@
android:paddingLeft="20dip"
android:paddingRight="20dip" />
- <RelativeLayout
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
@@ -42,11 +42,16 @@
<Button android:id="@+id/vibration_test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:paddingLeft="20dip"
- android:paddingRight="20dip"
- android:text="@string/vibration_test_title" />
+ android:text="@string/vibration_test_title"
+ android:width="100dp" />
- </RelativeLayout>
+ <Button android:id="@+id/vibration_reset"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/button_reset_title"
+ android:width="100dp" />
+
+ </LinearLayout>
</RelativeLayout>
</ScrollView>
diff --git a/AriesParts/res/layout/preference_dialog_volume_boost.xml b/AriesParts/res/layout/preference_dialog_volume_boost.xml
index 8134a55..cd7f9eb 100644
--- a/AriesParts/res/layout/preference_dialog_volume_boost.xml
+++ b/AriesParts/res/layout/preference_dialog_volume_boost.xml
@@ -208,5 +208,21 @@
android:paddingLeft="20dip"
android:paddingRight="20dip" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:layout_below="@+id/mic_hp_no_mic_seekbar"
+ android:paddingTop="5dip" >
+
+ <Button android:id="@+id/volume_reset"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:paddingLeft="20dip"
+ android:paddingRight="20dip"
+ android:text="@string/button_reset_title" />
+
+ </LinearLayout>
+
</RelativeLayout>
</ScrollView>
diff --git a/AriesParts/res/values/strings.xml b/AriesParts/res/values/strings.xml
index fe2d7d6..f5fc448 100644
--- a/AriesParts/res/values/strings.xml
+++ b/AriesParts/res/values/strings.xml
@@ -56,6 +56,8 @@
<string name="vibration_title">Vibration intensity</string>
<string name="vibration_test_title">Test</string>
+ <string name="button_reset_title">Reset</string>
+
<!-- Used for activity title. Usually not visible, except on the
multi-task screen -->
<string name="generic_warning_title">Warning</string>
diff --git a/AriesParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java b/AriesParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java
index 390c5a2..6c72906 100644
--- a/AriesParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java
+++ b/AriesParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java
@@ -7,6 +7,8 @@ import android.preference.DialogPreference;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
import android.widget.SeekBar;
import android.widget.TextView;
@@ -14,7 +16,7 @@ import android.widget.TextView;
* Special preference type that allows configuration of both the ring volume and
* notification volume.
*/
-public class ColorTuningPreference extends DialogPreference {
+public class ColorTuningPreference extends DialogPreference implements OnClickListener {
enum Colors {
RED,
@@ -92,6 +94,13 @@ public class ColorTuningPreference extends DialogPreference {
TextView valueDisplay = (TextView) view.findViewById(GAMMA_VALUE_DISPLAY_ID[i]);
mSeekBars[SEEKBAR_ID.length + i] = new GammaSeekBar(seekBar, valueDisplay, GAMMA_FILE_PATH[i]);
}
+
+ SetupButtonClickListener(view);
+ }
+
+ private void SetupButtonClickListener(View view) {
+ Button mResetButton = (Button)view.findViewById(R.id.color_reset);
+ mResetButton.setOnClickListener(this);
}
@Override
@@ -208,6 +217,12 @@ public class ColorTuningPreference extends DialogPreference {
mValueDisplay.setText(String.format("%.3f", (double) progress / MAX_VALUE));
}
+ public void resetDefault(String path, int value) {
+ mSeekBar.setProgress(value);
+ updateValue(value);
+ Utils.writeColor(path, value);
+ }
+
}
class GammaSeekBar extends ColorSeekBar {
@@ -238,5 +253,25 @@ public class ColorTuningPreference extends DialogPreference {
mValueDisplay.setText("-" + progress);
}
+ public void resetDefault(String path, int value) {
+ mSeekBar.setProgress(value);
+ updateValue(value);
+ Utils.writeGamma(path, value);
+ }
+
}
+
+ public void onClick(View v) {
+ switch(v.getId()) {
+ case R.id.color_reset:
+ for (int i = 0; i < SEEKBAR_ID.length; i++) {
+ mSeekBars[i].resetDefault(FILE_PATH[i], MAX_VALUE);
+ }
+ for (int i = 0; i < GAMMA_SEEKBAR_ID.length; i++) {
+ mSeekBars[SEEKBAR_ID.length + i].resetDefault(GAMMA_FILE_PATH[i], GAMMA_DEFAULT_VALUE);
+ }
+ break;
+ }
+ }
+
}
diff --git a/AriesParts/src/com/cyanogenmod/settings/device/VibrationPreference.java b/AriesParts/src/com/cyanogenmod/settings/device/VibrationPreference.java
index 1c5f204..1799ab4 100644
--- a/AriesParts/src/com/cyanogenmod/settings/device/VibrationPreference.java
+++ b/AriesParts/src/com/cyanogenmod/settings/device/VibrationPreference.java
@@ -51,6 +51,9 @@ public class VibrationPreference extends DialogPreference implements OnClickList
private void SetupButtonClickListener(View view) {
Button mTestButton = (Button)view.findViewById(R.id.vibration_test);
mTestButton.setOnClickListener(this);
+
+ Button mResetButton = (Button)view.findViewById(R.id.vibration_reset);
+ mResetButton.setOnClickListener(this);
}
@Override
@@ -142,6 +145,11 @@ public class VibrationPreference extends DialogPreference implements OnClickList
mValueDisplay.setText(String.valueOf(progress) + "%");
}
+ public void resetDefault() {
+ mSeekBar.setProgress(MAX_VALUE);
+ updateValue(MAX_VALUE);
+ Utils.writeValue(FILE_PATH, String.valueOf(MAX_VALUE));
+ }
}
public void onClick(View v) {
@@ -149,6 +157,9 @@ public class VibrationPreference extends DialogPreference implements OnClickList
case R.id.vibration_test:
testVibration();
break;
+ case R.id.vibration_reset:
+ mSeekBar.resetDefault();
+ break;
}
}
diff --git a/AriesParts/src/com/cyanogenmod/settings/device/VolumeBoostPreference.java b/AriesParts/src/com/cyanogenmod/settings/device/VolumeBoostPreference.java
index f168314..c048132 100644
--- a/AriesParts/src/com/cyanogenmod/settings/device/VolumeBoostPreference.java
+++ b/AriesParts/src/com/cyanogenmod/settings/device/VolumeBoostPreference.java
@@ -7,6 +7,8 @@ import android.preference.DialogPreference;
import android.preference.PreferenceManager;
import android.util.AttributeSet;
import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
import android.widget.SeekBar;
import android.widget.TextView;
@@ -14,7 +16,7 @@ import android.widget.TextView;
* Special preference type that allows configuration of both the in call volume and
* in call mic gain.
*/
-public class VolumeBoostPreference extends DialogPreference {
+public class VolumeBoostPreference extends DialogPreference implements OnClickListener {
private static final int[] SEEKBAR_ID = new int[] {
R.id.boost_rcv_seekbar,
@@ -93,6 +95,13 @@ public class VolumeBoostPreference extends DialogPreference {
TextView valueDisplay = (TextView) view.findViewById(MIC_VALUE_DISPLAY_ID[i]);
mSeekBars[SEEKBAR_ID.length + i] = new MicSeekBar(seekBar, valueDisplay, MIC_FILE_PATH[i]);
}
+
+ SetupButtonClickListener(view);
+ }
+
+ private void SetupButtonClickListener(View view) {
+ Button mResetButton = (Button)view.findViewById(R.id.volume_reset);
+ mResetButton.setOnClickListener(this);
}
@Override
@@ -211,6 +220,12 @@ public class VolumeBoostPreference extends DialogPreference {
mValueDisplay.setText(String.valueOf(progress));
}
+ public void resetDefault(String path, int value) {
+ mSeekBar.setProgress(value);
+ updateValue(value);
+ Utils.writeValue(path, String.valueOf(value));
+ }
+
}
class MicSeekBar extends VolumeSeekBar {
@@ -242,4 +257,18 @@ public class VolumeBoostPreference extends DialogPreference {
}
}
+
+ public void onClick(View v) {
+ switch(v.getId()) {
+ case R.id.volume_reset:
+ for (int i = 0; i < BOOST_FILE_PATH.length; i++) {
+ mSeekBars[i].resetDefault(BOOST_FILE_PATH[i], BOOST_DEFAULT_VALUE);
+ }
+ for (int i = 0; i < MIC_FILE_PATH.length; i++) {
+ mSeekBars[BOOST_FILE_PATH.length + i].resetDefault(MIC_FILE_PATH[i], MIC_DEFAULT_VALUE);
+ }
+ break;
+ }
+ }
+
}