From ee21cab0e684710a77df85577ff16d1f00edaf4d Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Sun, 13 May 2012 18:25:29 -0700 Subject: Fix up tabs in the permissions display Make tab bar scrollable if tabs don't all fit. Scroll the currently selected tab into view when it becomes selected. Bug 6481646 Change-Id: Ic492526ce06fae759b23127f74cfcb8e2fd8f030 --- src/com/android/packageinstaller/PackageInstallerActivity.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/com/android/packageinstaller') diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java index 7051bddb..da0df53d 100644 --- a/src/com/android/packageinstaller/PackageInstallerActivity.java +++ b/src/com/android/packageinstaller/PackageInstallerActivity.java @@ -28,17 +28,17 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageParser; +import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.provider.Settings; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; -import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; import android.view.View.OnClickListener; +import android.view.ViewGroup; import android.widget.AppSecurityPermissions; import android.widget.Button; import android.widget.ScrollView; @@ -103,6 +103,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen private final TabHost mTabHost; private final ViewPager mViewPager; private final ArrayList mTabs = new ArrayList(); + private final Rect mTempRect = new Rect(); static final class TabInfo { private final String tag; @@ -193,6 +194,11 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); mTabHost.setCurrentTab(position); widget.setDescendantFocusability(oldFocusability); + + // Scroll the current tab into visibility if needed. + View tab = widget.getChildTabViewAt(position); + mTempRect.set(tab.getLeft(), tab.getTop(), tab.getRight(), tab.getBottom()); + widget.requestRectangleOnScreen(mTempRect, false); } @Override -- cgit v1.2.3