Example usage for android.preference ListPreference setShouldDisableView

List of usage examples for android.preference ListPreference setShouldDisableView

Introduction

In this page you can find the example usage for android.preference ListPreference setShouldDisableView.

Prototype

public void setShouldDisableView(boolean shouldDisableView) 

Source Link

Document

Sets whether this Preference should disable its view when it gets disabled.

Usage

From source file:com.android.leanlauncher.SettingsActivity.java

private void displayIconThemePref(ListPreference lpIconSetting) {
    ArrayMap<String, String> iconPacks = LauncherAppState.getInstance().getIconCache().getAvailableIconPacks();

    if (iconPacks != null && iconPacks.size() != 0) {
        String iconPackValues[] = iconPacks.keySet().toArray(new String[iconPacks.size() + 1]);
        iconPackValues[iconPacks.size()] = "";

        String[] iconPackTitles = new String[iconPacks.size() + 1];
        for (int i = 0; i < iconPacks.size(); i++) {
            iconPackTitles[i] = iconPacks.get(iconPacks.keyAt(i));
        }/*from   w  w w  . j  a v a2  s  . co m*/
        iconPackTitles[iconPacks.size()] = getString(R.string.pref_no_icon_theme);

        lpIconSetting.setEntries(iconPackTitles);
        lpIconSetting.setEntryValues(iconPackValues);
    } else {
        lpIconSetting.setEnabled(false);
        lpIconSetting.setShouldDisableView(true);
        lpIconSetting.setSummary(R.string.pref_icon_theme_summary_disabled);
    }
}