cked out changesets 10bdfbe0195b and 06b0f332039d (bug 858687) because of Robocop failures (r=backout)

This commit is contained in:
Lucas Rocha 2013-04-24 22:53:31 +01:00
Родитель 348bbcb521
Коммит 2c84e2db6e
14 изменённых файлов: 763 добавлений и 357 удалений

Просмотреть файл

@ -342,7 +342,7 @@ abstract public class BrowserApp extends GeckoApp
super.onCreate(savedInstanceState);
RelativeLayout actionBar = (RelativeLayout) getActionBarLayout();
LinearLayout actionBar = (LinearLayout) getActionBarLayout();
mMainLayout.addView(actionBar, 2);
((GeckoApp.MainLayout) mMainLayout).setTouchEventInterceptor(new HideTabsTouchListener());
@ -683,9 +683,16 @@ abstract public class BrowserApp extends GeckoApp
}
public View getActionBarLayout() {
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)));
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)));
return actionBar;
}

Просмотреть файл

@ -40,7 +40,6 @@ 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;
@ -53,12 +52,16 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
GeckoMenu.ActionItemBarPresenter,
Animation.AnimationListener {
private static final String LOGTAG = "GeckoToolbar";
private GeckoRelativeLayout mLayout;
private LinearLayout mLayout;
private View mAwesomeBar;
private LayoutParams mAwesomeBarParams;
private View mAwesomeBarContent;
private View mAwesomeBarEntry;
private ImageView mAwesomeBarRightEdge;
private int mAwesomeBarEntryRightMargin;
private GeckoFrameLayout mAwesomeBarRightEdge;
private BrowserToolbarBackground mAddressBarBg;
private View mAddressBarView;
private BrowserToolbarBackground.CurveTowards mAddressBarBgCurveTowards;
private int mAddressBarBgRightMargin;
private GeckoTextView mTitle;
private int mTitlePadding;
private boolean mSiteSecurityVisible;
@ -102,6 +105,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
private TranslateAnimation mTitleSlideRight;
private int mAddressBarViewOffset;
private int mAddressBarViewOffsetNoForward;
private int mDefaultForwardMargin;
private PropertyAnimator mForwardAnim = null;
@ -127,23 +131,49 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mAnimatingEntry = false;
}
public void from(RelativeLayout layout) {
public void from(LinearLayout 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) {
}
});
mLayout = (GeckoRelativeLayout) layout;
mShowSiteSecurity = false;
mShowReader = false;
mLayout.setOnClickListener(new Button.OnClickListener() {
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() {
@Override
public void onClick(View v) {
mActivity.autoHideTabs();
onAwesomeBarSearch();
}
});
mLayout.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
mAwesomeBar.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
MenuInflater inflater = mActivity.getMenuInflater();
@ -176,30 +206,6 @@ 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
@ -317,11 +323,6 @@ 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);
@ -380,7 +381,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, mShadow);
TailTouchDelegate delegate = new TailTouchDelegate(bounds, mAddressBarView);
mTabs.setTouchDelegate(delegate);
}
});
@ -412,7 +413,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
}
mFocusOrder = Arrays.asList(mBack, mForward, mLayout, mReader, mSiteSecurity, mStop, mTabs);
mFocusOrder = Arrays.asList(mBack, mForward, mAwesomeBar, mReader, mSiteSecurity, mStop, mTabs);
}
public View getLayout() {
@ -498,7 +499,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
public void setNextFocusDownId(int nextId) {
mLayout.setNextFocusDownId(nextId);
mAwesomeBar.setNextFocusDownId(nextId);
mTabs.setNextFocusDownId(nextId);
mBack.setNextFocusDownId(nextId);
mForward.setNextFocusDownId(nextId);
@ -543,8 +544,52 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
return mInflater.inflate(R.layout.tabs_counter, null);
}
private int getAwesomeBarAnimTranslation() {
return mLayout.getWidth() - mAwesomeBarEntry.getRight();
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;
}
public void fromAwesomeBarSearch(String url) {
@ -565,11 +610,8 @@ 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 (!mLayout.isSelected()) {
// Keep the entry highlighted during the animation
mLayout.setSelected(true);
final int translation = getAwesomeBarAnimTranslation();
if (!mAwesomeBar.isSelected()) {
int translation = prepareAwesomeBarAnimation();
proxy = AnimatorProxy.create(mAwesomeBarRightEdge);
proxy.setTranslationX(translation);
@ -631,7 +673,27 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
@Override
public void onPropertyAnimationEnd() {
// Turn off selected state on the entry
mLayout.setSelected(false);
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);
PropertyAnimator buttonsAnimator = new PropertyAnimator(150);
@ -673,10 +735,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
final PropertyAnimator contentAnimator = new PropertyAnimator(250);
contentAnimator.setUseHardwareLayer(false);
final int translation = getAwesomeBarAnimTranslation();
// Keep the entry highlighted during the animation
mLayout.setSelected(true);
int translation = prepareAwesomeBarAnimation();
if (mActionItemBar.getVisibility() == View.VISIBLE) {
contentAnimator.attach(mFavicon,
@ -800,7 +859,13 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
public void prepareTabsAnimation(PropertyAnimator animator, int width) {
animator.attach(mAwesomeBarEntry,
// 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,
PropertyAnimator.Property.TRANSLATION_X,
width);
animator.attach(mAddressBarBg,
@ -842,7 +907,8 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
public void adjustTabsAnimation(boolean reset) {
int width = reset ? 0 : mTabsPaneWidth;
mAwesomeBarEntry.setTranslationX(width);
mAwesomeBarRightEdge.setTranslationX(-width);
mAwesomeBar.setTranslationX(width);
mAddressBarBg.setTranslationX(width);
mTabs.setTranslationX(width);
mTabsCount.setTranslationX(width);
@ -1005,7 +1071,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
title = null;
mTitle.setText(title);
mLayout.setContentDescription(title != null ? title : mTitle.getHint());
mAwesomeBar.setContentDescription(title != null ? title : mTitle.getHint());
}
private void setFavicon(Bitmap image) {
@ -1041,7 +1107,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}
public void requestFocusFromTouch() {
mLayout.requestFocusFromTouch();
mAwesomeBar.requestFocusFromTouch();
}
public void updateBackButton(boolean enabled) {
@ -1064,7 +1130,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
@ -1073,9 +1139,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)mAwesomeBarContent.getLayoutParams();
layoutParams.leftMargin = 0;
mAwesomeBarContent.requestLayout();
(ViewGroup.MarginLayoutParams)mAddressBarView.getLayoutParams();
layoutParams.leftMargin = mAddressBarViewOffsetNoForward;
mAddressBarView.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.
@ -1086,7 +1152,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
public void onPropertyAnimationEnd() {
if (enabled) {
ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mAwesomeBarContent.getLayoutParams();
(ViewGroup.MarginLayoutParams)mAddressBarView.getLayoutParams();
layoutParams.leftMargin = mAddressBarViewOffset;
AnimatorProxy proxy = AnimatorProxy.create(mTitle);
@ -1095,19 +1161,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);
mAwesomeBarContent.requestLayout();
mAddressBarView.requestLayout();
mForwardAnim = null;
}
});
prepareForwardAnimation(mForwardAnim, enabled, width);
mForwardAnim.start();
}
@ -1116,7 +1182,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
if (!enabled) {
anim.attach(mForward,
PropertyAnimator.Property.TRANSLATION_X,
-width);
-1*width);
anim.attach(mForward,
PropertyAnimator.Property.ALPHA,
0);
@ -1133,12 +1199,13 @@ 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(mAddressBarViewOffset);
proxy.setTranslationX(startTrans);
proxy = AnimatorProxy.create(mFavicon);
proxy.setTranslationX(mAddressBarViewOffset);
proxy.setTranslationX(startTrans);
proxy = AnimatorProxy.create(mSiteSecurity);
proxy.setTranslationX(mAddressBarViewOffset);
proxy.setTranslationX(startTrans);
} else {
anim.attach(mForward,
PropertyAnimator.Property.TRANSLATION_X,
@ -1148,13 +1215,13 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
1);
anim.attach(mTitle,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset);
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
anim.attach(mFavicon,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset);
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
anim.attach(mSiteSecurity,
PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset);
mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
}
}
@ -1201,7 +1268,11 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mAddressBarBg.setPrivateMode(tab.isPrivate());
mLayout.setPrivateMode(tab.isPrivate());
if (mAwesomeBar instanceof GeckoButton)
((GeckoButton) mAwesomeBar).setPrivateMode(tab.isPrivate());
else if (mAwesomeBar instanceof GeckoRelativeLayout)
((GeckoRelativeLayout) mAwesomeBar).setPrivateMode(tab.isPrivate());
mTabs.setPrivateMode(tab.isPrivate());
mTitle.setPrivateMode(tab.isPrivate());
mMenu.setPrivateMode(tab.isPrivate());
@ -1238,4 +1309,43 @@ 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]);
}
}
}

