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


Java MultiSelectListPreference.setEntries方法代码示例

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


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

示例1: setupWeekDaysPref

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
private void setupWeekDaysPref() {
    mPrefWeekDays = (MultiSelectListPreference) findPreference(PREF_KEY_QH_WEEKDAYS);
    String[] days = new DateFormatSymbols(Locale.getDefault()).getWeekdays();
    CharSequence[] entries = new CharSequence[7];
    CharSequence[] entryValues = new CharSequence[7];
    for (int i = 1; i <= 7; i++) {
        entries[i - 1] = days[i];
        entryValues[i - 1] = String.valueOf(i);
    }
    mPrefWeekDays.setEntries(entries);
    mPrefWeekDays.setEntryValues(entryValues);
    if (mPrefs.getStringSet(PREF_KEY_QH_WEEKDAYS, null) == null) {
        Set<String> value = new HashSet<String>(Arrays.asList("2", "3", "4", "5", "6"));
        mPrefs.edit().putStringSet(PREF_KEY_QH_WEEKDAYS, value).commit();
        mPrefWeekDays.setValues(value);
    }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:18,代码来源:QuietHoursActivity.java

示例2: onCreate

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.pref_scanning);
    bindPreferenceToSummary();
    setOnPreferenceClickListeners();

    beaconFormatList = new HashSet<>();
    sharedPreferences = getPreferenceManager().getSharedPreferences();

    MultiSelectListPreference list = (MultiSelectListPreference) getPreferenceManager().findPreference("key_beacon_formats");

    Set<String> beaconFormats = sharedPreferences.getStringSet("key_beacon_formats", beaconFormatList);
    CharSequence[] sequences = beaconFormats.toArray(new CharSequence[beaconFormats.size()]);

    list.setEntries(sequences);
    list.setEntryValues(sequences);
}
 
开发者ID:BoydHogerheijde,项目名称:Beacon-Scanner-Android,代码行数:19,代码来源:SettingsFragment.java

示例3: setupElmCmdSelection

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
/**
 * set up protocol selection
 */
void setupElmCmdSelection()
{
	MultiSelectListPreference pref =
		(MultiSelectListPreference) findPreference(ELM_CMD_DISABLE);
	ElmProt.CMD[] values = ElmProt.CMD.values();
	HashSet<String> selections = new HashSet<String>();
	CharSequence[] titles = new CharSequence[values.length];
	CharSequence[] keys = new CharSequence[values.length];
	int i = 0;
	for (ElmProt.CMD cmd : values)
	{
		titles[i] = cmd.toString();
		keys[i] = cmd.toString();
		if(!cmd.isEnabled()) selections.add(cmd.toString());
		i++;
	}
	// set enries and keys
	pref.setEntries(titles);
	pref.setEntryValues(keys);
	pref.setValues(selections);
}
 
开发者ID:fr3ts0n,项目名称:AndrOBD,代码行数:25,代码来源:SettingsActivity.java

示例4: loadGroup

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
private void loadGroup() {
    // Consider adding more features here, such as those in Track and TrackPreferenceFragment
    name = (EditTextPreference) findPreference("name");
    name.setText(group.getName());
    name.setSummary(group.getName());

    description = (EditTextPreference) findPreference("description");
    description.setText(group.getDescription());
    description.setSummary(group.getDescription());

    mTracksPref = (MultiSelectListPreference) findPreference("tracks");
    mTracksPref.setValues(getTrackIdsForGroupAsSet(group.getId()));

    mTracksPref.setEntries(getAllTrackNamesAsCharSeq());
    mTracksPref.setEntryValues(getAllTrackIdsAsCharSeq());
    mTracksPref.setSummary(getTrackNamesForSummary());

}
 
开发者ID:lordi,项目名称:tickmate,代码行数:19,代码来源:GroupPreferenceFragment.java

示例5: setUpUnitTypePrefs

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
/**
 * Helper Class to setup the default Unit Type preference list in code
 */
