diff options
-rw-r--r-- | res/layout/nav_tab_view.xml | 7 | ||||
-rw-r--r-- | res/layout/title_bar.xml | 6 | ||||
-rw-r--r-- | res/values/dimensions.xml | 2 | ||||
-rw-r--r-- | src/com/android/browser/BaseUi.java | 24 | ||||
-rw-r--r-- | src/com/android/browser/NavScreen.java | 7 | ||||
-rw-r--r-- | src/com/android/browser/TitleBarBase.java | 18 | ||||
-rw-r--r-- | src/com/android/browser/TitleBarPhone.java | 2 |
7 files changed, 34 insertions, 32 deletions
diff --git a/res/layout/nav_tab_view.xml b/res/layout/nav_tab_view.xml index f9e471b..439eb89 100644 --- a/res/layout/nav_tab_view.xml +++ b/res/layout/nav_tab_view.xml @@ -30,13 +30,10 @@ android:layout_height="@dimen/toolbar_height" > <ImageView android:id="@+id/favicon" - android:layout_width="22dip" - android:layout_height="22dip" + android:layout_width="20dip" + android:layout_height="20dip" android:layout_marginLeft="4dip" android:layout_marginRight="4dip" - android:background="@color/white" - android:scaleType="center" - android:src="@drawable/app_web_browser_sm" android:layout_gravity="center_vertical" /> <TextView android:id="@+id/title" diff --git a/res/layout/title_bar.xml b/res/layout/title_bar.xml index 35d3611..d00a56c 100644 --- a/res/layout/title_bar.xml +++ b/res/layout/title_bar.xml @@ -22,7 +22,7 @@ <LinearLayout android:id="@+id/taburlbar" android:layout_width="match_parent" - android:layout_height="wrap_content" + android:layout_height="@dimen/toolbar_height" android:orientation="horizontal" android:background="@drawable/bg_urlbar" android:paddingLeft="4dip" @@ -33,7 +33,7 @@ android:id="@+id/title_bg" android:layout_width="0dip" android:layout_weight="1.0" - android:layout_height="40dip" + android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="horizontal"> <ImageView @@ -55,7 +55,7 @@ android:layout_marginLeft="2dip" android:paddingLeft="4dip" android:paddingRight="4dip" - android:background="@drawable/url_selector" + android:background="@*android:drawable/edit_text_holo_dark" android:textAppearance="?android:attr/textAppearanceMedium" android:hint="@string/search_hint" android:singleLine="true" diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml index 4d1c534..5b962d8 100644 --- a/res/values/dimensions.xml +++ b/res/values/dimensions.xml @@ -66,5 +66,5 @@ <dimen name="preference_widget_width">56dp</dimen> <dimen name="nav_tab_spacing">8dp</dimen> <dimen name="menu_width">240dip</dimen> - <dimen name="toolbar_height">40dip</dimen> + <dimen name="toolbar_height">52dip</dimen> </resources> diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java index e2e313e..20195ad 100644 --- a/src/com/android/browser/BaseUi.java +++ b/src/com/android/browser/BaseUi.java @@ -26,7 +26,11 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.graphics.drawable.LayerDrawable; +import android.graphics.drawable.PaintDrawable; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; @@ -74,6 +78,7 @@ public abstract class BaseUi implements UI, WebViewFactory { private Drawable mSecLockIcon; private Drawable mMixLockIcon; + protected Drawable mGenericFavicon; private FrameLayout mBrowserFrameLayout; protected FrameLayout mContentView; @@ -88,6 +93,7 @@ public abstract class BaseUi implements UI, WebViewFactory { private Toast mStopToast; + // the default <video> poster private Bitmap mDefaultVideoPoster; // the video progress view @@ -117,6 +123,8 @@ public abstract class BaseUi implements UI, WebViewFactory { .findViewById(R.id.fullscreen_custom_content); frameLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS); setFullscreen(BrowserSettings.getInstance().useFullscreen()); + mGenericFavicon = res.getDrawable( + R.drawable.app_web_browser_sm); } @Override @@ -795,4 +803,20 @@ public abstract class BaseUi implements UI, WebViewFactory { } } + protected Drawable getFaviconDrawable(Bitmap icon) { + Drawable[] array = new Drawable[3]; + array[0] = new PaintDrawable(Color.BLACK); + PaintDrawable p = new PaintDrawable(Color.WHITE); + array[1] = p; + if (icon == null) { + array[2] = mGenericFavicon; + } else { + array[2] = new BitmapDrawable(icon); + } + LayerDrawable d = new LayerDrawable(array); + d.setLayerInset(1, 1, 1, 1, 1); + d.setLayerInset(2, 2, 2, 2, 2); + return d; + } + } diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java index c61c39f..e636b2b 100644 --- a/src/com/android/browser/NavScreen.java +++ b/src/com/android/browser/NavScreen.java @@ -297,13 +297,12 @@ public class NavScreen extends LinearLayout implements OnClickListener { } else { content = (ImageView) convertView.findViewById(R.id.content); } + View tbar = convertView.findViewById(R.id.titlebar); TextView title = (TextView) convertView.findViewById(R.id.title); ImageView icon = (ImageView) convertView.findViewById(R.id.favicon); ImageButton close = (ImageButton) convertView.findViewById(R.id.closetab); final Tab tab = getItem(position); - if (tab.getFavicon() != null) { - icon.setImageBitmap(tab.getFavicon()); - } + icon.setImageDrawable(mUi.getFaviconDrawable(tab.getFavicon())); title.setText(tab.getUrl()); Bitmap screen = tab.getScreenshot(); content.setImageBitmap(screen); @@ -313,7 +312,7 @@ public class NavScreen extends LinearLayout implements OnClickListener { onCloseTab(tab); } }); - title.setOnClickListener(new OnClickListener() { + tbar.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { close(false); diff --git a/src/com/android/browser/TitleBarBase.java b/src/com/android/browser/TitleBarBase.java index 284fe12..7897b65 100644 --- a/src/com/android/browser/TitleBarBase.java +++ b/src/com/android/browser/TitleBarBase.java @@ -73,7 +73,6 @@ public class TitleBarBase extends RelativeLayout protected ImageView mFavicon; protected ImageView mLockIcon; - protected Drawable mGenericFavicon; protected UiController mUiController; protected BaseUi mBaseUi; protected FrameLayout mParent; @@ -106,8 +105,6 @@ public class TitleBarBase extends RelativeLayout mUiController = controller; mBaseUi = ui; mParent = parent; - mGenericFavicon = context.getResources().getDrawable( - R.drawable.app_web_browser_sm); } protected void initLayout(Context context, int layoutId) { @@ -311,20 +308,7 @@ public class TitleBarBase extends RelativeLayout } /* package */ void setFavicon(Bitmap icon) { - assert mFavicon != null; - Drawable[] array = new Drawable[3]; - array[0] = new PaintDrawable(Color.BLACK); - PaintDrawable p = new PaintDrawable(Color.WHITE); - array[1] = p; - if (icon == null) { - array[2] = mGenericFavicon; - } else { - array[2] = new BitmapDrawable(icon); - } - LayerDrawable d = new LayerDrawable(array); - d.setLayerInset(1, 1, 1, 1, 1); - d.setLayerInset(2, 2, 2, 2, 2); - mFavicon.setImageDrawable(d); + mFavicon.setImageDrawable(mBaseUi.getFaviconDrawable(icon)); } public int getEmbeddedHeight() { diff --git a/src/com/android/browser/TitleBarPhone.java b/src/com/android/browser/TitleBarPhone.java index 0eb2d1a..9242f99 100644 --- a/src/com/android/browser/TitleBarPhone.java +++ b/src/com/android/browser/TitleBarPhone.java @@ -86,12 +86,10 @@ public class TitleBarPhone extends TitleBarBase implements OnFocusChangeListener super.setFocusState(focus); if (focus) { mHasLockIcon = (mLockIcon.getVisibility() == View.VISIBLE); - mFavicon.setVisibility(View.GONE); mLockIcon.setVisibility(View.GONE); mStopButton.setVisibility(View.GONE); mVoiceButton.setVisibility(View.VISIBLE); } else { - mFavicon.setVisibility(View.VISIBLE); mLockIcon.setVisibility(mHasLockIcon ? View.VISIBLE : View.GONE); if (mInLoad) { mStopButton.setVisibility(View.VISIBLE); |