buttons: converting to float
This commit is contained in:
@@ -47,7 +47,7 @@
|
|||||||
<com.cherish.settings.preferences.CustomSeekBarPreference
|
<com.cherish.settings.preferences.CustomSeekBarPreference
|
||||||
android:key="button_brightness"
|
android:key="button_brightness"
|
||||||
android:title="@string/button_brightness_title"
|
android:title="@string/button_brightness_title"
|
||||||
android:max="255"
|
android:max="100"
|
||||||
settings:min="0"
|
settings:min="0"
|
||||||
settings:units=""
|
settings:units=""
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|||||||
@@ -116,16 +116,16 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange
|
|||||||
if (variableBrightness) {
|
if (variableBrightness) {
|
||||||
hwkeyCat.removePreference(mButtonBrightness_sw);
|
hwkeyCat.removePreference(mButtonBrightness_sw);
|
||||||
if (mButtonBrightness != null) {
|
if (mButtonBrightness != null) {
|
||||||
int ButtonBrightness = Settings.System.getInt(getContentResolver(),
|
float ButtonBrightness = Settings.System.getFloat(getContentResolver(),
|
||||||
Settings.System.BUTTON_BRIGHTNESS, 255);
|
Settings.System.BUTTON_BRIGHTNESS, 1.0f);
|
||||||
mButtonBrightness.setValue(ButtonBrightness / 1);
|
mButtonBrightness.setValue((int)(ButtonBrightness * 100.0f));
|
||||||
mButtonBrightness.setOnPreferenceChangeListener(this);
|
mButtonBrightness.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hwkeyCat.removePreference(mButtonBrightness);
|
hwkeyCat.removePreference(mButtonBrightness);
|
||||||
if (mButtonBrightness_sw != null) {
|
if (mButtonBrightness_sw != null) {
|
||||||
mButtonBrightness_sw.setChecked((Settings.System.getInt(getContentResolver(),
|
mButtonBrightness_sw.setChecked((Settings.System.getFloat(getContentResolver(),
|
||||||
Settings.System.BUTTON_BRIGHTNESS, 1) == 1));
|
Settings.System.BUTTON_BRIGHTNESS, 1.0f) == 1));
|
||||||
mButtonBrightness_sw.setOnPreferenceChangeListener(this);
|
mButtonBrightness_sw.setOnPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,14 +202,14 @@ public class ButtonSettings extends ActionFragment implements OnPreferenceChange
|
|||||||
.setSummary(mBacklightTimeout.getEntries()[BacklightTimeoutIndex]);
|
.setSummary(mBacklightTimeout.getEntries()[BacklightTimeoutIndex]);
|
||||||
return true;
|
return true;
|
||||||
} else if (preference == mButtonBrightness) {
|
} else if (preference == mButtonBrightness) {
|
||||||
int value = (Integer) newValue;
|
float value = (Integer) newValue;
|
||||||
Settings.System.putInt(getActivity().getContentResolver(),
|
Settings.System.putFloat(getActivity().getContentResolver(),
|
||||||
Settings.System.BUTTON_BRIGHTNESS, value * 1);
|
Settings.System.BUTTON_BRIGHTNESS, value / 100.0f);
|
||||||
return true;
|
return true;
|
||||||
} else if (preference == mButtonBrightness_sw) {
|
} else if (preference == mButtonBrightness_sw) {
|
||||||
boolean value = (Boolean) newValue;
|
boolean value = (Boolean) newValue;
|
||||||
Settings.System.putInt(getActivity().getContentResolver(),
|
Settings.System.putFloat(getActivity().getContentResolver(),
|
||||||
Settings.System.BUTTON_BRIGHTNESS, value ? 1 : 0);
|
Settings.System.BUTTON_BRIGHTNESS, value ? 1.0f : -1.0f);
|
||||||
return true;
|
return true;
|
||||||
} else if (preference == mHwKeyDisable) {
|
} else if (preference == mHwKeyDisable) {
|
||||||
boolean value = (Boolean) newValue;
|
boolean value = (Boolean) newValue;
|
||||||
|
|||||||
Reference in New Issue
Block a user