diff options
Diffstat (limited to 'src/com')
| -rw-r--r-- | src/com/android/browser/BrowserActivity.java | 83 | ||||
| -rw-r--r-- | src/com/android/browser/TabControl.java | 21 |
2 files changed, 73 insertions, 31 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index d4cd7eb1f..aa2b2ccb9 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -881,6 +881,19 @@ public class BrowserActivity extends Activity private TitleBar mFakeTitleBar; /** + * Holder for the fake title bar. It will have a foreground shadow, as well + * as a white background, so the fake title bar looks like the real one. + */ + private ViewGroup mFakeTitleBarHolder; + + /** + * Layout parameters for the fake title bar within mFakeTitleBarHolder + */ + private FrameLayout.LayoutParams mFakeTitleBarParams + = new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT); + /** * Keeps track of whether the options menu is open. This is important in * determining whether to show or hide the title bar overlay. */ @@ -967,7 +980,16 @@ public class BrowserActivity extends Activity Rect rectangle = new Rect(); mBrowserFrameLayout.getGlobalVisibleRect(rectangle); params.y = rectangle.top; - manager.addView(mFakeTitleBar, params); + // Add a holder for the title bar. It is a FrameLayout, which + // allows it to have an overlay shadow. It also has a white + // background, which is the same as the background when it is + // placed in a WebView. + if (mFakeTitleBarHolder == null) { + mFakeTitleBarHolder = (ViewGroup) LayoutInflater.from(this) + .inflate(R.layout.title_bar_bg, null); + } + mFakeTitleBarHolder.addView(mFakeTitleBar, mFakeTitleBarParams); + manager.addView(mFakeTitleBarHolder, params); } } @@ -987,7 +1009,8 @@ public class BrowserActivity extends Activity if (mFakeTitleBar == null) return; WindowManager manager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); - manager.removeView(mFakeTitleBar); + mFakeTitleBarHolder.removeView(mFakeTitleBar); + manager.removeView(mFakeTitleBarHolder); mFakeTitleBar = null; } @@ -1342,10 +1365,10 @@ public class BrowserActivity extends Activity // we do not need to remove it removeTabFromContentView(currentTab); } - removeTabFromContentView(tab); mTabControl.setCurrentTab(tab); attachTabToContentView(tab); - resetTitle(); + resetTitleIconAndProgress(); + updateLockIconToLatest(); return true; } @@ -1751,6 +1774,11 @@ public class BrowserActivity extends Activity ViewGroup.LayoutParams.WRAP_CONTENT)); } + if (t == mTabControl.getCurrentTab()) { + setLockIconType(t.getLockIconType()); + setPrevLockType(t.getPrevLockIconType()); + } + WebView view = t.getWebView(); view.setEmbeddedTitleBar(mTitleBar); // Attach the sub window if necessary @@ -1788,6 +1816,11 @@ public class BrowserActivity extends Activity if (t.getSubWebView() != null) { mContentView.removeView(t.getSubWebViewContainer()); } + + if (t == mTabControl.getCurrentTab()) { + t.setLockIconType(getLockIconType()); + t.setPrevLockIconType(getPrevLockType()); + } } // Remove the sub window if it exists. Also called by TabControl when the @@ -1827,10 +1860,10 @@ public class BrowserActivity extends Activity if (currentTab != null) { removeTabFromContentView(currentTab); } - attachTabToContentView(tab); // We must set the new tab as the current tab to reflect the old // animation behavior. mTabControl.setCurrentTab(tab); + attachTabToContentView(tab); if (!urlData.isEmpty()) { urlData.loadIn(webview); } @@ -1897,15 +1930,6 @@ public class BrowserActivity extends Activity } /** - * Resets the browser title-view to whatever it must be (for example, if we - * load a page from history). - */ - private void resetTitle() { - resetLockIcon(); - resetTitleIconAndProgress(); - } - - /** * Resets the browser title-view to whatever it must be * (for example, if we had a loading error) * When we have a new page, we call resetTitle, when we @@ -3428,23 +3452,20 @@ public class BrowserActivity extends Activity updateLockIconImage(LOCK_ICON_UNSECURE); } - /** - * Resets the lock icon. This method is called when the icon needs to be - * reset but we do not know whether we are loading a secure or not secure - * page. - */ - private void resetLockIcon() { - // Save the lock-icon state (we revert to it if the load gets cancelled) - saveLockIcon(); + /* package */ void setLockIconType(int type) { + mLockIconType = type; + } - mLockIconType = LOCK_ICON_UNSECURE; + /* package */ int getLockIconType() { + return mLockIconType; + } - if (LOGV_ENABLED) { - Log.v(LOGTAG, "BrowserActivity.resetLockIcon:" + - " reset lock icon to " + mLockIconType); - } + /* package */ void setPrevLockType(int type) { + mPrevLockType = type; + } - updateLockIconImage(LOCK_ICON_UNSECURE); + /* package */ int getPrevLockType() { + return mPrevLockType; } /** @@ -4150,9 +4171,9 @@ public class BrowserActivity extends Activity } - private final static int LOCK_ICON_UNSECURE = 0; - private final static int LOCK_ICON_SECURE = 1; - private final static int LOCK_ICON_MIXED = 2; + final static int LOCK_ICON_UNSECURE = 0; + final static int LOCK_ICON_SECURE = 1; + final static int LOCK_ICON_MIXED = 2; private int mLockIconType = LOCK_ICON_UNSECURE; private int mPrevLockType = LOCK_ICON_UNSECURE; diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java index 037a757c7..4089cac8e 100644 --- a/src/com/android/browser/TabControl.java +++ b/src/com/android/browser/TabControl.java @@ -210,12 +210,17 @@ class TabControl { private String mOriginalUrl; private ErrorConsoleView mErrorConsole; + // the lock icon type and previous lock icon type for the tab + private int mSavedLockIconType; + private int mSavedPrevLockIconType; // Construct a new tab private Tab(WebView w, boolean closeOnExit, String appId, String url, Context context) { mCloseOnExit = closeOnExit; mAppId = appId; mOriginalUrl = url; + mSavedLockIconType = BrowserActivity.LOCK_ICON_UNSECURE; + mSavedPrevLockIconType = BrowserActivity.LOCK_ICON_UNSECURE; // The tab consists of a container view, which contains the main // WebView, as well as any other UI elements associated with the tab. @@ -413,6 +418,22 @@ class TabControl { mPickerData.mFakeWebView.invalidate(); } } + + void setLockIconType(int type) { + mSavedLockIconType = type; + } + + int getLockIconType() { + return mSavedLockIconType; + } + + void setPrevLockIconType(int type) { + mSavedPrevLockIconType = type; + } + + int getPrevLockIconType() { + return mSavedPrevLockIconType; + } }; // Directory to store thumbnails for each WebView. |
