summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2014-04-30 00:38:35 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-04-30 00:38:35 +0000
commit92bc07534e511b9afa7edaffe867d2674c504d73 (patch)
tree099c71f08b33d0737632eb377fa989b82f46f39d /tools
parentc6ebc0d120bd7faa61d2f906f4a180c720f1f0d8 (diff)
parent8c15cd0dc1d04490b82fd7d8da7611ff3219a1f0 (diff)
downloadframeworks_base-92bc07534e511b9afa7edaffe867d2674c504d73.zip
frameworks_base-92bc07534e511b9afa7edaffe867d2674c504d73.tar.gz
frameworks_base-92bc07534e511b9afa7edaffe867d2674c504d73.tar.bz2
am 8c15cd0d: am c967d8dc: Add special system view cookie to OverflowButton. [DO NOT MERGE]
* commit '8c15cd0dc1d04490b82fd7d8da7611ff3219a1f0': Add special system view cookie to OverflowButton. [DO NOT MERGE]
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java
index 69f6a65..6f18bd5 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/bars/ActionBarLayout.java
@@ -23,8 +23,10 @@ import com.android.ide.common.rendering.api.ActionBarCallback.HomeButtonStyle;
import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.rendering.api.SessionParams;
+import com.android.ide.common.rendering.api.SystemViewCookie;
import com.android.internal.R;
import com.android.internal.app.ActionBarImpl;
+import com.android.internal.util.Predicate;
import com.android.internal.view.menu.MenuBuilder;
import com.android.internal.view.menu.MenuBuilderAccessor;
import com.android.internal.view.menu.MenuItemImpl;
@@ -57,6 +59,8 @@ import android.widget.RelativeLayout;
import java.util.ArrayList;
+import static com.android.ide.common.rendering.api.SystemViewCookie.ACTION_BAR_OVERFLOW;
+
/**
* A layout representing the action bar.
*/
@@ -165,10 +169,33 @@ public class ActionBarLayout extends LinearLayout {
}
// Set action bar to be split, if needed.
- mActionBarView.setSplitView((ActionBarContainer) findViewById(R.id.split_action_bar));
+ ActionBarContainer splitView = (ActionBarContainer) findViewById(R.id.split_action_bar);
+ mActionBarView.setSplitView(splitView);
mActionBarView.setSplitActionBar(mSplit);
inflateMenus();
+
+ // Find if the Overflow Menu Button (the three dots) exists. If yes,
+ // add the view cookie.
+ Predicate<View> overflowMenuButtonTest = new Predicate<View>() {
+ @Override
+ public boolean apply(View view) {
+ return view.getClass().getName()
+ .equals("android.widget.ActionMenuPresenter$OverflowMenuButton");
+ }
+ };
+ View overflowMenu = null;
+ if (mSplit) {
+ if (splitView != null) {
+ overflowMenu = splitView.findViewByPredicate(overflowMenuButtonTest);
+ }
+ }
+ else {
+ overflowMenu = mActionBarView.findViewByPredicate(overflowMenuButtonTest);
+ }
+ if (overflowMenu != null) {
+ mBridgeContext.addViewKey(overflowMenu, new SystemViewCookie(ACTION_BAR_OVERFLOW));
+ }
}
}