зеркало из https://github.com/mozilla/gecko-dev.git
Bug 848719: TabsButton will have curve only one side. [r=mfinkle] [needs-clobber]
--HG-- extra : rebase_source : 815c210eb08dbe17801fd951822a0b3908ed96a6
This commit is contained in:
Родитель
6000b18725
Коммит
8253fa41ba
|
@ -136,7 +136,7 @@ public class AwesomeBar extends GeckoActivity {
|
||||||
BrowserToolbarBackground mAddressBarBg = (BrowserToolbarBackground) findViewById(R.id.address_bar_bg);
|
BrowserToolbarBackground mAddressBarBg = (BrowserToolbarBackground) findViewById(R.id.address_bar_bg);
|
||||||
mAddressBarBg.setPrivateMode(true);
|
mAddressBarBg.setPrivateMode(true);
|
||||||
|
|
||||||
TabsButton mTabs = (TabsButton) findViewById(R.id.dummy_tab);
|
ShapedButton mTabs = (ShapedButton) findViewById(R.id.dummy_tab);
|
||||||
if (mTabs != null)
|
if (mTabs != null)
|
||||||
mTabs.setPrivateMode(true);
|
mTabs.setPrivateMode(true);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import android.graphics.drawable.StateListDrawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
public class BackButton extends ShapedButton {
|
public class BackButton extends ShapedButton {
|
||||||
|
private Path mPath;
|
||||||
private Path mBorderPath;
|
private Path mBorderPath;
|
||||||
private Paint mBorderPaint;
|
private Paint mBorderPaint;
|
||||||
private Paint mBorderPrivatePaint;
|
private Paint mBorderPrivatePaint;
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
private int mTitlePadding;
|
private int mTitlePadding;
|
||||||
private boolean mSiteSecurityVisible;
|
private boolean mSiteSecurityVisible;
|
||||||
private boolean mAnimateSiteSecurity;
|
private boolean mAnimateSiteSecurity;
|
||||||
private TabsButton mTabs;
|
private ShapedButton mTabs;
|
||||||
private int mTabsPaneWidth;
|
private int mTabsPaneWidth;
|
||||||
private ImageButton mBack;
|
private ImageButton mBack;
|
||||||
private ImageButton mForward;
|
private ImageButton mForward;
|
||||||
|
@ -217,7 +217,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mTabs = (TabsButton) mLayout.findViewById(R.id.tabs);
|
mTabs = (ShapedButton) mLayout.findViewById(R.id.tabs);
|
||||||
mTabs.setOnClickListener(new Button.OnClickListener() {
|
mTabs.setOnClickListener(new Button.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -906,21 +906,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
mActivity.getString(R.string.num_tabs, count) :
|
mActivity.getString(R.string.num_tabs, count) :
|
||||||
mActivity.getString(R.string.one_tab));
|
mActivity.getString(R.string.one_tab));
|
||||||
mCount = count;
|
mCount = count;
|
||||||
mHandler.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
GeckoTextView view = (GeckoTextView) mTabsCount.getCurrentView();
|
|
||||||
view.setSelected(true);
|
|
||||||
}
|
|
||||||
}, mDuration);
|
|
||||||
|
|
||||||
mHandler.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
GeckoTextView view = (GeckoTextView) mTabsCount.getCurrentView();
|
|
||||||
view.setSelected(false);
|
|
||||||
}
|
|
||||||
}, 2 * mDuration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTabCount(int count) {
|
public void updateTabCount(int count) {
|
||||||
|
@ -1005,27 +990,10 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTabs(boolean areTabsShown) {
|
public void updateTabs(boolean areTabsShown) {
|
||||||
if (areTabsShown) {
|
if (areTabsShown)
|
||||||
mTabs.getBackground().setLevel(TABS_EXPANDED);
|
mTabs.setImageLevel(TABS_EXPANDED);
|
||||||
|
else
|
||||||
if (!mActivity.hasTabsSideBar()) {
|
|
||||||
mTabs.setImageLevel(0);
|
|
||||||
mTabsCount.setVisibility(View.GONE);
|
|
||||||
mMenu.setImageLevel(TABS_EXPANDED);
|
|
||||||
mMenu.getBackground().setLevel(TABS_EXPANDED);
|
|
||||||
} else {
|
|
||||||
mTabs.setImageLevel(TABS_EXPANDED);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mTabs.setImageLevel(TABS_CONTRACTED);
|
mTabs.setImageLevel(TABS_CONTRACTED);
|
||||||
mTabs.getBackground().setLevel(TABS_CONTRACTED);
|
|
||||||
|
|
||||||
if (!mActivity.hasTabsSideBar()) {
|
|
||||||
mTabsCount.setVisibility(View.VISIBLE);
|
|
||||||
mMenu.setImageLevel(TABS_CONTRACTED);
|
|
||||||
mMenu.getBackground().setLevel(TABS_CONTRACTED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// A level change will not trigger onMeasure() for the tabs, where the path is created.
|
// A level change will not trigger onMeasure() for the tabs, where the path is created.
|
||||||
// Manually requesting a layout to re-calculate the path.
|
// Manually requesting a layout to re-calculate the path.
|
||||||
|
@ -1033,11 +1001,9 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsSideBar(boolean isSideBar) {
|
public void setIsSideBar(boolean isSideBar) {
|
||||||
mTabs.setIsSideBar(isSideBar);
|
|
||||||
|
|
||||||
Resources resources = mActivity.getResources();
|
Resources resources = mActivity.getResources();
|
||||||
mTabs.setImageDrawable(resources.getDrawable(R.drawable.tabs_level));
|
mTabs.setImageDrawable(resources.getDrawable(R.drawable.tabs_level));
|
||||||
mTabs.setBackgroundDrawable(resources.getDrawable(R.drawable.tabs_button));
|
mTabs.setBackgroundDrawable(resources.getDrawable(R.drawable.shaped_button));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProgressVisibility(boolean visible) {
|
public void setProgressVisibility(boolean visible) {
|
||||||
|
|
|
@ -65,10 +65,9 @@ public final class GeckoViewsFactory implements LayoutInflater.Factory {
|
||||||
mFactoryMap.put("MenuItemDefault", MenuItemDefault.class.getConstructor(arg1Class, arg2Class));
|
mFactoryMap.put("MenuItemDefault", MenuItemDefault.class.getConstructor(arg1Class, arg2Class));
|
||||||
mFactoryMap.put("FindInPageBar", FindInPageBar.class.getConstructor(arg1Class, arg2Class));
|
mFactoryMap.put("FindInPageBar", FindInPageBar.class.getConstructor(arg1Class, arg2Class));
|
||||||
mFactoryMap.put("IconTabWidget", IconTabWidget.class.getConstructor(arg1Class, arg2Class));
|
mFactoryMap.put("IconTabWidget", IconTabWidget.class.getConstructor(arg1Class, arg2Class));
|
||||||
mFactoryMap.put("MenuButton", MenuButton.class.getConstructor(arg1Class, arg2Class));
|
|
||||||
mFactoryMap.put("RemoteTabs", RemoteTabs.class.getConstructor(arg1Class, arg2Class));
|
mFactoryMap.put("RemoteTabs", RemoteTabs.class.getConstructor(arg1Class, arg2Class));
|
||||||
|
mFactoryMap.put("ShapedButton", ShapedButton.class.getConstructor(arg1Class, arg2Class));
|
||||||
mFactoryMap.put("TabRow", TabRow.class.getConstructor(arg1Class, arg2Class));
|
mFactoryMap.put("TabRow", TabRow.class.getConstructor(arg1Class, arg2Class));
|
||||||
mFactoryMap.put("TabsButton", TabsButton.class.getConstructor(arg1Class, arg2Class));
|
|
||||||
mFactoryMap.put("TabsPanel", TabsPanel.class.getConstructor(arg1Class, arg2Class));
|
mFactoryMap.put("TabsPanel", TabsPanel.class.getConstructor(arg1Class, arg2Class));
|
||||||
mFactoryMap.put("TabsPanel$TabsListContainer", TabsPanel.TabsListContainer.class.getConstructor(arg1Class, arg2Class));
|
mFactoryMap.put("TabsPanel$TabsListContainer", TabsPanel.TabsListContainer.class.getConstructor(arg1Class, arg2Class));
|
||||||
mFactoryMap.put("TabsPanel$TabsPanelToolbar", TabsPanel.TabsPanelToolbar.class.getConstructor(arg1Class, arg2Class));
|
mFactoryMap.put("TabsPanel$TabsPanelToolbar", TabsPanel.TabsPanelToolbar.class.getConstructor(arg1Class, arg2Class));
|
||||||
|
|
|
@ -112,7 +112,6 @@ FENNEC_JAVA_FILES = \
|
||||||
LightweightThemeDrawable.java \
|
LightweightThemeDrawable.java \
|
||||||
LinkPreference.java \
|
LinkPreference.java \
|
||||||
MemoryMonitor.java \
|
MemoryMonitor.java \
|
||||||
MenuButton.java \
|
|
||||||
MenuItemActionBar.java \
|
MenuItemActionBar.java \
|
||||||
MenuItemDefault.java \
|
MenuItemDefault.java \
|
||||||
MenuPanel.java \
|
MenuPanel.java \
|
||||||
|
@ -146,7 +145,6 @@ FENNEC_JAVA_FILES = \
|
||||||
SurfaceBits.java \
|
SurfaceBits.java \
|
||||||
Tab.java \
|
Tab.java \
|
||||||
Tabs.java \
|
Tabs.java \
|
||||||
TabsButton.java \
|
|
||||||
TabsPanel.java \
|
TabsPanel.java \
|
||||||
TabsTray.java \
|
TabsTray.java \
|
||||||
TabsAccessor.java \
|
TabsAccessor.java \
|
||||||
|
@ -917,7 +915,6 @@ RES_DRAWABLE_LAND_XHDPI_V14 = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
RES_DRAWABLE_LARGE_LAND_V11 = \
|
RES_DRAWABLE_LARGE_LAND_V11 = \
|
||||||
res/drawable-large-land-v11/tabs_button.xml \
|
|
||||||
res/drawable-large-land-v11/tabs_level.xml \
|
res/drawable-large-land-v11/tabs_level.xml \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
@ -1027,18 +1024,17 @@ MOZ_ANDROID_DRAWABLES += \
|
||||||
mobile/android/base/resources/drawable/ic_menu_desktop_mode_off.xml \
|
mobile/android/base/resources/drawable/ic_menu_desktop_mode_off.xml \
|
||||||
mobile/android/base/resources/drawable/ic_menu_desktop_mode_on.xml \
|
mobile/android/base/resources/drawable/ic_menu_desktop_mode_on.xml \
|
||||||
mobile/android/base/resources/drawable/ic_menu_quit.xml \
|
mobile/android/base/resources/drawable/ic_menu_quit.xml \
|
||||||
mobile/android/base/resources/drawable/menu_button.xml \
|
|
||||||
mobile/android/base/resources/drawable/menu_item_state.xml \
|
mobile/android/base/resources/drawable/menu_item_state.xml \
|
||||||
mobile/android/base/resources/drawable/menu_level.xml \
|
mobile/android/base/resources/drawable/menu_level.xml \
|
||||||
mobile/android/base/resources/drawable/progress_spinner.xml \
|
mobile/android/base/resources/drawable/progress_spinner.xml \
|
||||||
mobile/android/base/resources/drawable/remote_tabs_child_divider.xml \
|
mobile/android/base/resources/drawable/remote_tabs_child_divider.xml \
|
||||||
|
mobile/android/base/resources/drawable/shaped_button.xml \
|
||||||
mobile/android/base/resources/drawable/site_security_level.xml \
|
mobile/android/base/resources/drawable/site_security_level.xml \
|
||||||
mobile/android/base/resources/drawable/spinner.xml \
|
mobile/android/base/resources/drawable/spinner.xml \
|
||||||
mobile/android/base/resources/drawable/suggestion_selector.xml \
|
mobile/android/base/resources/drawable/suggestion_selector.xml \
|
||||||
mobile/android/base/resources/drawable/tab_new_level.xml \
|
mobile/android/base/resources/drawable/tab_new_level.xml \
|
||||||
mobile/android/base/resources/drawable/tab_row.xml \
|
mobile/android/base/resources/drawable/tab_row.xml \
|
||||||
mobile/android/base/resources/drawable/tab_thumbnail.xml \
|
mobile/android/base/resources/drawable/tab_thumbnail.xml \
|
||||||
mobile/android/base/resources/drawable/tabs_button.xml \
|
|
||||||
mobile/android/base/resources/drawable/tabs_level.xml \
|
mobile/android/base/resources/drawable/tabs_level.xml \
|
||||||
mobile/android/base/resources/drawable/tabs_panel_indicator.xml \
|
mobile/android/base/resources/drawable/tabs_panel_indicator.xml \
|
||||||
mobile/android/base/resources/drawable/webapp_titlebar_bg.xml \
|
mobile/android/base/resources/drawable/webapp_titlebar_bg.xml \
|
||||||
|
|
|
@ -1,82 +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 android.content.Context;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Path;
|
|
||||||
import android.graphics.PorterDuff.Mode;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.graphics.drawable.LevelListDrawable;
|
|
||||||
import android.graphics.drawable.StateListDrawable;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
|
|
||||||
public class MenuButton extends ShapedButton {
|
|
||||||
|
|
||||||
public MenuButton(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
|
|
||||||
// Path is clipped.
|
|
||||||
mPath = new Path();
|
|
||||||
mCanvasDelegate = new CanvasDelegate(this, Mode.DST_OUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
||||||
|
|
||||||
int width = getMeasuredWidth();
|
|
||||||
int height = getMeasuredHeight();
|
|
||||||
int curve = (int) (height * 1.125f);
|
|
||||||
|
|
||||||
mPath.reset();
|
|
||||||
|
|
||||||
// Clipping happens on opposite side for menu.
|
|
||||||
if (mSide == CurveTowards.RIGHT) {
|
|
||||||
mPath.moveTo(0, 0);
|
|
||||||
mPath.cubicTo(curve * 0.75f, 0,
|
|
||||||
curve * 0.25f, height,
|
|
||||||
curve, height);
|
|
||||||
mPath.lineTo(0, height);
|
|
||||||
mPath.lineTo(0, 0);
|
|
||||||
} else if (mSide == CurveTowards.LEFT) {
|
|
||||||
mPath.moveTo(width, 0);
|
|
||||||
mPath.cubicTo((width - (curve * 0.75f)), 0,
|
|
||||||
(width - (curve * 0.25f)), height,
|
|
||||||
(width - curve), height);
|
|
||||||
mPath.lineTo(width, height);
|
|
||||||
mPath.lineTo(width, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The drawable is constructed as per @drawable/menu_button.
|
|
||||||
@Override
|
|
||||||
public void onLightweightThemeChanged() {
|
|
||||||
LightweightThemeDrawable drawable = mActivity.getLightweightTheme().getColorDrawable(this, Color.BLACK);
|
|
||||||
if (drawable == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
drawable.setAlpha(34, 34);
|
|
||||||
|
|
||||||
Resources resources = getContext().getResources();
|
|
||||||
StateListDrawable stateList = new StateListDrawable();
|
|
||||||
stateList.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight_menu)));
|
|
||||||
stateList.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_menu_focused)));
|
|
||||||
stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(Color.BLACK));
|
|
||||||
stateList.addState(new int[] {}, drawable);
|
|
||||||
|
|
||||||
LevelListDrawable levelList = new LevelListDrawable();
|
|
||||||
levelList.addLevel(0, 1, stateList);
|
|
||||||
levelList.addLevel(2, 2, new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
setBackgroundDrawable(levelList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLightweightThemeReset() {
|
|
||||||
setBackgroundResource(R.drawable.menu_button);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,27 +5,34 @@
|
||||||
package org.mozilla.gecko;
|
package org.mozilla.gecko;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
|
import android.graphics.PorterDuff.Mode;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.graphics.drawable.LevelListDrawable;
|
||||||
|
import android.graphics.drawable.StateListDrawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
public class ShapedButton extends GeckoImageButton
|
public class ShapedButton extends GeckoImageButton
|
||||||
implements CanvasDelegate.DrawManager {
|
implements CanvasDelegate.DrawManager {
|
||||||
protected GeckoActivity mActivity;
|
protected GeckoActivity mActivity;
|
||||||
protected Path mPath;
|
|
||||||
protected CurveTowards mSide;
|
private Path mPath;
|
||||||
|
private CurveTowards mSide;
|
||||||
|
|
||||||
protected CanvasDelegate mCanvasDelegate;
|
protected CanvasDelegate mCanvasDelegate;
|
||||||
|
|
||||||
protected enum CurveTowards { NONE, LEFT, RIGHT };
|
private enum CurveTowards { NONE, LEFT, RIGHT };
|
||||||
|
|
||||||
public ShapedButton(Context context, AttributeSet attrs) {
|
public ShapedButton(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
mActivity = (GeckoActivity) context;
|
mActivity = (GeckoActivity) context;
|
||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BrowserToolbarCurve);
|
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BrowserToolbarCurve);
|
||||||
int curveTowards = a.getInt(R.styleable.BrowserToolbarCurve_curveTowards, 0x02);
|
int curveTowards = a.getInt(R.styleable.BrowserToolbarCurve_curveTowards, 0x00);
|
||||||
a.recycle();
|
a.recycle();
|
||||||
|
|
||||||
if (curveTowards == 0x00)
|
if (curveTowards == 0x00)
|
||||||
|
@ -35,12 +42,46 @@ public class ShapedButton extends GeckoImageButton
|
||||||
else
|
else
|
||||||
mSide = CurveTowards.RIGHT;
|
mSide = CurveTowards.RIGHT;
|
||||||
|
|
||||||
|
// Path is clipped.
|
||||||
|
mPath = new Path();
|
||||||
|
mCanvasDelegate = new CanvasDelegate(this, Mode.DST_OUT);
|
||||||
|
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
|
if (mSide == CurveTowards.NONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int width = getMeasuredWidth();
|
||||||
|
int height = getMeasuredHeight();
|
||||||
|
int curve = (int) (height * 1.125f);
|
||||||
|
|
||||||
|
mPath.reset();
|
||||||
|
|
||||||
|
if (mSide == CurveTowards.RIGHT) {
|
||||||
|
mPath.moveTo(0, 0);
|
||||||
|
mPath.cubicTo(curve * 0.75f, 0,
|
||||||
|
curve * 0.25f, height,
|
||||||
|
curve, height);
|
||||||
|
mPath.lineTo(0, height);
|
||||||
|
mPath.lineTo(0, 0);
|
||||||
|
} else if (mSide == CurveTowards.LEFT) {
|
||||||
|
mPath.moveTo(width, 0);
|
||||||
|
mPath.cubicTo((width - (curve * 0.75f)), 0,
|
||||||
|
(width - (curve * 0.25f)), height,
|
||||||
|
(width - curve), height);
|
||||||
|
mPath.lineTo(width, height);
|
||||||
|
mPath.lineTo(width, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
if (mCanvasDelegate != null)
|
if (mCanvasDelegate != null && mSide != CurveTowards.NONE)
|
||||||
mCanvasDelegate.draw(canvas, mPath, getWidth(), getHeight());
|
mCanvasDelegate.draw(canvas, mPath, getWidth(), getHeight());
|
||||||
else
|
else
|
||||||
defaultDraw(canvas);
|
defaultDraw(canvas);
|
||||||
|
@ -51,6 +92,32 @@ public class ShapedButton extends GeckoImageButton
|
||||||
super.draw(canvas);
|
super.draw(canvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The drawable is constructed as per @drawable/shaped_button.
|
||||||
|
@Override
|
||||||
|
public void onLightweightThemeChanged() {
|
||||||
|
int background = mActivity.getResources().getColor(R.color.background_tabs);
|
||||||
|
LightweightThemeDrawable lightWeight = mActivity.getLightweightTheme().getColorDrawable(this, background);
|
||||||
|
|
||||||
|
if (lightWeight == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
lightWeight.setAlpha(34, 34);
|
||||||
|
|
||||||
|
Resources resources = this.getContext().getResources();
|
||||||
|
StateListDrawable stateList = new StateListDrawable();
|
||||||
|
stateList.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight_shaped)));
|
||||||
|
stateList.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_shaped_focused)));
|
||||||
|
stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(resources.getColor(R.color.background_tabs)));
|
||||||
|
stateList.addState(new int[] {}, lightWeight);
|
||||||
|
|
||||||
|
setBackgroundDrawable(stateList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLightweightThemeReset() {
|
||||||
|
setBackgroundResource(R.drawable.shaped_button);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBackgroundDrawable(Drawable drawable) {
|
public void setBackgroundDrawable(Drawable drawable) {
|
||||||
if (getBackground() == null || drawable == null) {
|
if (getBackground() == null || drawable == null) {
|
||||||
|
|
|
@ -1,208 +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 android.content.Context;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.content.res.TypedArray;
|
|
||||||
import android.graphics.Canvas;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.Paint;
|
|
||||||
import android.graphics.Path;
|
|
||||||
import android.graphics.PorterDuff.Mode;
|
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.graphics.drawable.LevelListDrawable;
|
|
||||||
import android.graphics.drawable.StateListDrawable;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
|
|
||||||
public class TabsButton extends ShapedButton {
|
|
||||||
private Paint mPaint;
|
|
||||||
|
|
||||||
private Path mBackgroundPath;
|
|
||||||
private Path mLeftCurve;
|
|
||||||
private Path mRightCurve;
|
|
||||||
|
|
||||||
private boolean mCropped;
|
|
||||||
private boolean mSideBar;
|
|
||||||
|
|
||||||
public TabsButton(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
|
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TabsButton);
|
|
||||||
mCropped = a.getBoolean(R.styleable.TabsButton_cropped, false);
|
|
||||||
a.recycle();
|
|
||||||
|
|
||||||
mSideBar = false;
|
|
||||||
|
|
||||||
// Paint to draw the background.
|
|
||||||
mPaint = new Paint();
|
|
||||||
mPaint.setAntiAlias(true);
|
|
||||||
mPaint.setColor(0xFF000000);
|
|
||||||
mPaint.setStrokeWidth(0.0f);
|
|
||||||
|
|
||||||
// Path is masked.
|
|
||||||
mPath = new Path();
|
|
||||||
mBackgroundPath = new Path();
|
|
||||||
mLeftCurve = new Path();
|
|
||||||
mRightCurve = new Path();
|
|
||||||
mCanvasDelegate = new CanvasDelegate(this, Mode.DST_IN);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
||||||
|
|
||||||
int width = getMeasuredWidth();
|
|
||||||
int height = getMeasuredHeight();
|
|
||||||
int curve = (int) (height * 1.125f);
|
|
||||||
|
|
||||||
// The bounds for the rectangle to carve the curves.
|
|
||||||
float left;
|
|
||||||
float right;
|
|
||||||
float top;
|
|
||||||
float bottom;
|
|
||||||
|
|
||||||
if (mSide == CurveTowards.RIGHT) {
|
|
||||||
left = 0;
|
|
||||||
right = width;
|
|
||||||
top = 0;
|
|
||||||
bottom = height;
|
|
||||||
} else {
|
|
||||||
left = 0;
|
|
||||||
right = width;
|
|
||||||
top = height;
|
|
||||||
bottom = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLeftCurve.reset();
|
|
||||||
mLeftCurve.moveTo(left, top);
|
|
||||||
|
|
||||||
if (mCropped && mSide == CurveTowards.LEFT) {
|
|
||||||
mLeftCurve.lineTo(left, top/2);
|
|
||||||
mLeftCurve.quadTo(left * 0.95f, top * 0.05f, left + curve/2, bottom);
|
|
||||||
} else {
|
|
||||||
mLeftCurve.cubicTo(left + (curve * 0.75f), top,
|
|
||||||
left + (curve * 0.25f), bottom,
|
|
||||||
left + curve, bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
mRightCurve.reset();
|
|
||||||
mRightCurve.moveTo(right, bottom);
|
|
||||||
|
|
||||||
if (mCropped && mSide == CurveTowards.RIGHT) {
|
|
||||||
mRightCurve.lineTo(right, bottom/2);
|
|
||||||
mRightCurve.quadTo(right * 0.95f, bottom * 0.05f, right - (curve/2), top);
|
|
||||||
} else {
|
|
||||||
mRightCurve.cubicTo(right - (curve * 0.75f), bottom,
|
|
||||||
right - (curve * 0.25f), top,
|
|
||||||
right - curve, top);
|
|
||||||
}
|
|
||||||
|
|
||||||
mPath.reset();
|
|
||||||
|
|
||||||
// Level 2: for phones: transparent.
|
|
||||||
// for tablets: only one curve.
|
|
||||||
Drawable background = getBackground();
|
|
||||||
if (background == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(background.getCurrent() instanceof ColorDrawable)) {
|
|
||||||
if (background.getLevel() == 2) {
|
|
||||||
mPath.moveTo(left, top);
|
|
||||||
mPath.lineTo(left, bottom);
|
|
||||||
mPath.lineTo(right, bottom);
|
|
||||||
mPath.addPath(mRightCurve);
|
|
||||||
mPath.lineTo(left, top);
|
|
||||||
} else {
|
|
||||||
mPath.moveTo(left, top);
|
|
||||||
mPath.addPath(mLeftCurve);
|
|
||||||
mPath.lineTo(right, bottom);
|
|
||||||
mPath.addPath(mRightCurve);
|
|
||||||
mPath.lineTo(left, top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mCropped) {
|
|
||||||
mBackgroundPath.reset();
|
|
||||||
|
|
||||||
if (mSide == CurveTowards.RIGHT) {
|
|
||||||
mBackgroundPath.moveTo(right, bottom);
|
|
||||||
mBackgroundPath.addPath(mRightCurve);
|
|
||||||
mBackgroundPath.lineTo(right, top);
|
|
||||||
mBackgroundPath.lineTo(right, bottom);
|
|
||||||
} else {
|
|
||||||
mBackgroundPath.moveTo(left, top);
|
|
||||||
mBackgroundPath.addPath(mLeftCurve);
|
|
||||||
mBackgroundPath.lineTo(left, bottom);
|
|
||||||
mBackgroundPath.lineTo(left, top);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void draw(Canvas canvas) {
|
|
||||||
mCanvasDelegate.draw(canvas, mPath, getWidth(), getHeight());
|
|
||||||
|
|
||||||
Drawable background = getBackground();
|
|
||||||
if (background.getCurrent() instanceof ColorDrawable)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Additionally draw a black curve for cropped button's default level.
|
|
||||||
if (mCropped && background.getLevel() != 2)
|
|
||||||
canvas.drawPath(mBackgroundPath, mPaint);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The drawable is constructed as per @drawable/tabs_button.
|
|
||||||
@Override
|
|
||||||
public void onLightweightThemeChanged() {
|
|
||||||
int background1 = mActivity.getResources().getColor(R.color.background_tabs_light);
|
|
||||||
LightweightThemeDrawable lightWeight1 = mActivity.getLightweightTheme().getColorDrawable(this, background1);
|
|
||||||
int background2 = mActivity.getResources().getColor(R.color.background_tabs_dark);
|
|
||||||
LightweightThemeDrawable lightWeight2 = mActivity.getLightweightTheme().getColorDrawable(this, background2);
|
|
||||||
if (lightWeight1 == null || lightWeight2 == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
lightWeight1.setAlpha(34, 34);
|
|
||||||
lightWeight2.setAlpha(34, 34);
|
|
||||||
|
|
||||||
Resources resources = this.getContext().getResources();
|
|
||||||
StateListDrawable stateList1 = new StateListDrawable();
|
|
||||||
stateList1.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight_tabs)));
|
|
||||||
stateList1.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_tabs_focused)));
|
|
||||||
stateList1.addState(new int[] { R.attr.state_private }, new ColorDrawable(resources.getColor(R.color.background_tabs_light)));
|
|
||||||
stateList1.addState(new int[] {}, lightWeight1);
|
|
||||||
|
|
||||||
StateListDrawable stateList2 = new StateListDrawable();
|
|
||||||
stateList2.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(resources.getColor(R.color.highlight_tabs)));
|
|
||||||
stateList2.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(resources.getColor(R.color.highlight_tabs_focused)));
|
|
||||||
stateList2.addState(new int[] { R.attr.state_private }, new ColorDrawable(resources.getColor(R.color.background_tabs_dark)));
|
|
||||||
stateList2.addState(new int[] {}, lightWeight2);
|
|
||||||
|
|
||||||
LevelListDrawable levelList = new LevelListDrawable();
|
|
||||||
levelList.addLevel(0, 1, stateList1);
|
|
||||||
|
|
||||||
// If there is a side bar, the expanded state will have a filled button.
|
|
||||||
if (mSideBar)
|
|
||||||
levelList.addLevel(2, 2, stateList2);
|
|
||||||
else
|
|
||||||
levelList.addLevel(2, 2, new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
|
|
||||||
setBackgroundDrawable(levelList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLightweightThemeReset() {
|
|
||||||
setBackgroundResource(R.drawable.tabs_button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsSideBar(boolean isSideBar) {
|
|
||||||
if (mSideBar == isSideBar)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mSideBar = isSideBar;
|
|
||||||
requestLayout();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -173,7 +173,7 @@ public class TabsPanel extends LinearLayout
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLightweightThemeChanged() {
|
public void onLightweightThemeChanged() {
|
||||||
int background = mActivity.getResources().getColor(R.color.background_tabs_light);
|
int background = mActivity.getResources().getColor(R.color.background_tabs);
|
||||||
LightweightThemeDrawable drawable = mActivity.getLightweightTheme().getColorDrawable(this, background, true);
|
LightweightThemeDrawable drawable = mActivity.getLightweightTheme().getColorDrawable(this, background, true);
|
||||||
if (drawable == null)
|
if (drawable == null)
|
||||||
return;
|
return;
|
||||||
|
@ -184,7 +184,7 @@ public class TabsPanel extends LinearLayout
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLightweightThemeReset() {
|
public void onLightweightThemeReset() {
|
||||||
setBackgroundColor(getContext().getResources().getColor(R.color.background_tabs_light));
|
setBackgroundColor(getContext().getResources().getColor(R.color.background_tabs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -256,7 +256,7 @@ public class TabsPanel extends LinearLayout
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLightweightThemeChanged() {
|
public void onLightweightThemeChanged() {
|
||||||
int background = mActivity.getResources().getColor(R.color.background_tabs_dark);
|
int background = mActivity.getResources().getColor(R.color.background_tabs);
|
||||||
LightweightThemeDrawable drawable = mActivity.getLightweightTheme().getColorDrawable(this, background);
|
LightweightThemeDrawable drawable = mActivity.getLightweightTheme().getColorDrawable(this, background);
|
||||||
if (drawable == null)
|
if (drawable == null)
|
||||||
return;
|
return;
|
||||||
|
@ -267,7 +267,7 @@ public class TabsPanel extends LinearLayout
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLightweightThemeReset() {
|
public void onLightweightThemeReset() {
|
||||||
setBackgroundColor(getContext().getResources().getColor(R.color.background_tabs_dark));
|
setBackgroundColor(getContext().getResources().getColor(R.color.background_tabs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
<?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/. -->
|
|
||||||
|
|
||||||
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item android:maxLevel="1">
|
|
||||||
|
|
||||||
<selector>
|
|
||||||
|
|
||||||
<item android:state_pressed="true"
|
|
||||||
android:drawable="@color/highlight_tabs"/>
|
|
||||||
|
|
||||||
<item android:state_focused="true"
|
|
||||||
android:state_pressed="false"
|
|
||||||
android:drawable="@color/highlight_tabs_focused"/>
|
|
||||||
|
|
||||||
<item android:drawable="@color/background_tabs_light"/>
|
|
||||||
|
|
||||||
</selector>
|
|
||||||
|
|
||||||
</item>
|
|
||||||
|
|
||||||
<item android:maxLevel="2">
|
|
||||||
|
|
||||||
<selector>
|
|
||||||
|
|
||||||
<item android:state_pressed="true"
|
|
||||||
android:drawable="@color/highlight_tabs"/>
|
|
||||||
|
|
||||||
<item android:state_focused="true"
|
|
||||||
android:state_pressed="false"
|
|
||||||
android:drawable="@color/highlight_tabs_focused"/>
|
|
||||||
|
|
||||||
<item android:drawable="@color/background_tabs_dark"/>
|
|
||||||
|
|
||||||
</selector>
|
|
||||||
|
|
||||||
</item>
|
|
||||||
|
|
||||||
</level-list>
|
|
|
@ -1,27 +0,0 @@
|
||||||
<?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/. -->
|
|
||||||
|
|
||||||
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item android:maxLevel="1">
|
|
||||||
|
|
||||||
<selector>
|
|
||||||
|
|
||||||
<item android:state_pressed="true"
|
|
||||||
android:drawable="@color/highlight_menu"/>
|
|
||||||
|
|
||||||
<item android:state_focused="true"
|
|
||||||
android:state_pressed="false"
|
|
||||||
android:drawable="@color/highlight_menu_focused"/>
|
|
||||||
|
|
||||||
<item android:drawable="@android:color/black"/>
|
|
||||||
|
|
||||||
</selector>
|
|
||||||
|
|
||||||
</item>
|
|
||||||
|
|
||||||
<item android:maxLevel="2" android:drawable="@android:color/transparent"/>
|
|
||||||
|
|
||||||
</level-list>
|
|
|
@ -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">
|
||||||
|
|
||||||
|
<item android:state_pressed="true"
|
||||||
|
android:drawable="@color/highlight_shaped"/>
|
||||||
|
|
||||||
|
<item android:state_focused="true"
|
||||||
|
android:state_pressed="false"
|
||||||
|
android:drawable="@color/highlight_shaped_focused"/>
|
||||||
|
|
||||||
|
<item android:drawable="@color/background_tabs"/>
|
||||||
|
|
||||||
|
</selector>
|
|
@ -1,27 +0,0 @@
|
||||||
<?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/. -->
|
|
||||||
|
|
||||||
<level-list xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<item android:maxLevel="1">
|
|
||||||
|
|
||||||
<selector>
|
|
||||||
|
|
||||||
<item android:state_pressed="true"
|
|
||||||
android:drawable="@color/highlight_tabs"/>
|
|
||||||
|
|
||||||
<item android:state_focused="true"
|
|
||||||
android:state_pressed="false"
|
|
||||||
android:drawable="@color/highlight_tabs_focused"/>
|
|
||||||
|
|
||||||
<item android:drawable="@color/background_tabs_light"/>
|
|
||||||
|
|
||||||
</selector>
|
|
||||||
|
|
||||||
</item>
|
|
||||||
|
|
||||||
<item android:maxLevel="2" android:drawable="@android:color/transparent"/>
|
|
||||||
|
|
||||||
</level-list>
|
|
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
<item android:maxLevel="0" android:drawable="@android:color/transparent"/>
|
<item android:maxLevel="0" android:drawable="@android:color/transparent"/>
|
||||||
|
|
||||||
<item android:maxLevel="1" android:drawable="@drawable/tabs_carat"/>
|
<item android:maxLevel="2" android:drawable="@drawable/tabs_carat"/>
|
||||||
|
|
||||||
</level-list>
|
</level-list>
|
||||||
|
|
|
@ -18,19 +18,13 @@
|
||||||
<ImageButton style="@style/AddressBar.ImageButton.Forward"
|
<ImageButton style="@style/AddressBar.ImageButton.Forward"
|
||||||
android:id="@+id/forward"/>
|
android:id="@+id/forward"/>
|
||||||
|
|
||||||
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
|
||||||
android:layout_width="60dip"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:background="@color/background_tabs_dark"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_marginRight="14dip"
|
android:layout_marginRight="14dip"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
gecko:curveTowards="right"
|
||||||
android:background="@drawable/address_bar_bg"/>
|
android:background="@drawable/address_bar_bg"/>
|
||||||
|
|
||||||
<FrameLayout style="@style/AddressBar.Button.Container"
|
<FrameLayout style="@style/AddressBar.Button.Container"
|
||||||
|
@ -139,20 +133,19 @@
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.MenuButton android:id="@+id/menu"
|
<Gecko.ShapedButton android:id="@+id/menu"
|
||||||
style="@style/AddressBar.ImageButton.Unused"/>
|
style="@style/AddressBar.ImageButton.Unused"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.TabsButton android:id="@+id/tabs"
|
<Gecko.ShapedButton android:id="@+id/tabs"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="60dip"
|
android:layout_width="60dip"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
gecko:curveTowards="right"
|
gecko:curveTowards="right"
|
||||||
gecko:cropped="true"
|
android:background="@drawable/shaped_button"
|
||||||
android:background="@drawable/tabs_button"
|
android:gravity="center_vertical"
|
||||||
android:gravity="center_vertical"
|
android:src="@drawable/tabs_level"
|
||||||
android:src="@drawable/tabs_level"
|
android:paddingLeft="30dip"
|
||||||
android:paddingLeft="30dip"
|
android:paddingRight="10dip"/>
|
||||||
android:paddingRight="10dip"/>
|
|
||||||
|
|
||||||
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
|
|
|
@ -18,19 +18,13 @@
|
||||||
<ImageButton style="@style/AddressBar.ImageButton.Forward"
|
<ImageButton style="@style/AddressBar.ImageButton.Forward"
|
||||||
android:id="@+id/forward"/>
|
android:id="@+id/forward"/>
|
||||||
|
|
||||||
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
|
||||||
android:layout_width="95dip"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:background="@color/background_tabs_dark"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_marginRight="50dip"
|
android:layout_marginRight="50dip"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
gecko:curveTowards="right"
|
||||||
android:background="@drawable/address_bar_bg"/>
|
android:background="@drawable/address_bar_bg"/>
|
||||||
|
|
||||||
<FrameLayout style="@style/AddressBar.Button.Container"
|
<FrameLayout style="@style/AddressBar.Button.Container"
|
||||||
|
@ -139,32 +133,30 @@
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.MenuButton android:id="@+id/menu"
|
<Gecko.ShapedButton android:id="@+id/menu"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="60dip"
|
android:layout_width="40dip"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:src="@drawable/menu_level"
|
android:src="@drawable/menu_level"
|
||||||
android:contentDescription="@string/menu"
|
android:contentDescription="@string/menu"
|
||||||
android:background="@drawable/menu_button"
|
android:background="@drawable/shaped_button"/>
|
||||||
android:paddingLeft="30dip"
|
|
||||||
android:paddingRight="10dip"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.TabsButton android:id="@+id/tabs"
|
<Gecko.ShapedButton android:id="@+id/tabs"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="80dip"
|
android:layout_width="60dip"
|
||||||
android:layout_marginRight="15dip"
|
android:layout_marginRight="40dip"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
gecko:curveTowards="right"
|
gecko:curveTowards="right"
|
||||||
android:background="@drawable/tabs_button"
|
android:background="@drawable/shaped_button"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:src="@drawable/tabs_level"
|
android:src="@drawable/tabs_level"
|
||||||
android:paddingLeft="30dip"
|
android:paddingLeft="30dip"
|
||||||
android:paddingRight="30dip"/>
|
android:paddingRight="10dip"/>
|
||||||
|
|
||||||
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="80dip"
|
android:layout_width="39dip"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="4.5dp"
|
android:layout_marginTop="4.5dp"
|
||||||
android:layout_alignRight="@id/tabs"
|
android:layout_alignRight="@id/tabs"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:background="@color/background_tabs_dark">
|
android:background="@color/background_tabs">
|
||||||
|
|
||||||
<include layout="@layout/tabs_panel_header"/>
|
<include layout="@layout/tabs_panel_header"/>
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:background="@color/background_tabs_dark">
|
android:background="@color/background_tabs">
|
||||||
|
|
||||||
<include layout="@layout/tabs_panel_footer"/>
|
<include layout="@layout/tabs_panel_footer"/>
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,6 @@
|
||||||
<RelativeLayout android:id="@+id/address_bar"
|
<RelativeLayout android:id="@+id/address_bar"
|
||||||
style="@style/AddressBar">
|
style="@style/AddressBar">
|
||||||
|
|
||||||
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
|
||||||
android:layout_width="84dip"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:background="@color/background_tabs_dark"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
@ -23,17 +18,16 @@
|
||||||
gecko:curveTowards="left"
|
gecko:curveTowards="left"
|
||||||
android:background="@drawable/address_bar_bg"/>
|
android:background="@drawable/address_bar_bg"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.TabsButton android:id="@+id/tabs"
|
<Gecko.ShapedButton android:id="@+id/tabs"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="84dip"
|
android:layout_width="84dip"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
gecko:curveTowards="left"
|
gecko:curveTowards="left"
|
||||||
gecko:cropped="true"
|
android:background="@drawable/shaped_button"
|
||||||
android:background="@drawable/tabs_button"
|
android:gravity="center_vertical"
|
||||||
android:gravity="center_vertical"
|
android:src="@drawable/tabs_level"
|
||||||
android:src="@drawable/tabs_level"
|
android:paddingLeft="6dip"
|
||||||
android:paddingLeft="6dip"
|
android:paddingRight="38dip"/>
|
||||||
android:paddingRight="38dip"/>
|
|
||||||
|
|
||||||
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
|
|
|
@ -15,14 +15,13 @@
|
||||||
gecko:curveTowards="none"
|
gecko:curveTowards="none"
|
||||||
android:background="@drawable/address_bar_bg"/>
|
android:background="@drawable/address_bar_bg"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.TabsButton android:id="@+id/dummy_tab"
|
<Gecko.ShapedButton android:id="@+id/dummy_tab"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="84dip"
|
android:layout_width="84dip"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
gecko:curveTowards="left"
|
gecko:curveTowards="left"
|
||||||
gecko:cropped="true"
|
android:background="@drawable/shaped_button"
|
||||||
android:background="@drawable/tabs_button"
|
android:gravity="center_vertical"/>
|
||||||
android:gravity="center_vertical"/>
|
|
||||||
|
|
||||||
<view class="org.mozilla.gecko.CustomEditText"
|
<view class="org.mozilla.gecko.CustomEditText"
|
||||||
android:id="@+id/awesomebar_text"
|
android:id="@+id/awesomebar_text"
|
||||||
|
|
|
@ -18,19 +18,13 @@
|
||||||
<ImageButton style="@style/AddressBar.ImageButton.Forward"
|
<ImageButton style="@style/AddressBar.ImageButton.Forward"
|
||||||
android:id="@+id/forward"/>
|
android:id="@+id/forward"/>
|
||||||
|
|
||||||
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
|
||||||
android:layout_width="72dip"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:background="@color/background_tabs_dark"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_marginRight="18dip"
|
android:layout_marginRight="18dip"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
gecko:curveTowards="right"
|
||||||
android:background="@drawable/address_bar_bg"/>
|
android:background="@drawable/address_bar_bg"/>
|
||||||
|
|
||||||
<FrameLayout style="@style/AddressBar.Button.Container"
|
<FrameLayout style="@style/AddressBar.Button.Container"
|
||||||
|
@ -137,20 +131,19 @@
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.MenuButton android:id="@+id/menu"
|
<Gecko.ShapedButton android:id="@+id/menu"
|
||||||
style="@style/AddressBar.ImageButton.Unused"/>
|
style="@style/AddressBar.ImageButton.Unused"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.TabsButton android:id="@+id/tabs"
|
<Gecko.ShapedButton android:id="@+id/tabs"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="72dip"
|
android:layout_width="72dip"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
gecko:curveTowards="right"
|
gecko:curveTowards="right"
|
||||||
gecko:cropped="true"
|
android:background="@drawable/shaped_button"
|
||||||
android:background="@drawable/tabs_button"
|
android:gravity="center_vertical"
|
||||||
android:gravity="center_vertical"
|
android:src="@drawable/tabs_level"
|
||||||
android:src="@drawable/tabs_level"
|
android:paddingLeft="37dip"
|
||||||
android:paddingLeft="37dip"
|
android:paddingRight="11dip"/>
|
||||||
android:paddingRight="11dip"/>
|
|
||||||
|
|
||||||
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
|
|
|
@ -18,19 +18,13 @@
|
||||||
<ImageButton style="@style/AddressBar.ImageButton.Forward"
|
<ImageButton style="@style/AddressBar.ImageButton.Forward"
|
||||||
android:id="@+id/forward"/>
|
android:id="@+id/forward"/>
|
||||||
|
|
||||||
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
|
||||||
android:layout_width="120dip"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:background="@color/background_tabs_dark"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_marginRight="66dip"
|
android:layout_marginRight="66dip"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
gecko:curveTowards="right"
|
||||||
android:background="@drawable/address_bar_bg"/>
|
android:background="@drawable/address_bar_bg"/>
|
||||||
|
|
||||||
<FrameLayout style="@style/AddressBar.Button.Container"
|
<FrameLayout style="@style/AddressBar.Button.Container"
|
||||||
|
@ -137,33 +131,30 @@
|
||||||
android:layout_height="0dip"
|
android:layout_height="0dip"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<org.mozilla.gecko.MenuButton android:id="@+id/menu"
|
<Gecko.ShapedButton android:id="@+id/menu"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="76dip"
|
android:layout_width="48dip"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
gecko:curveTowards="right"
|
android:gravity="center_vertical"
|
||||||
android:gravity="center_vertical"
|
android:src="@drawable/menu_level"
|
||||||
android:src="@drawable/menu_level"
|
android:contentDescription="@string/menu"
|
||||||
android:contentDescription="@string/menu"
|
android:background="@drawable/shaped_button"/>
|
||||||
android:background="@drawable/menu_button"
|
|
||||||
android:paddingLeft="40dip"
|
|
||||||
android:paddingRight="12dip"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<org.mozilla.gecko.TabsButton android:id="@+id/tabs"
|
<Gecko.ShapedButton android:id="@+id/tabs"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="98dip"
|
android:layout_width="72dip"
|
||||||
android:layout_marginRight="22dip"
|
android:layout_marginRight="48dip"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:background="@drawable/tabs_button"
|
gecko:curveTowards="right"
|
||||||
android:gravity="center_vertical"
|
android:background="@drawable/shaped_button"
|
||||||
android:src="@drawable/tabs_level"
|
android:gravity="center_vertical"
|
||||||
android:paddingLeft="37dip"
|
android:src="@drawable/tabs_level"
|
||||||
android:paddingRight="37dip"/>
|
android:paddingLeft="37dip"
|
||||||
|
android:paddingRight="11dip"/>
|
||||||
|
|
||||||
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
<Gecko.TextSwitcher android:id="@+id/tabs_count"
|
||||||
style="@style/AddressBar.ImageButton"
|
style="@style/AddressBar.ImageButton"
|
||||||
android:layout_width="98dip"
|
android:layout_width="44.5dip"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_alignRight="@id/tabs"
|
android:layout_alignRight="@id/tabs"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<org.mozilla.gecko.TabsPanel android:id="@+id/tabs_panel"
|
<org.mozilla.gecko.TabsPanel android:id="@+id/tabs_panel"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:background="@color/background_tabs_light"
|
android:background="@color/background_tabs"
|
||||||
android:visibility="invisible"/>
|
android:visibility="invisible"/>
|
||||||
|
|
||||||
<view class="org.mozilla.gecko.GeckoApp$MainLayout"
|
<view class="org.mozilla.gecko.GeckoApp$MainLayout"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
<view class="org.mozilla.gecko.TabsPanel$TabsPanelToolbar"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:background="@color/background_tabs_dark">
|
android:background="@color/background_tabs">
|
||||||
|
|
||||||
<include layout="@layout/tabs_panel_header"/>
|
<include layout="@layout/tabs_panel_header"/>
|
||||||
|
|
||||||
|
|
|
@ -45,10 +45,6 @@
|
||||||
</attr>
|
</attr>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
<declare-styleable name="TabsButton">
|
|
||||||
<attr name="cropped" format="boolean"/>
|
|
||||||
</declare-styleable>
|
|
||||||
|
|
||||||
<declare-styleable name="TabsTray">
|
<declare-styleable name="TabsTray">
|
||||||
<attr name="tabs">
|
<attr name="tabs">
|
||||||
<flag name="tabs_normal" value="0x00" />
|
<flag name="tabs_normal" value="0x00" />
|
||||||
|
|
|
@ -8,24 +8,17 @@
|
||||||
<color name="awesomebar_header_row_focused">#FFA2AAB2</color>
|
<color name="awesomebar_header_row_focused">#FFA2AAB2</color>
|
||||||
<color name="background_normal">#FFCED7DE</color>
|
<color name="background_normal">#FFCED7DE</color>
|
||||||
<color name="background_private">#FF292C29</color>
|
<color name="background_private">#FF292C29</color>
|
||||||
<color name="background_tabs_dark">#FF363B40</color>
|
<color name="background_tabs">#FF363B40</color>
|
||||||
<color name="background_tabs_light">#FF43484E</color>
|
|
||||||
<color name="highlight">#33000000</color>
|
<color name="highlight">#33000000</color>
|
||||||
<color name="highlight_focused">#1A000000</color>
|
<color name="highlight_focused">#1A000000</color>
|
||||||
<color name="highlight_dark">#33FFFFFF</color>
|
<color name="highlight_dark">#33FFFFFF</color>
|
||||||
<color name="highlight_dark_focused">#1AFFFFFF</color>
|
<color name="highlight_dark_focused">#1AFFFFFF</color>
|
||||||
|
|
||||||
<!-- highlight on tabs button: 20% white over background_tabs_dark -->
|
<!-- highlight on shaped button: 20% white over background_tabs -->
|
||||||
<color name="highlight_tabs">#FF696D71</color>
|
<color name="highlight_shaped">#FF696D71</color>
|
||||||
|
|
||||||
<!-- highlight-focused on tabs button: 10% white over background_tabs_dark -->
|
<!-- highlight-focused on shaped button: 10% white over background_tabs -->
|
||||||
<color name="highlight_tabs_focused">#FF565B60</color>
|
<color name="highlight_shaped_focused">#FF565B60</color>
|
||||||
|
|
||||||
<!-- highlight on menu button: 20% white over black -->
|
|
||||||
<color name="highlight_menu">#FF333333</color>
|
|
||||||
|
|
||||||
<!-- highlight-focused on menu button: 10% white over black -->
|
|
||||||
<color name="highlight_menu_focused">#FF1A1A1A</color>
|
|
||||||
|
|
||||||
<!-- highlight on nav button: 20% black over background_normal -->
|
<!-- highlight on nav button: 20% black over background_normal -->
|
||||||
<color name="highlight_nav">#FFA5ACB2</color>
|
<color name="highlight_nav">#FFA5ACB2</color>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче