diff options
| author | Leon Scroggins <scroggo@google.com> | 2009-09-14 12:58:04 -0400 |
|---|---|---|
| committer | Leon Scroggins <scroggo@google.com> | 2009-09-14 15:09:14 -0400 |
| commit | a27ff19e24cb1c9fef5624dbc4554548349b5b31 (patch) | |
| tree | 46d278060ca4fa3f1b910e386db826c9c34e4f78 /src/com/android/browser/BrowserActivity.java | |
| parent | b9daacb7513c5a42000285ad456cc614af1915c0 (diff) | |
Show title bar while loading, and hide it when finished loading.
Fix for http://b/issue?id=2107276
Change-Id: I96cb4d3bd71edeb38b3afc7e58a339021a81ed46
Diffstat (limited to 'src/com/android/browser/BrowserActivity.java')
| -rw-r--r-- | src/com/android/browser/BrowserActivity.java | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 1c270bea..adb9b7da 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -973,8 +973,10 @@ public class BrowserActivity extends Activity WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.OPAQUE); params.gravity = Gravity.TOP; - params.windowAnimations = getTopWindow().getScrollY() == 0 ? 0 - : com.android.internal.R.style.Animation_DropDownDown; + WebView mainView = mTabControl.getCurrentWebView(); + params.windowAnimations = mainView == null + || mainView.getScrollY() != 0 + ? com.android.internal.R.style.Animation_DropDownDown : 0; // XXX : Without providing an offset, the fake title bar will be // placed underneath the status bar. Use the global visible rect // of mBrowserFrameLayout to determine the bottom of the status bar @@ -988,7 +990,14 @@ public class BrowserActivity extends Activity @Override public void onOptionsMenuClosed(Menu menu) { mOptionsMenuOpen = false; - hideFakeTitleBar(); + if (!mInLoad) { + hideFakeTitleBar(); + } else if (!mIconView) { + // The page is currently loading, and we are in expanded mode, so + // we were not showing the menu. Show it once again. It will be + // removed when the page finishes. + showFakeTitleBar(); + } } private void hideFakeTitleBar() { if (mFakeTitleBar == null) return; @@ -2406,6 +2415,11 @@ public class BrowserActivity extends Activity CookieSyncManager.getInstance().resetSync(); mInLoad = true; + WebView currentWebView = mTabControl.getCurrentWebView(); + if (currentWebView == null || currentWebView.getScrollY() != 0) { + // This page has begun to load, so show the title bar + showFakeTitleBar(); + } updateInLoadMenuItems(); if (!mIsNetworkUp) { if ( mAlertDialog == null) { @@ -3060,14 +3074,22 @@ public class BrowserActivity extends Activity if (mInLoad) { mInLoad = false; updateInLoadMenuItems(); + // If the options menu is open, leave the title bar + if (!mOptionsMenuOpen || !mIconView) { + hideFakeTitleBar(); + } } - } else { + } else if (!mInLoad) { // onPageFinished may have already been called but a subframe // is still loading and updating the progress. Reset mInLoad // and update the menu items. - if (!mInLoad) { - mInLoad = true; - updateInLoadMenuItems(); + mInLoad = true; + updateInLoadMenuItems(); + WebView currentWebView = mTabControl.getCurrentWebView(); + if ((currentWebView == null || currentWebView.getScrollY() != 0) + && (!mOptionsMenuOpen || mIconView)) { + // This page has begun to load, so show the title bar + showFakeTitleBar(); } } } |
