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

The following examples show how to use android.preference.PreferenceCategory#removeAll() . 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: Settings.java    From BluetoothHidEmu with Apache License 2.0 6 votes vote down vote up
/**
 * 
 */
private void populateDeviceList(PreferenceCategory deviceListCategory) {
    deviceListCategory.removeAll();
    Set<BluetoothDevice> deviceSet = BluetoothAdapter.getDefaultAdapter().getBondedDevices();
    
    for (BluetoothDevice device: deviceSet) {
        Preference devicePref = new Preference(this);
        devicePref.setTitle(device.getName().equals("") ? device.getAddress() : device.getName());
        
        BluetoothDeviceView.isBluetoothDevicePs3(device);
        
        SpoofMode spoofMode = getEmulationMode(this, device);
        String emulationSummary = (spoofMode == SpoofMode.INVALID) ? 
                getResources().getString(R.string.msg_pref_summary_device_emulation_mode_invalid) :
                getEmulationModeSummary(this, Spoof.intValue(spoofMode)); 
        
        devicePref.setSummary(device.getAddress() + "\n" 
                    + String.format(getResources().getString(R.string.msg_pref_summary_device_emulation_mode), 
                            emulationSummary));

        deviceListCategory.addPreference(devicePref);
    }
    
}
 
Example 2
Source File: SettingsFragment.java    From Linphone4Android with GNU General Public License v3.0 5 votes vote down vote up
private void emptyAndHidePreferenceCategory(int preferenceKey) {
	Preference preference = findPreference(getString(preferenceKey));
	if (!(preference instanceof PreferenceCategory))
		return;

	PreferenceCategory preferenceCategory = (PreferenceCategory) preference;
	preferenceCategory.removeAll();
	hidePreference(preferenceCategory);
}
 
Example 3
Source File: SettingsFragment.java    From Linphone4Android with GNU General Public License v3.0 5 votes vote down vote up
private void initAccounts() {
	PreferenceCategory accounts = (PreferenceCategory) findPreference(getString(R.string.pref_sipaccounts_key));
	accounts.removeAll();

	// Get already configured extra accounts
	int defaultAccountID = mPrefs.getDefaultAccountIndex();
	int nbAccounts = mPrefs.getAccountCount();
	for (int i = 0; i < nbAccounts; i++) {
		final int accountId = i;
		// For each, add menus to configure it
		String username = mPrefs.getAccountUsername(accountId);
		String domain = mPrefs.getAccountDomain(accountId);
		LedPreference account = new LedPreference(getActivity());

		if (username == null) {
			account.setTitle(getString(R.string.pref_sipaccount));
		} else {
			account.setTitle(username + "@" + domain);
		}

		if (defaultAccountID == i) {
			account.setSummary(R.string.default_account_flag);
		}

		account.setOnPreferenceClickListener(new OnPreferenceClickListener()
		{
			public boolean onPreferenceClick(Preference preference) {
				LinphoneActivity.instance().displayAccountSettings(accountId);
				return false;
			}
		});
		updateAccountLed(account, username, domain, mPrefs.isAccountEnabled(i));
		accounts.addPreference(account);
	}
}
 
Example 4
Source File: SavePasswordsPreferences.java    From delion with Apache License 2.0 5 votes vote down vote up
private void resetList(String preferenceCategoryKey) {
    PreferenceCategory profileCategory =
            (PreferenceCategory) getPreferenceScreen().findPreference(preferenceCategoryKey);
    if (profileCategory != null) {
        profileCategory.removeAll();
        getPreferenceScreen().removePreference(profileCategory);
    }

    mEmptyView.setVisibility(View.GONE);
}
 
Example 5
Source File: SavePasswordsPreferences.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void resetList(String preferenceCategoryKey) {
    PreferenceCategory profileCategory =
            (PreferenceCategory) getPreferenceScreen().findPreference(preferenceCategoryKey);
    if (profileCategory != null) {
        profileCategory.removeAll();
        getPreferenceScreen().removePreference(profileCategory);
    }

    mEmptyView.setVisibility(View.GONE);
}
 
Example 6
Source File: SavePasswordsPreferences.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void resetList(String preferenceCategoryKey) {
    PreferenceCategory profileCategory =
            (PreferenceCategory) getPreferenceScreen().findPreference(preferenceCategoryKey);
    if (profileCategory != null) {
        profileCategory.removeAll();
        getPreferenceScreen().removePreference(profileCategory);
    }
}
 
Example 7
Source File: OpenFitActivity.java    From OpenFit with MIT License 4 votes vote down vote up
public void clearNotificationApplications() {
    Log.d(LOG_TAG, "Clearing listening apps");
    PreferenceCategory category = (PreferenceCategory) findPreference("preference_category_apps");
    category.removeAll();
    appManager.clearNotificationApplications();
}