Fix issues in Autohide TitleBar
- Fixes issue when longpress of TitleBar
shows copy/paste menu on top of titleBar.
- Fixes issue in landscape mode where the
setTranslationY value is reused from portrait
mode.
Change-Id: I521b4dd7a5385c621c941487f77894a3dcef42d3
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index 900abff..78b3cc8 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -52,11 +52,12 @@
private NavScreen mNavScreen;
private AnimScreen mAnimScreen;
private NavigationBarPhone mNavigationBar;
- private int mActionBarHeight;
+ private Activity mBrowser;
boolean mAnimating;
boolean mShowNav = false;
+
/**
* @param browser
* @param controller
@@ -65,11 +66,7 @@
super(browser, controller);
setUseQuickControls(BrowserSettings.getInstance().useQuickControls());
mNavigationBar = (NavigationBarPhone) mTitleBar.getNavigationBar();
- TypedValue heightValue = new TypedValue();
- browser.getTheme().resolveAttribute(
- android.R.attr.actionBarSize, heightValue, true);
- mActionBarHeight = TypedValue.complexToDimensionPixelSize(heightValue.data,
- browser.getResources().getDisplayMetrics());
+ mBrowser = browser;
}
@Override
@@ -238,7 +235,12 @@
if (!isEditingUrl()) {
hideTitleBar();
} else {
- mTitleBar.setTranslationY(mActionBarHeight);
+ TypedValue heightValue = new TypedValue();
+ mBrowser.getTheme().resolveAttribute(
+ android.R.attr.actionBarSize, heightValue, true);
+ int actionBarHeight = TypedValue.complexToDimensionPixelSize(heightValue.data,
+ mBrowser.getResources().getDisplayMetrics());
+ mTitleBar.setTranslationY(actionBarHeight);
}
}