use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by omnirom.
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;
mPageNames = getResources().getTextArray(R.array.app_ops_categories);
mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
MyPagerAdapter adapter = new MyPagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(adapter);
mViewPager.setOnPageChangeListener(adapter);
PagerTabStrip tabs = (PagerTabStrip) rootView.findViewById(R.id.tabs);
// This should be set in the XML layout, but PagerTabStrip lives in
// support-v4 and doesn't have styleable attributes.
final TypedArray ta = tabs.getContext().obtainStyledAttributes(new int[] { android.R.attr.colorAccent });
final int colorAccent = ta.getColor(0, 0);
ta.recycle();
tabs.setTabIndicatorColorResource(colorAccent);
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
}
return rootView;
}
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, true), "appops");
ft.commitAllowingStateLoss();
return rootView;
}
use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by DirtyUnicorns.
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 paddingSide = res.getDimensionPixelSize(R.dimen.settings_side_margin);
final int paddingBottom = res.getDimensionPixelSize(com.android.internal.R.dimen.preference_fragment_padding_bottom);
if (parent instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) child.getLayoutParams()).removeBorders = true;
final int effectivePaddingSide = ignoreSidePadding ? 0 : paddingSide;
list.setPaddingRelative(effectivePaddingSide, 0, effectivePaddingSide, paddingBottom);
} else {
list.setPaddingRelative(paddingSide, 0, paddingSide, paddingBottom);
}
}
}
use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by DirtyUnicorns.
the class ManageApplications method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// initialize the inflater
mInflater = inflater;
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
View emptyView = mListContainer.findViewById(com.android.internal.R.id.empty);
ListView lv = (ListView) mListContainer.findViewById(android.R.id.list);
if (emptyView != null) {
lv.setEmptyView(emptyView);
}
lv.setOnItemClickListener(this);
lv.setSaveEnabled(true);
lv.setItemsCanFocus(true);
lv.setTextFilterEnabled(true);
mListView = lv;
mApplications = new ApplicationsAdapter(mApplicationsState, this, mFilter);
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)));
}
mListView.setAdapter(mApplications);
mListView.setRecyclerListener(mApplications);
mListView.setFastScrollEnabled(isFastScrollEnabled());
Utils.prepareCustomPreferencesList(container, mRootView, mListView, false);
}
// 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 android_packages_apps_Settings by DirtyUnicorns.
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;
mPageNames = getResources().getTextArray(R.array.app_ops_categories);
mViewPager = (ViewPager) rootView.findViewById(R.id.pager);
MyPagerAdapter adapter = new MyPagerAdapter(getChildFragmentManager());
mViewPager.setAdapter(adapter);
mViewPager.setOnPageChangeListener(adapter);
PagerTabStrip tabs = (PagerTabStrip) rootView.findViewById(R.id.tabs);
// This should be set in the XML layout, but PagerTabStrip lives in
// support-v4 and doesn't have styleable attributes.
final TypedArray ta = tabs.getContext().obtainStyledAttributes(new int[] { android.R.attr.colorAccent });
final int colorAccent = ta.getColor(0, 0);
ta.recycle();
tabs.setTabIndicatorColorResource(colorAccent);
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
}
return rootView;
}
Aggregations