Java Code Examples for android.preference.PreferenceScreen#removePreference()

The following examples show how to use android.preference.PreferenceScreen#removePreference() . 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: Preferences.java    From xDrip with GNU General Public License v3.0 6 votes vote down vote up
private void update_nfc_expiry_preferences(Boolean show_age) {
    try {
        ;
        final PreferenceScreen nfcScreen = (PreferenceScreen) findPreference("xdrip_plus_nfc_settings");
        final String nfc_expiry_days_string = AllPrefsFragment.this.prefs.getString("nfc_expiry_days", "14.5");

        final CheckBoxPreference nfc_show_age = (CheckBoxPreference) findPreference("nfc_show_age");
        nfc_show_age.setSummaryOff("Show the sensor expiry time based on " + nfc_expiry_days_string + " days");
        if (show_age == null) show_age = nfc_show_age.isChecked();
        if (show_age) {
            nfcScreen.removePreference(nfc_expiry_days);
        } else {
            nfc_expiry_days.setOrder(3);
            nfcScreen.addPreference(nfc_expiry_days);
        }
    } catch (NullPointerException e) {
        //
    }
}
 
Example 2
Source File: SensorSettingsActivity.java    From mytracks with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle bundle) {
  super.onCreate(bundle);
  addPreferencesFromResource(R.xml.sensor_settings);

  boolean hasAntSupport = AntInterface.hasAntSupport(this);

  configSensorType(hasAntSupport);

  findPreference(getString(R.string.settings_sensor_bluetooth_pairing_key))
      .setOnPreferenceClickListener(new OnPreferenceClickListener() {
        public boolean onPreferenceClick(Preference preference) {
          Intent settingsIntent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
          startActivity(settingsIntent);
          return true;
        }
      });

  if (!hasAntSupport) {
    PreferenceScreen rootPreferenceScreen = (PreferenceScreen) findPreference(
        getString(R.string.settings_sensor_root_key));
    rootPreferenceScreen.removePreference(
        findPreference(getString(R.string.settings_sensor_ant_key)));
  }
}
 
Example 3
Source File: NSClientPlugin.java    From AndroidAPS with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void preprocessPreferences(@NotNull PreferenceFragment preferenceFragment) {
    super.preprocessPreferences(preferenceFragment);

    if (Config.NSCLIENT) {
        PreferenceScreen scrnAdvancedSettings = (PreferenceScreen) preferenceFragment.findPreference(MainApp.gs(R.string.key_advancedsettings));
        if (scrnAdvancedSettings != null) {
            scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_statuslights_res_warning)));
            scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_statuslights_res_critical)));
            scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_statuslights_bat_warning)));
            scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_statuslights_bat_critical)));
            scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_show_statuslights)));
            scrnAdvancedSettings.removePreference(preferenceFragment.findPreference(MainApp.gs(R.string.key_show_statuslights_extended)));
        }
    }
}
 
Example 4
Source File: SingleWebsitePreferences.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPreferenceClick(Preference preference) {
    Bundle extras = preference.peekExtras();
    if (extras != null) {
        UsbInfo usbInfo = (UsbInfo) extras.getSerializable(EXTRA_USB_INFO);
        if (usbInfo != null) {
            usbInfo.revoke();

            PreferenceScreen preferenceScreen = getPreferenceScreen();
            preferenceScreen.removePreference(preference);
            mUsbPermissionCount--;
            if (!hasPermissionsPreferences()) {
                Preference heading = preferenceScreen.findPreference(PREF_PERMISSIONS);
                preferenceScreen.removePreference(heading);
            }
            return true;
        }
    }

    // Handle the Clear & Reset preference click by showing a confirmation.
    new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setTitle(R.string.website_reset)
            .setMessage(R.string.website_reset_confirmation)
            .setPositiveButton(R.string.website_reset, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    resetSite();
                }
            })
            .setNegativeButton(R.string.cancel, null)
            .show();
    return true;
}
 
