diff options
author | Leon Scroggins <scroggo@google.com> | 2009-09-16 11:12:09 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-09-16 13:34:59 -0400 |
commit | d8fd2fcf4eb037fd65ae923c6dbeff6c6ecb4d4f (patch) | |
tree | fabb4155bb5d6b8aaa63c1e8ff5d97cb430ad1b4 | |
parent | 83cdb2c40f2dbcbdf522a2af0ec8224c7195c6c1 (diff) | |
download | packages_apps_Browser-d8fd2fcf4eb037fd65ae923c6dbeff6c6ecb4d4f.zip packages_apps_Browser-d8fd2fcf4eb037fd65ae923c6dbeff6c6ecb4d4f.tar.gz packages_apps_Browser-d8fd2fcf4eb037fd65ae923c6dbeff6c6ecb4d4f.tar.bz2 |
Make the fake title bar look more like the regular title bar.
Place the fake title bar in FrameLayout with a shadow overlay and
a white background so it will look like the embedded title bar.
Fixes http://b/issue?id=2123300 and part of http://b/issue?id=2118813
Change-Id: I079cd5100dbc344867a75e3593471bc0c1e3d8eb
-rw-r--r-- | res/layout/title_bar_bg.xml | 23 | ||||
-rw-r--r-- | src/com/android/browser/BrowserActivity.java | 27 |
2 files changed, 48 insertions, 2 deletions
diff --git a/res/layout/title_bar_bg.xml b/res/layout/title_bar_bg.xml new file mode 100644 index 0000000..c4213b0 --- /dev/null +++ b/res/layout/title_bar_bg.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright 2009, The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:foreground="?android:attr/windowContentOverlay" + android:background="@color/white" + /> diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index d4cd7eb..74103f2 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.WRAP_CONTENT, + 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; } |