diff options
author | John Reck <jreck@google.com> | 2011-02-15 11:13:25 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-15 11:13:25 -0800 |
commit | 4ea2c8e2013815003657c6239ae3a5f942079b83 (patch) | |
tree | 0b3a57cd2a8b9dbbfbb40266ae6a0ea11d46a0fd /src/com/android/browser | |
parent | 6eb5077fa54d88530ce88ef5db44365f3079b615 (diff) | |
parent | 539937b9bd803c1abf8b3a038f1524add1d8b230 (diff) | |
download | packages_apps_Browser-4ea2c8e2013815003657c6239ae3a5f942079b83.zip packages_apps_Browser-4ea2c8e2013815003657c6239ae3a5f942079b83.tar.gz packages_apps_Browser-4ea2c8e2013815003657c6239ae3a5f942079b83.tar.bz2 |
Merge "Fix layout params for TouchProxy"
Diffstat (limited to 'src/com/android/browser')
-rw-r--r-- | src/com/android/browser/PhoneUi.java | 51 |
1 files changed, 8 insertions, 43 deletions
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java index e51962e..cfe7351 100644 --- a/src/com/android/browser/PhoneUi.java +++ b/src/com/android/browser/PhoneUi.java @@ -26,7 +26,6 @@ import android.view.KeyEvent; import android.view.Menu; import android.view.MotionEvent; import android.view.View; -import android.view.ViewGroup; import android.view.WindowManager; import android.webkit.WebView; @@ -145,31 +144,10 @@ public class PhoneUi extends BaseUi { tab.getTopWindow().requestFocus(); } - private void attachTitleBar(WebView mainView) { - if (mainView != null) { - mainView.setEmbeddedTitleBar(null); - } - WindowManager manager = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE); - // Add the title bar to the window manager so it can receive - // touches while the menu is up - WindowManager.LayoutParams params = - new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT, - WindowManager.LayoutParams.TYPE_APPLICATION, - WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, - PixelFormat.OPAQUE); - params.gravity = Gravity.TOP; - boolean atTop = mainView.getScrollY() == 0; - params.windowAnimations = atTop ? 0 : R.style.TitleBar; - manager.addView(mTitleBar, params); - super.showTitleBar(); - } - @Override protected void showTitleBar() { if (canShowTitleBar()) { - WebView mainView = mUiController.getCurrentWebView(); - attachTitleBar(mainView); + setTitleGravity(Gravity.TOP); super.showTitleBar(); } } @@ -177,23 +155,7 @@ public class PhoneUi extends BaseUi { @Override protected void hideTitleBar() { if (isTitleBarShowing()) { - WindowManager.LayoutParams params = - (WindowManager.LayoutParams) mTitleBar.getLayoutParams(); - WebView mainView = mUiController.getCurrentWebView(); - // Although we decided whether or not to animate based on the - // current - // scroll position, the scroll position may have changed since the - // fake title bar was displayed. Make sure it has the appropriate - // animation/lack thereof before removing. - params.windowAnimations = - mainView != null && mainView.getScrollY() == 0 ? 0 : R.style.TitleBar; - WindowManager manager = - (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE); - manager.updateViewLayout(mTitleBar, params); - manager.removeView(mTitleBar); - if (mainView != null) { - mainView.setEmbeddedTitleBar(mTitleBar); - } + setTitleGravity(Gravity.NO_GRAVITY); super.hideTitleBar(); } } @@ -307,12 +269,15 @@ public class PhoneUi extends BaseUi { WindowManager.LayoutParams getWindowLayoutParams() { WindowManager.LayoutParams params = - new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.WRAP_CONTENT, + new WindowManager.LayoutParams( + mTarget.getWidth(), + mTarget.getHeight(), WindowManager.LayoutParams.TYPE_APPLICATION, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSPARENT); - params.gravity = Gravity.TOP; + params.gravity = Gravity.TOP | Gravity.LEFT; + params.y = mTarget.getTop(); + params.x = mTarget.getLeft(); return params; } } |