private void setUpUnitTypePrefs() {
   PreferenceScreen screen = getPreferenceScreen();
   MultiSelectListPreference listPref = new MultiSelectListPreference(super.getActivity());
   listPref.setOrder(0);
   listPref.setDialogTitle(R.string.unit_select_title);
   listPref.setKey(UNIT_TYPE_PREF_KEY);
   listPref.setSummary(R.string.unit_select_summary);
   listPref.setTitle(R.string.unit_select_title);
   listPref.setEntries(getUnitTypeNameArray(getResources()));

   String[] keyArray = getUnitTypeKeyArray(getResources());
   listPref.setEntryValues(keyArray);

   final Set<String> result = new HashSet<>();
   Collections.addAll(result, keyArray);

   listPref.setDefaultValue(result);

   screen.addPreference(listPref);
}
 
开发者ID:EvanRespaut,项目名称:Equate,代码行数:24,代码来源:SettingsActivity.java

示例6: onCreate

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    addPreferencesFromResource(R.xml.settings_preferences);

    mMultiSelectListPreference = (MultiSelectListPreference) findPreference("select_apply_on_boot");
    ArrayList<CharSequence> entries = new ArrayList<>();
    entries.add(getString(R.string.cpu_frequency));
    if (GpuUtils.isGpuFrequencyScalingSupported()) {
        entries.add(getString(R.string.gpu_frequency));
    }
    entries.add(getString(R.string.io));
    entries.add(getString(R.string.build_prop));
    entries.add(getString(R.string.vm));

    CharSequence[] charSequences = new CharSequence[entries.size()];
    for (int i = 0; i < entries.size(); i++) {
        charSequences[i] = entries.get(i);
    }
    mMultiSelectListPreference.setEntries(charSequences);
    mMultiSelectListPreference.setEntryValues(charSequences);
}
 
开发者ID:rahulkumar66,项目名称:Performance-Tweaker,代码行数:23,代码来源:SettingsFragment.java

示例7: onCreate

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

    final Vibrator vibrator = (Vibrator) getActivity().getSystemService(Context
            .VIBRATOR_SERVICE);
    if (!vibrator.hasVibrator()) {
        final MultiSelectListPreference inAppSettings = (MultiSelectListPreference)
                findPreference(PREF_IN_APP_NOTIFICATION_SETTINGS);
        final MultiSelectListPreference outOfAppSettings = (MultiSelectListPreference)
                findPreference(PREF_OUT_OF_APP_NOTIFICATION_SETTINGS);

        inAppSettings.setEntries(R.array.notification_in_entries_no_vibrator);
        inAppSettings.setEntryValues(R.array.notification_in_values_no_vibrator);
        outOfAppSettings.setEntries(R.array.notification_out_entries_no_vibrator);
        outOfAppSettings.setEntryValues(R.array.notification_out_values_no_vibrator);
    }
}
 
开发者ID:tilal6991,项目名称:HoloIRC,代码行数:21,代码来源:NotificationPreferenceFragment.java

示例8: onCreate

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            // Load the preferences from an XML resource
            addPreferencesFromResource(R.xml.preferences);
            
    		//dynamically populate this with the databases available
    		final DatabaseHelper dbHelper = new DatabaseHelper(getActivity());
    		dbHelper.gatherFiles();
    		final Set<String> mDBList = dbHelper.GetListofDB();
    		MultiSelectListPreference myMultPref = (MultiSelectListPreference) findPreference(getString(R.string.pref_dbs));
    		if (myMultPref != null) {
    			
    			CharSequence entries[] = new String[mDBList.size()];
    			CharSequence entryValues[] = new String[mDBList.size()];
    			int i = 0;
    			for (String str : mDBList) {
    				entries[i] = str;
    				entryValues[i] = str;
    				i++;
    			}
    			myMultPref.setEntries(entries);
    			myMultPref.setEntryValues(entryValues);
    		}
}
 
开发者ID:wbrenna,项目名称:GTFSOffline,代码行数:27,代码来源:PrefsActivity.java

