Java PreferenceCategory.getPreferenceCount方法代码示例

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


Java PreferenceCategory.getPreferenceCount方法代码示例

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

示例1: initPrefSummary

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void initPrefSummary() {
    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.getActivity());

    for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); ++i) {
        Preference preference = getPreferenceScreen().getPreference(i);

        if (preference instanceof PreferenceCategory) {
            PreferenceCategory pGrp = (PreferenceCategory) preference;
            for (int j = 0; j < pGrp.getPreferenceCount(); j++) {
                updatePrefSummary(pGrp.getPreference(j));
            }
        } else {
            updatePrefSummary(preference);
        }
    }
} 
开发者ID:cuihaoleo,项目名称:AndroidEquationSolver,代码行数:17,代码来源:SettingsActivity.java

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

示例3: setSummaryPref

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
public void setSummaryPref(Preference pref) {
    if (pref == null)
        return;

    String key = pref.getKey();
    if (key == null)
        key = "";

    if (pref instanceof KeyMapPreference) {
        KeyMapPreference kbPref = (KeyMapPreference) pref;
        String desc = kbPref.getDescription();
        pref.setSummary(desc);
    } else if (pref instanceof PreferenceCategory) {
        PreferenceCategory prefCat = (PreferenceCategory) pref;
        int count = prefCat.getPreferenceCount();
        for (int i = 0; i < count; i++) {
            setSummaryPref(prefCat.getPreference(i));
        }
    } else if (pref instanceof PreferenceScreen) {
        setSummaryAll((PreferenceScreen) pref);
    }
} 
开发者ID:michaelbarlow7,项目名称:dungeon-crawl-android,代码行数:23,代码来源:PreferencesActivity.java

示例4: onReceive

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    final String packageName = intent.getStringExtra(OpenFitIntent.EXTRA_PACKAGE_NAME);
    final String appName = intent.getStringExtra(OpenFitIntent.EXTRA_APP_NAME);
    Log.d(LOG_TAG, "Recieved del application: "+appName+" : "+packageName);
    appManager.delNotificationApp(packageName);
    oPrefs.removeSet(packageName);
    oPrefs.removeString(packageName);
    PreferenceCategory category = (PreferenceCategory) findPreference("preference_category_apps");
    Preference app = (Preference) findPreference(packageName);
    category.removePreference(app);
    // If no more preference in the category, restore the placeholder
    if(category.getPreferenceCount() <= 0) {
        category.addPreference(preference_apps_placeholder);
    }
    sendNotificationApplications();
} 
开发者ID:jareddlc,项目名称:OpenFit,代码行数:18,代码来源:OpenFitActivity.java

示例5: initSummary

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void initSummary(Preference p) {
    if (p instanceof PreferenceCategory) {
        PreferenceCategory pCat = (PreferenceCategory) p;
        for (int i = 0; i < pCat.getPreferenceCount(); i++) {
            initSummary(pCat.getPreference(i));
        }
    } else {
        p.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
            @Override
            public boolean onPreferenceChange(Preference preference, Object newVal) {
                preference.setSummary(newVal.toString());
                return true;
            }

        });
        updatePrefSummary(p);
    }
} 
开发者ID:hecosire,项目名称:hecosire-androidapp,代码行数:19,代码来源:SamplePreferenceActivity.java

示例6: initSummary

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void initSummary(Preference p) {
    if (p instanceof PreferenceCategory) {
        PreferenceCategory pCat = (PreferenceCategory) p;
        for (int i = 0; i < pCat.getPreferenceCount(); i++) {
            initSummary(pCat.getPreference(i));
        }
    } else {
        updatePrefSummary(p);
    }
} 
开发者ID:pazaan,项目名称:600SeriesAndroidUploader,代码行数:11,代码来源:SettingsFragment.java

