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);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LockClockFonts method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.lock_clock_fonts);
final ContentResolver resolver = getActivity().getContentResolver();
PreferenceScreen prefs = getPreferenceScreen();
mLockClockFonts = (ListPreference) findPreference(LOCK_CLOCK_FONTS);
mLockClockFonts.setValue(String.valueOf(Settings.System.getInt(getContentResolver(), Settings.System.LOCK_CLOCK_FONTS, 0)));
mLockClockFonts.setSummary(mLockClockFonts.getEntry());
mLockClockFonts.setOnPreferenceChangeListener(this);
mDateFonts = (ListPreference) findPreference(LOCK_DATE_FONTS);
mDateFonts.setValue(String.valueOf(Settings.System.getInt(resolver, Settings.System.LOCK_DATE_FONTS, 8)));
mDateFonts.setSummary(mDateFonts.getEntry());
mDateFonts.setOnPreferenceChangeListener(this);
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class GestureAnywhereSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.gesture_anywhere);
mEnabledPref = (SwitchPreference) findPreference(KEY_ENABLED);
mEnabledPref.setChecked((Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_ENABLED, 0) == 1));
mEnabledPref.setOnPreferenceChangeListener(this);
PreferenceScreen prefSet = getPreferenceScreen();
mPositionPref = (ListPreference) prefSet.findPreference(KEY_POSITION);
mPositionPref.setOnPreferenceChangeListener(this);
int position = Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_POSITION, Gravity.LEFT);
mPositionPref.setValue(String.valueOf(position));
mTriggerWidthPref = (SeekBarPreference) findPreference(KEY_TRIGGER_WIDTH);
mTriggerWidthPref.setValue(Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_WIDTH, 20));
mTriggerWidthPref.setOnPreferenceChangeListener(this);
mTriggerTopPref = (SeekBarPreference) findPreference(KEY_TRIGGER_TOP);
mTriggerTopPref.setValue(Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_TOP, 0));
mTriggerTopPref.setOnPreferenceChangeListener(this);
mTriggerBottomPref = (SeekBarPreference) findPreference(KEY_TRIGGER_BOTTOM);
mTriggerBottomPref.setValue(Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_HEIGHT, 100));
mTriggerBottomPref.setOnPreferenceChangeListener(this);
Preference pref = findPreference(KEY_GESTURES);
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivity(new Intent(getActivity(), GestureAnywhereBuilderActivity.class));
return true;
}
});
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class Utils method getNonIndexable.
public static List<String> getNonIndexable(int xml, Context context) {
if (Looper.myLooper() == null) {
// Hack to make sure Preferences can initialize. Prefs expect a looper, but
// don't actually use it for the basic stuff here.
Looper.prepare();
}
final List<String> ret = new ArrayList<>();
PreferenceManager manager = new PreferenceManager(context);
PreferenceScreen screen = manager.inflateFromResource(context, xml, null);
checkPrefs(screen, ret);
return ret;
}
use of android.support.v7.preference.PreferenceScreen in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ManageAccountsSettings method updatePreferenceIntents.
/**
* Filters through the preference list provided by GoogleLoginService.
*
* This method removes all the invalid intent from the list, adds account name as extra into the
* intent, and hack the location settings to start it as a fragment.
*/
private void updatePreferenceIntents(PreferenceScreen prefs) {
final PackageManager pm = getActivity().getPackageManager();
for (int i = 0; i < prefs.getPreferenceCount(); ) {
Preference pref = prefs.getPreference(i);
Intent intent = pref.getIntent();
if (intent != null) {
// preference click event here directly.
if (intent.getAction().equals(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS)) {
// The OnPreferenceClickListener overrides the click event completely. No intent
// will get fired.
pref.setOnPreferenceClickListener(new FragmentStarter(LocationSettings.class.getName(), R.string.location_settings_title));
} else {
ResolveInfo ri = pm.resolveActivityAsUser(intent, PackageManager.MATCH_DEFAULT_ONLY, mUserHandle.getIdentifier());
if (ri == null) {
prefs.removePreference(pref);
continue;
} else {
intent.putExtra(ACCOUNT_KEY, mFirstAccount);
intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent prefIntent = preference.getIntent();
/*
* Check the intent to see if it resolves to a exported=false
* activity that doesn't share a uid with the authenticator.
*
* Otherwise the intent is considered unsafe in that it will be
* exploiting the fact that settings has system privileges.
*/
if (isSafeIntent(pm, prefIntent)) {
getActivity().startActivityAsUser(prefIntent, mUserHandle);
} else {
Log.e(TAG, "Refusing to launch authenticator intent because" + "it exploits Settings permissions: " + prefIntent);
}
return true;
}
});
}
}
}
i++;
}
}
Aggregations