Просмотреть файл

@ -14,14 +14,72 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
public class BrowserToolbarBackground extends GeckoLinearLayout {
public class BrowserToolbarBackground extends GeckoLinearLayout
implements CanvasDelegate.DrawManager {
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);
@ -32,11 +90,35 @@ 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();
}
}

Просмотреть файл

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

Просмотреть файл

@ -56,6 +56,7 @@ 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));

Просмотреть файл

@ -401,6 +401,7 @@ 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 \
@ -999,7 +1000,6 @@ 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 \

Просмотреть файл

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

Просмотреть файл

@ -6,162 +6,176 @@
<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"
android:clickable="true"
android:focusable="true">
style="@style/BrowserToolbar">
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
gecko:curveTowards="none"
android:layout_marginLeft="10dp"
android:background="@drawable/address_bar_bg"/>
<RelativeLayout android:id="@+id/address_bar"
style="@style/AddressBar">
<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"/>
<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.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.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"/>
<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.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"/>
<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"/>
<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"/>
</FrameLayout>
<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"/>
<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"/>
<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">
<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"
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"
android:layout_centerVertical="true"
android:padding="13dp"
android:src="@drawable/ic_menu_back"
android:contentDescription="@string/back"
android:background="@drawable/address_bar_nav_button"/>
android:clickable="true"
android:focusable="true">
<LinearLayout android:id="@+id/awesome_bar_content"
style="@style/AddressBar.Button.Container"
android:layout_toRightOf="@id/back"
android:layout_toLeftOf="@id/menu_items">
<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"/>
<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"/>
<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/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.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.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"/>
</view>
<ImageButton android:id="@+id/reader"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/reader"
android:contentDescription="@string/reader"
android:visibility="gone"/>
</Gecko.RelativeLayout>
<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.ForwardButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
</LinearLayout>
<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 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"/>
<LinearLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<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/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"/>
<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"/>
<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>
</org.mozilla.gecko.BrowserToolbarLayout>