示例7: setupPeriodicControls

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void setupPeriodicControls() {
    final PreferenceCategory periodicSpeechPrefs = (PreferenceCategory) findPreference(DroidPlannerPrefs.PREF_TTS_PERIODIC);
    ListPreference periodic = ((ListPreference) periodicSpeechPrefs.getPreference(0));
    periodic.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, final Object newValue) {
            // Broadcast the event locally on update.
            // A handler is used to that the current action has the time to
            // return, and store the value in the preferences.
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    lbm.sendBroadcast(new Intent(ACTION_UPDATED_STATUS_PERIOD)
                            .putExtra(EXTRA_UPDATED_STATUS_PERIOD, (String) newValue));

                    setupPeriodicControls();
                }
            });
            return true;
        }
    });

    int val = Integer.parseInt(periodic.getValue());

    final boolean isEnabled = val != 0;
    if (isEnabled) {
        periodic.setSummary(getString(R.string.pref_tts_status_every) + " " + val + " "
                + getString(R.string.pref_tts_seconds));
    } else {
        periodic.setSummary(R.string.pref_tts_periodic_status_disabled);
    }

    for (int i = 1; i < periodicSpeechPrefs.getPreferenceCount(); i++) {
        periodicSpeechPrefs.getPreference(i).setEnabled(isEnabled);
    }
} 
开发者ID:mxiao6,项目名称:Tower-develop,代码行数:37,代码来源:SettingsFragment.java

示例8: initSummary

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void initSummary(Preference p) {
    if (p instanceof PreferenceCategory) {
        PreferenceCategory cat = (PreferenceCategory) p;
        for (int i = 0; i < cat.getPreferenceCount(); i++) {
            initSummary(cat.getPreference(i));
        }
    } else {
        updatePreferences(p);
    }
} 
开发者ID:SecureSmartHome,项目名称:SecureSmartHome,代码行数:11,代码来源:MasterPreferenceFragment.java

示例9: setupPeriodicControls

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void setupPeriodicControls() {
    final PreferenceCategory periodicSpeechPrefs = (PreferenceCategory) findPreference(getString(R.string.pref_tts_periodic_key));
    ListPreference periodic = ((ListPreference) periodicSpeechPrefs.getPreference(0));
    periodic.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, final Object newValue) {
            // Broadcast the event locally on update.
            // A handler is used to that the current action has the time to
            // return,
            // and store the value in the preferences.
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(
                            new Intent(ACTION_UPDATED_STATUS_PERIOD).putExtra(
                                    EXTRA_UPDATED_STATUS_PERIOD, (String) newValue));

                    setupPeriodicControls();
                }
            });
            return true;
        }
    });

    int val = Integer.parseInt(periodic.getValue());

    final boolean isEnabled = val != 0;
    if (isEnabled) {
        periodic.setSummary(getString(R.string.pref_tts_status_every) + " " + val + " "
                + getString(R.string.pref_tts_seconds));
    } else {
        periodic.setSummary(R.string.pref_tts_periodic_status_disabled);
    }

    for (int i = 1; i < periodicSpeechPrefs.getPreferenceCount(); i++) {
        periodicSpeechPrefs.getPreference(i).setEnabled(isEnabled);
    }
} 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:39,代码来源:SettingsFragment.java

示例10: updateSummaryForPreference

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void updateSummaryForPreference(Preference p){
    if(p instanceof ListPreference){
        ListPreference lp = (ListPreference) p;
        lp.setSummary(lp.getEntry());
    }
    if(p instanceof EditTextPreference){
        EditTextPreference ep = (EditTextPreference) p;
        ep.setSummary(ep.getText());
    }
    if(p instanceof PreferenceCategory){
        PreferenceCategory pc = (PreferenceCategory) p;
        for(int i=0; i < pc.getPreferenceCount(); i++)
            updateSummaryForPreference(pc.getPreference(i));
    }
} 
开发者ID:jkarolus,项目名称:UltraSense,代码行数:16,代码来源:SettingsFragment.java

示例11: initPrefsSummary

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
protected void initPrefsSummary(SharedPreferences sharedPreferences,
                                Preference p) {
    if (p instanceof PreferenceCategory) {
        PreferenceCategory pCat = (PreferenceCategory) p;
        for (int i = 0; i < pCat.getPreferenceCount(); i++) {
            initPrefsSummary(sharedPreferences, pCat.getPreference(i));
        }
    } else {
        updatePrefsSummary(sharedPreferences, p.getKey());
    }
} 
开发者ID:lowwor,项目名称:Realtime-Bus,代码行数:12,代码来源:SettingsActivity.java