Example 5
Source File: Preferences.java    From xDrip with GNU General Public License v3.0 5 votes vote down vote up
private void updateMiBandScreen(){
    MiBand.MiBandType type = MiBand.getMibandType();
    PreferenceScreen settings = (PreferenceScreen) findPreference(MiBandEntry.PREF_MIBAND_SETTINGS);
    PreferenceScreen prefs = (PreferenceScreen) findPreference(MiBandEntry.PREF_MIBAND_PREFERENCES);
    try {
        settings.removePreference(miband2_screen);
        settings.removePreference(miband3_4_screen);
        settings.removePreference(miband_nightmode_category);
        prefs.removePreference(miband_graph_category);
        prefs.removePreference(miband_send_readings_as_notification);
        prefs.removePreference(miband_authkey);

        if (type == MiBand.MiBandType.MI_BAND4) {
            settings.addPreference(miband3_4_screen);
            settings.addPreference(miband_nightmode_category);
            prefs.addPreference(miband_graph_category);
            prefs.addPreference(miband_send_readings_as_notification);
            prefs.addPreference(miband_authkey);
        } else if (type == MiBand.MiBandType.MI_BAND2) {
            settings.addPreference(miband2_screen);
        }
        else if (type == MiBand.MiBandType.MI_BAND3 || type == MiBand.MiBandType.MI_BAND3_1){
            settings.addPreference(miband3_4_screen);
            settings.addPreference(miband_nightmode_category);
        }
    } catch (Exception e) {
        Log.e(TAG, "Cannot find preference item: " + e);
    }
}
 
Example 6
Source File: PreferencesActivity.java    From ministocks with MIT License 5 votes vote down vote up
private void removePref(String screenName, String name) {
    PreferenceScreen screen = (PreferenceScreen) findPreference(screenName);
    try {
        screen.removePreference(findPreference(name));
    } catch (Exception ignored) {
    }
}
 
Example 7
Source File: AccountManagementFragment.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void updateAccountsList() {
    PreferenceScreen prefScreen = getPreferenceScreen();
    if (prefScreen == null) return;

    for (int i = 0; i < mAccountsListPreferences.size(); i++) {
        prefScreen.removePreference(mAccountsListPreferences.get(i));
    }
    mAccountsListPreferences.clear();

    final Preferences activity = (Preferences) getActivity();
    Account[] accounts = AccountManagerHelper.get().getGoogleAccounts();
    int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER;

    for (Account account : accounts) {
        ChromeBasePreference pref = new ChromeBasePreference(activity);
        pref.setSelectable(false);
        pref.setTitle(account.name);

        boolean isChildAccount = mProfile.isChild();
        pref.setUseReducedPadding(isChildAccount);
        pref.setIcon(new BitmapDrawable(getResources(),
                isChildAccount ? getBadgedUserPicture(account.name, getResources()) :
                    getUserPicture(account.name, getResources())));

        pref.setOrder(nextPrefOrder++);
        prefScreen.addPreference(pref);
        mAccountsListPreferences.add(pref);
    }
}
 
Example 8
Source File: AccountManagementFragment.java    From delion with Apache License 2.0 5 votes vote down vote up
private void updateAccountsList() {
    PreferenceScreen prefScreen = getPreferenceScreen();
    if (prefScreen == null) return;

    for (int i = 0; i < mAccountsListPreferences.size(); i++) {
        prefScreen.removePreference(mAccountsListPreferences.get(i));
    }
    mAccountsListPreferences.clear();

    final Preferences activity = (Preferences) getActivity();
    Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts();
    int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER;

    for (Account account : accounts) {
        ChromeBasePreference pref = new ChromeBasePreference(activity);
        pref.setSelectable(false);
        pref.setTitle(account.name);

        boolean isChildAccount = ChildAccountService.isChildAccount();

        pref.setIcon(new BitmapDrawable(getResources(),
                isChildAccount ? getBadgedUserPicture(account.name, getResources()) :
                    getUserPicture(account.name, getResources())));

        pref.setOrder(nextPrefOrder++);
        prefScreen.addPreference(pref);
        mAccountsListPreferences.add(pref);
    }
}
 
Example 9
Source File: SettingsFragment.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    setHasOptionsMenu(true);
    setInputMethodSettingsCategoryTitle(R.string.language_selection_title);
    setSubtypeEnablerTitle(R.string.select_language);
    addPreferencesFromResource(R.xml.prefs);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.setTitle(
            ApplicationUtils.getActivityTitleResId(getActivity(), SettingsActivity.class));
    if (!JniUtils.sHaveGestureLib) {
        final Preference gesturePreference = findPreference(Settings.SCREEN_GESTURE);
        preferenceScreen.removePreference(gesturePreference);
    }
}
 
