--- a/mobile/android/app/src/main/res/values/attrs.xml
+++ b/mobile/android/app/src/main/res/values/attrs.xml
@@ -191,10 +191,14 @@
</declare-styleable>
<declare-styleable name="AnimatedProgressBar">
<attr name="wrapShiftDrawable" format="boolean" />
<attr name="shiftDuration" format="reference" />
<attr name="shiftInterpolator" format="reference" />
</declare-styleable>
+ <declare-styleable name="ToolbarRoundButton">
+ <attr name="showLWTBackground" format="boolean"/>
+ </declare-styleable>
+
</resources>
--- a/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ForwardButton.java
+++ b/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ForwardButton.java
@@ -7,16 +7,17 @@ package org.mozilla.gecko.toolbar;
import android.content.Context;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.lwt.LightweightTheme;
public class ForwardButton extends NavButton {
public ForwardButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
@@ -34,21 +35,31 @@ public class ForwardButton extends NavBu
public void onLightweightThemeChanged() {
final Drawable drawable = BrowserToolbar.getLightweightThemeDrawable(this, getTheme(), R.color.toolbar_grey);
if (drawable == null) {
return;
}
final StateListDrawable stateList = new StateListDrawable();
- stateList.addState(PRIVATE_PRESSED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_private_pressed));
- stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_pressed));
- stateList.addState(PRIVATE_STATE_SET, getColorDrawable(android.R.color.transparent));
+
+ final LightweightTheme lightweightTheme = getTheme();
+ if (!lightweightTheme.isEnabled() || isPrivateMode()) {
+ stateList.addState(PRIVATE_PRESSED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_private_pressed));
+ stateList.addState(PRIVATE_STATE_SET, getColorDrawable(android.R.color.transparent));
+ stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_pressed));
+ } else {
+ if (lightweightTheme.isLightTheme()) {
+ stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_lwt_light_pressed));
+ } else {
+ stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_lwt_dark_pressed));
+ }
+ }
+
stateList.addState(EMPTY_STATE_SET, drawable);
-
setBackgroundDrawable(stateList);
}
@Override
public void onLightweightThemeReset() {
setBackgroundResource(R.drawable.url_bar_forward_button);
}
}
--- a/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
+++ b/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarDisplayLayout.java
@@ -98,17 +98,17 @@ public class ToolbarDisplayLayout extend
private final BrowserApp mActivity;
private UIMode mUiMode;
private boolean mIsAttached;
private final ThemedTextView mTitle;
- private final ThemedView mTitleBackground;
+ private final ThemedLinearLayout mThemeBackground;
private final int mTitlePadding;
private final HorizontalScrollView mTitleScroll;
private final int mMinUrlScrollMargin;
private ToolbarPrefs mPrefs;
private OnTitleChangeListener mTitleChangeListener;
private final ThemedImageButton mSiteSecurity;
private final ThemedImageButton mStop;
@@ -145,17 +145,17 @@ public class ToolbarDisplayLayout extend
super(context, attrs);
setOrientation(HORIZONTAL);
mActivity = (BrowserApp) context;
LayoutInflater.from(context).inflate(R.layout.toolbar_display_layout, this);
mTitle = (ThemedTextView) findViewById(R.id.url_bar_title);
- mTitleBackground = (ThemedView) findViewById(R.id.url_bar_title_bg);
+ mThemeBackground = (ThemedLinearLayout) findViewById(R.id.url_bar_title_bg);
mTitlePadding = mTitle.getPaddingRight();
mTitleScroll = (HorizontalScrollView) findViewById(R.id.url_bar_title_scroll_view);
final OnLayoutChangeListener resizeListener = new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
final int oldWidth = oldRight - oldLeft;
final int newWidth = right - left;
@@ -194,17 +194,17 @@ public class ToolbarDisplayLayout extend
@Override
public void setPrivateMode(boolean isPrivate) {
super.setPrivateMode(isPrivate);
mSiteSecurity.setPrivateMode(isPrivate);
mStop.setPrivateMode(isPrivate);
mPageActionLayout.setPrivateMode(isPrivate);
mTitle.setPrivateMode(isPrivate);
- mTitleBackground.setPrivateMode(isPrivate);
+ mThemeBackground.setPrivateMode(isPrivate);
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
mIsAttached = true;
@@ -272,17 +272,17 @@ public class ToolbarDisplayLayout extend
}
if (flags.contains(UpdateFlags.PROGRESS)) {
updateProgress(tab);
}
if (flags.contains(UpdateFlags.PRIVATE_MODE)) {
mTitle.setPrivateMode(tab.isPrivate());
- mTitleBackground.setPrivateMode(tab.isPrivate());
+ mThemeBackground.setPrivateMode(tab.isPrivate());
}
}
void setTitle(CharSequence title) {
mTitle.setText(title);
if (TextUtils.isEmpty(title)) {
// Reset TextDirection to Locale in order to reveal text hint in correct direction
--- a/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarRoundButton.java
+++ b/mobile/android/app/src/photon/java/org/mozilla/gecko/toolbar/ToolbarRoundButton.java
@@ -5,23 +5,26 @@
package org.mozilla.gecko.toolbar;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.StateListDrawable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.lwt.LightweightTheme;
class ToolbarRoundButton extends ShapedButton {
+ private boolean mShowLWTBackground;
private Drawable mBackgroundDrawable;
public ToolbarRoundButton(Context context) {
this(context, null);
}
public ToolbarRoundButton(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -33,16 +36,20 @@ class ToolbarRoundButton extends ShapedB
final TypedArray a = context.obtainStyledAttributes(attrs, new int[] { android.R.attr.background });
mBackgroundDrawable = a.getDrawable(0);
if (mBackgroundDrawable == null) {
// Use default value if no background specified.
mBackgroundDrawable = ContextCompat.getDrawable(context, R.drawable.url_bar_action_button);
}
a.recycle();
+ final TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ToolbarRoundButton);
+ mShowLWTBackground = ta.getBoolean(R.styleable.ToolbarRoundButton_showLWTBackground, false);
+ ta.recycle();
+
setPrivateMode(false);
}
@Override
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
super.onSizeChanged(width, height, oldWidth, oldHeight);
mPath.reset();
@@ -53,16 +60,27 @@ class ToolbarRoundButton extends ShapedB
final int hSpace = res.getDimensionPixelSize(R.dimen.browser_toolbar_image_button_h_spacing);
final RectF rect = new RectF(hSpace, vSpace, width - hSpace, height - vSpace);
final int radius = res.getDimensionPixelSize(R.dimen.browser_toolbar_menu_radius);
mPath.addRoundRect(rect, radius, radius, Path.Direction.CW);
}
@Override
public void onLightweightThemeChanged() {
- setBackground(mBackgroundDrawable);
+ final LightweightTheme lightweightTheme = getTheme();
+ if (!lightweightTheme.isEnabled() || isPrivateMode()) {
+ setBackground(mBackgroundDrawable);
+ } else {
+ final StateListDrawable stateList = new StateListDrawable();
+ final int backgroundColorRes = lightweightTheme.isLightTheme()
+ ? R.color.action_bar_item_bg_color_lwt_light_pressed
+ : R.color.action_bar_item_bg_color_lwt_dark_pressed;
+ stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(backgroundColorRes));
+ stateList.addState(EMPTY_STATE_SET, getColorDrawable(android.R.color.transparent));
+ setBackgroundDrawable(stateList);
+ }
}
@Override
public void onLightweightThemeReset() {
setBackground(mBackgroundDrawable);
}
}
--- a/mobile/android/app/src/photon/res/color/url_bar_title_hint.xml
+++ b/mobile/android/app/src/photon/res/color/url_bar_title_hint.xml
@@ -4,12 +4,18 @@
- 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">
<!-- private browsing mode -->
<item android:color="@color/photon_text_placeholder_private" gecko:state_private="true" />
+ <!-- dark theme -->
+ <item android:color="@color/photon_text_placeholder_private" gecko:state_dark="true" />
+
+ <!-- light theme -->
+ <item android:color="@color/photon_text_placeholder_private" gecko:state_light="true" />
+
<!-- normal mode -->
<item android:color="@color/photon_text_placeholder" />
</selector>
--- a/mobile/android/app/src/photon/res/drawable/menu_item_button.xml
+++ b/mobile/android/app/src/photon/res/drawable/menu_item_button.xml
@@ -31,16 +31,72 @@
<shape>
<solid android:color="@color/action_bar_item_bg_color_private_pressed"/>
<corners android:radius="@dimen/browser_toolbar_menu_radius"/>
</shape>
</inset>
</item>
<item android:state_enabled="true"
+ android:state_pressed="true"
+ gecko:state_dark="true">
+ <inset android:insetBottom="@dimen/browser_toolbar_image_button_v_spacing"
+ android:insetLeft="@dimen/browser_toolbar_image_button_h_spacing"
+ android:insetRight="@dimen/browser_toolbar_image_button_h_spacing"
+ android:insetTop="@dimen/browser_toolbar_image_button_v_spacing">
+ <shape>
+ <solid android:color="@color/action_bar_item_bg_color_lwt_dark_pressed"/>
+ <corners android:radius="@dimen/browser_toolbar_menu_radius"/>
+ </shape>
+ </inset>
+ </item>
+
+ <item android:state_focused="true"
+ android:state_pressed="false"
+ gecko:state_dark="true">
+ <inset android:insetBottom="@dimen/browser_toolbar_image_button_v_spacing"
+ android:insetLeft="@dimen/browser_toolbar_image_button_h_spacing"
+ android:insetRight="@dimen/browser_toolbar_image_button_h_spacing"
+ android:insetTop="@dimen/browser_toolbar_image_button_v_spacing">
+ <shape>
+ <solid android:color="@color/action_bar_item_bg_color_lwt_dark_pressed"/>
+ <corners android:radius="@dimen/browser_toolbar_menu_radius"/>
+ </shape>
+ </inset>
+ </item>
+
+ <item android:state_enabled="true"
+ android:state_pressed="true"
+ gecko:state_light="true">
+ <inset android:insetBottom="@dimen/browser_toolbar_image_button_v_spacing"
+ android:insetLeft="@dimen/browser_toolbar_image_button_h_spacing"
+ android:insetRight="@dimen/browser_toolbar_image_button_h_spacing"
+ android:insetTop="@dimen/browser_toolbar_image_button_v_spacing">
+ <shape>
+ <solid android:color="@color/action_bar_item_bg_color_lwt_light_pressed"/>
+ <corners android:radius="@dimen/browser_toolbar_menu_radius"/>
+ </shape>
+ </inset>
+ </item>
+
+ <item android:state_focused="true"
+ android:state_pressed="false"
+ gecko:state_light="true">
+ <inset android:insetBottom="@dimen/browser_toolbar_image_button_v_spacing"
+ android:insetLeft="@dimen/browser_toolbar_image_button_h_spacing"
+ android:insetRight="@dimen/browser_toolbar_image_button_h_spacing"
+ android:insetTop="@dimen/browser_toolbar_image_button_v_spacing">
+ <shape>
+ <solid android:color="@color/action_bar_item_bg_color_lwt_light_pressed"/>
+ <corners android:radius="@dimen/browser_toolbar_menu_radius"/>
+ </shape>
+ </inset>
+ </item>
+
+ <item android:state_enabled="true"
android:state_pressed="true">
<inset android:insetBottom="@dimen/browser_toolbar_image_button_v_spacing"
android:insetLeft="@dimen/browser_toolbar_image_button_h_spacing"
android:insetRight="@dimen/browser_toolbar_image_button_h_spacing"
android:insetTop="@dimen/browser_toolbar_image_button_v_spacing">
<shape>
<solid android:color="@color/action_bar_item_bg_color_pressed"/>
<corners android:radius="@dimen/browser_toolbar_menu_radius"/>
--- a/mobile/android/app/src/photon/res/drawable/tab_strip_item_bg.xml
+++ b/mobile/android/app/src/photon/res/drawable/tab_strip_item_bg.xml
@@ -15,19 +15,16 @@
<item android:drawable="@color/photon_tab_strip_item_private_checked"
android:state_checked="true"
gecko:state_private="true"/>
<item android:drawable="@color/photon_tab_strip_item_private_pressed"
android:state_pressed="true"
gecko:state_private="true"/>
- <item android:drawable="@color/photon_tab_strip_item_private"
- gecko:state_private="true"/>
-
<!-- dark theme-->
<item android:drawable="@color/photon_tab_strip_item_lwt_checked_pressed"
android:state_checked="true"
android:state_pressed="true"
gecko:state_dark="true"/>
<item android:drawable="@color/photon_tab_strip_item_lwt_checked"
android:state_checked="true"
@@ -63,11 +60,11 @@
android:state_pressed="true"/>
<item android:drawable="@color/photon_tab_strip_item_checked"
android:state_checked="true"/>
<item android:drawable="@color/photon_tab_strip_item_pressed"
android:state_pressed="true"/>
- <item android:drawable="@color/photon_tab_strip_item"/>
+ <item android:drawable="@android:color/transparent"/>
</selector>
--- a/mobile/android/app/src/photon/res/drawable/url_bar_title_bg.xml
+++ b/mobile/android/app/src/photon/res/drawable/url_bar_title_bg.xml
@@ -7,19 +7,27 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto">
<!-- private browsing mode -->
<item android:drawable="@android:color/transparent"
gecko:state_private="true"/>
<!-- dark theme -->
- <item android:drawable="@color/photon_url_bar_bg"
- gecko:state_dark="true"/>
+ <item gecko:state_dark="true">
+ <shape android:shape="rectangle">
+ <corners android:radius="2dp"/>
+ <solid android:color="@color/photon_url_bar_bg"/>
+ </shape>
+ </item>
<!-- light theme -->
- <item android:drawable="@color/photon_url_bar_bg"
- gecko:state_light="true"/>
+ <item gecko:state_light="true">
+ <shape android:shape="rectangle">
+ <corners android:radius="2dp"/>
+ <solid android:color="@color/photon_url_bar_bg"/>
+ </shape>
+ </item>
<!-- normal mode -->
<item android:drawable="@android:color/transparent"/>
</selector>
--- a/mobile/android/app/src/photon/res/layout-large-v11/browser_toolbar.xml
+++ b/mobile/android/app/src/photon/res/layout-large-v11/browser_toolbar.xml
@@ -64,17 +64,18 @@
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"/>
<org.mozilla.gecko.toolbar.ToolbarRoundButton
android:id="@+id/tabs"
style="@style/UrlBar.Tabs"
android:layout_alignWithParentIfMissing="true"
- android:background="@drawable/url_bar_action_button"/>
+ android:background="@drawable/url_bar_action_button"
+ gecko:showLWTBackground="true"/>
<!-- In a 56x60dp space, centering 24dp image will leave 16x18dp. -->
<org.mozilla.gecko.toolbar.TabCounter
android:id="@+id/tabs_counter"
style="@style/UrlBar.TabCounter"
android:layout_alignBottom="@id/tabs"
android:layout_alignTop="@id/tabs"
android:gravity="center"/>
@@ -91,17 +92,18 @@
<org.mozilla.gecko.toolbar.ToolbarRoundButton
android:id="@+id/menu"
style="@style/UrlBar.Menu"
android:layout_alignWithParentIfMissing="true"
android:background="@drawable/url_bar_action_button"
android:contentDescription="@string/menu"
android:scaleType="center"
- android:src="@drawable/ic_overflow"/>
+ android:src="@drawable/ic_overflow"
+ gecko:showLWTBackground="true"/>
<!-- We draw after the menu items so when they are hidden, the cancel button,
which is thus drawn on top, may be pressed. -->
<org.mozilla.gecko.widget.themed.ThemedImageView
android:id="@+id/edit_cancel"
style="@style/UrlBar.EditCancel"
android:contentDescription="@string/edit_mode_cancel"
android:src="@drawable/close_edit_mode_selector"
--- a/mobile/android/app/src/photon/res/layout/browser_toolbar.xml
+++ b/mobile/android/app/src/photon/res/layout/browser_toolbar.xml
@@ -39,23 +39,25 @@
android:src="@android:color/transparent"
android:visibility="invisible"/>
<org.mozilla.gecko.toolbar.ToolbarRoundButton
android:id="@+id/menu"
style="@style/UrlBar.Menu"
android:background="@drawable/url_bar_action_button"
android:contentDescription="@string/menu"
- android:src="@drawable/ic_overflow"/>
+ android:src="@drawable/ic_overflow"
+ gecko:showLWTBackground="true"/>
<org.mozilla.gecko.toolbar.ToolbarRoundButton
android:id="@+id/tabs"
style="@style/UrlBar.Tabs"
android:layout_alignWithParentIfMissing="true"
- android:background="@drawable/url_bar_action_button"/>
+ android:background="@drawable/url_bar_action_button"
+ gecko:showLWTBackground="true"/>
<org.mozilla.gecko.toolbar.TabCounter
android:id="@+id/tabs_counter"
style="@style/UrlBar.TabCounter"
android:layout_height="24dip"
android:layout_centerVertical="true"
android:clipChildren="false"
android:clipToPadding="false"
@@ -65,17 +67,18 @@
<!-- Note that the edit components are invisible so that the views
depending on their location can properly layout. -->
<org.mozilla.gecko.toolbar.ToolbarRoundButton
android:id="@+id/edit_cancel"
style="@style/UrlBar.EditCancel"
android:background="@drawable/url_bar_action_button"
android:contentDescription="@string/edit_mode_cancel"
android:src="@drawable/ic_cancel"
- android:visibility="invisible"/>
+ android:visibility="invisible"
+ gecko:showLWTBackground="true"/>
<!-- The space to the left of the cancel button would be larger than the right because
the url bar drawable contains some whitespace, so we compensate by removing
some padding from the right (value determined through experimentation). -->
<org.mozilla.gecko.toolbar.ToolbarEditLayout
android:id="@+id/edit_layout"
style="@style/UrlBar.EditLayout"
android:visibility="invisible"/>
--- a/mobile/android/app/src/photon/res/layout/toolbar_display_layout.xml
+++ b/mobile/android/app/src/photon/res/layout/toolbar_display_layout.xml
@@ -12,36 +12,32 @@
tools:layout_width="match_parent"
tools:parentTag="LinearLayout">
<!-- The site security icon is misaligned with the page title so
we add a bottom margin to align their bottoms.
Site security icon must have exact position and size as search icon in
edit layout -->
- <org.mozilla.gecko.widget.themed.ThemedImageButton
- android:id="@+id/site_security"
- style="@style/UrlBar.SiteIdentity"
+ <org.mozilla.gecko.widget.themed.ThemedLinearLayout
+ android:id="@+id/url_bar_title_bg"
+ style="@style/UrlBar.ThemeBackground"
+ android:layout_width="0dp"
+ android:layout_height="@dimen/browser_toolbar_url_height"
+ android:layout_weight="1"
android:layout_gravity="center_vertical"
- android:background="@drawable/url_bar_title_bg"
- android:contentDescription="@string/site_security"
- android:src="@drawable/security_mode_icon"
- tools:src="@drawable/ic_lock"/>
+ android:background="@drawable/url_bar_title_bg">
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1.0">
-
- <org.mozilla.gecko.widget.themed.ThemedView
- android:id="@+id/url_bar_title_bg"
- android:layout_width="match_parent"
- android:layout_height="@dimen/browser_toolbar_url_height"
+ <org.mozilla.gecko.widget.themed.ThemedImageButton
+ android:id="@+id/site_security"
+ style="@style/UrlBar.SiteIdentity"
android:layout_gravity="center_vertical"
- android:background="@drawable/url_bar_title_bg"/>
+ android:contentDescription="@string/site_security"
+ android:src="@drawable/security_mode_icon"
+ tools:src="@drawable/ic_lock"/>
<!-- We need this on a separate layer to avoid fading out the toolbar background as well
and we can't use a hardware layer because that causes problems with the snapshot
for our toolbar animation.-->
<org.mozilla.gecko.widget.FadedHorizontalScrollView
android:id="@+id/url_bar_title_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -54,28 +50,29 @@
<org.mozilla.gecko.widget.themed.ThemedTextView
android:id="@+id/url_bar_title"
style="@style/UrlBar.Title"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"/>
</org.mozilla.gecko.widget.FadedHorizontalScrollView>
- </FrameLayout>
+ </org.mozilla.gecko.widget.themed.ThemedLinearLayout>
<org.mozilla.gecko.toolbar.PageActionLayout
android:id="@+id/page_action_layout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:visibility="gone"
tools:visibility="visible"/>
<org.mozilla.gecko.toolbar.ToolbarRoundButton
android:id="@+id/stop"
style="@style/UrlBar.ImageButton"
android:background="@drawable/url_bar_action_button"
android:contentDescription="@string/stop"
android:src="@drawable/ic_cancel"
android:visibility="gone"
- tools:visibility="visible"/>
+ tools:visibility="visible"
+ gecko:showLWTBackground="true"/>
</merge>
--- a/mobile/android/app/src/photon/res/layout/toolbar_edit_layout.xml
+++ b/mobile/android/app/src/photon/res/layout/toolbar_edit_layout.xml
@@ -8,45 +8,55 @@
xmlns:gecko="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:background="@android:color/holo_green_light"
tools:layout_height="@dimen/browser_toolbar_height"
tools:layout_width="match_parent"
tools:orientation="horizontal"
tools:parentTag="LinearLayout">
- <!-- Search icon must have exact position and size as site security in
- display layout -->
- <org.mozilla.gecko.widget.themed.ThemedImageButton
- android:id="@+id/search_icon"
- style="@style/UrlBar.SiteIdentity"
+ <org.mozilla.gecko.widget.themed.ThemedLinearLayout
+ android:id="@+id/url_bar_title_bg"
+ style="@style/UrlBar.ThemeBackground"
+ android:layout_width="0dp"
+ android:layout_height="@dimen/browser_toolbar_url_height"
+ android:layout_weight="1"
android:layout_gravity="center_vertical"
- android:background="@drawable/url_bar_title_bg"
- android:scaleType="center"
- android:src="@drawable/ic_search_icon"
- android:visibility="gone"
- tools:visibility="visible"/>
+ android:background="@drawable/url_bar_title_bg">
- <org.mozilla.gecko.toolbar.ToolbarEditText
- android:id="@+id/url_edit_text"
- style="@style/UrlBar.EditLayout.Title"
- android:layout_width="match_parent"
- android:layout_gravity="center_vertical"
- android:layout_weight="1.0"
- android:background="@drawable/url_bar_title_bg"
- android:contentDescription="@string/url_bar_default_text"
- android:imeOptions="actionGo|flagNoExtractUi|flagNoFullscreen"
- android:inputType="textUri"
- android:selectAllOnFocus="true"/>
+ <!-- Search icon must have exact position and size as site security in
+ display layout -->
+ <org.mozilla.gecko.widget.themed.ThemedImageButton
+ android:id="@+id/search_icon"
+ style="@style/UrlBar.SiteIdentity"
+ android:layout_gravity="center_vertical"
+ android:scaleType="center"
+ android:src="@drawable/ic_search_icon"
+ android:visibility="gone"
+ tools:visibility="visible"/>
+
+ <org.mozilla.gecko.toolbar.ToolbarEditText
+ android:id="@+id/url_edit_text"
+ style="@style/UrlBar.EditLayout.Title"
+ android:layout_width="match_parent"
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1.0"
+ android:contentDescription="@string/url_bar_default_text"
+ android:imeOptions="actionGo|flagNoExtractUi|flagNoFullscreen"
+ android:inputType="textUri"
+ android:selectAllOnFocus="true"/>
+ </org.mozilla.gecko.widget.themed.ThemedLinearLayout>
<org.mozilla.gecko.toolbar.ToolbarRoundButton
android:id="@+id/qrcode"
style="@style/UrlBar.QRCode"
android:background="@drawable/url_bar_action_button"
- android:src="@drawable/ic_qrcode"/>
+ android:src="@drawable/ic_qrcode"
+ gecko:showLWTBackground="true"/>
<org.mozilla.gecko.toolbar.ToolbarRoundButton
android:id="@+id/mic"
style="@style/UrlBar.ImageButton"
android:background="@drawable/url_bar_action_button"
- android:src="@drawable/ic_mic"/>
+ android:src="@drawable/ic_mic"
+ gecko:showLWTBackground="true"/>
</merge>
--- a/mobile/android/app/src/photon/res/values-large-v17/styles.xml
+++ b/mobile/android/app/src/photon/res/values-large-v17/styles.xml
@@ -76,20 +76,26 @@
</style>
<style name="UrlBar.EditCancel" parent="UrlBar.V17.EditCancel" />
<style name="UrlBar.V17.EditCancel" parent="UrlBar.Base.EditCancel">
<item name="android:layout_alignParentEnd">true</item>
</style>
+ <style name="UrlBar.ThemeBackground" parent="UrlBar.V17.ThemeBackground"/>
+
+ <style name="UrlBar.V17.ThemeBackground" parent="UrlBar.Base">
+ <item name="android:layout_marginStart">8dp</item>
+ </style>
+
<style name="UrlBar.SiteIdentity" parent="UrlBar.V17.SiteIdentity" />
<style name="UrlBar.V17.SiteIdentity" parent="UrlBar.Base.SiteIdentity">
- <item name="android:layout_marginStart">8dp</item>
+ <item name="android:paddingStart">3dp</item>
<item name="android:paddingEnd">@dimen/browser_toolbar_site_security_margin_end</item>
</style>
<style name="TabsTray.AddTab" parent="TabsTray.V17.AddTab"/>
<style name="TabsTray.V17.AddTab" parent="TabsTray.Base.AddTab"/>
<style name="TabsTray.Menu" parent="TabsTray.V17.Menu"/>
<style name="TabsTray.V17.Menu" parent="TabsTray.Base.Menu">
--- a/mobile/android/app/src/photon/res/values-large/dimens.xml
+++ b/mobile/android/app/src/photon/res/values-large/dimens.xml
@@ -12,23 +12,25 @@
<dimen name="browser_toolbar_button_padding">16dp</dimen>
<dimen name="browser_toolbar_icon_width">@dimen/browser_toolbar_height</dimen>
<dimen name="browser_toolbar_menu_radius">4dp</dimen>
<dimen name="browser_toolbar_favicon_size">16dp</dimen>
<dimen name="browser_toolbar_image_button_width">48dp</dimen>
<!-- ToolbarImageButton's pressed-highlight region is different from clickable region.
Our design is to make pressed-highlight region to be square. this vertical spacing value
- helps drawable xml to set padding: (56 - 48) / 2 -->
- <dimen name="browser_toolbar_image_button_v_spacing">4dp</dimen>
- <dimen name="browser_toolbar_image_button_h_spacing">4dp</dimen>
+ helps drawable xml to set padding: (56 - 36) / 2 -->
+ <dimen name="browser_toolbar_image_button_v_spacing">10dp</dimen>
+ <dimen name="browser_toolbar_image_button_h_spacing">10dp</dimen>
<dimen name="browser_toolbar_site_security_width">34dp</dimen>
<dimen name="browser_toolbar_site_security_margin_end">6dp</dimen>
+ <dimen name="browser_toolbar_url_height">36dp</dimen>
+
<dimen name="firstrun_background_height">300dp</dimen>
<dimen name="tabs_panel_indicator_width">96dp</dimen>
<dimen name="tabs_panel_button_width">60dp</dimen>
<dimen name="panel_grid_view_column_width">200dp</dimen>
<dimen name="overlay_prompt_container_width">360dp</dimen>
--- a/mobile/android/app/src/photon/res/values-large/styles.xml
+++ b/mobile/android/app/src/photon/res/values-large/styles.xml
@@ -195,20 +195,26 @@
<style name="UrlBar.EditCancel" parent="UrlBar.V15.EditCancel" />
<style name="UrlBar.Base.EditCancel" parent="UrlBar.ImageButton" />
<style name="UrlBar.V15.EditCancel" parent="UrlBar.Base.EditCancel">
<item name="android:layout_alignParentRight">true</item>
</style>
+ <style name="UrlBar.ThemeBackground" parent="UrlBar.V15.ThemeBackground"/>
+
+ <style name="UrlBar.V15.ThemeBackground" parent="UrlBar.Base">
+ <item name="android:layout_marginLeft">8dp</item>
+ </style>
+
<style name="UrlBar.SiteIdentity" parent="UrlBar.V15.SiteIdentity" />
<style name="UrlBar.V15.SiteIdentity" parent="UrlBar.Base.SiteIdentity">
- <item name="android:layout_marginLeft">8dp</item>
+ <item name="android:paddingLeft">3dp</item>
<item name="android:paddingRight">@dimen/browser_toolbar_site_security_margin_end</item>
</style>
<style name="TabsTray.AddTab" parent="TabsTray.V15.AddTab"/>
<style name="TabsTray.V15.AddTab" parent="TabsTray.Base.AddTab"/>
<style name="TabsTray.Menu" parent="TabsTray.V15.Menu"/>
<style name="TabsTray.V15.Menu" parent="TabsTray.Base.Menu">
--- a/mobile/android/app/src/photon/res/values-v17/styles.xml
+++ b/mobile/android/app/src/photon/res/values-v17/styles.xml
@@ -1,15 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
+ <style name="UrlBar.ThemeBackground" parent="UrlBar.V17.ThemeBackground"/>
+
+ <style name="UrlBar.V17.ThemeBackground" parent="UrlBar.Base">
+ <item name="android:layout_marginStart">5dp</item>
+ </style>
<style name="UrlBar.SiteIdentity" parent="UrlBar.V17.SiteIdentity" />
<style name="UrlBar.V17.SiteIdentity" parent="UrlBar.Base.SiteIdentity">
- <item name="android:layout_marginStart">5dp</item>
<item name="android:paddingEnd">@dimen/browser_toolbar_site_security_margin_end</item>
</style>
<style name="UrlBar.Entry" parent="UrlBar.V17.Entry" />
<style name="UrlBar.V17.Entry" parent="UrlBar.Base.Entry">
<item name="android:layout_marginStart">5dp</item>
<item name="android:layout_toStartOf">@+id/tabs</item>
--- a/mobile/android/app/src/photon/res/values/colors.xml
+++ b/mobile/android/app/src/photon/res/values/colors.xml
@@ -64,27 +64,25 @@
<color name="photon_search_item_text_private">@color/photon_text_main_private</color>
<color name="photon_url_bar_blocked">#D70022</color>
<color name="photon_url_bar_blocked_private">#D70022</color>
<color name="photon_url_bar_certificate_owner">#05A700</color>
<color name="photon_url_bar_certificate_owner_private">#16DA00</color>
<color name="photon_url_bar_domain">@color/photon_text_main</color>
<color name="photon_url_bar_domain_private">@color/photon_text_main_private</color>
- <color name="photon_url_bar_bg">#80FFFFFF</color>
+ <color name="photon_url_bar_bg">#B3FFFFFF</color>
<!-- Tab strip color on tablet -->
<color name="photon_tab_strip_bg">#272727</color>
<!-- Tab strip item color on tablet -->
- <color name="photon_tab_strip_item">#272727</color>
<color name="photon_tab_strip_item_checked">#F9F9FA</color>
<color name="photon_tab_strip_item_checked_pressed">#E4E4E5</color> <!-- #F9F9FA + #272727@10% Alpha -->
<color name="photon_tab_strip_item_pressed">#3D3C3D</color> <!-- #272727 + #FFFFFF@10% Alpha -->
- <color name="photon_tab_strip_item_private">#272727</color>
<color name="photon_tab_strip_item_private_checked">#38383D</color>
<color name="photon_tab_strip_item_private_checked_pressed">#4C4B51</color> <!-- #38383D + #FFFFFF@10% Alpha -->
<color name="photon_tab_strip_item_private_pressed">#3D3C3D</color> <!-- #272727 + #FFFFFF@10% Alpha -->
<color name="photon_tab_strip_item_lwt_checked">#CCF9F9FA</color> <!-- 80% -->
<color name="photon_tab_strip_item_lwt_checked_pressed">#99FFFFFF</color> <!-- 60% -->
<color name="photon_tab_strip_item_lwt">#66E4E4E4</color> <!-- 40% -->
<color name="photon_tab_strip_item_lwt_pressed">#33FFFFFF</color> <!-- 20% -->
@@ -115,16 +113,18 @@
<color name="nav_button_bg_color_private">#2A2A2A</color>
<color name="nav_button_bg_color_private_disabled">#0DFFFFFF</color>
<color name="nav_button_bg_color_private_focused">#1AFFFFFF</color>
<color name="nav_button_bg_color_private_pressed">#33FFFFFF</color>
<color name="nav_button_border_color">#E4E4E4</color>
<color name="nav_button_border_color_private">#272727</color>
<color name="action_bar_item_bg_color_pressed">#33272727</color>
+ <color name="action_bar_item_bg_color_lwt_dark_pressed">#B3FFFFFF</color>
+ <color name="action_bar_item_bg_color_lwt_light_pressed">#80B2B2B2</color>
<color name="action_bar_item_bg_color_private_pressed">#33FFFFFF</color>
<!-- Fennec color palette (bug 1127517) -->
<color name="fennec_ui_accent">@color/photon_highlight</color>
<color name="affirmative_green">#6FBE4A</color>
<color name="rejection_red">#D23228</color>
<color name="action_accent">#0979D9</color>
<color name="link_blue">#0096DD</color>
@@ -219,18 +219,18 @@
<color name="tab_item_normal_bg">#F9F9FA</color>
<color name="tab_item_private_bg">#38383D</color>
<color name="tab_item_normal_highlight_bg">#0a84ff</color>
<color name="tab_item_normal_highlight_bg_80">#CC0a84ff</color>
<color name="tab_item_private_highlight_bg">#AC39FF</color>
<color name="tab_item_private_highlight_bg_80">#CCAC39FF</color>
<color name="tab_item_thumbnail_default_bg">#E4E4E4</color>
- <color name="url_bar_urltext">@color/photon_text_placeholder</color>
- <color name="url_bar_urltext_private">@color/photon_text_placeholder_private</color>
+ <color name="url_bar_urltext">#737373</color>
+ <color name="url_bar_urltext_private">#B2B2B2</color>
<color name="url_bar_domaintext">@color/photon_url_bar_domain</color>
<color name="url_bar_domaintext_private">@color/photon_url_bar_domain_private</color>
<color name="url_bar_blockedtext">@color/photon_url_bar_blocked</color>
<color name="url_bar_blockedtext_private">@color/photon_url_bar_blocked_private</color>
<color name="url_bar_certificate_owner">@color/photon_url_bar_certificate_owner</color>
<color name="url_bar_certificate_owner_private">@color/photon_url_bar_certificate_owner_private</color>
<color name="url_bar_shadow">#12000000</color>
--- a/mobile/android/app/src/photon/res/values/dimens.xml
+++ b/mobile/android/app/src/photon/res/values/dimens.xml
@@ -10,19 +10,19 @@
<dimen name="autocomplete_min_width">200dp</dimen>
<dimen name="autocomplete_row_height">32dp</dimen>
<dimen name="browser_toolbar_height">56dp</dimen>
<dimen name="browser_toolbar_image_button_width">42dp</dimen>
<!-- ToolbarImageButton's pressed-highlight region is different from clickable region.
Our design is to make pressed-highlight region to be square. this vertical spacing value
- helps drawable xml to set padding: (56 - 42) / 2 -->
- <dimen name="browser_toolbar_image_button_v_spacing">7dp</dimen>
- <dimen name="browser_toolbar_image_button_h_spacing">0dp</dimen>
+ helps drawable xml to set padding: (56 - 32) / 2 -->
+ <dimen name="browser_toolbar_image_button_v_spacing">12dp</dimen>
+ <dimen name="browser_toolbar_image_button_h_spacing">5dp</dimen>
<!-- This value is the height of the Tabs Panel header view
(browser_toolbar_height) minus the height of the indicator
(4dp). This value should change when the height of the view changes. -->
<dimen name="tabs_panel_indicator_selected_padding_top">52dp</dimen>
<!-- We use two different values for browser_toolbar_height on tablet
which is inconsistent. Temporary value until bug 1150730 is fixed. -->
--- a/mobile/android/app/src/photon/res/values/styles.xml
+++ b/mobile/android/app/src/photon/res/values/styles.xml
@@ -840,25 +840,29 @@
border around them. When changing these values, consider favicons downloaded from the internet and
those provided by suggested sites, including suggested sites from distributions. -->
<style name="ActivityStreamFaviconView">
<item name="enableRoundCorners">false</item>
<item name="overrideScaleType">false</item>
<item name="android:scaleType">centerInside</item>
</style>
+ <style name="UrlBar.ThemeBackground" parent="UrlBar.V15.ThemeBackground"/>
+ <style name="UrlBar.V15.ThemeBackground" parent="UrlBar.Base">
+ <item name="android:layout_marginLeft">5dp</item>
+ </style>
+
<!-- URL bar - Site identity -->
<style name="UrlBar.SiteIdentity" parent="UrlBar.V15.SiteIdentity"/>
<style name="UrlBar.Base.SiteIdentity" parent="UrlBar.Button">
<item name="android:layout_width">@dimen/browser_toolbar_site_security_width</item>
<item name="android:layout_height">@dimen/browser_toolbar_url_height</item>
<item name="android:scaleType">center</item>
</style>
<style name="UrlBar.V15.SiteIdentity" parent="UrlBar.Base.SiteIdentity">
- <item name="android:layout_marginLeft">5dp</item>
<item name="android:paddingRight">@dimen/browser_toolbar_site_security_margin_end</item>
</style>
<style name="UrlBar.Entry" parent="UrlBar.V15.Entry"/>
<style name="UrlBar.Base.Entry" parent="UrlBar.Button"/>
<style name="UrlBar.V15.Entry" parent="UrlBar.Base.Entry">
<item name="android:layout_marginLeft">5dp</item>
<item name="android:layout_toLeftOf">@+id/tabs</item>
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/BrowserToolbar.java
@@ -81,17 +81,17 @@ import android.support.annotation.NonNul
* to state changes accordingly.
*/
public abstract class BrowserToolbar extends ThemedRelativeLayout
implements Tabs.OnTabsChangedListener,
GeckoMenu.ActionItemBarPresenter {
private static final String LOGTAG = "GeckoToolbar";
private static final int LIGHTWEIGHT_THEME_INVERT_ALPHA_START = 204; // 255 - alpha = invert_alpha
- private static final int LIGHTWEIGHT_THEME_INVERT_ALPHA_END = 102;
+ private static final int LIGHTWEIGHT_THEME_INVERT_ALPHA_END = 179;
public static final int LIGHTWEIGHT_THEME_INVERT_ALPHA_TABLET = 51;
public interface OnActivateListener {
public void onActivate();
}
public interface OnCommitListener {
public void onCommit();
--- a/mobile/android/base/java/org/mozilla/gecko/toolbar/NavButton.java
+++ b/mobile/android/base/java/org/mozilla/gecko/toolbar/NavButton.java
@@ -2,16 +2,17 @@
* 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.toolbar;
import android.content.res.TypedArray;
import android.support.v4.content.ContextCompat;
import org.mozilla.gecko.R;
+import org.mozilla.gecko.lwt.LightweightTheme;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
@@ -79,23 +80,35 @@ abstract class NavButton extends ShapedB
public void onLightweightThemeChanged() {
final Drawable drawable = BrowserToolbar.getLightweightThemeDrawable(this, getTheme(), R.color.toolbar_grey);
if (drawable == null) {
return;
}
final StateListDrawable stateList = new StateListDrawable();
- stateList.addState(PRIVATE_PRESSED_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_private_pressed));
- stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_pressed));
- stateList.addState(PRIVATE_FOCUSED_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_private_focused));
- stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_focused));
- stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_private));
+
+ final LightweightTheme lightweightTheme = getTheme();
+ if (!lightweightTheme.isEnabled() || isPrivateMode()) {
+ stateList.addState(PRIVATE_PRESSED_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_private_pressed));
+ stateList.addState(PRIVATE_FOCUSED_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_private_focused));
+ stateList.addState(PRIVATE_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_private));
+ stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_pressed));
+ stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.nav_button_bg_color_focused));
+ } else {
+ if (lightweightTheme.isLightTheme()) {
+ stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_lwt_light_pressed));
+ stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_lwt_light_pressed));
+ } else {
+ stateList.addState(PRESSED_ENABLED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_lwt_dark_pressed));
+ stateList.addState(FOCUSED_STATE_SET, getColorDrawable(R.color.action_bar_item_bg_color_lwt_dark_pressed));
+ }
+ }
+
stateList.addState(EMPTY_STATE_SET, drawable);
-
setBackgroundDrawable(stateList);
}
@Override
public void onLightweightThemeReset() {
setBackgroundResource(R.drawable.url_bar_nav_button);
}
}