diff options
| author | Adam Powell <adamp@google.com> | 2011-09-21 17:17:01 -0700 |
|---|---|---|
| committer | Adam Powell <adamp@google.com> | 2011-09-21 17:21:47 -0700 |
| commit | 823f074a73cfc23c40a7b576c71daa096ee9ed6a (patch) | |
| tree | 0ad49dc344b4395247ce90346054b9c0901a7098 /core/java/android/widget/ActivityChooserView.java | |
| parent | a80599f5be394edd9f3918ba03c490850a1d9e7f (diff) | |
Fix bug 5300621 - Share menu disappears in gallery
ActionProviders (or action views) unfortunately had no way to report
that they had opened a sub-UI that would affect menu visibility
listeners used to hide action bars when not in use. This caused the
Gallery UI to hide its action bar when the share popup was open.
Add hidden API (to be made public later) to ActionProvider that can be
used to inform the menu system that a sub UI has opened or
closed. Account for this in menu visibility callbacks. Fix
ShareActionProvider to use this when its popup windows open and close.
Fix a regression where submenus were not properly reporting visibility
changes.
Change-Id: Ia6f45fb463ad106105c40d01f141c2e5c8b96f78
Diffstat (limited to 'core/java/android/widget/ActivityChooserView.java')
| -rw-r--r-- | core/java/android/widget/ActivityChooserView.java | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/core/java/android/widget/ActivityChooserView.java b/core/java/android/widget/ActivityChooserView.java index 25af3fa0e85a..5841283e4d75 100644 --- a/core/java/android/widget/ActivityChooserView.java +++ b/core/java/android/widget/ActivityChooserView.java @@ -16,6 +16,8 @@ package android.widget; +import com.android.internal.R; + import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; @@ -25,6 +27,7 @@ import android.content.res.TypedArray; import android.database.DataSetObserver; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.view.ActionProvider; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -32,8 +35,6 @@ import android.view.ViewTreeObserver; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.widget.ActivityChooserModel.ActivityChooserModelClient; -import com.android.internal.R; - /** * This class is a view for choosing an activity for handling a given {@link Intent}. * <p> @@ -105,6 +106,11 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod private final int mListPopupMaxWidth; /** + * The ActionProvider hosting this view, if applicable. + */ + ActionProvider mProvider; + + /** * Observer for the model data. */ private final DataSetObserver mModelDataSetOberver = new DataSetObserver() { @@ -129,6 +135,9 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod getListPopupWindow().dismiss(); } else { getListPopupWindow().show(); + if (mProvider != null) { + mProvider.subUiVisibilityChanged(true); + } } } } @@ -260,6 +269,14 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod } /** + * Set the provider hosting this view, if applicable. + * @hide Internal use only + */ + public void setProvider(ActionProvider provider) { + mProvider = provider; + } + + /** * Shows the popup window with activities. * * @return True if the popup was shown, false if already showing. @@ -307,6 +324,9 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod final int contentWidth = Math.min(mAdapter.measureContentWidth(), mListPopupMaxWidth); popupWindow.setContentWidth(contentWidth); popupWindow.show(); + if (mProvider != null) { + mProvider.subUiVisibilityChanged(true); + } } } @@ -525,6 +545,9 @@ public class ActivityChooserView extends ViewGroup implements ActivityChooserMod // PopUpWindow.OnDismissListener#onDismiss public void onDismiss() { notifyOnDismissListener(); + if (mProvider != null) { + mProvider.subUiVisibilityChanged(false); + } } private void notifyOnDismissListener() { |
