Bug 935628 - Remove BrowserToolbarBackground from toolbar (r=sriram)

This commit is contained in:
Lucas Rocha 2013-11-11 18:33:49 +00:00
parent 2ef8a630f9
commit 7e5972dae7
6 changed files with 23 additions and 54 deletions

View File

@ -120,7 +120,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;
@ -185,6 +184,8 @@ public class BrowserToolbar extends GeckoRelativeLayout
private final ForegroundColorSpan mDomainColor;
private final ForegroundColorSpan mPrivateDomainColor;
private final LightweightTheme mTheme;
private boolean mShowUrl;
private boolean mTrimURLs;
@ -196,6 +197,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;
@ -272,7 +274,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);
@ -1772,7 +1773,6 @@ public class BrowserToolbar extends GeckoRelativeLayout
updateForwardButton(tab.canDoForward());
final boolean isPrivate = tab.isPrivate();
mUrlBarBackground.setPrivateMode(isPrivate);
setPrivateMode(isPrivate);
mTabs.setPrivateMode(isPrivate);
mTitle.setPrivateMode(isPrivate);
@ -1860,4 +1860,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);
}
}

View File

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.gecko;
import org.mozilla.gecko.widget.GeckoLinearLayout;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
public class BrowserToolbarBackground extends GeckoLinearLayout {
private final LightweightTheme mTheme;
public BrowserToolbarBackground(Context context, AttributeSet attrs) {
super(context, attrs);
mTheme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();
}
@Override
public void onLightweightThemeChanged() {
final Drawable drawable = mTheme.getDrawable(this);
if (drawable == null)
return;
final 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);
}
}

View File

@ -99,7 +99,6 @@ gbjar.sources += [
'BaseGeckoInterface.java',
'BrowserApp.java',
'BrowserToolbar.java',
'BrowserToolbarBackground.java',
'CameraImageResultHandler.java',
'CameraVideoResultHandler.java',
'CanvasDelegate.java',

View File

@ -6,11 +6,6 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto">
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/url_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/url_bar_bg"/>
<org.mozilla.gecko.ShapedButton android:id="@+id/tabs"
style="@style/UrlBar.ImageButton"
android:layout_width="84dip"

View File

@ -12,11 +12,6 @@
<ImageButton android:id="@+id/forward"
style="@style/UrlBar.ImageButton.Unused"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/url_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/url_bar_bg"/>
<ImageView android:id="@+id/url_bar_entry"
style="@style/UrlBar.Button"
android:layout_marginLeft="4dp"

View File

@ -72,7 +72,8 @@
android:layout_width="fill_parent"
android:layout_height="@dimen/browser_toolbar_height"
android:clickable="true"
android:focusable="true"/>
android:focusable="true"
android:background="@drawable/url_bar_bg"/>
</view>