示例12: pickPreferenceObject

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void pickPreferenceObject(Preference p) {
    if (p instanceof PreferenceCategory) {
        PreferenceCategory category = (PreferenceCategory) p;
        for (int i = 0; i < category.getPreferenceCount(); i++) {
            pickPreferenceObject(category.getPreference(i));
        }
    } else {
        initSummary(p);
    }
} 
开发者ID:xpush,项目名称:lib-xpush-android,代码行数:11,代码来源:SettingsFragment.java

示例13: setupPeriodicControls

import android.preference.PreferenceCategory; //导入方法依赖的package包/类
private void setupPeriodicControls() {
    final PreferenceCategory periodicSpeechPrefs = (PreferenceCategory) findPreference(getString(R.string.pref_tts_periodic_key));
    ListPreference periodic = ((ListPreference) periodicSpeechPrefs.getPreference(0));
    periodic.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, final Object newValue) {
            // Broadcast the event locally on update.
            // A handler is used to that the current action has the time to
            // return, and store the value in the preferences.
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    lbm.sendBroadcast(new Intent(ACTION_UPDATED_STATUS_PERIOD)
                            .putExtra(EXTRA_UPDATED_STATUS_PERIOD, (String) newValue));

                    setupPeriodicControls();
                }
            });
            return true;
        }
    });

    int val = Integer.parseInt(periodic.getValue());

    final boolean isEnabled = val != 0;
    if (isEnabled) {
        periodic.setSummary(getString(R.string.pref_tts_status_every) + " " + val + " "
                + getString(R.string.pref_tts_seconds));
    } else {
        periodic.setSummary(R.string.pref_tts_periodic_status_disabled);
    }

    for (int i = 1; i < periodicSpeechPrefs.getPreferenceCount(); i++) {
        periodicSpeechPrefs.getPreference(i).setEnabled(isEnabled);
    }
} 
开发者ID:sommishra,项目名称:DroidPlanner-Tower,代码行数:37,代码来源:SettingsFragment.java

示例14: onCreate

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

    // Bind the view with presenter
    presenter = new Presenter(this);
    presenter.getInitialize(getArguments());

    PreferenceScreen preferenceScreen = getPreferenceScreen();

    //START loop to set listener on Preferences
    // Set "this" to listen for all preference click/change listener for all preferences
    for (int i = 0, size = preferenceScreen.getPreferenceCount(); i < size; i++) {
        Preference preference = preferenceScreen.getPreference(i);
        preference.setOnPreferenceClickListener(this);
        preference.setOnPreferenceChangeListener(this);

        // If this is a preference category, make sure to go through all the subpreferences as well.
        if (preference instanceof PreferenceCategory) {
            Stack<PreferenceCategory> stack = new Stack<>();
            stack.push((PreferenceCategory) preference);

            do {
                PreferenceCategory category = stack.pop();
                for (int x = 0, xSize = category.getPreferenceCount(); x < xSize; x++) {
                    Preference subPref = category.getPreference(x);
                    subPref.setOnPreferenceChangeListener(this);
                    subPref.setOnPreferenceClickListener(this);

                    if (subPref instanceof PreferenceCategory) {
                        stack.push((PreferenceCategory) subPref);
                    }
                }
            }
            while (!stack.isEmpty());
        }
    } //END loop to set listener on Preferences

    //This will update the state of the Settings view
    presenter.handlePreferences();
} 
开发者ID:pedromassango,项目名称:Programmers,代码行数:42,代码来源:SettingsFragment.java

本文标签属性:

示例:示例图

代码:代码零九

java:java自行车

PreferenceCategory:PreferenceCategory

getPreferenceCount:getPreferenceCount

上一篇:关东的解释关东的解释是什么(关东是指什么以东)
下一篇:Golang UserManager.VerifyEmail方法代码示例(golanguser.verifyemail方法代码示例汇总)

为您推荐