Bug 858687/862755/860308 - Major simplification of browser toolbar layout (r=mfinkle)

* * *
Bug fi
This commit is contained in:
Lucas Rocha 2013-03-14 15:35:38 -07:00
parent 35285d6e2f
commit 530a611185
15 changed files with 353 additions and 762 deletions

View File

@ -342,7 +342,7 @@ abstract public class BrowserApp extends GeckoApp
super.onCreate(savedInstanceState);
LinearLayout actionBar = (LinearLayout) getActionBarLayout();
RelativeLayout actionBar = (RelativeLayout) getActionBarLayout();
mMainLayout.addView(actionBar, 2);
((GeckoApp.MainLayout) mMainLayout).setTouchEventInterceptor(new HideTabsTouchListener());
@ -683,16 +683,9 @@ abstract public class BrowserApp extends GeckoApp
}
public View getActionBarLayout() {
int actionBarRes;
if (!HardwareUtils.hasMenuButton() || HardwareUtils.isTablet())
actionBarRes = R.layout.browser_toolbar_menu;
else
actionBarRes = R.layout.browser_toolbar;
LinearLayout actionBar = (LinearLayout) LayoutInflater.from(this).inflate(actionBarRes, null);
actionBar.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
(int) getResources().getDimension(R.dimen.browser_toolbar_height)));
RelativeLayout actionBar = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.browser_toolbar_menu, null);
actionBar.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT,
(int) getResources().getDimension(R.dimen.browser_toolbar_height)));
return actionBar;
}

View File

