当前位置: 首页>>代码示例>>Java>>正文


Java PreferenceCategory.setTitle方法代码示例

本文整理汇总了Java中android.preference.PreferenceCategory.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java PreferenceCategory.setTitle方法的具体用法?Java PreferenceCategory.setTitle怎么用?Java PreferenceCategory.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.PreferenceCategory的用法示例。


在下文中一共展示了PreferenceCategory.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.pref_wireless_socket);
    setHasOptionsMenu(true);

    PreferenceScreen preferenceScreen = this.getPreferenceScreen();

    PreferenceCategory preferenceCategory = new PreferenceCategory(preferenceScreen.getContext());
    preferenceCategory.setTitle("Wireless sockets");
    preferenceScreen.addPreference(preferenceCategory);

    for (int index = 0; index < WirelessSocketService.getInstance().GetDataList().getSize(); index++) {
        WirelessSocket wirelessSocket = WirelessSocketService.getInstance().GetDataList().getValue(index);

        SwitchPreference preference = new SwitchPreference(preferenceScreen.getContext());

        preference.setTitle(wirelessSocket.GetName());
        preference.setKey(wirelessSocket.GetSettingsKey());
        preference.setDefaultValue(false);

        preferenceCategory.addPreference(preference);

        bindPreferenceSummaryToValue(preference);
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:27,代码来源:SettingsActivity.java

示例2: setupSimplePreferencesScreen

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown.
 */
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.

    // Add 'general' preferences.
    addPreferencesFromResource(R.xml.pref_general);

    // Add 'notifications' preferences, and a corresponding header.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_notifications);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_notification);

    // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
    // their values. When their values change, their summaries are updated
    // to reflect the new value, per the Android Design guidelines.
    bindPreferenceSummaryToValue(findPreference("display_name"));
    bindPreferenceSummaryToValue(findPreference("display_image"));
    bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
}
 
开发者ID:eduyayo,项目名称:gamesboard,代码行数:30,代码来源:SettingsActivity.java

示例3: onCreate

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());

    PreferenceCategory category = new PreferenceCategory(getActivity());
    category.setTitle("Libraries");

    screen.addPreference(category);

    CheckBoxPreference checkBoxPref = new CheckBoxPreference(getActivity());
    checkBoxPref.setTitle("title");
    checkBoxPref.setSummary("summary");
    checkBoxPref.setChecked(true);

    category.addPreference(checkBoxPref);
    setPreferenceScreen(screen);
}
 
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:19,代码来源:SettingsActivity.java

示例4: createInstrumentPrefs

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
 * Create the "Select Instruments For Each Track " lists.
 * The list of possible instruments is in MidiFile.java.
 */
private void createInstrumentPrefs(PreferenceScreen root) {
    PreferenceCategory selectInstrTitle = new PreferenceCategory(this);
    selectInstrTitle.setTitle(R.string.select_instruments_per_track);
    root.addPreference(selectInstrTitle);
    selectInstruments = new ListPreference[options.tracks.length];
    for (int i = 0; i < options.instruments.length; i++) {
        selectInstruments[i] = new ListPreference(this);
        selectInstruments[i].setOnPreferenceChangeListener(this);
        selectInstruments[i].setEntries(MidiFile.Instruments);
        selectInstruments[i].setEntryValues(MidiFile.Instruments);
        selectInstruments[i].setTitle("Track " + i);
        selectInstruments[i].setValueIndex(options.instruments[i]);
        selectInstruments[i].setSummary(selectInstruments[i].getEntry());
        root.addPreference(selectInstruments[i]);
    }
    setAllToPiano = new Preference(this);
    setAllToPiano.setTitle(R.string.set_all_to_piano);
    setAllToPiano.setOnPreferenceClickListener(this);
    root.addPreference(setAllToPiano);
}
 
开发者ID:Ag47,项目名称:TrueTone,代码行数:25,代码来源:SettingsActivity.java

示例5: setupSimplePreferencesScreen

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.

    // Add 'general' preferences.
    addPreferencesFromResource(R.xml.pref_general);

    // Add 'data and sync' preferences, and a corresponding header.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_server);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_server);

    // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
    // their values. When their values change, their summaries are updated
    // to reflect the new value, per the Android Design guidelines.
    bindPreferenceSummaryToValue(findPreference("server_custom_url"));
    bindPreferenceSummaryToValue(findPreference("server_custom_sender_id"));

    findPreference("general_reset").setOnPreferenceClickListener(sBindOnPreferenceClickListener);
    findPreference("server_register").setOnPreferenceClickListener(sBindOnPreferenceClickListener);
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:27,代码来源:SettingsActivity.java

示例6: connectDebugButtons

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
 * Iterate through debug buttons, adding a special debug preference click
 * listener to each of them.
 */
protected void connectDebugButtons() {
  // Separate listener to really separate debug logic from main code paths.
  final OnPreferenceClickListener listener = new DebugPreferenceClickListener();

  // We don't want to use Android resource strings for debug UI, so we just
  // use the keys throughout.
  final PreferenceCategory debugCategory = (PreferenceCategory) ensureFindPreference("debug_category");
  debugCategory.setTitle(debugCategory.getKey());

  for (int i = 0; i < debugCategory.getPreferenceCount(); i++) {
    final Preference button = debugCategory.getPreference(i);
    button.setTitle(button.getKey()); // Not very friendly, but this is for debugging only!
    button.setOnPreferenceClickListener(listener);
  }
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:20,代码来源:FxAccountStatusFragment.java

示例7: setupSimplePreferencesScreen

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
     * Shows the simplified settings UI if the device configuration if the
     * device configuration dictates that a simplified, single-pane UI should be
     * shown.
     */
    private void setupSimplePreferencesScreen() {
        if (!isSimplePreferences(this)) {
            return;
        }

        // In the simplified UI, fragments are not used at all and we instead
        // use the older PreferenceActivity APIs.

        // Add 'general' preferences.
        addPreferencesFromResource(R.xml.pref_general);

        // Add 'data' preferences, and a corresponding header.
        PreferenceCategory fakeHeader = new PreferenceCategory(this);
        fakeHeader.setTitle(R.string.pref_header_data);
        getPreferenceScreen().addPreference(fakeHeader);
        addPreferencesFromResource(R.xml.pref_data);

        // Bind the summaries of relevant preferences to
        // their values. When their values change, their summaries are updated
        // to reflect the new value, per the Android Design guidelines.
        bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_destination)));
