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

This commit is contained in:
Lucas Rocha 2013-11-22 13:33:15 +00:00
Родитель 7326350fe4
Коммит 114bc8b06f
5 изменённых файлов: 23 добавлений и 15 удалений

Просмотреть файл

@ -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',

Просмотреть файл

@ -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.toolbar.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.toolbar.ShapedButton android:id="@+id/tabs"
style="@style/UrlBar.ImageButton"
android:layout_width="84dip"

Просмотреть файл

@ -12,11 +12,6 @@
<ImageButton android:id="@+id/forward"
style="@style/UrlBar.ImageButton.Unused"/>
<org.mozilla.gecko.toolbar.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"

Просмотреть файл

@ -73,7 +73,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>

Просмотреть файл

@ -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);
}
}