Example 10
Source File: Preferences.java    From xDrip-plus with GNU General Public License v3.0 5 votes vote down vote up
private void updateMiBandScreen(){
    MiBand.MiBandType type = MiBand.getMibandType();
    PreferenceScreen settings = (PreferenceScreen) findPreference(MiBandEntry.PREF_MIBAND_SETTINGS);
    PreferenceScreen prefs = (PreferenceScreen) findPreference(MiBandEntry.PREF_MIBAND_PREFERENCES);
    try {
        settings.removePreference(miband2_screen);
        settings.removePreference(miband3_4_screen);
        settings.removePreference(miband_nightmode_category);
        prefs.removePreference(miband_graph_category);
        prefs.removePreference(miband_send_readings_as_notification);
        prefs.removePreference(miband_authkey);

        if (type == MiBand.MiBandType.MI_BAND4) {
            settings.addPreference(miband3_4_screen);
            settings.addPreference(miband_nightmode_category);
            prefs.addPreference(miband_graph_category);
            prefs.addPreference(miband_send_readings_as_notification);
            prefs.addPreference(miband_authkey);
        } else if (type == MiBand.MiBandType.MI_BAND2) {
            settings.addPreference(miband2_screen);
        }
        else if (type == MiBand.MiBandType.MI_BAND3 || type == MiBand.MiBandType.MI_BAND3_1){
            settings.addPreference(miband3_4_screen);
            settings.addPreference(miband_nightmode_category);
        }
    } catch (Exception e) {
        Log.e(TAG, "Cannot find preference item: " + e);
    }
}
 
Example 11
Source File: ConfigActivity.java    From AccelerationAlert with Apache License 2.0 5 votes vote down vote up
private void toggleEmailCategories(boolean enabled)
{
	PreferenceScreen screen = getPreferenceScreen();

	if (!enabled)
	{
		screen.removePreference(emailHostCategory);
		screen.removePreference(emailRecipientCategory);
	}
	else
	{
		screen.addPreference(emailHostCategory);
		screen.addPreference(emailRecipientCategory);
	}
}
 
Example 12
Source File: SingleWebsitePreferences.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Resets the current site, clearing all permissions and storage used (inc. cookies).
 */
@VisibleForTesting
protected void resetSite() {
    if (getActivity() == null) return;
    // Clear the screen.
    // TODO(mvanouwerkerk): Refactor this class so that it does not depend on the screen state
    // for its logic. This class should maintain its own data model, and only update the screen
    // after a change is made.
    PreferenceScreen screen = getPreferenceScreen();
    for (String key : PERMISSION_PREFERENCE_KEYS) {
        Preference preference = screen.findPreference(key);
        if (preference != null) screen.removePreference(preference);
    }

    String origin = mSite.getAddress().getOrigin();
    WebsitePreferenceBridge.nativeClearCookieData(origin);
    WebsitePreferenceBridge.nativeClearBannerData(origin);

    // Clear the permissions.
    mSite.setAutoplayPermission(ContentSetting.DEFAULT);
    mSite.setBackgroundSyncPermission(ContentSetting.DEFAULT);
    mSite.setCameraPermission(ContentSetting.DEFAULT);
    mSite.setCookiePermission(ContentSetting.DEFAULT);
    mSite.setGeolocationPermission(ContentSetting.DEFAULT);
    mSite.setJavaScriptPermission(ContentSetting.DEFAULT);
    mSite.setKeygenPermission(ContentSetting.DEFAULT);
    mSite.setMicrophonePermission(ContentSetting.DEFAULT);
    mSite.setMidiPermission(ContentSetting.DEFAULT);
    mSite.setNotificationPermission(ContentSetting.DEFAULT);
    mSite.setPopupPermission(ContentSetting.DEFAULT);
    mSite.setProtectedMediaIdentifierPermission(ContentSetting.DEFAULT);

    for (UsbInfo info : mSite.getUsbInfo()) info.revoke();

    // Clear the storage and finish the activity if necessary.
    if (mSite.getTotalUsage() > 0) {
        clearStoredData();
    } else {
        // Clearing stored data implies popping back to parent menu if there
        // is nothing left to show. Therefore, we only need to explicitly
        // close the activity if there's no stored data to begin with.
        getActivity().finish();
    }
}
 
Example 13
Source File: SubScreenFragment.java    From simple-keyboard with Apache License 2.0 4 votes vote down vote up
static void removePreference(final String prefKey, final PreferenceScreen screen) {
    final Preference preference = screen.findPreference(prefKey);
    if (preference != null) {
        screen.removePreference(preference);
    }
}
 
