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


Java PreferenceGroup类代码示例

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


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

示例1: setChildrenStarted

import android.preference.PreferenceGroup; //导入依赖的package包/类
private void setChildrenStarted(PreferenceGroup group, boolean started) {
    final int count = group.getPreferenceCount();
    for (int i = 0; i < count; i++) {
        Preference pref = group.getPreference(i);
        if (pref instanceof ApplicationLightPreference) {
            ApplicationLightPreference ap = (ApplicationLightPreference) pref;
            if (started) {
                ap.onStart();
            } else {
                ap.onStop();
            }
        } else if (pref instanceof PreferenceGroup) {
            setChildrenStarted((PreferenceGroup) pref, started);
        }
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:17,代码来源:NotificationLightSettings.java

示例2: onPause

import android.preference.PreferenceGroup; //导入依赖的package包/类
@Override
protected void onPause() {
    super.onPause();
    // Save the selected languages
    String checkedLanguages = "";
    PreferenceGroup parent = getPreferenceScreen();
    int count = parent.getPreferenceCount();
    for (int i = 0; i < count; i++) {
        CheckBoxPreference pref = (CheckBoxPreference) parent.getPreference(i);
        if (pref.isChecked()) {
            Locale locale = mAvailableLanguages.get(i).locale;
            checkedLanguages += get5Code(locale) + ",";
        }
    }
    if (checkedLanguages.length() < 1) checkedLanguages = null; // Save null
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    Editor editor = sp.edit();
    editor.putString(KP2AKeyboard.PREF_SELECTED_LANGUAGES, checkedLanguages);
    SharedPreferencesCompat.apply(editor);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:21,代码来源:InputLanguageSelection.java

示例3: onResume

import android.preference.PreferenceGroup; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    //Atribui os valores selecionados
    for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); ++i) {
        Preference preference = getPreferenceScreen().getPreference(i);
        if (preference instanceof PreferenceGroup) {
            PreferenceGroup preferenceGroup = (PreferenceGroup) preference;
            for (int j = 0; j < preferenceGroup.getPreferenceCount(); ++j) {
                updatePreference(preferenceGroup.getPreference(j));
            }
        } else {
            updatePreference(preference);
        }
    }
}
 
开发者ID:alessandrojean,项目名称:order-by-android,代码行数:17,代码来源:SettingsActivity.java

示例4: getPreferenceList

import android.preference.PreferenceGroup; //导入依赖的package包/类
/**
 * Gets the list of preferences in a PreferenceScreen
 *
 * @param p    preference to add to the list
 * @param list of preferences in the PreferenceScreen
 * @return a list of all the preferences
 */
private ArrayList<Preference> getPreferenceList(Preference p, ArrayList<Preference> list) {
    if (p instanceof PreferenceCategory || p instanceof PreferenceScreen) {
        PreferenceGroup prefGroup = (PreferenceGroup) p;

        final int prefCount = prefGroup.getPreferenceCount();

        for (int i = 0; i < prefCount; i++) {
            getPreferenceList(prefGroup.getPreference(i), list);
        }
    }

    if (!(p instanceof PreferenceCategory)) {
        list.add(p);
    }

    return list;
}
 
开发者ID:Nxt3,项目名称:IO_Classic_WatchFace,代码行数:25,代码来源:SettingsFragment.java

示例5: onSaveCustomInputStyle

