sdm660-common: XiaomiParts: use % for notification LED brightness

Signed-off-by: Dušan Uverić <dusan.uveric9@gmail.com>
Change-Id: I7c7800fead90478cc8d7a1f94209d8920d36f5be
This commit is contained in:
Dušan Uverić 2020-04-15 22:27:30 +02:00 committed by OdSazib
parent e4b58961a5
commit 973ee9b5d9
No known key found for this signature in database
GPG key ID: CB336514F9F5CF69
3 changed files with 8 additions and 4 deletions

View file

@ -34,9 +34,10 @@
<org.lineageos.settings.device.preferences.NotificationLedSeekBarPreference
android:key="notification_led_brightness"
android:title="@string/notification_led_title"
android:max="64"
android:max="100"
app:min="1"
android:defaultValue="64" />
app:units="%"
android:defaultValue="100" />
</PreferenceCategory>
<PreferenceCategory

View file

@ -54,7 +54,7 @@ public class BootReceiver extends BroadcastReceiver implements Utils {
}
FileUtils.setValue(DeviceSettings.NOTIF_LED_PATH, Settings.Secure.getInt(
context.getContentResolver(), DeviceSettings.PREF_NOTIF_LED, 64));
context.getContentResolver(), DeviceSettings.PREF_NOTIF_LED, 100) / 100.0 * (DeviceSettings.MAX_LED - DeviceSettings.MIN_LED) + DeviceSettings.MIN_LED);
FileUtils.setValue(DeviceSettings.VIBRATION_STRENGTH_PATH, Settings.Secure.getInt(
context.getContentResolver(), DeviceSettings.PREF_VIBRATION_STRENGTH, 80) / 100.0 * (DeviceSettings.MAX_VIBRATION - DeviceSettings.MIN_VIBRATION) + DeviceSettings.MIN_VIBRATION);
FileUtils.setValue(DeviceSettings.THERMAL_PATH, Settings.Secure.getString(

View file

@ -44,6 +44,9 @@ public class DeviceSettings extends PreferenceFragment implements
public static final int MIN_VIBRATION = 116;
public static final int MAX_VIBRATION = 3596;
public static final int MIN_LED = 1;
public static final int MAX_LED = 64;
private static final String CATEGORY_DISPLAY = "display";
private static final String PREF_DEVICE_DOZE = "device_doze";
private static final String PREF_DEVICE_KCAL = "device_kcal";
@ -142,7 +145,7 @@ public class DeviceSettings extends PreferenceFragment implements
final String key = preference.getKey();
switch (key) {
case PREF_NOTIF_LED:
FileUtils.setValue(NOTIF_LED_PATH, (int) value);
FileUtils.setValue(NOTIF_LED_PATH, (int) value / 100.0 * (MAX_LED - MIN_LED) + MIN_LED);
break;
case PREF_VIBRATION_STRENGTH: