diff options
author | Adam Powell <adamp@google.com> | 2012-05-22 17:19:36 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2012-05-22 17:22:19 -0700 |
commit | 019c976364314aa16e53e8af31616ab902711288 (patch) | |
tree | 7d06350620b34c31411cde908b7f571ceb036538 | |
parent | 40ad9cdfc250a6c7aae476f5cb77084b9e75e9f2 (diff) | |
download | packages_apps_packageinstaller-019c976364314aa16e53e8af31616ab902711288.zip packages_apps_packageinstaller-019c976364314aa16e53e8af31616ab902711288.tar.gz packages_apps_packageinstaller-019c976364314aa16e53e8af31616ab902711288.tar.bz2 |
Make permissions pages awaken their scrollbars when the page is focused
Bug 6538805
Change-Id: I8baec78443f7e623cfb49cda90a5a9a95e71090d
-rw-r--r-- | src/com/android/packageinstaller/PackageInstallerActivity.java | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java index da0df53..c07ed4a 100644 --- a/src/com/android/packageinstaller/PackageInstallerActivity.java +++ b/src/com/android/packageinstaller/PackageInstallerActivity.java @@ -199,6 +199,12 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen View tab = widget.getChildTabViewAt(position); mTempRect.set(tab.getLeft(), tab.getTop(), tab.getRight(), tab.getBottom()); widget.requestRectangleOnScreen(mTempRect, false); + + // Make sure the scrollbars are visible for a moment after selection + final View contentView = mTabs.get(position).view; + if (contentView instanceof CaffeinatedScrollView) { + ((CaffeinatedScrollView) contentView).awakenScrollBars(); + } } @Override @@ -221,7 +227,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen msg = (mAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ? R.string.install_confirm_question_update_system : R.string.install_confirm_question_update; - ScrollView scrollView = new ScrollView(this); + ScrollView scrollView = new CaffeinatedScrollView(this); scrollView.setFillViewport(true); if (perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0) { scrollView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_NEW)); @@ -237,7 +243,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen } if (perms.getPermissionCount(AppSecurityPermissions.WHICH_PERSONAL) > 0) { permVisible = true; - ScrollView scrollView = new ScrollView(this); + ScrollView scrollView = new CaffeinatedScrollView(this); scrollView.setFillViewport(true); scrollView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_PERSONAL)); adapter.addTab(tabHost.newTabSpec("personal").setIndicator( @@ -245,7 +251,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen } if (perms.getPermissionCount(AppSecurityPermissions.WHICH_DEVICE) > 0) { permVisible = true; - ScrollView scrollView = new ScrollView(this); + ScrollView scrollView = new CaffeinatedScrollView(this); scrollView.setFillViewport(true); scrollView.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_DEVICE)); adapter.addTab(tabHost.newTabSpec("device").setIndicator( @@ -513,4 +519,21 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen finish(); } } + + /** + * It's a ScrollView that knows how to stay awake. + */ + static class CaffeinatedScrollView extends ScrollView { + public CaffeinatedScrollView(Context context) { + super(context); + } + + /** + * Make this visible so we can call it + */ + @Override + public boolean awakenScrollBars() { + return super.awakenScrollBars(); + } + } } |