public void setHasDisabled(boolean hasDisabledApps) { if (mListType == LIST_TYPE_HIGH_POWER) { return; } mFilterAdapter.setFilterEnabled(FILTER_APPS_ENABLED, hasDisabledApps); mFilterAdapter.setFilterEnabled(FILTER_APPS_DISABLED, hasDisabledApps); }
private void createHeader() { Activity activity = getActivity(); FrameLayout pinnedHeader = (FrameLayout) mRootView.findViewById(R.id.pinned_header); mSpinnerHeader = (ViewGroup) activity.getLayoutInflater().inflate(R.layout.apps_filter_spinner, pinnedHeader, false); mFilterSpinner = (Spinner) mSpinnerHeader.findViewById(R.id.filter_spinner); mFilterAdapter = new FilterSpinnerAdapter(this); mFilterSpinner.setAdapter(mFilterAdapter); mFilterSpinner.setOnItemSelectedListener(this); pinnedHeader.addView(mSpinnerHeader, 0); mFilterAdapter.enableFilter(getDefaultFilter()); if (mListType == LIST_TYPE_MAIN || mListType == LIST_TYPE_NOTIFICATION) { if (UserManager.get(getActivity()).getUserProfiles().size() > 1) { mFilterAdapter.enableFilter(FILTER_APPS_PERSONAL); mFilterAdapter.enableFilter(FILTER_APPS_WORK); } } if (mListType == LIST_TYPE_NOTIFICATION) { mFilterAdapter.enableFilter(FILTER_APPS_BLOCKED); mFilterAdapter.enableFilter(FILTER_APPS_PRIORITY); mFilterAdapter.enableFilter(FILTER_APPS_SENSITIVE); mFilterAdapter.enableFilter(FILTER_APPS_NO_PEEKING); } if (mListType == LIST_TYPE_HIGH_POWER) { mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL); } if (mListType == LIST_TYPE_STORAGE) { mApplications.setOverrideFilter(new VolumeFilter(mVolumeUuid)); } }
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mFilter = mFilterAdapter.getFilter(position); mApplications.setFilter(mFilter); if (DEBUG) Log.d(TAG, "Selecting filter " + mFilter); }