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


Java PreferenceGroup.getPreferenceCount方法代码示例

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


在下文中一共展示了PreferenceGroup.getPreferenceCount方法的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: 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

示例6: 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

示例7: 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

示例8: getPreferenceList

import android.preference.PreferenceGroup; //导入方法依赖的package包/类
private List<Preference> getPreferenceList(Preference p, List<Preference> list)
{
    if (p instanceof PreferenceCategory || p instanceof PreferenceScreen)
    {
        PreferenceGroup g = (PreferenceGroup) p;
        int pCount = g.getPreferenceCount();
        for (int i = 0; i < pCount; i++)
        {
            getPreferenceList(g.getPreference(i), list);
        }
    }
    else
    {
        list.add(p);
    }
    return list;
}
 
开发者ID:Rouji,项目名称:Hupl,代码行数:18,代码来源:GlobalSettingsActivity.java

示例9: 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(LatinIME.PREF_SELECTED_LANGUAGES, checkedLanguages);
    SharedPreferencesCompat.apply(editor);
}
 
开发者ID:klausw,项目名称:hackerskeyboard,代码行数:21,代码来源:InputLanguageSelection.java

示例10: onActivityCreated

import android.preference.PreferenceGroup; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    SharedPreferenceListener sharedPreferenceListener = new SharedPreferenceListener();
    for(int idPreference = 0; idPreference < preferenceScreen.getPreferenceCount(); idPreference++) {
        Preference preference = preferenceScreen.getPreference(idPreference);
        if(preference instanceof PreferenceGroup) {
            PreferenceGroup preferenceGroup = (PreferenceGroup)preference;
            for(int IdGroupReference = 0; IdGroupReference < preferenceGroup.getPreferenceCount(); IdGroupReference++) {
                preference = preferenceGroup.getPreference(IdGroupReference);
                preference.setOnPreferenceChangeListener(sharedPreferenceListener);
            }
        } else {
            preference.setOnPreferenceChangeListener(sharedPreferenceListener);
        }
    }
}
 
开发者ID:Ifsttar,项目名称:NoiseCapture,代码行数:19,代码来源:SettingsFragment.java

示例11: onResume

import android.preference.PreferenceGroup; //导入方法依赖的package包/类
/**
 * On resume it update every settings.
 */
@Override
public void onResume() {
    super.onResume();
    getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    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:illbexyz,项目名称:latex-it,代码行数:21,代码来源:SettingsFragment.java

示例12: onResume

import android.preference.PreferenceGroup; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    PreferenceScreen preferenceScreen = getPreferenceScreen();
    for (int i = 0; i < preferenceScreen.getPreferenceCount(); i++) {
        Preference preference = preferenceScreen.getPreference(i);
        if (preference instanceof PreferenceGroup) {
            PreferenceGroup preferenceGroup = (PreferenceGroup) preference;
            for (int j = 0; j < preferenceGroup.getPreferenceCount(); j++) {
                Preference subPref = preferenceGroup.getPreference(j);
                updatePreference(subPref, subPref.getKey());
            }
        } else {
            updatePreference(preference, preference.getKey());
        }
    }
}
 
开发者ID:andreynovikov,项目名称:trekarta,代码行数:18,代码来源:Settings.java

示例13: putAllPreferences

import android.preference.PreferenceGroup; //导入方法依赖的package包/类
private void putAllPreferences(PreferenceGroup group) {
    int c = 0;
    String advancedPrefix = mActivity.getString(string.pref_advanced_prefix);
    while(c < group.getPreferenceCount()) {
        String key;
        Preference preference = group.getPreference(c);
        if(preference instanceof PreferenceGroup) {
            putAllPreferences((PreferenceGroup)preference);
            key = preference.getKey();
        } else {
            key = String.format("%s.%s", group.getKey(), preference.getKey());
        }
        setProperty(key, String.valueOf(!preference.getKey().startsWith(advancedPrefix)));
        c++;
    }
}
 
开发者ID:hmrs-cr,项目名称:android-nmea-logger,代码行数:17,代码来源:SettingsActivity.java

示例14: hideAdvancedPreferences

import android.preference.PreferenceGroup; //导入方法依赖的package包/类
private void hideAdvancedPreferences(PreferenceGroup group) {
    if(mAdvancedSettings.showAll()) {
        return;
    }

    int c = 0;
    while(c < group.getPreferenceCount()) {
        Preference pref = group.getPreference(c);
        if(!mAdvancedSettings.isVisible(group, pref)) {
            group.removePreference(pref);
        } else {
            if(pref instanceof PreferenceGroup) {
                hideAdvancedPreferences((PreferenceGroup)pref);
            }
            c++;
        }
    }
}
 
开发者ID:hmrs-cr,项目名称:android-nmea-logger,代码行数:19,代码来源:SettingsActivity.java

示例15: onResume

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

    SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences();

    // Register self als listener for changes
    sharedPreferences.registerOnSharedPreferenceChangeListener(this);

    // Set initial summary state
    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++) {
                updatePreferenceSummary(sharedPreferences, preferenceGroup.getPreference(j));
            }
        } else {
            updatePreferenceSummary(sharedPreferences, preference);
        }
    }
}
 
开发者ID:Any1s,项目名称:RBTV-Sendeplan,代码行数:24,代码来源:SettingsFragment.java


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