Java Code Examples for android.preference.PreferenceScreen#setTitle()

The following examples show how to use android.preference.PreferenceScreen#setTitle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PreferencesActivity.java    From denominator with Apache License 2.0 6 votes vote down vote up
private PreferenceScreen createFromProvider() {
  PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
  if (provider.credentialTypeToParameterNames().isEmpty()) {
    return root;
  }
  String credentialType = provider.credentialTypeToParameterNames().keySet().iterator().next();
  root.setTitle(credentialType + " credentials for provider " + provider.name());
  for (String parameter : provider.credentialTypeToParameterNames().get(credentialType)) {
    EditTextPreference cred = new EditTextPreference(this);
    cred.setKey(parameter);
    cred.setTitle(parameter);
    cred.setDialogTitle(parameter);
    root.addPreference(cred);
  }
  return root;
}
 
Example 2
Source File: Preferences.java    From Androzic with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	PreferenceScreen root = getPreferenceManager().createPreferenceScreen(getActivity());
	root.setTitle(R.string.pref_plugins_title);
	setPreferenceScreen(root);

	Androzic application = (Androzic) getActivity().getApplication();
	Map<String, Intent> plugins = application.getPluginsPreferences();

	for (String plugin : plugins.keySet())
	{
		Preference preference = new Preference(getActivity());
		preference.setTitle(plugin);
		preference.setIntent(plugins.get(plugin));
		root.addPreference(preference);
	}
}
 
Example 3
Source File: SettingsActivity.java    From document-viewer with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
PreferenceScreen createPreferences() {
    final PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);

    root.setTitle(R.string.menu_settings);

    loadPreferences(root, R.xml.fragment_ui);
    loadPreferences(root, R.xml.fragment_scroll);
    loadPreferences(root, R.xml.fragment_navigation);
    loadPreferences(root, R.xml.fragment_performance);
    loadPreferences(root, R.xml.fragment_render);
    loadPreferences(root, R.xml.fragment_typespec);
    loadPreferences(root, R.xml.fragment_browser);
    loadPreferences(root, R.xml.fragment_opds);

    loadPreferences(root, R.xml.fragment_backup);

    return root;
}
 
Example 4
Source File: SavePasswordsPreferences.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordExceptionListAvailable(int count) {
    resetList(PREF_CATEGORY_EXCEPTIONS);
    mNoPasswordExceptions = count == 0;
    if (mNoPasswordExceptions) {
        if (mNoPasswords) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_EXCEPTIONS);
    profileCategory.setTitle(R.string.section_saved_passwords_exceptions);
    profileCategory.setOrder(ORDER_EXCEPTIONS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        String exception = mPasswordManagerHandler.getSavedPasswordException(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        screen.setTitle(exception);
        screen.setOnPreferenceClickListener(this);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_URL, exception);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example 5
Source File: SettingsFragment.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 6
Source File: SpellCheckerSettingsFragment.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    addPreferencesFromResource(R.xml.spell_checker_settings);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(
            getActivity(), SpellCheckerSettingsActivity.class));
    TwoStatePreferenceHelper.replaceCheckBoxPreferencesBySwitchPreferences(preferenceScreen);

    mLookupContactsPreference = (SwitchPreference) findPreference(
            AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY);
    turnOffLookupContactsIfNoPermission();
}
 