Example 14
Source File: PrivacyPreferences.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
    privacyPrefManager.migrateNetworkPredictionPreferences();
    addPreferencesFromResource(R.xml.privacy_preferences);
    getActivity().setTitle(R.string.prefs_privacy);
    setHasOptionsMenu(true);
    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();

    mManagedPreferenceDelegate = createManagedPreferenceDelegate();

    ChromeBaseCheckBoxPreference networkPredictionPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
    networkPredictionPref.setChecked(prefServiceBridge.getNetworkPredictionEnabled());
    networkPredictionPref.setOnPreferenceChangeListener(this);
    networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference navigationErrorPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
    navigationErrorPref.setOnPreferenceChangeListener(this);
    navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference searchSuggestionsPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
    searchSuggestionsPref.setOnPreferenceChangeListener(this);
    searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (!ContextualSearchFieldTrial.isEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
    }

    // Listen to changes to both Extended Reporting prefs.
    ChromeBaseCheckBoxPreference legacyExtendedReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(
                PREF_SAFE_BROWSING_EXTENDED_REPORTING);
    legacyExtendedReportingPref.setOnPreferenceChangeListener(this);
    legacyExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    ChromeBaseCheckBoxPreference scoutReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING);
    scoutReportingPref.setOnPreferenceChangeListener(this);
    scoutReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    // Remove the extended reporting preference that is NOT active.
    String extended_reporting_pref_to_remove =
            prefServiceBridge.isSafeBrowsingScoutReportingActive()
                ? PREF_SAFE_BROWSING_EXTENDED_REPORTING : PREF_SAFE_BROWSING_SCOUT_REPORTING;
    preferenceScreen.removePreference(findPreference(extended_reporting_pref_to_remove));

    ChromeBaseCheckBoxPreference safeBrowsingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    safeBrowsingPref.setOnPreferenceChangeListener(this);
    safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    if (!PhysicalWeb.featureIsEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
    }

    updateSummaries();
}
 
Example 15
Source File: AccountManagementFragment.java    From delion with Apache License 2.0 4 votes vote down vote up
private void configureChildAccountPreferences() {
    Preference parentAccounts = findPreference(PREF_PARENT_ACCOUNTS);
    Preference childContent = findPreference(PREF_CHILD_CONTENT);
    Preference childSafeSites = findPreference(PREF_CHILD_SAFE_SITES);
    if (ChildAccountService.isChildAccount()) {
        Resources res = getActivity().getResources();
        PrefServiceBridge prefService = PrefServiceBridge.getInstance();

        String firstParent = prefService.getSupervisedUserCustodianEmail();
        String secondParent = prefService.getSupervisedUserSecondCustodianEmail();
        String parentText;

        if (!secondParent.isEmpty()) {
            parentText = res.getString(R.string.account_management_two_parent_names,
                    firstParent, secondParent);
        } else if (!firstParent.isEmpty()) {
            parentText = res.getString(R.string.account_management_one_parent_name,
                    firstParent);
        } else {
            parentText = res.getString(R.string.account_management_no_parental_data);
        }
        parentAccounts.setSummary(parentText);
        parentAccounts.setSelectable(false);

        final boolean unapprovedContentBlocked =
                prefService.getDefaultSupervisedUserFilteringBehavior()
                == PrefServiceBridge.SUPERVISED_USER_FILTERING_BLOCK;
        final String contentText = res.getString(
                unapprovedContentBlocked ? R.string.account_management_child_content_approved
                        : R.string.account_management_child_content_all);
        childContent.setSummary(contentText);
        childContent.setSelectable(false);

        final String safeSitesText = res.getString(
                prefService.isSupervisedUserSafeSitesEnabled()
                        ? R.string.text_on : R.string.text_off);
        childSafeSites.setSummary(safeSitesText);
        childSafeSites.setSelectable(false);
    } else {
        PreferenceScreen prefScreen = getPreferenceScreen();
        prefScreen.removePreference(findPreference(PREF_PARENTAL_SETTINGS));
        prefScreen.removePreference(parentAccounts);
        prefScreen.removePreference(childContent);
        prefScreen.removePreference(childSafeSites);
    }
}
 
