use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by crdroidandroid.
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 crdroidandroid.
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_lineage);
AppOpsState.OpsTemplate[] templates = AppOpsState.ALL_PERMS_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;
}
use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by SudaMod.
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_lineage);
AppOpsState.OpsTemplate[] templates = AppOpsState.ALL_PERMS_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;
}
use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by SudaMod.
the class CaptionPropertiesFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.captioning_preview, container, false);
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
}
final View content = super.onCreateView(inflater, container, savedInstanceState);
((ViewGroup) rootView.findViewById(R.id.properties_fragment)).addView(content, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
return rootView;
}
use of android.preference.PreferenceFrameLayout in project android_packages_apps_Settings by DirtyUnicorns.
the class CaptionPropertiesFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.captioning_preview, container, false);
// only when the view is added.
if (container instanceof PreferenceFrameLayout) {
((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
}
final View content = super.onCreateView(inflater, container, savedInstanceState);
((ViewGroup) rootView.findViewById(R.id.properties_fragment)).addView(content, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
return rootView;
}
Aggregations