import android.preference.PreferenceGroup; //导入依赖的package包/类
@Override
public void onSaveCustomInputStyle(final CustomInputStylePreference stylePref) {
    final InputMethodSubtype subtype = stylePref.getSubtype();
    if (!stylePref.hasBeenModified()) {
        return;
    }
    if (findDuplicatedSubtype(subtype) == null) {
        mRichImm.setAdditionalInputMethodSubtypes(getSubtypes());
        return;
    }

    // Saved subtype is duplicated.
    final PreferenceGroup group = getPreferenceScreen();
    group.removePreference(stylePref);
    stylePref.revert();
    group.addPreference(stylePref);
    showSubtypeAlreadyExistsToast(subtype);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:19,代码来源:CustomInputStyleSettingsFragment.java

示例6: onAddCustomInputStyle

import android.preference.PreferenceGroup; //导入依赖的package包/类
@Override
public void onAddCustomInputStyle(final CustomInputStylePreference stylePref) {
    mIsAddingNewSubtype = false;
    final InputMethodSubtype subtype = stylePref.getSubtype();
    if (findDuplicatedSubtype(subtype) == null) {
        mRichImm.setAdditionalInputMethodSubtypes(getSubtypes());
        mSubtypePreferenceKeyForSubtypeEnabler = stylePref.getKey();
        mSubtypeEnablerNotificationDialog = createDialog();
        mSubtypeEnablerNotificationDialog.show();
        return;
    }

    // Newly added subtype is duplicated.
    final PreferenceGroup group = getPreferenceScreen();
    group.removePreference(stylePref);
    showSubtypeAlreadyExistsToast(subtype);
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:18,代码来源:CustomInputStyleSettingsFragment.java

示例7: replaceAllCheckBoxPreferencesBySwitchPreferences

import android.preference.PreferenceGroup; //导入依赖的package包/类
private static void replaceAllCheckBoxPreferencesBySwitchPreferences(
        final PreferenceGroup group) {
    final ArrayList<Preference> preferences = new ArrayList<>();
    final int count = group.getPreferenceCount();
    for (int index = 0; index < count; index++) {
        preferences.add(group.getPreference(index));
    }
    group.removeAll();
    for (int index = 0; index < count; index++) {
        final Preference preference = preferences.get(index);
        if (preference instanceof CheckBoxPreference) {
            addSwitchPreferenceBasedOnCheckBoxPreference((CheckBoxPreference)preference, group);
        } else {
            group.addPreference(preference);
            if (preference instanceof PreferenceGroup) {
                replaceAllCheckBoxPreferencesBySwitchPreferences((PreferenceGroup)preference);
            }
        }
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:21,代码来源:TwoStatePreferenceHelper.java

示例8: rebuildProfileList

import android.preference.PreferenceGroup; //导入依赖的package包/类
private void rebuildProfileList() {
    // Add an edit preference for each current Chrome profile.
    PreferenceGroup profileCategory = (PreferenceGroup) findPreference(PREF_AUTOFILL_PROFILES);
    profileCategory.removeAll();
    for (AutofillProfile profile : PersonalDataManager.getInstance().getProfilesForSettings()) {
        // Add an item on the current page...
        Preference pref = new Preference(getActivity());
        pref.setTitle(profile.getFullName());
        pref.setSummary(profile.getLabel());

        if (profile.getIsLocal()) {
            pref.setFragment(AutofillProfileEditor.class.getName());
        } else {
            pref.setWidgetLayoutResource(R.layout.autofill_server_data_label);
            pref.setFragment(AutofillServerProfilePreferences.class.getName());
        }

        Bundle args = pref.getExtras();
        args.putString(AUTOFILL_GUID, profile.getGUID());
        profileCategory.addPreference(pref);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:AutofillPreferences.java

示例9: rebuildCreditCardList

import android.preference.PreferenceGroup; //导入依赖的package包/类
private void rebuildCreditCardList() {
    PreferenceGroup profileCategory =
            (PreferenceGroup) findPreference(PREF_AUTOFILL_CREDIT_CARDS);
    profileCategory.removeAll();
    for (CreditCard card : PersonalDataManager.getInstance().getCreditCardsForSettings()) {
        // Add an item on the current page...
        Preference pref = new Preference(getActivity());
        pref.setTitle(card.getObfuscatedNumber());
        pref.setSummary(card.getFormattedExpirationDate(getActivity()));

        if (card.getIsLocal()) {
            pref.setFragment(AutofillLocalCardEditor.class.getName());
        } else {
            pref.setFragment(AutofillServerCardEditor.class.getName());
            pref.setWidgetLayoutResource(R.layout.autofill_server_data_label);
        }

        Bundle args = pref.getExtras();
        args.putString(AUTOFILL_GUID, card.getGUID());
        profileCategory.addPreference(pref);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:AutofillPreferences.java

示例10: createUserDictSettings

import android.preference.PreferenceGroup; //导入依赖的package包/类
/**
 * Creates the entries that allow the user to go into the user dictionary for each locale.
 * @param userDictGroup The group to put the settings in.
 */
protected void createUserDictSettings(final PreferenceGroup userDictGroup) {
    final Activity activity = getActivity();
    userDictGroup.removeAll();
    final TreeSet<String> localeSet =
            UserDictionaryList.getUserDictionaryLocalesSet(activity);

    if (localeSet.size() > 1) {
        // Have an "All languages" entry in the languages list if there are two or more active
        // languages
        localeSet.add("");
    }

    if (localeSet.isEmpty()) {
        userDictGroup.addPreference(createUserDictionaryPreference(null));
    } else {
        for (String locale : localeSet) {
            userDictGroup.addPreference(createUserDictionaryPreference(locale));
        }
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:25,代码来源:UserDictionaryList.java

示例11: addSwitchPreferenceBasedOnCheckBoxPreference

import android.preference.PreferenceGroup; //导入依赖的package包/类
static void addSwitchPreferenceBasedOnCheckBoxPreference(final CheckBoxPreference checkBox,
        final PreferenceGroup group) {
    final SwitchPreference switchPref = new SwitchPreference(checkBox.getContext());
    switchPref.setTitle(checkBox.getTitle());
    switchPref.setKey(checkBox.getKey());
    switchPref.setOrder(checkBox.getOrder());
    switchPref.setPersistent(checkBox.isPersistent());
    switchPref.setEnabled(checkBox.isEnabled());
    switchPref.setChecked(checkBox.isChecked());
    switchPref.setSummary(checkBox.getSummary());
    switchPref.setSummaryOn(checkBox.getSummaryOn());
    switchPref.setSummaryOff(checkBox.getSummaryOff());
    switchPref.setSwitchTextOn(EMPTY_TEXT);
    switchPref.setSwitchTextOff(EMPTY_TEXT);
    group.addPreference(switchPref);
    switchPref.setDependency(checkBox.getDependency());
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:18,代码来源:TwoStatePreferenceHelper.java

示例12: findWordListPreference

import android.preference.PreferenceGroup; //导入依赖的package包/类
private WordListPreference findWordListPreference(final String id) {
    final PreferenceGroup prefScreen = getPreferenceScreen();
    if (null == prefScreen) {
        Log.e(TAG, "Could not find the preference group");
        return null;
    }
    for (int i = prefScreen.getPreferenceCount() - 1; i >= 0; --i) {
        final Preference pref = prefScreen.getPreference(i);
        if (pref instanceof WordListPreference) {
            final WordListPreference wlPref = (WordListPreference)pref;
            if (id.equals(wlPref.mWordlistId)) {
                return wlPref;
            }
        }
    }
    Log.e(TAG, "Could not find the preference for a word list id " + id);
    return null;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:19,代码来源:DictionarySettingsFragment.java

示例13: refreshInterface

import android.preference.PreferenceGroup; //导入依赖的package包/类
void refreshInterface() {
    final Activity activity = getActivity();
    if (null == activity) return;
    final PreferenceGroup prefScreen = getPreferenceScreen();
    final Collection<? extends Preference> prefList =
            createInstalledDictSettingsCollection(mClientId);

    activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                // TODO: display this somewhere
                // if (0 != lastUpdate) mUpdateNowPreference.setSummary(updateNowSummary);
                refreshNetworkState();

                removeAnyDictSettings(prefScreen);
                int i = 0;
                for (Preference preference : prefList) {
                    preference.setOrder(i++);
                    prefScreen.addPreference(preference);
                }
            }
        });
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:24,代码来源:DictionarySettingsFragment.java

示例14: bind

import android.preference.PreferenceGroup; //导入依赖的package包/类
private void bind(PreferenceGroup group) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    for (int i = 0; i < group.getPreferenceCount(); i++) {
        Preference p = group.getPreference(i);
        if (p instanceof PreferenceGroup) {
            bind((PreferenceGroup) p);
        } else {
            if (p instanceof CheckBoxPreference) {
                ;
            } else {
                Object val = sp.getAll().get(p.getKey());
                p.setSummary(val == null ? "" : ("" + val));
                p.setOnPreferenceChangeListener(this);
            }
        }
    }
}
 
开发者ID:AleGogogo,项目名称:MaoMaoRobot,代码行数:18,代码来源:Setting.java

示例15: onCreate

import android.preference.PreferenceGroup; //导入依赖的package包/类
@DexAppend
@Override
public void onCreate(Bundle icicle) {
    try {
        PreferenceGroup pg = (PreferenceGroup) findPreference(
                FakeSignatureGlobalUI.DEBUG_APPLICATIONS_CATEGORY_KEY);
        if (pg != null) {
            TwoStatePreference p = createTwoStatePreference(pg.getContext());
            p.setKey(FakeSignatureGlobalUI.SETTING_SECURE_KEY);
            p.setTitle(FakeSignatureGlobalUI.SETTING_TITLE);
            p.setSummary(FakeSignatureGlobalUI.SETTING_SUMMARY);
            p.setPersistent(false);
            mResetTwoStatePrefsAdd(p);
            mAllPrefs.add(p);
            //pg.setOrderingAsAdded(true);
            pg.addPreference(p);
            mAllowFakeSignatureGlobal = p;
        } else {
            Log.e("DevelopmentSettings_FakeSignatureGlobalUI", "cannot find 'applications' preference category");
        }
    } catch (Throwable t) {
        Log.e("DevelopmentSettings_FakeSignatureGlobalUI", "onCreate exception", t);
    }
}
 
开发者ID:Lanchon,项目名称:haystack,代码行数:25,代码来源:DevelopmentSettings.java


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