From 3a115628236ee9051518d4f96840cbb76070cf92 Mon Sep 17 00:00:00 2001 From: Deepanshu Gupta Date: Tue, 6 May 2014 16:18:47 -0700 Subject: Add Navigation Bar to BridgeWindowManager [DO NOT MERGE] Return the right value for presence of software navigation bar in BridgeWindowManager. This is required to render the overflow menu button correctly in the Action Bar. Change-Id: I73de3b299f6a3a113425c436a59e800cd1d6b97f --- .../layoutlib/bridge/android/BridgeWindowManager.java | 12 ++++++------ .../com/android/layoutlib/bridge/impl/RenderSessionImpl.java | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'tools/layoutlib') diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java index 8ab875f..6f41f90 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeWindowManager.java @@ -35,11 +35,6 @@ import android.view.IOnKeyguardExitResult; import android.view.IRotationWatcher; import android.view.IWindowManager; import android.view.IWindowSession; -import android.view.InputChannel; -import android.view.InputDevice; -import android.view.InputEvent; -import android.view.KeyEvent; -import android.view.MotionEvent; import java.util.List; @@ -52,6 +47,7 @@ public class BridgeWindowManager implements IWindowManager { private final Configuration mConfig; private final DisplayMetrics mMetrics; private final int mRotation; + private boolean mHasNavBar; public BridgeWindowManager(Configuration config, DisplayMetrics metrics, int rotation) { mConfig = config; @@ -64,6 +60,10 @@ public class BridgeWindowManager implements IWindowManager { public DisplayMetrics getMetrics() { return mMetrics; } + + public void setHasNavBar(boolean hasNavBar) { + mHasNavBar = hasNavBar; + } // ---- implementation of IWindowManager that we care about ---- @@ -448,7 +448,7 @@ public class BridgeWindowManager implements IWindowManager { @Override public boolean hasNavigationBar() { - return false; // should this return something else? + return mHasNavBar; } @Override diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java index 03e7132..1d1c73f 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java @@ -182,6 +182,8 @@ public class RenderSessionImpl extends RenderAction { SessionParams params = getParams(); BridgeContext context = getContext(); + context.getIWindowManager().setHasNavBar(params.getHardwareConfig().hasSoftwareButtons()); + RenderResources resources = getParams().getResources(); DisplayMetrics metrics = getContext().getMetrics(); -- cgit v1.1