示例9: loadWasteStreamSettings

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
public void loadWasteStreamSettings(){
    final MultiSelectListPreference streamPrefs = (MultiSelectListPreference) findPreference(WeightRecorder.PREF_WASTE_STREAMS);
    WasteStreams wasteStreams = new WasteStreams();
    wasteStreams.loadWasteStreams(getActivity().getApplicationContext());

    streamPrefs.setDefaultValue(wasteStreams.getDefaultStreamValues());
    streamPrefs.setEntries(wasteStreams.getAllStreamNames());
    streamPrefs.setEntryValues(wasteStreams.getAllStreamValues());
    bindPreferenceSummaryToValue(streamPrefs);
}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:11,代码来源:SettingsActivity.java

示例10: reloadLogsFilter

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void reloadLogsFilter() {
	MultiSelectListPreference logsFilter = (MultiSelectListPreference) findPreference("logs_filter_manage");
	SharedPreferences prefs = PreferenceManager
			.getDefaultSharedPreferences(getApplicationContext());
	Set<String> items = prefs.getStringSet(LOGS_FILTER_MANAGE,
			new HashSet<String>());
	CharSequence[] logsFilterItems = items.toArray(new CharSequence[items
			.size()]);
	logsFilter.setEntries(logsFilterItems);
	logsFilter.setEntryValues(logsFilterItems);
}
 
开发者ID:pylerSM,项目名称:LogsFilter,代码行数:13,代码来源:Settings.java

示例11: multi

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
private MultiSelectListPreference multi() {
    MultiSelectListPreference pref = new MultiSelectListPreference(a);
    pref.setKey(MULTI);
    pref.setEntries(new String[]{"One", "Two", "Three"});
    pref.setEntryValues(new String[]{"1", "2", "3"});
    return pref;
}
 
开发者ID:pushbit,项目名称:sprockets-android,代码行数:8,代码来源:SprocketsPreferenceFragmentTest.java

示例12: fillBuckets

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
private void fillBuckets() {
    this.bucketNames = PBApplication.getMediaStore().getBucketData();

    final CharSequence[] ids = this.bucketNames.values().toArray(new CharSequence[this.bucketNames.size()]);
    final CharSequence[] names = this.bucketNames.keySet().toArray(new CharSequence[this.bucketNames.size()]);

    final MultiSelectListPreference bucketListPreference = (MultiSelectListPreference) findPreference(PBConstants.PREF_PICTURE_FOLDER_LIST);
    bucketListPreference.setEntries(ids);
    bucketListPreference.setEnabled(true);
    bucketListPreference.setEntryValues(names);

    setSummaries();
}
 
开发者ID:PhotoBackup,项目名称:client-android,代码行数:14,代码来源:PBPreferenceFragment.java

示例13: setupPidSelection

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
/**
 * set up selection for PIDs
 */
void setupPidSelection()
{
	MultiSelectListPreference itemList =
		(MultiSelectListPreference) findPreference(KEY_DATA_ITEMS);

	// collect data items for selection
	items = ObdProt.dataItems.getSvcDataItems(ObdProt.OBD_SVC_DATA);
	HashSet<String> selections = new HashSet<String>();
	CharSequence[] titles = new CharSequence[items.size()];
	CharSequence[] keys = new CharSequence[items.size()];
	// loop through data items
	int i = 0;
	for (EcuDataItem currItem : items)
	{
		titles[i] = currItem.label;
		keys[i] = currItem.toString();
		selections.add(currItem.toString());
		i++;
	}
	// set enries and keys
	itemList.setEntries(titles);
	itemList.setEntryValues(keys);

	// if there is no item selected, mark all as selected
	if (itemList.getValues().size() == 0)
	{
		itemList.setValues(selections);
	}
}
 
开发者ID:fr3ts0n,项目名称:AndrOBD,代码行数:33,代码来源:SettingsActivity.java

