Bug 1105541 - Part 3: Change add tab button to a dark color on light themes on new tablet. r=mhaigh

This commit is contained in:
Michael Comella 2014-12-12 14:03:28 -08:00
parent 5a1f77ba87
commit d2201742b6
6 changed files with 23 additions and 9 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto">
<item gecko:state_private="true"
android:drawable="@drawable/tab_new_pb"/>
<item gecko:state_light="true"
android:drawable="@drawable/new_tablet_tab_new_dark"/>
<item android:drawable="@drawable/tab_new"/>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

@ -14,11 +14,11 @@
<!-- The right margin creates a "dead area" on the right side of the button <!-- The right margin creates a "dead area" on the right side of the button
which we compensate for with a touch delegate. See TabStrip --> which we compensate for with a touch delegate. See TabStrip -->
<ImageButton <org.mozilla.gecko.widget.ThemedImageButton
android:id="@+id/add_tab" android:id="@+id/add_tab"
style="@style/UrlBar.ImageButton" style="@style/UrlBar.ImageButton"
android:layout_width="@dimen/new_tablet_tab_strip_height" android:layout_width="@dimen/new_tablet_tab_strip_height"
android:src="@drawable/tab_new_level" android:src="@drawable/new_tablet_tab_strip_add_tab"
android:contentDescription="@string/new_tab" android:contentDescription="@string/new_tab"
android:layout_marginRight="9dp" android:layout_marginRight="9dp"
android:background="@drawable/new_tablet_tab_strip_button"/> android:background="@drawable/new_tablet_tab_strip_button"/>

View File

@ -14,21 +14,18 @@ import android.view.LayoutInflater;
import android.view.TouchDelegate; import android.view.TouchDelegate;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver; import android.view.ViewTreeObserver;
import android.widget.ImageButton;
import org.mozilla.gecko.R; import org.mozilla.gecko.R;
import org.mozilla.gecko.Tab; import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs; import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.widget.ThemedImageButton;
import org.mozilla.gecko.widget.ThemedLinearLayout; import org.mozilla.gecko.widget.ThemedLinearLayout;
public class TabStrip extends ThemedLinearLayout { public class TabStrip extends ThemedLinearLayout {
private static final String LOGTAG = "GeckoTabStrip"; private static final String LOGTAG = "GeckoTabStrip";
private static final int IMAGE_LEVEL_NORMAL = 0;
private static final int IMAGE_LEVEL_PRIVATE = 1;
private final TabStripView tabStripView; private final TabStripView tabStripView;
private final ImageButton addTabButton; private final ThemedImageButton addTabButton;
private final TabsListener tabsListener; private final TabsListener tabsListener;
@ -43,7 +40,7 @@ public class TabStrip extends ThemedLinearLayout {
LayoutInflater.from(context).inflate(R.layout.tab_strip, this); LayoutInflater.from(context).inflate(R.layout.tab_strip, this);
tabStripView = (TabStripView) findViewById(R.id.tab_strip); tabStripView = (TabStripView) findViewById(R.id.tab_strip);
addTabButton = (ImageButton) findViewById(R.id.add_tab); addTabButton = (ThemedImageButton) findViewById(R.id.add_tab);
addTabButton.setOnClickListener(new View.OnClickListener() { addTabButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -97,7 +94,7 @@ public class TabStrip extends ThemedLinearLayout {
@Override @Override
public void setPrivateMode(boolean isPrivate) { public void setPrivateMode(boolean isPrivate) {
super.setPrivateMode(isPrivate); super.setPrivateMode(isPrivate);
addTabButton.setImageLevel(isPrivate ? IMAGE_LEVEL_PRIVATE : IMAGE_LEVEL_NORMAL); addTabButton.setPrivateMode(isPrivate);
} }
private class TabsListener implements Tabs.OnTabsChangedListener { private class TabsListener implements Tabs.OnTabsChangedListener {