use of android.preference.PreferenceFrameLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ManageApplications method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mListType == LIST_TYPE_OVERLAY && !Utils.isSystemAlertWindowEnabled(getContext())) {
mRootView = inflater.inflate(R.layout.manage_applications_apps_unsupported, null);
setHasOptionsMenu(false);
return mRootView;
}
mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
mListContainer = mRootView.findViewById(R.id.list_container);
if (mListContainer != null) {
// Create adapter and list view here
mEmptyView = mListContainer.findViewById(android.R.id.empty);
mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter, savedInstanceState);
if (savedInstanceState != null) {
mApplications.mHasReceivedLoadEntries = savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
mApplications.mHasReceivedBridgeCallback = savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
}
int userId = mIsWorkOnly ? mWorkUserId : UserHandle.getUserId(mCurrentUid);
if (mStorageType == STORAGE_TYPE_MUSIC) {
Context context = getContext();
mApplications.setExtraViewController(new MusicViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
} else if (mStorageType == STORAGE_TYPE_PHOTOS_VIDEOS) {
Context context = getContext();
mApplications.setExtraViewController(new PhotosViewHolderController(context, new StorageStatsSource(context), mVolumeUuid, UserHandle.of(userId)));
}
mRecyclerView = mListContainer.findViewById(R.id.apps_list);
mRecyclerView.setItemAnimator(null);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
mRecyclerView.setAdapter(mApplications);
}
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) mRootView.getLayoutParams()).removeBorders = true;
}
createHeader();
mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
return mRootView;
}
use of android.preference.PreferenceFrameLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class Utils method prepareCustomPreferencesList.
/**
* Prepare a custom preferences layout, moving padding to {@link ListView}
* when outside scrollbars are requested. Usually used to display
* {@link ListView} and {@link TabWidget} with correct padding.
*/
public static void prepareCustomPreferencesList(ViewGroup parent, View child, View list, boolean ignoreSidePadding) {
final boolean movePadding = list.getScrollBarStyle() == View.SCROLLBARS_OUTSIDE_OVERLAY;
if (movePadding) {
final Resources res = list.getResources();
final int paddingBottom = res.getDimensionPixelSize(com.android.internal.R.dimen.preference_fragment_padding_bottom);
if (parent instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) child.getLayoutParams()).removeBorders = true;
}
list.setPaddingRelative(0, /* start */
0, /* top */
0, /* end */
paddingBottom);
}
}
use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by omnirom.
the class ManageApplications method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mListType == LIST_TYPE_OVERLAY && !Utils.isSystemAlertWindowEnabled(getContext())) {
mRootView = inflater.inflate(R.layout.manage_applications_apps_unsupported, null);
setHasOptionsMenu(false);
return mRootView;
}
mRootView = inflater.inflate(R.layout.manage_applications_apps, null);
mLoadingContainer = mRootView.findViewById(R.id.loading_container);
mEmptyView = mRootView.findViewById(android.R.id.empty);
mRecyclerView = mRootView.findViewById(R.id.apps_list);
mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter, savedInstanceState);
if (savedInstanceState != null) {
mApplications.mHasReceivedLoadEntries = savedInstanceState.getBoolean(EXTRA_HAS_ENTRIES, false);
mApplications.mHasReceivedBridgeCallback = savedInstanceState.getBoolean(EXTRA_HAS_BRIDGE, false);
}
mRecyclerView.setItemAnimator(null);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.VERTICAL, false));
mRecyclerView.setAdapter(mApplications);
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) mRootView.getLayoutParams()).removeBorders = true;
}
createHeader();
mResetAppsHelper.onRestoreInstanceState(savedInstanceState);
mAppBarLayout = getActivity().findViewById(R.id.app_bar);
disableToolBarScrollableBehavior();
return mRootView;
}
use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by omnirom.
the class BackgroundCheckSummary method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// initialize the inflater
mInflater = inflater;
View rootView = mInflater.inflate(R.layout.background_check_summary, container, false);
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
}
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.add(R.id.appops_content, new AppOpsCategory(AppOpsState.RUN_IN_BACKGROUND_TEMPLATE), "appops");
ft.commitAllowingStateLoss();
return rootView;
}
use of android.preference.PreferenceFrameLayout in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppOpsSummary method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// initialize the inflater
mInflater = inflater;
View rootView = mInflater.inflate(R.layout.app_ops_summary, container, false);
mContentContainer = container;
mRootView = rootView;
CharSequence[] pageNames = getResources().getTextArray(R.array.app_ops_categories_cm);
AppOpsState.OpsTemplate[] templates = AppOpsState.ALL_TEMPLATES;
assert (pageNames.length == templates.length);
int specificTab = -1;
Bundle bundle = getArguments();
if (bundle != null) {
specificTab = Arrays.asList(pageNames).indexOf(bundle.getString("appops_tab", ""));
}
List<Pair<CharSequence, AppOpsState.OpsTemplate>> pageData = new ArrayList<>();
for (int i = 0; i < pageNames.length; i++) {
pageData.add(Pair.create(pageNames[i], templates[i]));
}
filterPageData(pageData, specificTab);
mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
mAdapter = new MyPagerAdapter(getChildFragmentManager(), pageData);
mViewPager.setAdapter(mAdapter);
mViewPager.setOnPageChangeListener(mAdapter);
PagerTabStrip tabs = (PagerTabStrip) rootView.findViewById(R.id.tabs);
// HACK - https://code.google.com/p/android/issues/detail?id=213359
((ViewPager.LayoutParams) tabs.getLayoutParams()).isDecor = true;
Resources.Theme theme = tabs.getContext().getTheme();
TypedValue typedValue = new TypedValue();
theme.resolveAttribute(android.R.attr.colorAccent, typedValue, true);
final int colorAccent = getContext().getColor(typedValue.resourceId);
tabs.setTabIndicatorColor(colorAccent);
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
}
mActivity = getActivity();
return rootView;
}
Aggregations