use of android.hardware.display.DcDimmingManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MiscInterfaceSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.rr_interface_other_settings);
Context mContext = getActivity().getApplicationContext();
PreferenceScreen prefSet = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
mAod = (SystemSettingSwitchPreference) findPreference(KEY_DOZE_ON_CHARGE);
mDisplay = (PreferenceCategory) findPreference(KEY_DISPLAY_CAT);
mPixel = (SystemSettingSwitchPreference) findPreference(PIXEL);
mWakeProx = (LineageSystemSettingSwitchPreference) findPreference(KEY_PROX_WAKE);
mHighTouch = (LineageSystemSettingSwitchPreference) findPreference(KEY_HIGH_TOUCH);
DcDimmingManager dm = (DcDimmingManager) mContext.getSystemService(Context.DC_DIM_SERVICE);
if (dm == null || !dm.isAvailable()) {
mDisplay.setVisible(false);
}
boolean dozeAlwaysOnDisplayAvailable = getContext().getResources().getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnDisplayAvailable);
if (!dozeAlwaysOnDisplayAvailable && mAod != null) {
getPreferenceScreen().removePreference(mAod);
}
if (SystemNavigationPreferenceController.isEdgeToEdgeEnabled(getContext())) {
mPixel.setEnabled(false);
mPixel.setSummary(R.string.navbar_not_active_pulse);
} else {
mPixel.setEnabled(true);
}
mScreenshotChordKeyTimeout = getContext().getResources().getInteger(com.android.internal.R.integer.config_screenshotChordKeyTimeout);
mScreenshotDelay = (CustomSeekBarPreference) findPreference(KEY_SCREENSHOT_DELAY);
mScreenshotDelay.setDefaultValue(mScreenshotChordKeyTimeout);
boolean hasAlertSlider = getContext().getResources().getBoolean(com.android.internal.R.bool.config_hasAlertSlider);
if (!hasAlertSlider) {
removePreference("alert_slider_notifications");
}
final PreferenceCategory aspectRatioCategory = (PreferenceCategory) getPreferenceScreen().findPreference(KEY_ASPECT_RATIO_CATEGORY);
final boolean supportMaxAspectRatio = getResources().getBoolean(com.android.internal.R.bool.config_haveHigherAspectRatioScreen);
if (!supportMaxAspectRatio) {
getPreferenceScreen().removePreference(aspectRatioCategory);
} else {
mAspectRatioAppsSelect = (AppMultiSelectListPreference) findPreference(KEY_ASPECT_RATIO_APPS_LIST);
mAspectRatioApps = (ScrollAppsViewPreference) findPreference(KEY_ASPECT_RATIO_APPS_LIST_SCROLLER);
final String valuesString = Settings.System.getString(resolver, Settings.System.OMNI_ASPECT_RATIO_APPS_LIST);
List<String> valuesList = new ArrayList<String>();
if (!TextUtils.isEmpty(valuesString)) {
valuesList.addAll(Arrays.asList(valuesString.split(":")));
mAspectRatioApps.setVisible(true);
mAspectRatioApps.setValues(valuesList);
} else {
mAspectRatioApps.setVisible(false);
}
mAspectRatioAppsSelect.setValues(valuesList);
mAspectRatioAppsSelect.setOnPreferenceChangeListener(this);
}
int anim = Settings.System.getInt(getActivity().getContentResolver(), Settings.System.RR_CONFIG_ANIM, 0);
try {
if (anim == 0) {
removePreference("animation");
} else if (anim == 1) {
removePreference("preview");
} else if (anim == 2) {
removePreference("animation");
removePreference("preview");
}
} catch (Exception e) {
}
}
Aggregations