use of android.support.v7.preference.PreferenceScreen in project android_frameworks_base by ResurrectionRemix.
the class DemoModeFragment method onCreatePreferences.
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
Context context = getContext();
mEnabledSwitch = new SwitchPreference(context);
mEnabledSwitch.setTitle(R.string.enable_demo_mode);
mEnabledSwitch.setOnPreferenceChangeListener(this);
mOnSwitch = new SwitchPreference(context);
mOnSwitch.setTitle(R.string.show_demo_mode);
mOnSwitch.setEnabled(false);
mOnSwitch.setOnPreferenceChangeListener(this);
PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(context);
screen.addPreference(mEnabledSwitch);
screen.addPreference(mOnSwitch);
setPreferenceScreen(screen);
updateDemoModeEnabled();
updateDemoModeOn();
ContentResolver contentResolver = getContext().getContentResolver();
contentResolver.registerContentObserver(Settings.Global.getUriFor(DemoMode.DEMO_MODE_ALLOWED), false, mDemoModeObserver);
contentResolver.registerContentObserver(Settings.Global.getUriFor(DEMO_MODE_ON), false, mDemoModeObserver);
setHasOptionsMenu(true);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccountPreferenceBase 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 && Utils.showAccount(getActivity(), accountType)) {
// 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 = getActivity().createPackageContextAsUser(desc.packageName, 0, mUserHandle);
final Theme baseTheme = getResources().newTheme();
baseTheme.applyStyle(com.android.settings.R.style.Theme_SettingsBase, true);
final Context themedCtx = new LocalClassLoaderContextThemeWrapper(getClass(), targetCtx, 0);
themedCtx.getTheme().setTo(baseTheme);
prefs = 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;
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ScrollAnimationInterfaceSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.scroll_animation_interface_settings);
PreferenceScreen prefSet = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
mAnimNoScroll = (SwitchPreference) prefSet.findPreference(ANIMATION_NO_SCROLL);
mAnimNoScroll.setChecked(Settings.System.getInt(resolver, Settings.System.ANIMATION_CONTROLS_NO_SCROLL, 0) == 1);
mAnimNoScroll.setOnPreferenceChangeListener(this);
float defaultScroll = Settings.System.getFloat(resolver, Settings.System.CUSTOM_SCROLL_FRICTION, ViewConfiguration.DEFAULT_SCROLL_FRICTION);
mAnimationScroll = (SeekBarPreference) prefSet.findPreference(ANIMATION_SCROLL_FRICTION);
mAnimationScroll.setValue((int) (defaultScroll * MULTIPLIER_SCROLL_FRICTION));
mAnimationScroll.setOnPreferenceChangeListener(this);
int defaultFling = Settings.System.getInt(resolver, Settings.System.CUSTOM_FLING_VELOCITY, ViewConfiguration.DEFAULT_MAXIMUM_FLING_VELOCITY);
mAnimationFling = (SeekBarPreference) prefSet.findPreference(ANIMATION_FLING_VELOCITY);
mAnimationFling.setValue(defaultFling);
mAnimationFling.setOnPreferenceChangeListener(this);
int defaultOverScroll = Settings.System.getInt(resolver, Settings.System.CUSTOM_OVERSCROLL_DISTANCE, ViewConfiguration.DEFAULT_OVERSCROLL_DISTANCE);
mAnimationOverScroll = (SeekBarPreference) prefSet.findPreference(ANIMATION_OVERSCROLL_DISTANCE);
mAnimationOverScroll.setValue(defaultOverScroll);
mAnimationOverScroll.setOnPreferenceChangeListener(this);
int defaultOverFling = Settings.System.getInt(resolver, Settings.System.CUSTOM_OVERFLING_DISTANCE, ViewConfiguration.DEFAULT_OVERFLING_DISTANCE);
mAnimationOverFling = (SeekBarPreference) prefSet.findPreference(ANIMATION_OVERFLING_DISTANCE);
mAnimationOverFling.setValue(defaultOverFling);
mAnimationOverFling.setOnPreferenceChangeListener(this);
setHasOptionsMenu(true);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class QsAnimations method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.rr_qs_animations);
mContext = getActivity().getApplicationContext();
mContentRes = getActivity().getContentResolver();
final Resources res = getResources();
PreferenceScreen prefs = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
mTileAnimationStyle = (ListPreference) findPreference(PREF_TILE_ANIM_STYLE);
int tileAnimationStyle = Settings.System.getIntForUser(getContentResolver(), Settings.System.ANIM_TILE_STYLE, 0, UserHandle.USER_CURRENT);
mTileAnimationStyle.setValue(String.valueOf(tileAnimationStyle));
updateTileAnimationStyleSummary(tileAnimationStyle);
updateAnimTileStyle(tileAnimationStyle);
mTileAnimationStyle.setOnPreferenceChangeListener(this);
mTileAnimationDuration = (ListPreference) findPreference(PREF_TILE_ANIM_DURATION);
int tileAnimationDuration = Settings.System.getIntForUser(getContentResolver(), Settings.System.ANIM_TILE_DURATION, 2000, UserHandle.USER_CURRENT);
mTileAnimationDuration.setValue(String.valueOf(tileAnimationDuration));
updateTileAnimationDurationSummary(tileAnimationDuration);
mTileAnimationDuration.setOnPreferenceChangeListener(this);
mTileAnimationInterpolator = (ListPreference) findPreference(PREF_TILE_ANIM_INTERPOLATOR);
int tileAnimationInterpolator = Settings.System.getIntForUser(getContentResolver(), Settings.System.ANIM_TILE_INTERPOLATOR, 0, UserHandle.USER_CURRENT);
mTileAnimationInterpolator.setValue(String.valueOf(tileAnimationInterpolator));
updateTileAnimationInterpolatorSummary(tileAnimationInterpolator);
mTileAnimationInterpolator.setOnPreferenceChangeListener(this);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RecentsStyles method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.recent_styles);
ContentResolver resolver = getActivity().getContentResolver();
PreferenceScreen prefSet = getPreferenceScreen();
int intColor;
String hexColor;
mfabColor = (ColorPickerPreference) prefSet.findPreference(FAB_COLOR);
mfabColor.setOnPreferenceChangeListener(this);
intColor = Settings.System.getInt(getContentResolver(), Settings.System.FAB_BUTTON_COLOR, DEFAULT_BG_FAB);
hexColor = String.format("#%08x", (0xff21272b & intColor));
mfabColor.setSummary(hexColor);
mfabColor.setNewPreviewColor(intColor);
mClearStyle = (ListPreference) prefSet.findPreference(RECENTS_STYLE);
mClearStyle.setValue(String.valueOf(Settings.System.getInt(getContentResolver(), Settings.System.CLEAR_RECENTS_STYLE, 0)));
mClearStyle.setSummary(mClearStyle.getEntry());
mClearStyle.setOnPreferenceChangeListener(this);
mFabanimation = (ListPreference) prefSet.findPreference(FAB_ANIM_STYLE);
mFabanimation.setValue(String.valueOf(Settings.System.getInt(getContentResolver(), Settings.System.FAB_ANIMATION_STYLE, 0)));
mFabanimation.setSummary(mFabanimation.getEntry());
mFabanimation.setOnPreferenceChangeListener(this);
mMemTextColor = (ColorPickerPreference) prefSet.findPreference(MEM_TEXT_COLOR);
mMemTextColor.setOnPreferenceChangeListener(this);
intColor = Settings.System.getInt(getContentResolver(), Settings.System.MEM_TEXT_COLOR, DEFAULT);
hexColor = String.format("#%08x", (0xffffffff & intColor));
mMemTextColor.setSummary(hexColor);
mMemTextColor.setNewPreviewColor(intColor);
mMemBarColor = (ColorPickerPreference) prefSet.findPreference(MEMBAR_COLOR);
mMemBarColor.setOnPreferenceChangeListener(this);
intColor = Settings.System.getInt(getContentResolver(), Settings.System.MEM_BAR_COLOR, DEFAULT_BG_MEM_BAR);
hexColor = String.format("#%08x", (0xff009688 & intColor));
mMemBarColor.setSummary(hexColor);
mMemBarColor.setNewPreviewColor(intColor);
mClearButtonColor = (ColorPickerPreference) prefSet.findPreference(CLEAR_BUTTON_COLOR);
mClearButtonColor.setOnPreferenceChangeListener(this);
intColor = Settings.System.getInt(getContentResolver(), Settings.System.CLEAR_BUTTON_COLOR, getResources().getColor(R.color.floating_action_button_touch_tint));
hexColor = String.format("#%08x", (0xff4285f4 & intColor));
mClearButtonColor.setSummary(hexColor);
mClearButtonColor.setNewPreviewColor(intColor);
mClockColor = (ColorPickerPreference) prefSet.findPreference(RECENTS_CLOCK_COLOR);
mClockColor.setOnPreferenceChangeListener(this);
intColor = Settings.System.getInt(getContentResolver(), Settings.System.RECENTS_CLOCK_COLOR, DEFAULT);
hexColor = String.format("#%08x", (0xffffffff & intColor));
mClockColor.setSummary(hexColor);
mClockColor.setNewPreviewColor(intColor);
mDateColor = (ColorPickerPreference) prefSet.findPreference(RECENTS_DATE_COLOR);
mDateColor.setOnPreferenceChangeListener(this);
intColor = Settings.System.getInt(getContentResolver(), Settings.System.RECENTS_DATE_COLOR, DEFAULT);
hexColor = String.format("#%08x", (0xffffffff & intColor));
mDateColor.setSummary(hexColor);
mDateColor.setNewPreviewColor(intColor);
setHasOptionsMenu(true);
}
Aggregations