use of android.preference.PreferenceScreen in project NimbusBase_Android_Tutorial by NimbusBase.
the class PGFragmentTable method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final ActionBar actionBar = getActivity().getActionBar();
if (actionBar != null)
actionBar.setTitle("Table " + mTableName);
final SQLiteDatabase database = mSQLiteOpenHelper.getReadableDatabase();
final List<MDLUser> records = MDLUser.fetchAll(database);
database.close();
if (!records.equals(mRecords)) {
this.mRecords = records;
reload(records);
final PreferenceScreen preferenceScreen = getPreferenceScreen();
preferenceScreen.removeAll();
for (final MDLUser user : records) {
final PGListItemRecord item = new PGListItemRecord(getActivity(), user);
item.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
return onRecordPressed((PGListItemRecord) preference);
}
});
preferenceScreen.addPreference(item);
}
}
}
use of android.preference.PreferenceScreen in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class SettingsFragment method onCreate.
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
setHasOptionsMenu(true);
setInputMethodSettingsCategoryTitle(R.string.language_selection_title);
setSubtypeEnablerTitle(R.string.select_language);
addPreferencesFromResource(R.xml.prefs);
final PreferenceScreen preferenceScreen = getPreferenceScreen();
preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(getActivity(), SettingsActivity.class));
if (!ProductionFlags.ENABLE_ACCOUNT_SIGN_IN) {
final Preference accountsPreference = findPreference(Settings.SCREEN_ACCOUNTS);
preferenceScreen.removePreference(accountsPreference);
}
if (!JniUtils.mHaveGestureLib) {
final Preference gesturePreference = findPreference(Settings.SCREEN_GESTURE);
preferenceScreen.removePreference(gesturePreference);
}
}
use of android.preference.PreferenceScreen in project AndroidChromium by JackyAndroid.
the class AccountManagementFragment method updateAccountsList.
private void updateAccountsList() {
PreferenceScreen prefScreen = getPreferenceScreen();
if (prefScreen == null)
return;
for (int i = 0; i < mAccountsListPreferences.size(); i++) {
prefScreen.removePreference(mAccountsListPreferences.get(i));
}
mAccountsListPreferences.clear();
final Preferences activity = (Preferences) getActivity();
Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts();
int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER;
for (Account account : accounts) {
ChromeBasePreference pref = new ChromeBasePreference(activity);
pref.setSelectable(false);
pref.setTitle(account.name);
boolean isChildAccount = ChildAccountService.isChildAccount();
pref.setIcon(new BitmapDrawable(getResources(), isChildAccount ? getBadgedUserPicture(account.name, getResources()) : getUserPicture(account.name, getResources())));
pref.setOrder(nextPrefOrder++);
prefScreen.addPreference(pref);
mAccountsListPreferences.add(pref);
}
}
use of android.preference.PreferenceScreen in project AndroidChromium by JackyAndroid.
the class PrivacyPreferences method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
privacyPrefManager.migrateNetworkPredictionPreferences();
addPreferencesFromResource(R.xml.privacy_preferences);
getActivity().setTitle(R.string.prefs_privacy);
setHasOptionsMenu(true);
mManagedPreferenceDelegate = createManagedPreferenceDelegate();
ChromeBaseCheckBoxPreference networkPredictionPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
networkPredictionPref.setChecked(PrefServiceBridge.getInstance().getNetworkPredictionEnabled());
networkPredictionPref.setOnPreferenceChangeListener(this);
networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference navigationErrorPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
navigationErrorPref.setOnPreferenceChangeListener(this);
navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference searchSuggestionsPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
searchSuggestionsPref.setOnPreferenceChangeListener(this);
searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
PreferenceScreen preferenceScreen = getPreferenceScreen();
if (!ContextualSearchFieldTrial.isEnabled()) {
preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
}
ChromeBaseCheckBoxPreference safeBrowsingExtendedReportingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_EXTENDED_REPORTING);
safeBrowsingExtendedReportingPref.setOnPreferenceChangeListener(this);
safeBrowsingExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
ChromeBaseCheckBoxPreference safeBrowsingPref = (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
safeBrowsingPref.setOnPreferenceChangeListener(this);
safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
if (!PhysicalWeb.featureIsEnabled()) {
preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
}
updateSummaries();
}
use of android.preference.PreferenceScreen in project AndroidChromium by JackyAndroid.
the class UsbDevicePreferences method resetList.
private void resetList() {
getPreferenceScreen().removeAll();
addPreferencesFromResource(R.xml.usb_device_preferences);
PreferenceScreen preferenceScreen = getPreferenceScreen();
Preference header = preferenceScreen.findPreference(PREF_OBJECT_NAME);
header.setTitle(mUsbInfo.getName());
header.setOnPreferenceClickListener(this);
for (int i = 0; i < mSites.size(); ++i) {
Website site = mSites.get(i);
Preference preference = new WebsitePreference(getActivity(), site, mCategory);
preference.getExtras().putSerializable(SingleWebsitePreferences.EXTRA_SITE, site);
preference.setFragment(SingleWebsitePreferences.class.getCanonicalName());
preferenceScreen.addPreference(preference);
}
// Force this list to be reloaded if the activity is resumed.
mSites = null;
}
Aggregations