From 114bc8b06f8dbff621e7ec28732079ed80e47c5f Mon Sep 17 00:00:00 2001 From: Lucas Rocha Date: Fri, 22 Nov 2013 13:33:15 +0000 Subject: [PATCH] Bug 935628 - Remove BrowserToolbarBackground from toolbar (r=sriram) --- mobile/android/base/moz.build | 1 - .../layout-large-v11/browser_toolbar.xml | 5 ---- .../base/resources/layout/browser_toolbar.xml | 5 ---- .../base/resources/layout/gecko_app.xml | 3 ++- .../android/base/toolbar/BrowserToolbar.java | 24 ++++++++++++++++--- 5 files changed, 23 insertions(+), 15 deletions(-) diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index 90ec779289da..2c5d01620ef0 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -289,7 +289,6 @@ gbjar.sources += [ 'toolbar/AutocompleteHandler.java', 'toolbar/BackButton.java', 'toolbar/BrowserToolbar.java', - 'toolbar/BrowserToolbarBackground.java', 'toolbar/CanvasDelegate.java', 'toolbar/ForwardButton.java', 'toolbar/PageActionLayout.java', diff --git a/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml b/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml index 3a9a3274646e..590557b4034f 100644 --- a/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml +++ b/mobile/android/base/resources/layout-large-v11/browser_toolbar.xml @@ -6,11 +6,6 @@ - - - - + android:focusable="true" + android:background="@drawable/url_bar_bg"/> diff --git a/mobile/android/base/toolbar/BrowserToolbar.java b/mobile/android/base/toolbar/BrowserToolbar.java index 368035e91051..fbc8decafc9d 100644 --- a/mobile/android/base/toolbar/BrowserToolbar.java +++ b/mobile/android/base/toolbar/BrowserToolbar.java @@ -131,7 +131,6 @@ public class BrowserToolbar extends GeckoRelativeLayout private CustomEditText mUrlEditText; private View mUrlBarEntry; private ImageView mUrlBarRightEdge; - private BrowserToolbarBackground mUrlBarBackground; private GeckoTextView mTitle; private int mTitlePadding; private boolean mSiteSecurityVisible; @@ -196,6 +195,8 @@ public class BrowserToolbar extends GeckoRelativeLayout private final ForegroundColorSpan mDomainColor; private final ForegroundColorSpan mPrivateDomainColor; + private final LightweightTheme mTheme; + private boolean mShowUrl; private boolean mTrimURLs; @@ -207,6 +208,7 @@ public class BrowserToolbar extends GeckoRelativeLayout public BrowserToolbar(Context context, AttributeSet attrs) { super(context, attrs); + mTheme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme(); // BrowserToolbar is attached to BrowserApp only. mActivity = (BrowserApp) context; @@ -283,7 +285,6 @@ public class BrowserToolbar extends GeckoRelativeLayout mAnimatingEntry = false; - mUrlBarBackground = (BrowserToolbarBackground) findViewById(R.id.url_bar_bg); mUrlBarViewOffset = res.getDimensionPixelSize(R.dimen.url_bar_offset_left); mDefaultForwardMargin = res.getDimensionPixelSize(R.dimen.forward_default_offset); mUrlDisplayContainer = findViewById(R.id.url_display_container); @@ -1791,7 +1792,6 @@ public class BrowserToolbar extends GeckoRelativeLayout updateForwardButton(canDoForward(tab)); final boolean isPrivate = tab.isPrivate(); - mUrlBarBackground.setPrivateMode(isPrivate); setPrivateMode(isPrivate); mTabs.setPrivateMode(isPrivate); mTitle.setPrivateMode(isPrivate); @@ -1879,4 +1879,22 @@ public class BrowserToolbar extends GeckoRelativeLayout } } } + + @Override + public void onLightweightThemeChanged() { + Drawable drawable = mTheme.getDrawable(this); + if (drawable == null) + return; + + StateListDrawable stateList = new StateListDrawable(); + stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.background_private)); + stateList.addState(EMPTY_STATE_SET, drawable); + + setBackgroundDrawable(stateList); + } + + @Override + public void onLightweightThemeReset() { + setBackgroundResource(R.drawable.url_bar_bg); + } }