@ -40,6 +40,7 @@ import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.ViewSwitcher;
@ -52,16 +53,12 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
GeckoMenu.ActionItemBarPresenter,
Animation.AnimationListener {
private static final String LOGTAG = "GeckoToolbar";
private LinearLayout mLayout;
private View mAwesomeBar;
private GeckoRelativeLayout mLayout;
private LayoutParams mAwesomeBarParams;
private View mAwesomeBarContent;
private View mAwesomeBarEntry;
private int mAwesomeBarEntryRightMargin;
private GeckoFrameLayout mAwesomeBarRightEdge;
private ImageView mAwesomeBarRightEdge;
private BrowserToolbarBackground mAddressBarBg;
private View mAddressBarView;
private BrowserToolbarBackground.CurveTowards mAddressBarBgCurveTowards;
private int mAddressBarBgRightMargin;
private GeckoTextView mTitle;
private int mTitlePadding;
private boolean mSiteSecurityVisible;
@ -105,7 +102,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
private TranslateAnimation mTitleSlideRight;
private int mAddressBarViewOffset;
private int mAddressBarViewOffsetNoForward;
private int mDefaultForwardMargin;
private PropertyAnimator mForwardAnim = null;
@ -131,49 +127,23 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mAnimatingEntry = false;
}
public void from(LinearLayout layout) {
public void from(RelativeLayout layout) {
if (mLayout != null) {
// make sure we retain the visibility property on rotation
layout.setVisibility(mLayout.getVisibility());
}
mLayout = layout;
mLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
mShowSiteSecurity = false;
mShowReader = false;
mLayout = (GeckoRelativeLayout) layout;
mAnimatingEntry = false;
mAddressBarBg = (BrowserToolbarBackground) mLayout.findViewById(R.id.address_bar_bg);
mAddressBarView = mLayout.findViewById(R.id.addressbar);
mAddressBarViewOffset = mActivity.getResources().getDimensionPixelSize(R.dimen.addressbar_offset_left);
mAddressBarViewOffsetNoForward = mActivity.getResources().getDimensionPixelSize(R.dimen.addressbar_offset_left_noforward);
mDefaultForwardMargin = mActivity.getResources().getDimensionPixelSize(R.dimen.forward_default_offset);
mAwesomeBarRightEdge = (GeckoFrameLayout) mLayout.findViewById(R.id.awesome_bar_right_edge);
mAwesomeBarEntry = mLayout.findViewById(R.id.awesome_bar_entry);
// This will hold the translation width inside the toolbar when the tabs
// pane is visible. It will affect the padding applied to the title TextView.
mTabsPaneWidth = 0;
mTitle = (GeckoTextView) mLayout.findViewById(R.id.awesome_bar_title);
mTitlePadding = mTitle.getPaddingRight();
if (Build.VERSION.SDK_INT >= 16)
mTitle.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
mAwesomeBar = mLayout.findViewById(R.id.awesome_bar);
mAwesomeBar.setOnClickListener(new Button.OnClickListener() {
mLayout.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
mActivity.autoHideTabs();
onAwesomeBarSearch();
}
});
mAwesomeBar.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
mLayout.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
MenuInflater inflater = mActivity.getMenuInflater();
@ -206,6 +176,30 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
});
mShowSiteSecurity = false;
mShowReader = false;
mAnimatingEntry = false;
mAddressBarBg = (BrowserToolbarBackground) mLayout.findViewById(R.id.address_bar_bg);
mAddressBarViewOffset = mActivity.getResources().getDimensionPixelSize(R.dimen.addressbar_offset_left);
mDefaultForwardMargin = mActivity.getResources().getDimensionPixelSize(R.dimen.forward_default_offset);
mAwesomeBarContent = mLayout.findViewById(R.id.awesome_bar_content);
mAwesomeBarEntry = mLayout.findViewById(R.id.awesome_bar_entry);
// This will clip the right edge's image at half of its width
mAwesomeBarRightEdge = (ImageView) mLayout.findViewById(R.id.awesome_bar_right_edge);
mAwesomeBarRightEdge.getDrawable().setLevel(5000);
// This will hold the translation width inside the toolbar when the tabs
// pane is visible. It will affect the padding applied to the title TextView.
mTabsPaneWidth = 0;
mTitle = (GeckoTextView) mLayout.findViewById(R.id.awesome_bar_title);
mTitlePadding = mTitle.getPaddingRight();
if (Build.VERSION.SDK_INT >= 16)
mTitle.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
mTabs = (ShapedButton) mLayout.findViewById(R.id.tabs);
mTabs.setOnClickListener(new Button.OnClickListener() {
@Override
@ -323,6 +317,11 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
});
mShadow = (ImageView) mLayout.findViewById(R.id.shadow);
mShadow.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
}
});
mHandler = new Handler();
mSlideUpIn = new TranslateAnimation(0, 0, 40, 0);
@ -381,7 +380,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
int tail = (width - height) / 2;
Rect bounds = new Rect(0, 0, tail, height);
TailTouchDelegate delegate = new TailTouchDelegate(bounds, mAddressBarView);
TailTouchDelegate delegate = new TailTouchDelegate(bounds, mShadow);
mTabs.setTouchDelegate(delegate);
}
});
@ -413,7 +412,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
}
mFocusOrder = Arrays.asList(mBack, mForward, mAwesomeBar, mReader, mSiteSecurity, mStop, mTabs);
mFocusOrder = Arrays.asList(mBack, mForward, mLayout, mReader, mSiteSecurity, mStop, mTabs);
}
public View getLayout() {
@ -499,7 +498,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
public void setNextFocusDownId(int nextId) {
mAwesomeBar.setNextFocusDownId(nextId);
mLayout.setNextFocusDownId(nextId);
mTabs.setNextFocusDownId(nextId);
mBack.setNextFocusDownId(nextId);
mForward.setNextFocusDownId(nextId);
@ -544,52 +543,8 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
return mInflater.inflate(R.layout.tabs_counter, null);
}
private int prepareAwesomeBarAnimation() {
// Keep the entry highlighted during the animation
mAwesomeBar.setSelected(true);
// Expand the entry to fill all the horizontal space available during the
// animation. The fake right edge will slide on top of it to give the effect
// of expanding the entry.
MarginLayoutParams entryParams = (MarginLayoutParams) mAwesomeBarEntry.getLayoutParams();
mAwesomeBarEntryRightMargin = entryParams.rightMargin;
entryParams.rightMargin = 0;
mAwesomeBarEntry.requestLayout();
// Remove any curves from the toolbar background and expand it to fill all
// the horizontal space.
MarginLayoutParams barParams = (MarginLayoutParams) mAddressBarBg.getLayoutParams();
mAddressBarBgRightMargin = barParams.rightMargin;
barParams.rightMargin = 0;
mAddressBarBgCurveTowards = mAddressBarBg.getCurveTowards();
mAddressBarBg.setCurveTowards(BrowserToolbarBackground.CurveTowards.NONE);
// If we don't have any menu_items, then we simply slide all elements on the
// rigth side of the toolbar out of screen.
int translation = mAwesomeBarEntryRightMargin;
if (mActionItemBar.getVisibility() == View.VISIBLE) {
// If the toolbar has action items (e.g. on the tablet UI), the translation will
// be in relation to the left side of their container (i.e. mActionItemBar).
MarginLayoutParams itemBarParams = (MarginLayoutParams) mActionItemBar.getLayoutParams();
translation = itemBarParams.rightMargin + mActionItemBar.getWidth() - entryParams.leftMargin;
// Expand the whole entry container to fill all the horizontal space available
View awesomeBarParent = (View) mAwesomeBar.getParent();
mAwesomeBarParams = (LayoutParams) awesomeBarParent.getLayoutParams();
awesomeBarParent.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
// Align the fake right edge to the right side of the entry bar
MarginLayoutParams rightEdgeParams = (MarginLayoutParams) mAwesomeBarRightEdge.getLayoutParams();
rightEdgeParams.rightMargin = itemBarParams.rightMargin + mActionItemBar.getWidth() - 100;
mAwesomeBarRightEdge.requestLayout();
}
// Make the right edge visible to start the animation
mAwesomeBarRightEdge.setVisibility(View.VISIBLE);
return translation;
private int getAwesomeBarAnimTranslation() {
return mLayout.getWidth() - mAwesomeBarEntry.getRight();
}
public void fromAwesomeBarSearch(String url) {
@ -610,8 +565,11 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
// while in awesome screen, activity was killed in background, etc). In this
// case, we have to ensure the toolbar is in the correct initial state to
// shrink back.
if (!mAwesomeBar.isSelected()) {
int translation = prepareAwesomeBarAnimation();
if (!mLayout.isSelected()) {
// Keep the entry highlighted during the animation
mLayout.setSelected(true);
final int translation = getAwesomeBarAnimTranslation();
proxy = AnimatorProxy.create(mAwesomeBarRightEdge);
proxy.setTranslationX(translation);
@ -673,27 +631,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
@Override
public void onPropertyAnimationEnd() {
// Turn off selected state on the entry
mAwesomeBar.setSelected(false);
// Restore entry state
MarginLayoutParams entryParams = (MarginLayoutParams) mAwesomeBarEntry.getLayoutParams();
entryParams.rightMargin = mAwesomeBarEntryRightMargin;
mAwesomeBarEntry.requestLayout();
// Restore the background state
MarginLayoutParams barParams = (MarginLayoutParams) mAddressBarBg.getLayoutParams();
barParams.rightMargin = mAddressBarBgRightMargin;
mAddressBarBg.setCurveTowards(mAddressBarBgCurveTowards);
// If there are action bar items in the toolbar, we have to restore the
// alignment of the entry in relation to them. mAwesomeBarParams might
// be null if the activity holding the toolbar is killed before returning
// from awesome screen (e.g. "Don't keep activities" is on)
if (mActionItemBar.getVisibility() == View.VISIBLE)
((View) mAwesomeBar.getParent()).setLayoutParams(mAwesomeBarParams);
// Hide fake right edge, we only use for the animation
mAwesomeBarRightEdge.setVisibility(View.INVISIBLE);
mLayout.setSelected(false);
PropertyAnimator buttonsAnimator = new PropertyAnimator(150);
@ -735,7 +673,10 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
final PropertyAnimator contentAnimator = new PropertyAnimator(250);
contentAnimator.setUseHardwareLayer(false);
int translation = prepareAwesomeBarAnimation();
final int translation = getAwesomeBarAnimTranslation();
// Keep the entry highlighted during the animation
mLayout.setSelected(true);
if (mActionItemBar.getVisibility() == View.VISIBLE) {
contentAnimator.attach(mFavicon,
@ -859,13 +800,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
public void prepareTabsAnimation(PropertyAnimator animator, int width) {
// This is negative before we want to keep the right edge in the same
// position while animating the left-most elements below.
animator.attach(mAwesomeBarRightEdge,
PropertyAnimator.Property.TRANSLATION_X,
-width);
animator.attach(mAwesomeBar,
animator.attach(mAwesomeBarEntry,
PropertyAnimator.Property.TRANSLATION_X,
width);
animator.attach(mAddressBarBg,
@ -907,8 +842,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
public void adjustTabsAnimation(boolean reset) {
int width = reset ? 0 : mTabsPaneWidth;
mAwesomeBarRightEdge.setTranslationX(-width);
mAwesomeBar.setTranslationX(width);
mAwesomeBarEntry.setTranslationX(width);
mAddressBarBg.setTranslationX(width);
mTabs.setTranslationX(width);
mTabsCount.setTranslationX(width);
@ -1071,7 +1005,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
title = null;
mTitle.setText(title);
mAwesomeBar.setContentDescription(title != null ? title : mTitle.getHint());
mLayout.setContentDescription(title != null ? title : mTitle.getHint());
}
private void setFavicon(Bitmap image) {
@ -1107,7 +1041,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
public void requestFocusFromTouch() {
mAwesomeBar.requestFocusFromTouch();
mLayout.requestFocusFromTouch();
}
public void updateBackButton(boolean enabled) {
@ -1130,7 +1064,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
return;
mForwardAnim = new PropertyAnimator(FORWARD_ANIMATION_DURATION);
final int width = mForward.getWidth()/2;
final int width = mForward.getWidth() / 2;
mForwardAnim.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
@Override
@ -1139,9 +1073,9 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
// Set the margin before the transition when hiding the forward button. We
// have to do this so that the favicon isn't clipped during the transition
ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mAddressBarView.getLayoutParams();
layoutParams.leftMargin = mAddressBarViewOffsetNoForward;
mAddressBarView.requestLayout();
(ViewGroup.MarginLayoutParams)mAwesomeBarContent.getLayoutParams();
layoutParams.leftMargin = 0;
mAwesomeBarContent.requestLayout();
// Note, we already translated the favicon, site security, and text field
// in prepareForwardAnimation, so they should appear to have not moved at
// all at this point.
@ -1152,7 +1086,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
public void onPropertyAnimationEnd() {
if (enabled) {
ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mAddressBarView.getLayoutParams();
(ViewGroup.MarginLayoutParams)mAwesomeBarContent.getLayoutParams();
layoutParams.leftMargin = mAddressBarViewOffset;
AnimatorProxy proxy = AnimatorProxy.create(mTitle);
@ -1161,19 +1095,19 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
proxy.setTranslationX(0);
proxy = AnimatorProxy.create(mSiteSecurity);
proxy.setTranslationX(0);
}
ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mForward.getLayoutParams();
layoutParams.leftMargin = mDefaultForwardMargin + (mForward.isEnabled() ? mForward.getWidth()/2 : 0);
layoutParams.leftMargin = mDefaultForwardMargin + (mForward.isEnabled() ? mForward.getWidth() / 2 : 0);
AnimatorProxy proxy = AnimatorProxy.create(mForward);
proxy.setTranslationX(0);
mAddressBarView.requestLayout();
mAwesomeBarContent.requestLayout();
mForwardAnim = null;
}
});
prepareForwardAnimation(mForwardAnim, enabled, width);
mForwardAnim.start();
}
@ -1182,7 +1116,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
if (!enabled) {
anim.attach(mForward,
PropertyAnimator.Property.TRANSLATION_X,
-1*width);
-width);
anim.attach(mForward,
PropertyAnimator.Property.ALPHA,
0);
@ -1199,13 +1133,12 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
// We're hiding the forward button. We're going to reset the margin before
// the animation starts, so we shift these items to the right so that they don't
// appear to move initially.
int startTrans = mAddressBarViewOffset - mAddressBarViewOffsetNoForward;
AnimatorProxy proxy = AnimatorProxy.create(mTitle);
proxy.setTranslationX(startTrans);
proxy.setTranslationX(mAddressBarViewOffset);
proxy = AnimatorProxy.create(mFavicon);
proxy.setTranslationX(startTrans);
proxy.setTranslationX(mAddressBarViewOffset);
proxy = AnimatorProxy.create(mSiteSecurity);
proxy.setTranslationX(startTrans);
proxy.setTranslationX(mAddressBarViewOffset);
} else {
anim.attach(mForward,
PropertyAnimator.Property.TRANSLATION_X,
@ -1215,13 +1148,13 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
1);
anim.attach(mTitle,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
mAddressBarViewOffset);
anim.attach(mFavicon,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
mAddressBarViewOffset);
anim.attach(mSiteSecurity,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
mAddressBarViewOffset);
}
}
@ -1267,12 +1200,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
updateForwardButton(tab.canDoForward());
mAddressBarBg.setPrivateMode(tab.isPrivate());
if (mAwesomeBar instanceof GeckoButton)
((GeckoButton) mAwesomeBar).setPrivateMode(tab.isPrivate());
else if (mAwesomeBar instanceof GeckoRelativeLayout)
((GeckoRelativeLayout) mAwesomeBar).setPrivateMode(tab.isPrivate());
mLayout.setPrivateMode(tab.isPrivate());
mTabs.setPrivateMode(tab.isPrivate());
mTitle.setPrivateMode(tab.isPrivate());
mMenu.setPrivateMode(tab.isPrivate());
@ -1309,43 +1237,4 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
return true;
}
public static class RightEdge extends GeckoFrameLayout {
private BrowserApp mActivity;
public RightEdge(Context context, AttributeSet attrs) {
super(context, attrs);
mActivity = (BrowserApp) context;
}
@Override
public void onLightweightThemeChanged() {
Drawable drawable = mActivity.getLightweightTheme().getDrawable(this);
if (drawable == null)
return;
StateListDrawable stateList = new StateListDrawable();
stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(mActivity.getResources().getColor(R.color.background_private)));
stateList.addState(new int[] {}, drawable);
int[] padding = new int[] { getPaddingLeft(),
getPaddingTop(),
getPaddingRight(),
getPaddingBottom()
};
setBackgroundDrawable(stateList);
setPadding(padding[0], padding[1], padding[2], padding[3]);
}
@Override
public void onLightweightThemeReset() {
int[] padding = new int[] { getPaddingLeft(),
getPaddingTop(),
getPaddingRight(),
getPaddingBottom()
};
setBackgroundResource(R.drawable.address_bar_bg);
setPadding(padding[0], padding[1], padding[2], padding[3]);
}
}
}

View File

@ -14,72 +14,14 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
public class BrowserToolbarBackground extends GeckoLinearLayout
implements CanvasDelegate.DrawManager {
public class BrowserToolbarBackground extends GeckoLinearLayout {
private GeckoActivity mActivity;
private Path mPath;
private CurveTowards mSide;
private CanvasDelegate mCanvasDelegate;
public enum CurveTowards { NONE, LEFT, RIGHT };
public BrowserToolbarBackground(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BrowserToolbarCurve);
int curveTowards = a.getInt(R.styleable.BrowserToolbarCurve_curveTowards, 0x02);
a.recycle();
if (curveTowards == 0x00)
mSide = CurveTowards.NONE;
else if (curveTowards == 0x01)
mSide = CurveTowards.LEFT;
else
mSide = CurveTowards.RIGHT;
// Path is clipped.
mPath = new Path();
mCanvasDelegate = new CanvasDelegate(this, Mode.DST_OUT);
mActivity = (GeckoActivity) context;
}
@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();
if (mSide == CurveTowards.LEFT) {
mPath.moveTo(0, height);
mPath.cubicTo(curve * 0.75f, height,
curve * 0.25f, 0,
curve, 0);
mPath.lineTo(0, 0);
mPath.lineTo(0, height);
} else if (mSide == CurveTowards.RIGHT) {
mPath.moveTo(width, height);
mPath.cubicTo((width - (curve * 0.75f)), height,
(width - (curve * 0.25f)), 0,
(width - curve), 0);
mPath.lineTo(width, 0);
mPath.lineTo(width, height);
}
}
@Override
public void draw(Canvas canvas) {
mCanvasDelegate.draw(canvas, mPath, getWidth(), getHeight());
}
@Override
public void defaultDraw(Canvas canvas) {
super.draw(canvas);
}
@Override
public void onLightweightThemeChanged() {
Drawable drawable = mActivity.getLightweightTheme().getDrawable(this);
@ -90,35 +32,11 @@ public class BrowserToolbarBackground extends GeckoLinearLayout
stateList.addState(new int[] { R.attr.state_private }, new ColorDrawable(mActivity.getResources().getColor(R.color.background_private)));
stateList.addState(new int[] {}, drawable);
int[] padding = new int[] { getPaddingLeft(),
getPaddingTop(),
getPaddingRight(),
getPaddingBottom()
};
setBackgroundDrawable(stateList);
setPadding(padding[0], padding[1], padding[2], padding[3]);
}
@Override
public void onLightweightThemeReset() {
int[] padding = new int[] { getPaddingLeft(),
getPaddingTop(),
getPaddingRight(),
getPaddingBottom()
};
setBackgroundResource(R.drawable.address_bar_bg);
setPadding(padding[0], padding[1], padding[2], padding[3]);
}
public CurveTowards getCurveTowards() {
return mSide;
}
public void setCurveTowards(CurveTowards side) {
if (side == mSide)
return;
mSide = side;
requestLayout();
}
}

View File

@ -8,9 +8,9 @@ package org.mozilla.gecko;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
public class BrowserToolbarLayout extends LinearLayout {
public class BrowserToolbarLayout extends GeckoRelativeLayout {
private static final String LOGTAG = "GeckoToolbarLayout";
public BrowserToolbarLayout(Context context, AttributeSet attrs) {

View File

@ -56,7 +56,6 @@ public final class GeckoViewsFactory implements LayoutInflater.Factory {
mFactoryMap.put("AwesomeBarTabs$BackgroundLayout", AwesomeBarTabs.BackgroundLayout.class.getConstructor(arg1Class, arg2Class));
mFactoryMap.put("BackButton", BackButton.class.getConstructor(arg1Class, arg2Class));
mFactoryMap.put("BrowserToolbarBackground", BrowserToolbarBackground.class.getConstructor(arg1Class, arg2Class));
mFactoryMap.put("BrowserToolbar$RightEdge", BrowserToolbar.RightEdge.class.getConstructor(arg1Class, arg2Class));
mFactoryMap.put("CheckableLinearLayout", CheckableLinearLayout.class.getConstructor(arg1Class, arg2Class));
mFactoryMap.put("FormAssistPopup", FormAssistPopup.class.getConstructor(arg1Class, arg2Class));
mFactoryMap.put("ForwardButton", ForwardButton.class.getConstructor(arg1Class, arg2Class));

View File

@ -401,7 +401,6 @@ RES_LAYOUT = \
res/layout/awesomebar_tab_indicator.xml \
res/layout/awesomebar_tabs.xml \
res/layout/bookmark_edit.xml \
res/layout/browser_toolbar.xml \
res/layout/browser_toolbar_menu.xml \
res/layout/datetime_picker.xml \
res/layout/doorhangerpopup.xml \
@ -1002,6 +1001,7 @@ MOZ_ANDROID_DRAWABLES += \
mobile/android/base/resources/drawable/address_bar_bg.xml \
mobile/android/base/resources/drawable/address_bar_bg_shadow_repeat.xml \
mobile/android/base/resources/drawable/address_bar_nav_button.xml \
mobile/android/base/resources/drawable/address_bar_right_edge.xml \
mobile/android/base/resources/drawable/address_bar_url.xml \
mobile/android/base/resources/drawable/awesomebar_header_row.xml \
mobile/android/base/resources/drawable/awesomebar_row_favicon_bg.xml \

View File

@ -0,0 +1,9 @@
<?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/. -->
<clip xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/address_bar_url"
android:clipOrientation="horizontal"
android:gravity="right"/>

View File

@ -6,176 +6,160 @@
<org.mozilla.gecko.BrowserToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto"
android:id="@+id/browser_toolbar"
style="@style/BrowserToolbar">
style="@style/BrowserToolbar"
android:clickable="true"
android:focusable="true">
<RelativeLayout android:id="@+id/address_bar"
style="@style/AddressBar">
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/address_bar_bg"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="21dip"
gecko:curveTowards="left"
android:background="@drawable/address_bar_bg"/>
<Gecko.ShapedButton android:id="@+id/tabs"
style="@style/AddressBar.ImageButton"
android:layout_width="84dip"
android:layout_alignParentLeft="true"
gecko:curveTowards="left"
android:background="@drawable/shaped_button"
android:gravity="center_vertical"
android:src="@drawable/tabs_level"
android:paddingLeft="6dip"
android:paddingRight="38dip"/>
<Gecko.ShapedButton android:id="@+id/tabs"
style="@style/AddressBar.ImageButton"
android:layout_width="84dip"
android:layout_alignParentLeft="true"
gecko:curveTowards="left"
android:background="@drawable/shaped_button"
android:gravity="center_vertical"
android:src="@drawable/tabs_level"
android:paddingLeft="6dip"
android:paddingRight="38dip"/>
<Gecko.TextSwitcher android:id="@+id/tabs_count"
style="@style/AddressBar.ImageButton"
android:layout_width="52dip"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_alignLeft="@id/tabs"
android:gravity="center_horizontal"/>
<Gecko.TextSwitcher android:id="@+id/tabs_count"
style="@style/AddressBar.ImageButton"
android:layout_width="52dip"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_alignLeft="@id/tabs"
android:gravity="center_horizontal"/>
<FrameLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_toRightOf="@id/tabs"
android:layout_toLeftOf="@id/menu_items"
android:layout_marginLeft="-18dp"
android:paddingRight="18dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
android:duplicateParentState="true">
<Gecko.ImageButton android:id="@+id/menu"
style="@style/AddressBar.ImageButton"
android:layout_width="56dip"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:src="@drawable/menu_level"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"
android:paddingLeft="14dip"
android:paddingRight="14dip"
android:visibility="gone"/>
<ImageView android:id="@+id/awesome_bar_entry"
style="@style/AddressBar.Button"
android:layout_toRightOf="@id/tabs"
android:layout_toLeftOf="@id/menu_items"
android:duplicateParentState="true"
android:clickable="false"
android:focusable="false"
android:src="@drawable/address_bar_url"
android:scaleType="fitXY"/>
<LinearLayout android:id="@+id/menu_items"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_toLeftOf="@id/menu"
android:layout_alignWithParentIfMissing="true"/>
</FrameLayout>
<RelativeLayout style="@style/AddressBar.Button"
android:layout_toRightOf="@id/tabs"
android:layout_toLeftOf="@id/menu_items"
android:layout_marginLeft="-28dp"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true">
<ImageView android:id="@+id/awesome_bar_right_edge"
style="@style/AddressBar.Button"
android:layout_toLeftOf="@id/menu_items"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
android:duplicateParentState="true"
android:clickable="false"
android:focusable="false"
android:src="@drawable/address_bar_right_edge"
android:scaleType="fitXY"/>
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"
<org.mozilla.gecko.ForwardButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"
android:layout_toRightOf="@+id/tabs"/>
<org.mozilla.gecko.BackButton android:id="@+id/back"
style="@style/AddressBar.ImageButton"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_toRightOf="@id/tabs"
android:layout_marginLeft="-28dp"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true">
android:padding="13dp"
android:src="@drawable/ic_menu_back"
android:contentDescription="@string/back"
android:background="@drawable/address_bar_nav_button"/>
<Gecko.ImageView android:id="@+id/awesome_bar_entry"
style="@style/AddressBar.Button"
android:layout_marginLeft="20dp"
android:layout_marginRight="0dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
android:duplicateParentState="true"
android:clickable="false"
android:focusable="false"
android:background="@drawable/address_bar_url"/>
<LinearLayout android:id="@+id/awesome_bar_content"
style="@style/AddressBar.Button.Container"
android:layout_toRightOf="@id/back"
android:layout_toLeftOf="@id/menu_items">
<view class="org.mozilla.gecko.BrowserToolbar$RightEdge"
android:id="@+id/awesome_bar_right_edge"
style="@style/AddressBar.ImageButton"
android:layout_width="25dp"
android:layout_height="fill_parent"
android:paddingTop="7dp"
android:paddingBottom="7dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:duplicateParentState="true">
<ImageButton android:id="@+id/favicon"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_favicon_size"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:paddingLeft="8dip"
android:layout_marginRight="4dip"
android:layout_gravity="center_vertical"
android:src="@drawable/favicon"/>
<Gecko.ImageView android:layout_width="50dp"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:layout_marginLeft="-26dp"
android:duplicateParentState="true"
android:clickable="false"
android:focusable="false"
android:src="@drawable/address_bar_url"/>
<ImageButton android:id="@+id/site_security"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_lock_width"
android:scaleType="fitCenter"
android:layout_marginLeft="-4dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
</view>
<Gecko.TextView android:id="@+id/awesome_bar_title"
style="@style/AddressBar.Button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:singleLine="true"
android:paddingRight="8dp"
android:textColor="@color/awesome_bar_title"
android:textColorHint="@color/awesome_bar_title_hint"
android:gravity="center_vertical|left"
android:hint="@string/awesomebar_default_text"
android:layout_gravity="center_vertical"
gecko:autoUpdateTheme="false"/>
</Gecko.RelativeLayout>
<ImageButton android:id="@+id/reader"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/reader"
android:contentDescription="@string/reader"
android:visibility="gone"/>
<org.mozilla.gecko.ForwardButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<ImageButton android:id="@+id/stop"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
<org.mozilla.gecko.BackButton android:id="@+id/back"
style="@style/AddressBar.ImageButton"
android:layout_width="50dip"
android:layout_height="50dip"
android:layout_centerVertical="true"
android:padding="13dp"
android:src="@drawable/ic_menu_back"
android:contentDescription="@string/back"
android:background="@drawable/address_bar_nav_button"/>
</LinearLayout>
<LinearLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<LinearLayout android:id="@+id/menu_items"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="3dp"
android:orientation="horizontal"
android:layout_toLeftOf="@id/menu"
android:layout_alignWithParentIfMissing="true"/>
<ImageButton android:id="@+id/favicon"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_favicon_size"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:paddingLeft="8dip"
android:layout_marginRight="4dip"
android:layout_gravity="center_vertical"
android:src="@drawable/favicon"/>
<Gecko.ImageButton android:id="@+id/menu"
style="@style/AddressBar.ImageButton"
android:layout_width="56dip"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:src="@drawable/menu_level"
android:contentDescription="@string/menu"
android:background="@drawable/action_bar_button"
android:paddingLeft="14dip"
android:paddingRight="14dip"
android:visibility="gone"/>
<ImageButton android:id="@+id/site_security"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_lock_width"
android:scaleType="fitCenter"
android:layout_marginLeft="-4dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
<Gecko.TextView android:id="@+id/awesome_bar_title"
style="@style/AddressBar.Button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:singleLine="true"
android:paddingRight="8dp"
android:textColor="@color/awesome_bar_title"
android:textColorHint="@color/awesome_bar_title_hint"
android:gravity="center_vertical|left"
android:hint="@string/awesomebar_default_text"
android:layout_gravity="center_vertical"
gecko:autoUpdateTheme="false"/>
<ImageButton android:id="@+id/reader"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/reader"
android:contentDescription="@string/reader"
android:visibility="gone"/>
<ImageButton android:id="@+id/stop"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
</LinearLayout>
</RelativeLayout>
<ImageView android:id="@+id/shadow"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/address_bar_bg_shadow_repeat"
android:visibility="gone"/>
</RelativeLayout>
<ImageView android:id="@+id/shadow"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/address_bar_bg_shadow_repeat"
android:visibility="gone"/>
</org.mozilla.gecko.BrowserToolbarLayout>

View File

@ -1,165 +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/. -->
<org.mozilla.gecko.BrowserToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto"
android:id="@+id/browser_toolbar"
style="@style/BrowserToolbar">
<RelativeLayout android:id="@+id/address_bar"
style="@style/AddressBar">
<ImageButton android:id="@+id/back"
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginRight="18dip"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
gecko:curveTowards="right"
android:background="@drawable/address_bar_bg"/>
<FrameLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true">
<ImageView android:id="@+id/awesome_bar_entry"
style="@style/AddressBar.Button"
android:duplicateParentState="true"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="52dp"
android:clickable="false"
android:focusable="false"
android:background="@drawable/address_bar_url"/>
<view class="org.mozilla.gecko.BrowserToolbar$RightEdge"
android:id="@+id/awesome_bar_right_edge"
style="@style/AddressBar.ImageButton"
android:layout_width="50dp"
android:layout_height="fill_parent"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="27dp"
android:duplicateParentState="true"
android:visibility="invisible"
android:background="@drawable/address_bar_bg">
<ImageView android:layout_width="50dp"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:layout_marginLeft="-26dp"
android:duplicateParentState="true"
android:clickable="false"
android:focusable="false"
android:src="@drawable/address_bar_url"/>
</view>
</Gecko.RelativeLayout>
<LinearLayout style="@style/AddressBar.Button"
android:paddingRight="52dp"
android:orientation="horizontal">
<ImageButton android:id="@+id/favicon"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_favicon_size"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:paddingLeft="8dip"
android:layout_marginRight="4dip"
android:layout_gravity="center_vertical"
android:src="@drawable/favicon"/>
<ImageButton android:id="@+id/site_security"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_lock_width"
android:scaleType="fitCenter"
android:layout_marginLeft="-4dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
<Gecko.TextView android:id="@+id/awesome_bar_title"
style="@style/AddressBar.Button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:singleLine="true"
android:paddingRight="8dp"
android:textColor="@color/awesome_bar_title"
android:textColorHint="@color/awesome_bar_title_hint"
android:gravity="center_vertical|left"
android:hint="@string/awesomebar_default_text"
android:layout_gravity="center_vertical"
gecko:autoUpdateTheme="false"/>
<ImageButton android:id="@+id/reader"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/reader"
android:contentDescription="@string/reader"
android:visibility="gone"/>
<ImageButton android:id="@+id/stop"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
</LinearLayout>
</FrameLayout>
<LinearLayout android:id="@+id/menu_items"
android:layout_width="0dip"
android:layout_height="0dip"
android:visibility="gone"/>
<Gecko.ShapedButton android:id="@+id/menu"
style="@style/AddressBar.ImageButton.Unused"/>
<Gecko.ShapedButton android:id="@+id/tabs"
style="@style/AddressBar.ImageButton"
android:layout_width="72dip"
android:layout_alignParentRight="true"
gecko:curveTowards="right"
android:background="@drawable/shaped_button"
android:gravity="center_vertical"
android:src="@drawable/tabs_level"
android:paddingLeft="37dip"
android:paddingRight="11dip"/>
<Gecko.TextSwitcher android:id="@+id/tabs_count"
style="@style/AddressBar.ImageButton"
android:layout_width="44.5dip"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_alignRight="@id/tabs"
android:gravity="center_horizontal"/>
<ImageView android:id="@+id/shadow"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/address_bar_bg_shadow_repeat"
android:visibility="gone"/>
</RelativeLayout>
</org.mozilla.gecko.BrowserToolbarLayout>

View File

@ -6,167 +6,141 @@
<org.mozilla.gecko.BrowserToolbarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto"
android:id="@+id/browser_toolbar"
style="@style/BrowserToolbar">
style="@style/BrowserToolbar"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true">
<RelativeLayout android:id="@+id/address_bar"
style="@style/AddressBar">
<ImageButton android:id="@+id/back"
style="@style/AddressBar.ImageButton.Back"/>
<ImageButton android:id="@+id/back"
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageButton android:id="@+id/forward"
style="@style/AddressBar.ImageButton.Forward"/>
<ImageButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/address_bar_bg"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginRight="66dip"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
gecko:curveTowards="right"
android:background="@drawable/address_bar_bg"/>
<ImageView android:id="@+id/awesome_bar_entry"
style="@style/AddressBar.Button"
android:layout_marginLeft="4dp"
android:layout_marginRight="-22dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/tabs"
android:paddingRight="4dp"
android:duplicateParentState="true"
android:clickable="false"
android:focusable="false"
android:src="@drawable/address_bar_url"
android:scaleType="fitXY"/>
<FrameLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<ImageView android:id="@+id/awesome_bar_right_edge"
style="@style/AddressBar.Button"
android:layout_alignLeft="@id/awesome_bar_entry"
android:layout_alignRight="@id/awesome_bar_entry"
android:layout_alignTop="@id/awesome_bar_entry"
android:layout_alignBottom="@id/awesome_bar_entry"
android:paddingRight="4dp"
android:duplicateParentState="true"
android:clickable="false"
android:focusable="false"
android:src="@drawable/address_bar_right_edge"
android:scaleType="fitXY"/>
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true">
<LinearLayout android:id="@+id/menu_items"
style="@style/AddressBar.ImageButton.Unused"/>
<ImageView android:id="@+id/awesome_bar_entry"
style="@style/AddressBar.Button"
android:duplicateParentState="true"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_marginRight="100dp"
android:clickable="false"
android:focusable="false"
android:background="@drawable/address_bar_url"/>
<Gecko.ShapedButton android:id="@+id/menu"
style="@style/AddressBar.ImageButton"
android:layout_width="48dip"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:src="@drawable/menu_level"
android:contentDescription="@string/menu"
android:background="@drawable/shaped_button"
android:visibility="gone"/>
<view class="org.mozilla.gecko.BrowserToolbar$RightEdge"
android:id="@+id/awesome_bar_right_edge"
style="@style/AddressBar.ImageButton"
android:layout_width="50dp"
android:layout_height="fill_parent"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="75dp"
android:duplicateParentState="true"
android:visibility="invisible"
android:background="@drawable/address_bar_bg">
<Gecko.ShapedButton android:id="@+id/tabs"
style="@style/AddressBar.ImageButton"
android:layout_width="72dip"
android:layout_toLeftOf="@id/menu"
android:layout_alignWithParentIfMissing="true"
gecko:curveTowards="right"
android:background="@drawable/shaped_button"
android:gravity="center_vertical"
android:src="@drawable/tabs_level"
android:paddingLeft="37dip"
android:paddingRight="11dip"/>
<ImageView android:layout_width="50dp"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:layout_marginLeft="-26dp"
android:duplicateParentState="true"
android:clickable="false"
android:focusable="false"
android:src="@drawable/address_bar_url"/>
<Gecko.TextSwitcher android:id="@+id/tabs_count"
style="@style/AddressBar.ImageButton"
android:layout_width="44.5dip"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_alignRight="@id/tabs"
android:gravity="center_horizontal"/>
</view>
<LinearLayout android:id="@+id/awesome_bar_content"
style="@style/AddressBar.Button"
android:layout_toLeftOf="@id/tabs"
android:layout_marginRight="-24dp"
android:orientation="horizontal">
</Gecko.RelativeLayout>
<ImageButton android:id="@+id/favicon"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_favicon_size"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:paddingLeft="12dip"
android:layout_marginRight="4dip"
android:layout_gravity="center_vertical"
android:src="@drawable/favicon"/>
<LinearLayout style="@style/AddressBar.Button"
android:paddingRight="100dp"
android:orientation="horizontal">
<ImageButton android:id="@+id/site_security"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_lock_width"
android:scaleType="fitCenter"
android:layout_marginLeft="-4dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
<ImageButton android:id="@+id/favicon"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_favicon_size"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:paddingLeft="8dip"
android:layout_marginRight="4dip"
android:layout_gravity="center_vertical"
android:src="@drawable/favicon"/>
<Gecko.TextView android:id="@+id/awesome_bar_title"
style="@style/AddressBar.Button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:singleLine="true"
android:paddingRight="8dp"
android:textColor="@color/awesome_bar_title"
android:textColorHint="@color/awesome_bar_title_hint"
android:gravity="center_vertical|left"
android:hint="@string/awesomebar_default_text"
android:layout_gravity="center_vertical"
gecko:autoUpdateTheme="false"/>
<ImageButton android:id="@+id/site_security"
style="@style/AddressBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_lock_width"
android:scaleType="fitCenter"
android:layout_marginLeft="-4dip"
android:src="@drawable/site_security_level"
android:contentDescription="@string/site_security"
android:visibility="gone"/>
<ImageButton android:id="@+id/reader"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/reader"
android:contentDescription="@string/reader"
android:visibility="gone"/>
<Gecko.TextView android:id="@+id/awesome_bar_title"
style="@style/AddressBar.Button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:singleLine="true"
android:paddingRight="8dp"
android:textColor="@color/awesome_bar_title"
android:textColorHint="@color/awesome_bar_title_hint"
android:gravity="center_vertical|left"
android:hint="@string/awesomebar_default_text"
android:layout_gravity="center_vertical"
gecko:autoUpdateTheme="false"/>
<ImageButton android:id="@+id/stop"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
<ImageButton android:id="@+id/reader"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/reader"
android:contentDescription="@string/reader"
android:visibility="gone"/>
</LinearLayout>
<ImageButton android:id="@+id/stop"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
android:visibility="gone"/>
</LinearLayout>
</FrameLayout>
<LinearLayout android:id="@+id/menu_items"
android:layout_width="0dip"
android:layout_height="0dip"
android:visibility="gone"/>
<Gecko.ShapedButton android:id="@+id/menu"
style="@style/AddressBar.ImageButton"
android:layout_width="48dip"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:src="@drawable/menu_level"
android:contentDescription="@string/menu"
android:background="@drawable/shaped_button"/>
<Gecko.ShapedButton android:id="@+id/tabs"
style="@style/AddressBar.ImageButton"
android:layout_width="72dip"
android:layout_marginRight="48dip"
android:layout_alignParentRight="true"
gecko:curveTowards="right"
android:background="@drawable/shaped_button"
android:gravity="center_vertical"
android:src="@drawable/tabs_level"
android:paddingLeft="37dip"
android:paddingRight="11dip"/>
<Gecko.TextSwitcher android:id="@+id/tabs_count"
style="@style/AddressBar.ImageButton"
android:layout_width="44.5dip"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_alignRight="@id/tabs"
android:gravity="center_horizontal"/>
<ImageView android:id="@+id/shadow"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/address_bar_bg_shadow_repeat"
android:visibility="gone"/>
</RelativeLayout>
<ImageView android:id="@+id/shadow"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/address_bar_bg_shadow_repeat"
android:visibility="gone"/>
</org.mozilla.gecko.BrowserToolbarLayout>

View File

@ -7,10 +7,7 @@
<dimen name="browser_toolbar_height">56dp</dimen>
<dimen name="browser_toolbar_button_padding">16dp</dimen>
<dimen name="browser_toolbar_icon_width">45dp</dimen>
<dimen name="menu_popup_arrow_margin">8dip</dimen>
<dimen name="tabs_counter_size">26sp</dimen>
<dimen name="addressbar_offset_left">90dp</dimen>
<dimen name="addressbar_offset_left_noforward">50dip</dimen>
</resources>

View File

@ -33,9 +33,9 @@
<style name="AddressBar.ImageButton.Forward">
<item name="android:contentDescription">@string/forward</item>
<item name="android:layout_width">64dip</item>
<item name="android:layout_width">45dip</item>
<item name="android:layout_height">38dip</item>
<item name="android:paddingLeft">26dp</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:paddingTop">7dp</item>
<item name="android:paddingBottom">7dp</item>
<item name="android:layout_gravity">center_vertical</item>
@ -50,9 +50,7 @@
<style name="AddressBar.Button.Container">
<item name="android:layout_marginTop">6dp</item>
<item name="android:layout_marginBottom">6dp</item>
<item name="android:layout_marginRight">0dp</item>
<!-- Start with forward hidden -->
<item name="android:layout_marginLeft">@dimen/addressbar_offset_left_noforward</item>
<item name="android:orientation">horizontal</item>
</style>

View File

@ -30,7 +30,7 @@
<dimen name="awesomebar_tab_transparency_height">38dp</dimen>
<dimen name="browser_toolbar_height">48dp</dimen>
<dimen name="browser_toolbar_button_padding">12dp</dimen>
<dimen name="browser_toolbar_icon_width">36dp</dimen>
<dimen name="browser_toolbar_icon_width">48dp</dimen>
<dimen name="browser_toolbar_lock_width">20dp</dimen>
<dimen name="browser_toolbar_favicon_size">29.33dip</dimen>

View File

@ -175,15 +175,6 @@
<item name="android:background">@android:color/transparent</item>
</style>
<style name="AddressBar.Button.Container">
<item name="android:layout_marginLeft">4dp</item>
<item name="android:layout_marginRight">4dp</item>
<item name="android:layout_toLeftOf">@id/menu_items</item>
<item name="android:layout_alignParentLeft">true</item>
<item name="android:layout_alignParentBottom">true</item>
<item name="android:layout_centerVertical">true</item>
</style>
<!-- Address bar - Image Button -->
<style name="AddressBar.ImageButton" parent="AddressBar.Button">
<item name="android:scaleType">center</item>
@ -198,6 +189,10 @@
<item name="android:visibility">gone</item>
</style>
<style name="AddressBar.ImageButton.Back" parent="AddressBar.ImageButton.Unused">
<item name="android:contentDescription">@string/back</item>
</style>
<style name="AddressBar.ImageButton.Forward" parent="AddressBar.ImageButton.Unused">
<item name="android:contentDescription">@string/forward</item>
</style>

View File

@ -190,7 +190,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
*/
protected final Activity clickOnAwesomeBar() {
Activity activity = null;
Element awesomebar = mDriver.findElement(mActivity, "awesome_bar");
Element awesomebar = mDriver.findElement(mActivity, "browser_toolbar");
if (awesomebar != null) {
activity = getActivityFromClick(awesomebar);
if (activity == null) {