Commit 1f9b9a7c authored by jwu's avatar jwu
Browse files

Bug 1366668 - Part 2: Apply new toolbar visual design on tablet. r=nechen,walkingice

MozReview-Commit-ID: DikmnNSpTQt

--HG--
extra : rebase_source : 7871e0fd76f06af261176ab89034431d05e60a84
extra : source : 4a8734955caf87d834b779065f2dea54f234ee8f
parent b100bb77
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
/* 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.toolbar;

import android.content.Context;
import android.util.AttributeSet;

import org.mozilla.gecko.widget.themed.ThemedImageButton;

class ToolbarRoundButton extends ThemedImageButton {

    public ToolbarRoundButton(Context context) {
        this(context, null);
    }

    public ToolbarRoundButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ToolbarRoundButton(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@
    </style>

    <style name="UrlBar.Button.Container">
        <item name="android:layout_marginTop">6dp</item>
        <item name="android:layout_marginBottom">6dp</item>
        <!-- Start with forward hidden -->
        <item name="android:orientation">horizontal</item>
    </style>
+9 −0
Original line number Diff line number Diff line
@@ -35,6 +35,15 @@
  <color name="restricted_profile_background_gold">#ffffcb51</color>
  <color name="restricted_profile_background_green">#1aaa86</color>

  <!-- Status bar background color -->
  <color name="status_bar_bg_color">@android:color/transparent</color>
  <color name="status_bar_bg_color_private">@android:color/transparent</color>
  <color name="status_bar_bg_color_tablet">@android:color/transparent</color>

  <!-- Toolbar menu item tint color -->
  <color name="menu_item_tint">@color/toolbar_icon_grey</color>
  <color name="menu_item_tint_private">@color/toolbar_icon_grey</color>

  <!-- Non-palette colors -->

  <!-- Synced w/ toolbar_grey -->
+5 −0
Original line number Diff line number Diff line
@@ -176,5 +176,10 @@
        <attr name="drawableTintList" format="color" />
    </declare-styleable>

    <declare-styleable name="NavButton">
        <attr name="borderColor" format="color" />
        <attr name="borderColorPrivate" format="color" />
    </declare-styleable>

</resources>
+55 −0
Original line number Diff line number Diff line
/* 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.toolbar;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;

import org.mozilla.gecko.R;

class ToolbarRoundButton extends ShapedButton {

    public ToolbarRoundButton(Context context) {
        this(context, null);
    }

    public ToolbarRoundButton(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ToolbarRoundButton(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        setPrivateMode(false);
    }

    @Override
    protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
        super.onSizeChanged(width, height, oldWidth, oldHeight);

        mPath.reset();
        mPath.setFillType(Path.FillType.INVERSE_EVEN_ODD);

        final Resources res = getResources();
        final int vSpace = res.getDimensionPixelSize(R.dimen.browser_toolbar_image_button_v_spacing);
        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() {
        setBackgroundResource(R.drawable.url_bar_action_button);
    }

    @Override
    public void onLightweightThemeReset() {
        setBackgroundResource(R.drawable.url_bar_action_button);
    }
}
Loading