diff options
author | KalimochoAz <calimochoazucarado@gmail.com> | 2012-02-07 21:34:44 -0500 |
---|---|---|
committer | Robert Burns <burnsra@gmail.com> | 2012-02-09 21:32:21 -0500 |
commit | 981b14fd4afc0b9151bb5c781aa8b4d93ad95fb6 (patch) | |
tree | 055e90e09c8093327f3956cd398dff1b074ff5e4 /CrespoParts | |
parent | 641ad6a9e0fb7f58e911e84748e746a8e93c5098 (diff) | |
download | device_samsung_crespo-981b14fd4afc0b9151bb5c781aa8b4d93ad95fb6.tar.gz device_samsung_crespo-981b14fd4afc0b9151bb5c781aa8b4d93ad95fb6.tar.bz2 device_samsung_crespo-981b14fd4afc0b9151bb5c781aa8b4d93ad95fb6.zip |
Fix restoring color multipliers
Diffstat (limited to 'CrespoParts')
-rw-r--r-- | CrespoParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/CrespoParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java b/CrespoParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java index 6db5bb0..085cae7 100644 --- a/CrespoParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java +++ b/CrespoParts/src/com/cyanogenmod/settings/device/ColorTuningPreference.java @@ -25,6 +25,7 @@ import android.util.AttributeSet; import android.view.View; import android.widget.SeekBar; import android.widget.TextView; +import android.util.Log; /** * Special preference type that allows configuration of both the ring volume and @@ -104,20 +105,28 @@ public class ColorTuningPreference extends DialogPreference { * @param context The context to read the SharedPreferences from */ public static void restore(Context context) { + int iValue, iValue2; if (!isSupported()) { return; } SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); for (String filePath : FILE_PATH) { - int iValue; String sDefaultValue = Utils.readOneLine(filePath); + Log.d(TAG,"INIT: " + sDefaultValue); + try { + iValue2 = Integer.parseInt(sDefaultValue); + } catch (NumberFormatException e) { + iValue2 = MAX_VALUE; + } try { - iValue = sharedPrefs.getInt(filePath, Integer.parseInt(sDefaultValue)); + iValue = sharedPrefs.getInt(filePath, iValue2); + Log.d(TAG, "restore: iValue: " + iValue + " File: " + filePath); } catch (NumberFormatException e) { - iValue = MAX_VALUE; + iValue = iValue2; + Log.e(TAG, "restore ERROR: iValue: " + iValue + " File: " + filePath); } - Utils.writeColor(filePath, iValue); + Utils.writeColor(filePath, (int) iValue); } } |