use of androidx.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ButtonBrightness method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.button_brightness);
PreferenceScreen prefSet = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
mManualButtonBrightness = (CustomSeekBarPreference) findPreference(KEY_BUTTON_MANUAL_BRIGHTNESS_NEW);
final int customButtonBrightness = getResources().getInteger(com.android.internal.R.integer.config_button_brightness_default);
final int currentBrightness = Settings.System.getInt(resolver, Settings.System.CUSTOM_BUTTON_BRIGHTNESS, customButtonBrightness);
PowerManager pm = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE);
mManualButtonBrightness.setMax(pm.getMaximumScreenBrightnessSetting());
mManualButtonBrightness.setValue(currentBrightness);
mManualButtonBrightness.setOnPreferenceChangeListener(this);
mButtonTimoutBar = (CustomSeekBarPreference) findPreference(KEY_BUTTON_TIMEOUT);
int currentTimeout = Settings.System.getInt(resolver, Settings.System.BUTTON_BACKLIGHT_TIMEOUT, 0);
mButtonTimoutBar.setValue(currentTimeout);
mButtonTimoutBar.setOnPreferenceChangeListener(this);
}
use of androidx.preference.PreferenceScreen 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) {
}
}
use of androidx.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class PartSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.rr_parts);
Context mContext = getActivity().getApplicationContext();
final PreferenceScreen prefScreen = getPreferenceScreen();
final Resources res = getResources();
mSmartPixels = (Preference) findPreference(SMART_PIXELS);
boolean mSmartPixelsSupported = res.getBoolean(com.android.internal.R.bool.config_supportSmartPixels);
if (!mSmartPixelsSupported)
removePreference("smart_pixels");
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) {
}
}
use of androidx.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class HeadsUp method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.rr_headsup);
PreferenceScreen prefSet = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
Resources systemUiResources;
try {
systemUiResources = getPackageManager().getResourcesForApplication("com.android.systemui");
} catch (Exception e) {
return;
}
int defaultTimeOut = systemUiResources.getInteger(systemUiResources.getIdentifier("com.android.systemui:integer/heads_up_notification_decay", null, null));
mHeadsUpTimeOut = (ListPreference) findPreference(PREF_HEADS_UP_TIME_OUT);
mHeadsUpTimeOut.setOnPreferenceChangeListener(this);
int headsUpTimeOut = Settings.System.getInt(getContentResolver(), Settings.System.HEADS_UP_TIMEOUT, defaultTimeOut);
mHeadsUpTimeOut.setValue(String.valueOf(headsUpTimeOut));
updateHeadsUpTimeOutSummary(headsUpTimeOut);
int defaultSnooze = systemUiResources.getInteger(systemUiResources.getIdentifier("com.android.systemui:integer/heads_up_default_snooze_length_ms", null, null));
mHeadsUpSnoozeTime = (ListPreference) findPreference(PREF_HEADS_UP_SNOOZE_TIME);
mHeadsUpSnoozeTime.setOnPreferenceChangeListener(this);
int headsUpSnooze = Settings.System.getInt(getContentResolver(), Settings.System.HEADS_UP_NOTIFICATION_SNOOZE, defaultSnooze);
mHeadsUpSnoozeTime.setValue(String.valueOf(headsUpSnooze));
updateHeadsUpSnoozeTimeSummary(headsUpSnooze);
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) {
}
}
use of androidx.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccountTypePreferenceLoader method addPreferencesForType.
/**
* Gets the preferences.xml file associated with a particular account type.
* @param accountType the type of account
* @return a PreferenceScreen inflated from accountPreferenceId.
*/
public PreferenceScreen addPreferencesForType(final String accountType, PreferenceScreen parent) {
PreferenceScreen prefs = null;
if (mAuthenticatorHelper.containsAccountType(accountType)) {
AuthenticatorDescription desc = null;
try {
desc = mAuthenticatorHelper.getAccountTypeDescription(accountType);
if (desc != null && desc.accountPreferencesId != 0) {
// Load the context of the target package, then apply the
// base Settings theme (no references to local resources)
// and create a context theme wrapper so that we get the
// correct text colors. Control colors will still be wrong,
// but there's not much we can do about it since we can't
// reference local color resources.
final Context targetCtx = mFragment.getActivity().createPackageContextAsUser(desc.packageName, 0, mUserHandle);
final Theme baseTheme = mFragment.getResources().newTheme();
baseTheme.applyStyle(R.style.Theme_SettingsBase, true);
final Context themedCtx = new LocalClassLoaderContextThemeWrapper(getClass(), targetCtx, 0);
themedCtx.getTheme().setTo(baseTheme);
prefs = mFragment.getPreferenceManager().inflateFromResource(themedCtx, desc.accountPreferencesId, parent);
}
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "Couldn't load preferences.xml file from " + desc.packageName);
} catch (Resources.NotFoundException e) {
Log.w(TAG, "Couldn't load preferences.xml file from " + desc.packageName);
}
}
return prefs;
}
Aggregations