diff --git a/res/xml/cherish_settings_button.xml b/res/xml/cherish_settings_button.xml index 68e8f00..6af320b 100644 --- a/res/xml/cherish_settings_button.xml +++ b/res/xml/cherish_settings_button.xml @@ -47,7 +47,7 @@ diff --git a/src/com/cherish/settings/fragments/ButtonSettings.java b/src/com/cherish/settings/fragments/ButtonSettings.java index 6893314..03fe873 100644 --- a/src/com/cherish/settings/fragments/ButtonSettings.java +++ b/src/com/cherish/settings/fragments/ButtonSettings.java @@ -116,16 +116,16 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange if (variableBrightness) { hwkeyCat.removePreference(mButtonBrightness_sw); if (mButtonBrightness != null) { - int ButtonBrightness = Settings.System.getInt(getContentResolver(), - Settings.System.BUTTON_BRIGHTNESS, 255); - mButtonBrightness.setValue(ButtonBrightness / 1); + float ButtonBrightness = Settings.System.getFloat(getContentResolver(), + Settings.System.BUTTON_BRIGHTNESS, 1.0f); + mButtonBrightness.setValue((int)(ButtonBrightness * 100.0f)); mButtonBrightness.setOnPreferenceChangeListener(this); } } else { hwkeyCat.removePreference(mButtonBrightness); if (mButtonBrightness_sw != null) { - mButtonBrightness_sw.setChecked((Settings.System.getInt(getContentResolver(), - Settings.System.BUTTON_BRIGHTNESS, 1) == 1)); + mButtonBrightness_sw.setChecked((Settings.System.getFloat(getContentResolver(), + Settings.System.BUTTON_BRIGHTNESS, 1.0f) == 1)); mButtonBrightness_sw.setOnPreferenceChangeListener(this); } } @@ -202,14 +202,14 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange .setSummary(mBacklightTimeout.getEntries()[BacklightTimeoutIndex]); return true; } else if (preference == mButtonBrightness) { - int value = (Integer) newValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.BUTTON_BRIGHTNESS, value * 1); + float value = (Integer) newValue; + Settings.System.putFloat(getActivity().getContentResolver(), + Settings.System.BUTTON_BRIGHTNESS, value / 100.0f); return true; } else if (preference == mButtonBrightness_sw) { boolean value = (Boolean) newValue; - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.BUTTON_BRIGHTNESS, value ? 1 : 0); + Settings.System.putFloat(getActivity().getContentResolver(), + Settings.System.BUTTON_BRIGHTNESS, value ? 1.0f : -1.0f); return true; } else if (preference == mHwKeyDisable) { boolean value = (Boolean) newValue;