summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2012-05-13 18:25:29 -0700
committerAdam Powell <adamp@google.com>2012-05-13 18:27:12 -0700
commitee21cab0e684710a77df85577ff16d1f00edaf4d (patch)
treeb12e3aaa012f453a78249263d92f5b429076190a
parent9822c2e38ef710936ea13e14d9c993e12797240f (diff)
downloadandroid_packages_apps_PackageInstaller-ee21cab0e684710a77df85577ff16d1f00edaf4d.tar.gz
android_packages_apps_PackageInstaller-ee21cab0e684710a77df85577ff16d1f00edaf4d.tar.bz2
android_packages_apps_PackageInstaller-ee21cab0e684710a77df85577ff16d1f00edaf4d.zip
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
-rw-r--r--res/layout/install_confirm.xml23
-rw-r--r--src/com/android/packageinstaller/PackageInstallerActivity.java10
2 files changed, 22 insertions, 11 deletions
diff --git a/res/layout/install_confirm.xml b/res/layout/install_confirm.xml
index 7a35e0cf..753a24b6 100644
--- a/res/layout/install_confirm.xml
+++ b/res/layout/install_confirm.xml
@@ -47,17 +47,22 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <FrameLayout
+ <HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@*android:drawable/tab_unselected_holo">
- <TabWidget
- android:id="@android:id/tabs"
- android:orientation="horizontal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center" />
- </FrameLayout>
+ android:background="@*android:drawable/tab_unselected_holo"
+ android:fillViewport="true"
+ android:scrollbars="none">
+ <FrameLayout android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TabWidget
+ android:id="@android:id/tabs"
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center" />
+ </FrameLayout>
+ </HorizontalScrollView>
<FrameLayout
android:id="@android:id/tabcontent"
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<TabInfo> mTabs = new ArrayList<TabInfo>();
+ 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