Example 7
Source File: SavePasswordsPreferences.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordExceptionListAvailable(int count) {
    resetList(PREF_CATEGORY_EXCEPTIONS);
    resetList(PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT);

    mNoPasswordExceptions = count == 0;
    if (mNoPasswordExceptions) {
        if (mNoPasswords) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_EXCEPTIONS);
    profileCategory.setTitle(R.string.section_saved_passwords_exceptions);
    profileCategory.setOrder(ORDER_EXCEPTIONS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        String exception = mPasswordManagerHandler.getSavedPasswordException(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        screen.setTitle(exception);
        screen.setOnPreferenceClickListener(this);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_URL, exception);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example 8
Source File: SavePasswordsPreferences.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordListAvailable(int count) {
    resetList(PREF_CATEGORY_SAVED_PASSWORDS);
    resetList(PREF_CATEGORY_SAVED_PASSWORDS_NO_TEXT);

    mNoPasswords = count == 0;
    if (mNoPasswords) {
        if (mNoPasswordExceptions) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_SAVED_PASSWORDS);
    profileCategory.setTitle(R.string.section_saved_passwords);
    profileCategory.setOrder(ORDER_SAVED_PASSWORDS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        PasswordUIView.SavedPasswordEntry saved =
                mPasswordManagerHandler.getSavedPasswordEntry(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        String url = saved.getUrl();
        String name = saved.getUserName();
        screen.setTitle(url);
        screen.setOnPreferenceClickListener(this);
        screen.setSummary(name);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_NAME, name);
        args.putString(PASSWORD_LIST_URL, url);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example 9
Source File: SavePasswordsPreferences.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordExceptionListAvailable(int count) {
    resetList(PREF_CATEGORY_EXCEPTIONS);
    mNoPasswordExceptions = count == 0;
    if (mNoPasswordExceptions) {
        if (mNoPasswords) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_EXCEPTIONS);
    profileCategory.setTitle(R.string.section_saved_passwords_exceptions);
    profileCategory.setOrder(ORDER_EXCEPTIONS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        String exception = mPasswordManagerHandler.getSavedPasswordException(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        screen.setTitle(exception);
        screen.setOnPreferenceClickListener(this);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_URL, exception);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example 10
Source File: SavePasswordsPreferences.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordListAvailable(int count) {
    resetList(PREF_CATEGORY_SAVED_PASSWORDS);
    mNoPasswords = count == 0;
    if (mNoPasswords) {
        if (mNoPasswordExceptions) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_SAVED_PASSWORDS);
    profileCategory.setTitle(R.string.section_saved_passwords);
    profileCategory.setOrder(ORDER_SAVED_PASSWORDS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        PasswordUIView.SavedPasswordEntry saved =
                mPasswordManagerHandler.getSavedPasswordEntry(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        String url = saved.getUrl();
        String name = saved.getUserName();
        screen.setTitle(url);
        screen.setOnPreferenceClickListener(this);
        screen.setSummary(name);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_NAME, name);
        args.putString(PASSWORD_LIST_URL, url);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example 11
Source File: SpellCheckerSettingsFragment.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    addPreferencesFromResource(R.xml.spell_checker_settings);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(
            getActivity(), SpellCheckerSettingsActivity.class));
    TwoStatePreferenceHelper.replaceCheckBoxPreferencesBySwitchPreferences(preferenceScreen);

    mLookupContactsPreference = (SwitchPreference) findPreference(
            AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY);
    turnOffLookupContactsIfNoPermission();
}
 
Example 12
Source File: SavePasswordsPreferences.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void passwordListAvailable(int count) {
    resetList(PREF_CATEGORY_SAVED_PASSWORDS);
    mNoPasswords = count == 0;
    if (mNoPasswords) {
        if (mNoPasswordExceptions) displayEmptyScreenMessage();
        return;
    }

    displayManageAccountLink();

    PreferenceCategory profileCategory = new PreferenceCategory(getActivity());
    profileCategory.setKey(PREF_CATEGORY_SAVED_PASSWORDS);
    profileCategory.setTitle(R.string.section_saved_passwords);
    profileCategory.setOrder(ORDER_SAVED_PASSWORDS);
    getPreferenceScreen().addPreference(profileCategory);
    for (int i = 0; i < count; i++) {
        PasswordUIView.SavedPasswordEntry saved =
                mPasswordManagerHandler.getSavedPasswordEntry(i);
        PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());
        String url = saved.getUrl();
        String name = saved.getUserName();
        screen.setTitle(url);
        screen.setOnPreferenceClickListener(this);
        screen.setSummary(name);
        Bundle args = screen.getExtras();
        args.putString(PASSWORD_LIST_NAME, name);
        args.putString(PASSWORD_LIST_URL, url);
        args.putInt(PASSWORD_LIST_ID, i);
        profileCategory.addPreference(screen);
    }
}
 
Example 13
Source File: SettingsFragment.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 14
Source File: SpellCheckerSettingsFragment.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    addPreferencesFromResource(R.xml.spell_checker_settings);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(
            getActivity(), SpellCheckerSettingsActivity.class));
    TwoStatePreferenceHelper.replaceCheckBoxPreferencesBySwitchPreferences(preferenceScreen);

    mLookupContactsPreference = (SwitchPreference) findPreference(
            AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY);
    turnOffLookupContactsIfNoPermission();
}
 
Example 15
Source File: SettingsFragment.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example 16
Source File: SettingsFragment.java    From NewsPushMonitor with Apache License 2.0 5 votes vote down vote up
private void addMonitorApp(String pkg) {
    if (TextUtils.isEmpty(pkg)) {
        return;
    }

    PreferenceManager manager = getPreferenceManager();
    try {
        PreferenceScreen screen = (PreferenceScreen) RefUtil.callDeclaredMethod(manager,
                "inflateFromResource",
                new Class[]{Context.class, int.class, PreferenceScreen.class},
                getActivity(), R.xml.prefs_monitor_apps, null);
        screen.setKey(pkg);
        screen.setTitle(pkg);
        screen.setSummary(getMonitorAppSummary(pkg, null));

        PreferenceGroup appConfigPref = (PreferenceGroup) screen.findPreference("monitor_app_config_pref");
        appConfigPref.setTitle(pkg);

        Preference titleViewIdPref = appConfigPref.findPreference("title_view_id_pref");
        titleViewIdPref.setKey(GlobalConfig.getSharedPrefKeyForTitleId(pkg));
        titleViewIdPref.getExtras().putString(KEY_PREF_EXTRA, pkg);
        titleViewIdPref.setOnPreferenceChangeListener(mOnPreferenceChangeListener);

        Preference contentViewIdPref = appConfigPref.findPreference("content_view_id_pref");
        contentViewIdPref.setKey(GlobalConfig.getSharedPrefKeyForContentId(pkg));
        contentViewIdPref.getExtras().putString(KEY_PREF_EXTRA, pkg);
        contentViewIdPref.setOnPreferenceChangeListener(mOnPreferenceChangeListener);

        PreferenceCategory container = (PreferenceCategory)
                getPreferenceManager().findPreference("monitor_apps_pref");
        container.addPreference(screen);
    } catch (Exception e) {
        LogWriter.e(TAG, "Add monitor ppp to preference error!", e);
    }
}
 
Example 17
Source File: SettingsFragment.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
@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));
}
 
Example 18
Source File: SettingsFragment.java    From Android-Keyboard with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 19
Source File: SpellCheckerSettingsFragment.java    From Android-Keyboard with Apache License 2.0 5 votes vote down vote up
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    addPreferencesFromResource(R.xml.spell_checker_settings);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.setTitle(ApplicationUtils.getActivityTitleResId(
            getActivity(), SpellCheckerSettingsActivity.class));
    TwoStatePreferenceHelper.replaceCheckBoxPreferencesBySwitchPreferences(preferenceScreen);

    mLookupContactsPreference = (SwitchPreference) findPreference(
            AndroidSpellCheckerService.PREF_USE_CONTACTS_KEY);
    turnOffLookupContactsIfNoPermission();
}
 
Example 20
Source File: SettingsFragment.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
@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 (!JniUtils.sHaveGestureLib) {
        final Preference gesturePreference = findPreference(Settings.SCREEN_GESTURE);
        preferenceScreen.removePreference(gesturePreference);
    }
}