//        bindPreferenceSummaryToValue(findPreference(getString(R.string.pref_key_keep_account)));
    }
 
开发者ID:TimMackenzie,项目名称:VoiceNote,代码行数:29,代码来源:SettingsActivity.java

示例8: setupSimplePreferencesScreen

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown.
 */
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.

    // Add 'general' preferences.
    addPreferencesFromResource(R.xml.pref_general);

    // Add 'advanced' preferences, and a corresponding header.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_advanced);
    getPreferenceScreen().addPreference(fakeHeader);
    addPreferencesFromResource(R.xml.pref_advanced);

    // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
    // their values. When their values change, their summaries are updated
    // to reflect the new value, per the Android Design guidelines.
    bindPreferenceSummaryToValue(findPreference("pref_defaultopts"));
    // Advanced
    bindPreferenceSummaryToValue(findPreference("pref_updateurl"));
    bindPreferenceSummaryToValue(findPreference("pref_binaryloc"));
}
 
开发者ID:kost,项目名称:NetworkMapper,代码行数:31,代码来源:SettingsActivity.java

示例9: onResume

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void onResume() {
	super.onResume();
	final PreferenceCategory defaultCat = (PreferenceCategory) findPreference(getString(R.string.pref_GeneralSettings));
	defaultCat.setTitle("Version: " + getAppVersion());
	getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
 
开发者ID:videgro,项目名称:Ships,代码行数:8,代码来源:SettingsFragment.java

示例10: addCategory

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private PreferenceCategory addCategory(String title, PreferenceScreen screen, String key, Drawable icon, Context context) {
    PreferenceCategory c = new PreferenceCategory(context);
    c.setTitle(title);
    if (null != key) c.setKey(key);
    if (null != icon) c.setIcon(icon);
    screen.addPreference(c);
    return c;
}
 
开发者ID:iebb,项目名称:Kasumi,代码行数:9,代码来源:AppPreferences.java

示例11: passwordListAvailable

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:33,代码来源:SavePasswordsPreferences.java

示例12: passwordExceptionListAvailable

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@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);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:28,代码来源:SavePasswordsPreferences.java

示例13: onCreate

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    getDelegate().installViewFactory();
    getDelegate().onCreate(savedInstanceState);
    super.onCreate(savedInstanceState);
    PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(this);
    PreferenceCategory category = new PreferenceCategory(this);
    category.setTitle(R.string.filter_pokemons);
    screen.addPreference(category);
    try {
        JSONArray pokemonList = new JSONArray(Utils.loadJSONFromFile(this, "pokemon.json"));
        for (int i = 0; i < pokemonList.length(); i++){
            JSONObject pokemon = pokemonList.getJSONObject(i);
            CheckBoxPreference checkBox = new CheckBoxPreference(this);
            checkBox.setTitle(pokemon.getString("Name"));
            checkBox.setIcon(new BitmapDrawable(getResources(), Utils.bitmapForPokemon(this, Integer.parseInt(pokemon.getString("Number")))));
            checkBox.setDefaultValue(true);
            checkBox.setSummary(String.format(getString(R.string.setting_filter_pokemon_summary), pokemon.getString("Name")));
            checkBox.setKey("pref_key_show_pokemon_" + Integer.parseInt(pokemon.getString("Number")));
            category.addPreference(checkBox);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

    setPreferenceScreen(screen);
}
 
开发者ID:guipenedo,项目名称:PokeRadar,代码行数:28,代码来源:PokemonFilterSettingsActivity.java

示例14: createCategory

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
 * Create a category using the specified string resource for the title
 * @param titleResId resource ID to use for the title
 * @return newly created category
 */
private PreferenceCategory createCategory(@StringRes int titleResId) {
    PreferenceCategory preferenceCategory = new PreferenceCategory(getActivity());
    preferenceCategory.setTitle(titleResId);
    getPreferenceScreen().addPreference(preferenceCategory);
    return preferenceCategory;
}
 
开发者ID:nitroshare,项目名称:nitroshare-android,代码行数:12,代码来源:SettingsActivity.java

示例15: setupSimplePreferencesScreen

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
/**
 * Shows the simplified settings UI if the device configuration if the
 * device configuration dictates that a simplified, single-pane UI should be
 * shown.
 */
private void setupSimplePreferencesScreen() {
    if (!isSimplePreferences(this)) {
        return;
    }

    // In the simplified UI, fragments are not used at all and we instead
    // use the older PreferenceActivity APIs.

    // Add 'general' preferences.
    PreferenceCategory fakeHeader = new PreferenceCategory(this);
    fakeHeader.setTitle(R.string.pref_header_general);
    addPreferencesFromResource(R.xml.pref_general);
}
 
开发者ID:sujitkjha,项目名称:360-Video-Player-for-Android,代码行数:19,代码来源:SettingsActivity.java


注:本文中的android.preference.PreferenceCategory.setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。