From ac6c78766b88e1edefdf5f63a664caeb17014d56 Mon Sep 17 00:00:00 2001 From: Clark Scheff Date: Thu, 14 Aug 2014 17:32:52 -0700 Subject: Increase paddingTop for scrollview when no navbar present Change-Id: I92d317af27ef3bdb5c42de31db5efb51957522f4 --- src/com/cyngn/theme/chooser/ThemeFragment.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/com/cyngn/theme/chooser/ThemeFragment.java b/src/com/cyngn/theme/chooser/ThemeFragment.java index e506d90..dfc75d5 100644 --- a/src/com/cyngn/theme/chooser/ThemeFragment.java +++ b/src/com/cyngn/theme/chooser/ThemeFragment.java @@ -290,6 +290,9 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb View v = inflater.inflate(R.layout.fragment_pager_list, container, false); mScrollView = (LockableScrollView) v.findViewById(android.R.id.list); + if (!Utils.hasNavigationBar(getActivity())) { + adjustScrollViewPaddingTop(); + } mScrollContent = (ViewGroup) mScrollView.getChildAt(0); mPreviewContent = (ViewGroup) v.findViewById(R.id.preview_container); mLoadingView = v.findViewById(R.id.loading_view); @@ -448,6 +451,17 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb } } + private void adjustScrollViewPaddingTop() { + Resources res = getResources(); + int extraPadding = + res.getDimensionPixelSize(R.dimen.system_bar_height) / 2; + mScrollView.setPadding( + mScrollView.getPaddingLeft(), + mScrollView.getPaddingTop() + extraPadding, + mScrollView.getPaddingRight(), + mScrollView.getPaddingBottom()); + } + protected boolean onPopupMenuItemClick(MenuItem item) { switch(item.getItemId()) { case R.id.menu_author: @@ -568,6 +582,10 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb //Move the theme preview so that it is near the center of page per spec int paddingTop = (int) r.getDimension(R.dimen.collapsed_theme_page_padding_top); + if (!Utils.hasNavigationBar(getActivity())) { + paddingTop += + r.getDimensionPixelSize(R.dimen.system_bar_height) / 2; + } mScrollView.setPadding(0, paddingTop, 0, 0); // During expand the wallpaper size decreases slightly to makeup for 9patch padding -- cgit v1.1