sm6150-common: parts: Set default doze brightness icon
Change-Id: I9d6b4b045af4a0e3a8865e17fc88b72e93c9c711
This commit is contained in:
parent
8720bb5de8
commit
dd8b25b294
@ -117,6 +117,7 @@ public class DozeSettingsFragment extends PreferenceFragment
|
||||
mWakeOnGesturePreference.setDependency(DozeUtils.ALWAYS_ON_DISPLAY);
|
||||
pickupSensorCategory.setDependency(DozeUtils.ALWAYS_ON_DISPLAY);
|
||||
proximitySensorCategory.setDependency(DozeUtils.ALWAYS_ON_DISPLAY);
|
||||
DozeUtils.updateDozeBrightnessIcon(getContext(), mDozeBrightnessPreference);
|
||||
}
|
||||
}
|
||||
|
||||
@ -166,23 +167,12 @@ public class DozeSettingsFragment extends PreferenceFragment
|
||||
if (!DozeUtils.DOZE_BRIGHTNESS_AUTO.equals((String) newValue)) {
|
||||
DozeUtils.setDozeMode((String) newValue);
|
||||
}
|
||||
switch ((String) newValue) {
|
||||
case DozeUtils.DOZE_BRIGHTNESS_LBM:
|
||||
mDozeBrightnessPreference.setIcon(R.drawable.ic_doze_brightness_low);
|
||||
break;
|
||||
case DozeUtils.DOZE_BRIGHTNESS_HBM:
|
||||
mDozeBrightnessPreference.setIcon(R.drawable.ic_doze_brightness_high);
|
||||
break;
|
||||
case DozeUtils.DOZE_BRIGHTNESS_DARK:
|
||||
mDozeBrightnessPreference.setIcon(R.drawable.ic_doze_brightness_dark);
|
||||
break;
|
||||
case DozeUtils.DOZE_BRIGHTNESS_AUTO:
|
||||
mDozeBrightnessPreference.setIcon(R.drawable.ic_doze_brightness_auto);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mHandler.post(() -> DozeUtils.checkDozeService(getActivity()));
|
||||
mHandler.post(() -> {
|
||||
DozeUtils.checkDozeService(getActivity());
|
||||
DozeUtils.updateDozeBrightnessIcon(getContext(), mDozeBrightnessPreference);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -199,6 +189,7 @@ public class DozeSettingsFragment extends PreferenceFragment
|
||||
DozeUtils.enableAlwaysOn(getActivity(), false);
|
||||
mAlwaysOnDisplayPreference.setChecked(false);
|
||||
mDozeBrightnessPreference.setValue(DozeUtils.DOZE_BRIGHTNESS_LBM);
|
||||
DozeUtils.updateDozeBrightnessIcon(getContext(), mDozeBrightnessPreference);
|
||||
mPickUpPreference.setChecked(false);
|
||||
mHandwavePreference.setChecked(false);
|
||||
mPocketPreference.setChecked(false);
|
||||
|
@ -28,8 +28,10 @@ import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.lineageos.settings.R;
|
||||
import org.lineageos.settings.utils.FileUtils;
|
||||
|
||||
import static android.provider.Settings.Secure.DOZE_ALWAYS_ON;
|
||||
@ -186,4 +188,22 @@ public final class DozeUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static void updateDozeBrightnessIcon(Context context, ListPreference preference) {
|
||||
switch (PreferenceManager.getDefaultSharedPreferences(context).getString(
|
||||
DOZE_BRIGHTNESS_KEY, DOZE_BRIGHTNESS_LBM)) {
|
||||
case DozeUtils.DOZE_BRIGHTNESS_LBM:
|
||||
preference.setIcon(R.drawable.ic_doze_brightness_low);
|
||||
break;
|
||||
case DozeUtils.DOZE_BRIGHTNESS_HBM:
|
||||
preference.setIcon(R.drawable.ic_doze_brightness_high);
|
||||
break;
|
||||
case DozeUtils.DOZE_BRIGHTNESS_DARK:
|
||||
preference.setIcon(R.drawable.ic_doze_brightness_dark);
|
||||
break;
|
||||
case DozeUtils.DOZE_BRIGHTNESS_AUTO:
|
||||
preference.setIcon(R.drawable.ic_doze_brightness_auto);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user