示例14: addAccountsPreference

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
private void addAccountsPreference() {
    final String[] accounts = GmailExtension.getAllAccountNames(this);
    Set<String> allAccountsSet = new HashSet<String>();
    allAccountsSet.addAll(Arrays.asList(accounts));

    MultiSelectListPreference accountsPreference = new MultiSelectListPreference(this);
    accountsPreference.setKey(GmailExtension.PREF_ACCOUNTS);
    accountsPreference.setTitle(R.string.pref_gmail_accounts_title);
    accountsPreference.setEntries(accounts);
    accountsPreference.setEntryValues(accounts);
    accountsPreference.setDefaultValue(allAccountsSet);
    mFragment.getPreferenceScreen().addPreference(accountsPreference);

    Preference.OnPreferenceChangeListener accountsChangeListener
            = new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object value) {
            int numSelected = 0;
            int numTotal = accounts.length;

            try {
                //noinspection unchecked
                Set<String> selectedAccounts = (Set<String>) value;
                if (selectedAccounts != null) {
                    numSelected = selectedAccounts.size();
                }
            } catch (ClassCastException ignored) {
            }

            preference.setSummary(getResources().getQuantityString(
                    R.plurals.pref_gmail_accounts_summary_template,
                    numTotal, numSelected, numTotal));
            return true;
        }
    };

    accountsPreference.setOnPreferenceChangeListener(accountsChangeListener);
    accountsChangeListener.onPreferenceChange(accountsPreference,
            PreferenceManager
                    .getDefaultSharedPreferences(this)
                    .getStringSet(accountsPreference.getKey(), allAccountsSet));
}
 
开发者ID:romannurik,项目名称:dashclock,代码行数:43,代码来源:GmailSettingsActivity.java

示例15: onCreate

import android.preference.MultiSelectListPreference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SettingsActivityComponent cmp = DaggerService.getDaggerComponent(getActivity());
    cmp.inject(this);

    mSettings.setCached(true);

    addPreferencesFromResource(R.xml.prefs_service);

    runWhen = (ListPreference) findPreference(ServiceSettings.RUN_WHEN);
    runWhen.setPersistent(false);
    runWhen.setValue(mSettings.runWhen());
    runWhen.setOnPreferenceChangeListener(this);

    onlyOnWifi = (CheckBoxPreference) findPreference(ServiceSettings.ONLY_WIFI);
    onlyOnWifi.setPersistent(false);
    onlyOnWifi.setChecked(mSettings.onlyOnWifi());
    onlyOnWifi.setOnPreferenceChangeListener(this);

    wifiNetwork = (MultiSelectListPreference) findPreference(ServiceSettings.WIFI_NETWORKS);
    wifiNetwork.setPersistent(false);
    String[] ssids = getWifiNetworks();
    wifiNetwork.setEntries(ssids);
    wifiNetwork.setEntryValues(ssids);
    wifiNetwork.setValues(mSettings.allowedWifiNetworks());
    wifiNetwork.setOnPreferenceChangeListener(this);

    onlyCharging = (CheckBoxPreference) findPreference(ServiceSettings.ONLY_CHARGING);
    onlyCharging.setPersistent(false);
    onlyCharging.setChecked(mSettings.onlyWhenCharging());
    onlyCharging.setOnPreferenceChangeListener(this);

    catBetween = (PreferenceCategory) findPreference("cat_between");
    hideShowRunWhenCategories(mSettings.runWhen());

    scheduleStart = (TimePreference) findPreference(ServiceSettings.RANGE_START);
    scheduleStart.setPersistent(false);
    scheduleStart.setValue(mSettings.getScheduledStartTime());
    scheduleStart.setOnPreferenceChangeListener(this);

    scheduleEnd = (TimePreference) findPreference(ServiceSettings.RANGE_END);
    scheduleEnd.setPersistent(false);
    scheduleEnd.setValue(mSettings.getScheduledEndTime());
    scheduleEnd.setOnPreferenceChangeListener(this);

    exportConfig = findPreference("export");
    exportConfig.setOnPreferenceClickListener(this);
    importConfig = findPreference("import");
    importConfig.setOnPreferenceClickListener(this);
}
 
开发者ID:OpenSilk,项目名称:SyncthingAndroid,代码行数:53,代码来源:ServiceSettingsFragment.java


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