Example 16
Source File: AccountManagementFragment.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private void configureChildAccountPreferences() {
    Preference parentAccounts = findPreference(PREF_PARENT_ACCOUNTS);
    Preference childContent = findPreference(PREF_CHILD_CONTENT);
    Preference childSafeSites = findPreference(PREF_CHILD_SAFE_SITES);
    if (ChildAccountService.isChildAccount()) {
        Resources res = getActivity().getResources();
        PrefServiceBridge prefService = PrefServiceBridge.getInstance();

        String firstParent = prefService.getSupervisedUserCustodianEmail();
        String secondParent = prefService.getSupervisedUserSecondCustodianEmail();
        String parentText;

        if (!secondParent.isEmpty()) {
            parentText = res.getString(R.string.account_management_two_parent_names,
                    firstParent, secondParent);
        } else if (!firstParent.isEmpty()) {
            parentText = res.getString(R.string.account_management_one_parent_name,
                    firstParent);
        } else {
            parentText = res.getString(R.string.account_management_no_parental_data);
        }
        parentAccounts.setSummary(parentText);
        parentAccounts.setSelectable(false);

        final boolean unapprovedContentBlocked =
                prefService.getDefaultSupervisedUserFilteringBehavior()
                == PrefServiceBridge.SUPERVISED_USER_FILTERING_BLOCK;
        final String contentText = res.getString(
                unapprovedContentBlocked ? R.string.account_management_child_content_approved
                        : R.string.account_management_child_content_all);
        childContent.setSummary(contentText);
        childContent.setSelectable(false);

        final String safeSitesText = res.getString(
                prefService.isSupervisedUserSafeSitesEnabled()
                        ? R.string.text_on : R.string.text_off);
        childSafeSites.setSummary(safeSitesText);
        childSafeSites.setSelectable(false);
    } else {
        PreferenceScreen prefScreen = getPreferenceScreen();
        prefScreen.removePreference(findPreference(PREF_PARENTAL_SETTINGS));
        prefScreen.removePreference(parentAccounts);
        prefScreen.removePreference(childContent);
        prefScreen.removePreference(childSafeSites);
    }
}
 
Example 17
Source File: SubScreenFragment.java    From Android-Keyboard with Apache License 2.0 4 votes vote down vote up
static void removePreference(final String prefKey, final PreferenceScreen screen) {
    final Preference preference = screen.findPreference(prefKey);
    if (preference != null) {
        screen.removePreference(preference);
    }
}
 
Example 18
Source File: SubScreenFragment.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
static void removePreference(final String prefKey, final PreferenceScreen screen) {
    final Preference preference = screen.findPreference(prefKey);
    if (preference != null) {
        screen.removePreference(preference);
    }
}
 
Example 19
Source File: SubScreenFragment.java    From openboard with GNU General Public License v3.0 4 votes vote down vote up
static void removePreference(final String prefKey, final PreferenceScreen screen) {
    final Preference preference = screen.findPreference(prefKey);
    if (preference != null) {
        screen.removePreference(preference);
    }
}
 
Example 20
Source File: SettingsActivity.java    From Gallery-example with GNU General Public License v3.0 2 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.prefs);

    PreferenceScreen preferenceScreen = getPreferenceScreen();

    Preference hiddenFolders = findPreference("hiddenFolders");

    SQLiteDatabase hiddenFoldersDB = getActivity().openOrCreateDatabase("HIDDEN", MODE_PRIVATE, null);

    final ArrayList<String> mHiddenFolders = new ArrayList<>();

    Cursor cursor = hiddenFoldersDB.rawQuery("SELECT * FROM foldersList;", null);

    if (cursor != null && cursor.moveToFirst()) {

        while (!cursor.isAfterLast()) {

            mHiddenFolders.add(cursor.getString(cursor.getColumnIndex("folder")));
            cursor.moveToNext();
        }
        cursor.close();
    }


    if (mHiddenFolders.size() != 0) {

        preferenceScreen.addPreference(hiddenFolders);

        hiddenFolders.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {

                HiddenFoldersDialog.show(getActivity(), mHiddenFolders);

                return false;
            }
        });
    } else {
        preferenceScreen.removePreference(hiddenFolders);
    }


    mListenerOptions = new SharedPreferences.OnSharedPreferenceChangeListener() {
        @Override
        public void onSharedPreferenceChanged(SharedPreferences preftheme, String key) {

            if (key.equals(getResources().getString(R.string.pref_theme)) | key.equals(getResources().getString(R.string.pref_grid))) {

                restartApp(getActivity());
            }
        }
    };


}