Просмотреть файл

@ -0,0 +1,165 @@
<?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>

Просмотреть файл

@ -6,142 +6,167 @@
<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"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true">
style="@style/BrowserToolbar">
<ImageButton android:id="@+id/back"
style="@style/AddressBar.ImageButton.Back"/>
<RelativeLayout android:id="@+id/address_bar"
style="@style/AddressBar">
<ImageButton android:id="@+id/forward"
style="@style/AddressBar.ImageButton.Forward"/>
<ImageButton android:id="@+id/back"
android:contentDescription="@string/back"
style="@style/AddressBar.ImageButton.Unused"/>
<org.mozilla.gecko.BrowserToolbarBackground android:id="@+id/address_bar_bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
gecko:curveTowards="none"
android:background="@drawable/address_bar_bg"/>
<ImageButton style="@style/AddressBar.ImageButton.Forward"
android:id="@+id/forward"/>
<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"/>
<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_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"/>
<FrameLayout style="@style/AddressBar.Button.Container"
android:id="@+id/addressbar">
<LinearLayout android:id="@+id/menu_items"
style="@style/AddressBar.ImageButton.Unused"/>
<Gecko.RelativeLayout android:id="@+id/awesome_bar"
style="@style/AddressBar.Button"
android:layout_centerVertical="true"
android:clickable="true"
android:focusable="true">
<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"/>
<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/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"/>
<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.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: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"/>
<LinearLayout android:id="@+id/awesome_bar_content"
style="@style/AddressBar.Button"
android:layout_toLeftOf="@id/tabs"
android:layout_marginRight="-24dp"
android:orientation="horizontal">
</view>
<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"/>
</Gecko.RelativeLayout>
<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"/>
<LinearLayout style="@style/AddressBar.Button"
android:paddingRight="100dp"
android:orientation="horizontal">
<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/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/reader"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/reader"
android:contentDescription="@string/reader"
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"/>
<ImageButton android:id="@+id/stop"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/urlbar_stop"
android:contentDescription="@string/stop"
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"/>
</LinearLayout>
<ImageButton android:id="@+id/reader"
style="@style/AddressBar.ImageButton.Icon"
android:src="@drawable/reader"
android:contentDescription="@string/reader"
android:visibility="gone"/>
<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"/>
<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>
</org.mozilla.gecko.BrowserToolbarLayout>

Просмотреть файл

@ -7,7 +7,10 @@
<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>

Просмотреть файл

@ -33,9 +33,9 @@
<style name="AddressBar.ImageButton.Forward">
<item name="android:contentDescription">@string/forward</item>
<item name="android:layout_width">45dip</item>
<item name="android:layout_width">64dip</item>
<item name="android:layout_height">38dip</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:paddingLeft">26dp</item>
<item name="android:paddingTop">7dp</item>
<item name="android:paddingBottom">7dp</item>
<item name="android:layout_gravity">center_vertical</item>
@ -50,7 +50,9 @@
<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>

Просмотреть файл

@ -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">48dp</dimen>
<dimen name="browser_toolbar_icon_width">36dp</dimen>
<dimen name="browser_toolbar_lock_width">20dp</dimen>
<dimen name="browser_toolbar_favicon_size">29.33dip</dimen>
@ -69,6 +69,7 @@
<dimen name="text_selection_handle_shadow">2dp</dimen>
<dimen name="validation_message_height">50dp</dimen>
<dimen name="validation_message_margin_top">6dp</dimen>
<dimen name="forward_default_offset">-13dip</dimen>
<dimen name="addressbar_offset_left">32dp</dimen>
<dimen name="forward_default_offset">-11dip</dimen>
<dimen name="addressbar_offset_left">90dp</dimen>
<dimen name="addressbar_offset_left_noforward">50dip</dimen>
</resources>

Просмотреть файл

@ -175,6 +175,15 @@
<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>
@ -189,10 +198,6 @@
<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>