use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BlurPersonalizations method createCustomView.
public void createCustomView() {
PreferenceScreen prefSet = getPreferenceScreen();
if (prefSet != null) {
prefSet.removeAll();
}
addPreferencesFromResource(R.xml.blur_cat);
ContentResolver resolver = getActivity().getContentResolver();
//Some help here
int intLightColor;
int intDarkColor;
int intMixedColor;
String hexLightColor;
String hexDarkColor;
String hexMixedColor;
mExpand = (SwitchPreference) findPreference("blurred_status_bar_expanded_enabled_pref");
mExpand.setChecked((Settings.System.getInt(getActivity().getContentResolver(), Settings.System.STATUS_BAR_EXPANDED_ENABLED_PREFERENCE_KEY, 0) == 1));
mScale = (SeekBarPreference) findPreference("statusbar_blur_scale");
mScale.setValue(Settings.System.getInt(resolver, Settings.System.BLUR_SCALE_PREFERENCE_KEY, 10));
mScale.setOnPreferenceChangeListener(this);
mRadius = (SeekBarPreference) findPreference("statusbar_blur_radius");
mRadius.setValue(Settings.System.getInt(resolver, Settings.System.BLUR_RADIUS_PREFERENCE_KEY, 5));
mRadius.setOnPreferenceChangeListener(this);
/*mNotiTrans = (SwitchPreference) prefSet.findPreference("translucent_notifications_pref");
mNotiTrans.setChecked((Settings.System.getInt(getActivity().getContentResolver(),
Settings.System.TRANSLUCENT_NOTIFICATIONS_PREFERENCE_KEY, 0) == 1));*/
mQuickSett = (SwitchPreference) findPreference("translucent_quick_settings_pref");
mQuickSett.setChecked((Settings.System.getInt(getActivity().getContentResolver(), Settings.System.TRANSLUCENT_QUICK_SETTINGS_PREFERENCE_KEY, 0) == 1));
mQuickSettPerc = (SeekBarPreference) findPreference("quick_settings_transluency");
mQuickSettPerc.setValue(Settings.System.getInt(resolver, Settings.System.TRANSLUCENT_QUICK_SETTINGS_PRECENTAGE_PREFERENCE_KEY, 60));
mQuickSettPerc.setOnPreferenceChangeListener(this);
/*mNotSettPerc = (SeekBarPreference) findPreference("notifications_transluency");
mNotSettPerc.setValue(Settings.System.getInt(resolver, Settings.System.TRANSLUCENT_NOTIFICATIONS_PRECENTAGE_PREFERENCE_KEY, 60));
mNotSettPerc.setOnPreferenceChangeListener(this);*/
mRecentsSett = (SwitchPreference) findPreference("blurred_recent_app_enabled_pref");
mRecentsSett.setChecked((Settings.System.getInt(getActivity().getContentResolver(), Settings.System.RECENT_APPS_ENABLED_PREFERENCE_KEY, 0) == 1));
mRecentsScale = (SeekBarPreference) findPreference("recents_blur_scale");
mRecentsScale.setValue(Settings.System.getInt(resolver, Settings.System.RECENT_APPS_SCALE_PREFERENCE_KEY, 6));
mRecentsScale.setOnPreferenceChangeListener(this);
mRecentsRadius = (SeekBarPreference) findPreference("recents_blur_radius");
mRecentsRadius.setValue(Settings.System.getInt(resolver, Settings.System.RECENT_APPS_RADIUS_PREFERENCE_KEY, 3));
mRecentsRadius.setOnPreferenceChangeListener(this);
mLightBlurColor = (ColorPickerPreference) findPreference("blur_light_color");
mLightBlurColor.setOnPreferenceChangeListener(this);
intLightColor = Settings.System.getInt(getContentResolver(), Settings.System.BLUR_LIGHT_COLOR_PREFERENCE_KEY, BLUR_LIGHT_COLOR_PREFERENCE_DEFAULT);
hexLightColor = String.format("#%08x", (0xffffffff & intLightColor));
mLightBlurColor.setSummary(hexLightColor);
mLightBlurColor.setNewPreviewColor(intLightColor);
mDarkBlurColor = (ColorPickerPreference) findPreference("blur_dark_color");
mDarkBlurColor.setOnPreferenceChangeListener(this);
intDarkColor = Settings.System.getInt(getContentResolver(), Settings.System.BLUR_DARK_COLOR_PREFERENCE_KEY, BLUR_DARK_COLOR_PREFERENCE_DEFAULT);
hexDarkColor = String.format("#%08x", (0xffffffff & intDarkColor));
mDarkBlurColor.setSummary(hexDarkColor);
mDarkBlurColor.setNewPreviewColor(intDarkColor);
mMixedBlurColor = (ColorPickerPreference) findPreference("blur_mixed_color");
mMixedBlurColor.setOnPreferenceChangeListener(this);
intMixedColor = Settings.System.getInt(getContentResolver(), Settings.System.BLUR_MIXED_COLOR_PREFERENCE_KEY, BLUR_MIXED_COLOR_PREFERENCE_DEFAULT);
hexMixedColor = String.format("#%08x", (0xffffffff & intMixedColor));
mMixedBlurColor.setSummary(hexMixedColor);
mMixedBlurColor.setNewPreviewColor(intMixedColor);
setHasOptionsMenu(true);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class InstalledAppDetails method addAppInstallerInfoPref.
private void addAppInstallerInfoPref(PreferenceScreen screen) {
String installerPackageName = null;
try {
installerPackageName = getContext().getPackageManager().getInstallerPackageName(mPackageName);
} catch (IllegalArgumentException e) {
Log.e(TAG, "Exception while retrieving the package installer of " + mPackageName, e);
}
if (installerPackageName == null) {
return;
}
final CharSequence installerLabel = Utils.getApplicationLabel(getContext(), installerPackageName);
if (installerLabel == null) {
return;
}
PreferenceCategory category = new PreferenceCategory(getPrefContext());
category.setTitle(R.string.app_install_details_group_title);
screen.addPreference(category);
Preference pref = new Preference(getPrefContext());
pref.setTitle(R.string.app_install_details_title);
pref.setKey("app_info_store");
pref.setSummary(getString(R.string.app_install_details_summary, installerLabel));
final Intent intent = new Intent(Intent.ACTION_SHOW_APP_INFO).setPackage(installerPackageName);
final Intent result = resolveIntent(intent);
if (result != null) {
result.putExtra(Intent.EXTRA_PACKAGE_NAME, mPackageName);
pref.setIntent(result);
} else {
pref.setEnabled(false);
}
category.addPreference(pref);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataUsageSummary method updateState.
private void updateState() {
DataUsageController.DataUsageInfo info = mDataUsageController.getDataUsageInfo(mDefaultTemplate);
Context context = getContext();
mDataInfoController.updateDataLimit(info, services.mPolicyEditor.getPolicy(mDefaultTemplate));
if (mSummaryPreference != null) {
mSummaryPreference.setTitle(formatTitle(context, getString(mDataUsageTemplate), info.usageLevel));
long limit = mDataInfoController.getSummaryLimit(info);
mSummaryPreference.setSummary(info.period);
if (limit <= 0) {
mSummaryPreference.setChartEnabled(false);
} else {
mSummaryPreference.setChartEnabled(true);
mSummaryPreference.setLabels(Formatter.formatFileSize(context, 0), Formatter.formatFileSize(context, limit));
mSummaryPreference.setRatios(info.usageLevel / (float) limit, 0, (limit - info.usageLevel) / (float) limit);
}
}
if (mLimitPreference != null && (info.warningLevel > 0 || info.limitLevel > 0)) {
String warning = Formatter.formatFileSize(context, info.warningLevel);
String limit = Formatter.formatFileSize(context, info.limitLevel);
mLimitPreference.setSummary(getString(info.limitLevel <= 0 ? R.string.cell_warning_only : R.string.cell_warning_and_limit, warning, limit));
} else if (mLimitPreference != null) {
mLimitPreference.setSummary(null);
}
PreferenceScreen screen = getPreferenceScreen();
for (int i = 1; i < screen.getPreferenceCount(); i++) {
((TemplatePreferenceCategory) screen.getPreference(i)).pushTemplates(services);
}
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenModeVisualInterruptionSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.zen_mode_visual_interruptions_settings);
final PreferenceScreen root = getPreferenceScreen();
mPolicy = NotificationManager.from(mContext).getNotificationPolicy();
mScreenOff = (SwitchPreference) root.findPreference(KEY_SCREEN_OFF);
if (!getResources().getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed)) {
mScreenOff.setSummary(R.string.zen_mode_screen_off_summary_no_led);
}
mScreenOff.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (mDisableListeners)
return true;
final boolean val = (Boolean) newValue;
MetricsLogger.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_WHEN_SCREEN_OFF, val);
if (DEBUG)
Log.d(TAG, "onPrefChange suppressWhenScreenOff=" + val);
savePolicy(getNewSuppressedEffects(val, Policy.SUPPRESSED_EFFECT_SCREEN_OFF));
return true;
}
});
mScreenOn = (SwitchPreference) root.findPreference(KEY_SCREEN_ON);
mScreenOn.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (mDisableListeners)
return true;
final boolean val = (Boolean) newValue;
MetricsLogger.action(mContext, MetricsEvent.ACTION_ZEN_ALLOW_WHEN_SCREEN_ON, val);
if (DEBUG)
Log.d(TAG, "onPrefChange suppressWhenScreenOn=" + val);
savePolicy(getNewSuppressedEffects(val, Policy.SUPPRESSED_EFFECT_SCREEN_ON));
return true;
}
});
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LockscreenShortcutFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.lockscreen_shortcut_fragment);
PreferenceScreen prefSet = getPreferenceScreen();
mLockscreenShortcutsLongpress = (SwitchPreference) findPreference(PREF_LOCKSCREEN_SHORTCUTS_LONGPRESS);
mLockscreenShortcutsLongpress.setChecked(Settings.System.getInt(getContentResolver(), Settings.System.LOCKSCREEN_SHORTCUTS_LONGPRESS, 1) == 1);
mLockscreenShortcutsLongpress.setOnPreferenceChangeListener(this);
setHasOptionsMenu(false);
}
Aggregations