use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AdaptiveSleepSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
final FooterPreference footerPreference = mFooterPreferenceMixin.createFooterPreference();
mContext = getContext();
footerPreference.setIcon(R.drawable.ic_privacy_shield_24dp);
footerPreference.setTitle(R.string.adaptive_sleep_privacy);
Preference permissionPreference = findPreference(AdaptiveSleepPermissionPreferenceController.PREF_NAME);
if (permissionPreference != null) {
permissionPreference.setVisible(false);
}
mContext.getSharedPreferences(PREF, Context.MODE_PRIVATE).edit().putBoolean(PREF_KEY_INTERACTED, true).apply();
}
use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DcDimmingSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = getContext();
mDcDimmingManager = (DcDimmingManager) getSystemService(Context.DC_DIM_SERVICE);
if (mDcDimmingManager == null || !mDcDimmingManager.isAvailable()) {
return;
}
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mMinimumBacklight = pm.getMinimumScreenBrightnessSetting();
mMaximumBacklight = pm.getMaximumScreenBrightnessSetting();
SettingsObserver settingsObserver = new SettingsObserver(new Handler());
settingsObserver.observe();
LayoutPreference brightnessPreference = findPreference(KEY_BRIGHTNESS);
mSeekBar = brightnessPreference.findViewById(R.id.seekbar);
mBrightnessValue = brightnessPreference.findViewById(R.id.value);
mBrightnessTitle = brightnessPreference.findViewById(R.id.title);
mBrightnessSumm = brightnessPreference.findViewById(R.id.summary);
mSeekBar.setOnSeekBarChangeListener(this);
mSeekBar.setMax(GAMMA_SPACE_MAX / 2);
LayoutPreference preference = findPreference(KEY_FORCE_BUTTON);
mTurnOnButton = preference.findViewById(R.id.dc_dimming_on_button);
mTurnOnButton.setOnClickListener(mForceListener);
mTurnOffButton = preference.findViewById(R.id.dc_dimming_off_button);
mTurnOffButton.setOnClickListener(mForceListener);
mRestoreAuto = findPreference(KEY_RESTORE_BUTTON);
Button restoreActiveButton = mRestoreAuto.findViewById(R.id.dc_dimming_restore_active);
restoreActiveButton.setOnClickListener(mRestoreListener);
mDropPreference = findPreference(KEY_AUTO_MODE);
mDropPreference.setEntries(new CharSequence[] { mContext.getString(R.string.dark_ui_auto_mode_never), mContext.getString(R.string.dark_ui_auto_mode_auto), mContext.getString(R.string.dc_dimming_mode_brightness), mContext.getString(R.string.dc_dimming_mode_full) });
mDropPreference.setEntryValues(new CharSequence[] { String.valueOf(MODE_AUTO_OFF), String.valueOf(MODE_AUTO_TIME), String.valueOf(MODE_AUTO_BRIGHTNESS), String.valueOf(MODE_AUTO_FULL) });
mDropPreference.setValue(String.valueOf(mDcDimmingManager.getAutoMode()));
mDropPreference.setOnPreferenceChangeListener(this);
Preference footerPreference = findPreference(FooterPreference.KEY_FOOTER);
footerPreference.setTitle(mContext.getResources().getString(R.string.dc_dimming_info));
final int gamma = convertLinearToGamma(mDcDimmingManager.getBrightnessThreshold(), mMinimumBacklight, mMaximumBacklight);
mSeekBar.setProgress(gamma);
updateStateInternal();
}
use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class MultiUserFooterPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
mUserCaps.updateAddUserCapabilities(mContext);
final FooterPreference pref = mFooterMixin.createFooterPreference();
pref.setTitle(R.string.user_settings_footer_text);
pref.setVisible(isAvailable());
}
use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LocationFooterPreferenceController method updateState.
/**
* Insert footer preferences. Send a {@link LocationManager#SETTINGS_FOOTER_DISPLAYED_ACTION}
* broadcast to receivers who have injected a footer
*/
@Override
public void updateState(Preference preference) {
PreferenceCategory category = (PreferenceCategory) preference;
category.removeAll();
mFooterInjectors.clear();
Collection<FooterData> footerData = getFooterData();
for (FooterData data : footerData) {
// Generate a footer preference with the given text
FooterPreference footerPreference = new FooterPreference(preference.getContext());
String footerString;
try {
footerString = mPackageManager.getResourcesForApplication(data.applicationInfo).getString(data.footerStringRes);
} catch (NameNotFoundException exception) {
Log.w(TAG, "Resources not found for application " + data.applicationInfo.packageName);
continue;
}
footerPreference.setTitle(footerString);
// Inject the footer
category.addPreference(footerPreference);
// Send broadcast to the injector announcing a footer has been injected
sendBroadcastFooterDisplayed(data.componentName);
mFooterInjectors.add(data.componentName);
}
}
use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatterySaverSettings method addHelpLink.
// Changes the text to include a learn more link if possible.
@VisibleForTesting
void addHelpLink() {
FooterPreference pref = getPreferenceScreen().findPreference(KEY_FOOTER_PREFERENCE);
if (pref != null) {
SupportPageLearnMoreSpan.linkify(mFooterText, this, mHelpUri);
pref.setTitle(mFooterText);
}
}
Aggregations