aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/Settings.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2013-01-10 12:06:00 +0900
committerTadashi G. Takaoka <takaoka@google.com>2013-01-10 15:11:30 +0900
commita7a7f4e00277b2d3c1c38d2b6fe558e177e1e8d2 (patch)
tree92577bb83a03b7231623efae8dd351ec8d33fea0 /java/src/com/android/inputmethod/latin/Settings.java
parent88df3d9239a714f6cda82a25cce35844d4d4dfb4 (diff)
downloadlatinime-a7a7f4e00277b2d3c1c38d2b6fe558e177e1e8d2.tar.gz
latinime-a7a7f4e00277b2d3c1c38d2b6fe558e177e1e8d2.tar.xz
latinime-a7a7f4e00277b2d3c1c38d2b6fe558e177e1e8d2.zip
Add default button to vibration/volume settings dialog
Change-Id: I7beb4517314efdefeb47d91b14a6b02c3075c19f
Diffstat (limited to '')
-rw-r--r--java/src/com/android/inputmethod/latin/Settings.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java
index f592a2515..a720203ae 100644
--- a/java/src/com/android/inputmethod/latin/Settings.java
+++ b/java/src/com/android/inputmethod/latin/Settings.java
@@ -168,19 +168,21 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static float readKeypressSoundVolume(final SharedPreferences prefs,
final Resources res) {
final float volume = prefs.getFloat(PREF_KEYPRESS_SOUND_VOLUME, -1.0f);
- if (volume >= 0) {
- return volume;
- }
+ return (volume >= 0) ? volume : readDefaultKeypressSoundVolume(res);
+ }
+
+ public static float readDefaultKeypressSoundVolume(final Resources res) {
return Float.parseFloat(
ResourceUtils.getDeviceOverrideValue(res, R.array.keypress_volumes));
}
- public static int readVibrationDuration(final SharedPreferences prefs,
+ public static int readKeypressVibrationDuration(final SharedPreferences prefs,
final Resources res) {
final int ms = prefs.getInt(PREF_VIBRATION_DURATION_SETTINGS, -1);
- if (ms >= 0) {
- return ms;
- }
+ return (ms >= 0) ? ms : readDefaultKeypressVibrationDuration(res);
+ }
+
+ public static int readDefaultKeypressVibrationDuration(final Resources res) {
return Integer.parseInt(
ResourceUtils.getDeviceOverrideValue(res, R.array.keypress_vibration_durations));
}