summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout-sw600dp/title_bar_nav.xml6
-rw-r--r--res/values-w720dp/dimensions.xml4
-rw-r--r--res/values/dimensions.xml5
-rw-r--r--src/com/android/browser/NavigationBarTablet.java23
-rw-r--r--src/com/android/browser/TabBar.java44
-rw-r--r--src/com/android/browser/XLargeUi.java34
6 files changed, 66 insertions, 50 deletions
diff --git a/res/layout-sw600dp/title_bar_nav.xml b/res/layout-sw600dp/title_bar_nav.xml
index 37bea35..3ef6d35 100644
--- a/res/layout-sw600dp/title_bar_nav.xml
+++ b/res/layout-sw600dp/title_bar_nav.xml
@@ -58,11 +58,12 @@
android:background="@drawable/url_background">
<ImageView
android:id="@+id/url_icon"
- android:layout_width="wrap_content"
+ android:layout_width="48dp"
android:layout_height="match_parent"
android:src="@drawable/ic_web_holo_dark"
android:contentDescription="@string/accessibility_button_uaswitch"
- style="@style/HoloIcon" />
+ android:scaleType="center"
+ style="@style/HoloButton" />
<ImageView
android:id="@+id/lock"
android:layout_width="wrap_content"
@@ -74,7 +75,6 @@
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="match_parent"
- android:layout_marginLeft="16dip"
android:paddingLeft="0dip"
android:paddingRight="0dip"
android:background="@null"
diff --git a/res/values-w720dp/dimensions.xml b/res/values-w720dp/dimensions.xml
index dcb5927..9fe5c68 100644
--- a/res/values-w720dp/dimensions.xml
+++ b/res/values-w720dp/dimensions.xml
@@ -13,7 +13,5 @@
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- The width of a selected tab -->
- <dimen name="tab_width_selected">280dp</dimen>
- <!-- The width of an unselected tab -->
- <dimen name="tab_width_unselected">240dp</dimen>
+ <dimen name="tab_width">240dp</dimen>
</resources>
diff --git a/res/values/dimensions.xml b/res/values/dimensions.xml
index 8fca68a..fa372e4 100644
--- a/res/values/dimensions.xml
+++ b/res/values/dimensions.xml
@@ -12,10 +12,7 @@
-->
<resources
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- <!-- The width of a selected tab -->
- <dimen name="tab_width_selected">200dp</dimen>
- <!-- The width of an unselected tab -->
- <dimen name="tab_width_unselected">160dp</dimen>
+ <dimen name="tab_width">180dp</dimen>
<dimen name="tab_height">44dp</dimen>
<dimen name="tab_overlap">8dp</dimen>
<dimen name="tab_addoverlap">14dp</dimen>
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java
index e3059ea..7f6992a 100644
--- a/src/com/android/browser/NavigationBarTablet.java
+++ b/src/com/android/browser/NavigationBarTablet.java
@@ -22,6 +22,7 @@ import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.util.AttributeSet;
@@ -53,6 +54,7 @@ public class NavigationBarTablet extends NavigationBarBase {
private Drawable mFocusDrawable;
private Drawable mUnfocusDrawable;
private boolean mHideNavButtons;
+ private Drawable mFaviconDrawable;
public NavigationBarTablet(Context context) {
super(context);
@@ -191,10 +193,25 @@ public class NavigationBarTablet extends NavigationBarBase {
}
}
+ @Override
+ public void setFavicon(Bitmap icon) {
+ mFaviconDrawable = mBaseUi.getFaviconDrawable(icon);
+ updateUrlIcon();
+ }
+
void updateUrlIcon() {
- mUrlIcon.setImageResource(mInVoiceMode ?
- R.drawable.ic_search_holo_dark
- : R.drawable.ic_web_holo_dark);
+ if (mUrlInput.hasFocus()) {
+ mUrlIcon.setImageResource(R.drawable.ic_search_holo_dark);
+ } else {
+ if (mInVoiceMode) {
+ mUrlIcon.setImageResource(R.drawable.ic_search_holo_dark);
+ } else {
+ if (mFaviconDrawable == null) {
+ mFaviconDrawable = mBaseUi.getFaviconDrawable(null);
+ }
+ mUrlIcon.setImageDrawable(mFaviconDrawable);
+ }
+ }
}
@Override
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index d1652dd..d549ac3 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -35,10 +35,8 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.PaintDrawable;
-import android.view.ContextMenu;
import android.view.Gravity;
import android.view.LayoutInflater;
-import android.view.MenuInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
@@ -62,8 +60,7 @@ public class TabBar extends LinearLayout implements OnClickListener {
private TabControl mTabControl;
private XLargeUi mUi;
- private int mTabWidthSelected;
- private int mTabWidthUnselected;
+ private int mTabWidth;
private TabScrollView mTabs;
@@ -72,8 +69,6 @@ public class TabBar extends LinearLayout implements OnClickListener {
private Map<Tab, TabView> mTabMap;
- private Drawable mGenericFavicon;
-
private int mCurrentTextureWidth = 0;
private int mCurrentTextureHeight = 0;
@@ -101,8 +96,7 @@ public class TabBar extends LinearLayout implements OnClickListener {
mTabControl = mUiController.getTabControl();
mUi = ui;
Resources res = activity.getResources();
- mTabWidthSelected = (int) res.getDimension(R.dimen.tab_width_selected);
- mTabWidthUnselected = (int) res.getDimension(R.dimen.tab_width_unselected);
+ mTabWidth = (int) res.getDimension(R.dimen.tab_width);
mActiveDrawable = res.getDrawable(R.drawable.bg_urlbar);
mInactiveDrawable = res.getDrawable(R.drawable.browsertab_inactive);
@@ -113,7 +107,6 @@ public class TabBar extends LinearLayout implements OnClickListener {
mTabs = (TabScrollView) findViewById(R.id.tabs);
mNewTab = (ImageButton) findViewById(R.id.newtab);
mNewTab.setOnClickListener(this);
- mGenericFavicon = res.getDrawable(R.drawable.app_web_browser_sm);
updateTabs(mUiController.getTabs());
mButtonWidth = -1;
@@ -138,8 +131,7 @@ public class TabBar extends LinearLayout implements OnClickListener {
public void onConfigurationChanged(Configuration config) {
super.onConfigurationChanged(config);
Resources res = mActivity.getResources();
- mTabWidthSelected = (int) res.getDimension(R.dimen.tab_width_selected);
- mTabWidthUnselected = (int) res.getDimension(R.dimen.tab_width_unselected);
+ mTabWidth = (int) res.getDimension(R.dimen.tab_width);
// force update of tab bar
mTabs.updateLayout();
}
@@ -309,7 +301,7 @@ public class TabBar extends LinearLayout implements OnClickListener {
setDisplayTitle(displayTitle);
setProgress(mTab.getLoadProgress());
if (mTab.getFavicon() != null) {
- setFavicon(renderFavicon(mTab.getFavicon()));
+ setFavicon(mUi.getFaviconDrawable(mTab.getFavicon()));
}
updateTabIcons();
}
@@ -326,6 +318,7 @@ public class TabBar extends LinearLayout implements OnClickListener {
public void setActivated(boolean selected) {
mSelected = selected;
mClose.setVisibility(mSelected ? View.VISIBLE : View.GONE);
+ mIconView.setVisibility(mSelected ? View.GONE : View.VISIBLE);
mTitle.setTextAppearance(mActivity, mSelected ?
R.style.TabTitleSelected : R.style.TabTitleUnselected);
setHorizontalFadingEdgeEnabled(!mSelected);
@@ -337,7 +330,7 @@ public class TabBar extends LinearLayout implements OnClickListener {
public void updateLayoutParams() {
LayoutParams lp = (LinearLayout.LayoutParams) getLayoutParams();
- lp.width = mSelected ? mTabWidthSelected : mTabWidthUnselected;
+ lp.width = mTabWidth;
lp.height = LayoutParams.MATCH_PARENT;
setLayoutParams(lp);
}
@@ -447,29 +440,6 @@ public class TabBar extends LinearLayout implements OnClickListener {
}
- static Drawable createFaviconBackground(Context context) {
- PaintDrawable faviconBackground = new PaintDrawable();
- Resources res = context.getResources();
- faviconBackground.getPaint().setColor(context.getResources()
- .getColor(R.color.tabFaviconBackground));
- faviconBackground.setCornerRadius(
- res.getDimension(R.dimen.tab_favicon_corner_radius));
- return faviconBackground;
- }
-
- private Drawable renderFavicon(Bitmap icon) {
- Drawable[] array = new Drawable[2];
- array[0] = createFaviconBackground(getContext());
- if (icon == null) {
- array[1] = mGenericFavicon;
- } else {
- array[1] = new BitmapDrawable(icon);
- }
- LayerDrawable d = new LayerDrawable(array);
- d.setLayerInset(1, 2, 2, 2, 2);
- return d;
- }
-
private void animateTabOut(final Tab tab, final TabView tv) {
ObjectAnimator scalex = ObjectAnimator.ofFloat(tv, "scaleX", 1.0f, 0.0f);
ObjectAnimator scaley = ObjectAnimator.ofFloat(tv, "scaleY", 1.0f, 0.0f);
@@ -542,7 +512,7 @@ public class TabBar extends LinearLayout implements OnClickListener {
public void onFavicon(Tab tab, Bitmap favicon) {
TabView tv = mTabMap.get(tab);
if (tv != null) {
- tv.setFavicon(renderFavicon(favicon));
+ tv.setFavicon(mUi.getFaviconDrawable(favicon));
}
}
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 5c11b58..724708b 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -18,6 +18,12 @@ package com.android.browser;
import android.app.ActionBar;
import android.app.Activity;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+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.os.Handler;
import android.util.Log;
@@ -38,6 +44,8 @@ public class XLargeUi extends BaseUi {
private static final String LOGTAG = "XLargeUi";
+ private PaintDrawable mFaviconBackground;
+
private ActionBar mActionBar;
private TabBar mTabBar;
@@ -348,4 +356,30 @@ public class XLargeUi extends BaseUi {
return mUseQuickControls;
}
+ private Drawable getFaviconBackground() {
+ if (mFaviconBackground == null) {
+ mFaviconBackground = new PaintDrawable();
+ Resources res = mActivity.getResources();
+ mFaviconBackground.getPaint().setColor(
+ res.getColor(R.color.tabFaviconBackground));
+ mFaviconBackground.setCornerRadius(
+ res.getDimension(R.dimen.tab_favicon_corner_radius));
+ }
+ return mFaviconBackground;
+ }
+
+ @Override
+ public Drawable getFaviconDrawable(Bitmap icon) {
+ Drawable[] array = new Drawable[2];
+ array[0] = getFaviconBackground();
+ if (icon == null) {
+ array[1] = mGenericFavicon;
+ } else {
+ array[1] = new BitmapDrawable(mActivity.getResources(), icon);
+ }
+ LayerDrawable d = new LayerDrawable(array);
+ d.setLayerInset(1, 2, 2, 2, 2);
+ return d;
+ }
+
}