Java Code Examples for android.preference.PreferenceCategory#getPreferenceCount()

The following examples show how to use android.preference.PreferenceCategory#getPreferenceCount() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OpenFitActivity.java    From OpenFit with MIT License 6 votes vote down vote up
@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();
}
 
Example 2
Source File: SettingsFragment.java    From NightWidget with GNU General Public License v2.0 6 votes vote down vote up
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 if (p instanceof PreferenceScreen) {
			PreferenceScreen pSc = (PreferenceScreen) p;
			for (int i = 0; i < pSc.getPreferenceCount(); i++) {
				initSummary(pSc.getPreference(i));
			}

		} else {

			updatePrefSummary(p);
		}
	}
 
Example 3
Source File: SettingsFragment.java    From 600SeriesAndroidUploader with MIT License 5 votes vote down vote up
private void initSummary(Preference p) {
    if (p instanceof PreferenceScreen) {
        PreferenceScreen pScr = (PreferenceScreen) p;
        for (int i = 0; i < pScr.getPreferenceCount(); i++) {
            initSummary(pScr.getPreference(i));
        }
    } else if (p instanceof PreferenceCategory) {
        PreferenceCategory pCat = (PreferenceCategory) p;
        for (int i = 0; i < pCat.getPreferenceCount(); i++) {
            initSummary(pCat.getPreference(i));
        }
    } else {
        updatePrefSummary(p);
    }
}
 
Example 4
Source File: SettingsFragment.java    From MedtronicUploader with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 5
Source File: SettingsActivity.java    From wear-notify-for-reddit with Apache License 2.0 5 votes vote down vote up
protected void initPrefsSummary(Preference p) {
    if (p instanceof PreferenceCategory) {
        PreferenceCategory cat = (PreferenceCategory) p;
        for (int i = 0; i < cat.getPreferenceCount(); i++) {
            initPrefsSummary(cat.getPreference(i));
        }
    } else {
        updatePrefsSummary(p);
    }
}