use of android.preference.PreferenceScreen in project Signal-Android by WhisperSystems.
the class AppProtectionPreferenceFragment method initializePlatformSpecificOptions.
private void initializePlatformSpecificOptions() {
PreferenceScreen preferenceScreen = getPreferenceScreen();
Preference screenSecurityPreference = findPreference(TextSecurePreferences.SCREEN_SECURITY_PREF);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH && screenSecurityPreference != null) {
preferenceScreen.removePreference(screenSecurityPreference);
}
}
use of android.preference.PreferenceScreen in project NimbusBase_Android_Tutorial by NimbusBase.
the class IndexFragment method initiatePreferenceScreen.
protected PreferenceScreen initiatePreferenceScreen(Base base, int preferencesResID) {
addPreferencesFromResource(preferencesResID);
final PreferenceScreen preferenceScreen = getPreferenceScreen();
final PreferenceCategory serverCate = getServerCategory(preferenceScreen);
serverCate.setOrderingAsAdded(true);
final Server[] servers = base.getServers();
for (int index = 0; index < servers.length; index++) {
final Server server = servers[index];
final ListItemServer item = new ListItemServer(getActivity(), server);
item.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
onServerItemStateChange((ListItemServer) preference, (Boolean) newValue);
return false;
}
});
item.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
onServerItemClick((ListItemServer) preference);
return true;
}
});
serverCate.addPreference(item);
onServerStateChange(server, index);
}
final PreferenceCategory databaseCate = getDatabaseCategory(preferenceScreen);
final PreferenceScreen playgroundItem = (PreferenceScreen) databaseCate.findPreference(getString(R.string.item_playground));
playgroundItem.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
return onPlaygroundItemClick(preference);
}
});
return preferenceScreen;
}
use of android.preference.PreferenceScreen in project NimbusBase_Android_Tutorial by NimbusBase.
the class PGFragmentRecord method getAllAttributeItems.
protected List<PGListItemAttribute> getAllAttributeItems() {
final PreferenceScreen root = getPreferenceScreen();
List<PGListItemAttribute> items = new ArrayList<PGListItemAttribute>(mAttrTypesByName.size());
for (int index = 0; index < root.getPreferenceCount(); index++) {
final PreferenceCategory category = (PreferenceCategory) root.getPreference(index);
final PGListItemAttribute item = (PGListItemAttribute) category.getPreference(0);
items.add(item);
}
return items;
}
use of android.preference.PreferenceScreen in project NimbusBase_Android_Tutorial by NimbusBase.
the class PGFragmentTable method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
setHasOptionsMenu(true);
final Bundle bundle = getArguments();
this.mTableName = bundle.getString(sTableNameKey);
this.mSQLiteOpenHelper = new MDLDatabaseManager(getActivity());
final PreferenceScreen preferenceScreen = getPreferenceManager().createPreferenceScreen(getActivity());
setPreferenceScreen(preferenceScreen);
preferenceScreen.setOrderingAsAdded(true);
}
use of android.preference.PreferenceScreen in project NimbusBase_Android_Tutorial by NimbusBase.
the class PGFragmentTable method reload.
protected void reload(List<? extends PGRecord> records) {
final PreferenceScreen preferenceScreen = getPreferenceScreen();
preferenceScreen.removeAll();
for (final PGRecord 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);
}
}
Aggregations