From f632eaa9d64fb21892cc057ec7444ec157686734 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Thu, 22 Sep 2011 16:05:12 -0700 Subject: ActivityChooserView not showing "Show all" properly if the default target button not shown. If the default target button is hidden all activities are shown in the list from which to choose. In this case due to off by one error the list was not showing the option to expand it if the activities are one more than the initially shown. bug:5358475 Change-Id: I8c3db37dab008637d78330f8de830cec92720264 --- core/java/android/widget/ActivityChooserView.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/widget/ActivityChooserView.java b/core/java/android/widget/ActivityChooserView.java index 25af3fa..26b0ae6 100644 --- a/core/java/android/widget/ActivityChooserView.java +++ b/core/java/android/widget/ActivityChooserView.java @@ -287,9 +287,13 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod mAdapter.setMaxActivityCount(maxActivityCount); + final boolean defaultActivityButtonShown = + mDefaultActivityButton.getVisibility() == VISIBLE; + final int activityCount = mAdapter.getActivityCount(); + final int maxActivityCountOffset = defaultActivityButtonShown ? 1 : 0; if (maxActivityCount != ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED - && activityCount > maxActivityCount + 1) { + && activityCount > maxActivityCount + maxActivityCountOffset) { mAdapter.setShowFooterView(true); } else { mAdapter.setShowFooterView(false); @@ -297,8 +301,6 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod ListPopupWindow popupWindow = getListPopupWindow(); if (!popupWindow.isShowing()) { - final boolean defaultActivityButtonShown = - mDefaultActivityButton.getVisibility() == VISIBLE; if (mIsSelectingDefaultActivity || !defaultActivityButtonShown) { mAdapter.setShowDefaultActivity(true, defaultActivityButtonShown); } else { -- cgit v1.1