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
parent 0f9731d61f
commit d3d1a792aa
14 changed files with 763 additions and 357 deletions

View File

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

View File

@@ -40,7 +40,6 @@ import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams; import android.widget.RelativeLayout.LayoutParams;
import android.widget.ViewSwitcher; import android.widget.ViewSwitcher;
@@ -53,12 +52,16 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
GeckoMenu.ActionItemBarPresenter, GeckoMenu.ActionItemBarPresenter,
Animation.AnimationListener { Animation.AnimationListener {
private static final String LOGTAG = "GeckoToolbar"; private static final String LOGTAG = "GeckoToolbar";
private GeckoRelativeLayout mLayout; private LinearLayout mLayout;
private View mAwesomeBar;
private LayoutParams mAwesomeBarParams; private LayoutParams mAwesomeBarParams;
private View mAwesomeBarContent;
private View mAwesomeBarEntry; private View mAwesomeBarEntry;
private ImageView mAwesomeBarRightEdge; private int mAwesomeBarEntryRightMargin;
private GeckoFrameLayout mAwesomeBarRightEdge;
private BrowserToolbarBackground mAddressBarBg; private BrowserToolbarBackground mAddressBarBg;
private View mAddressBarView;
private BrowserToolbarBackground.CurveTowards mAddressBarBgCurveTowards;
private int mAddressBarBgRightMargin;
private GeckoTextView mTitle; private GeckoTextView mTitle;
private int mTitlePadding; private int mTitlePadding;
private boolean mSiteSecurityVisible; private boolean mSiteSecurityVisible;
@@ -102,6 +105,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
private TranslateAnimation mTitleSlideRight; private TranslateAnimation mTitleSlideRight;
private int mAddressBarViewOffset; private int mAddressBarViewOffset;
private int mAddressBarViewOffsetNoForward;
private int mDefaultForwardMargin; private int mDefaultForwardMargin;
private PropertyAnimator mForwardAnim = null; private PropertyAnimator mForwardAnim = null;
@@ -127,23 +131,49 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mAnimatingEntry = false; mAnimatingEntry = false;
} }
public void from(RelativeLayout layout) { public void from(LinearLayout layout) {
if (mLayout != null) { if (mLayout != null) {
// make sure we retain the visibility property on rotation // make sure we retain the visibility property on rotation
layout.setVisibility(mLayout.getVisibility()); 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 @Override
public void onClick(View v) { public void onClick(View v) {
mActivity.autoHideTabs(); mActivity.autoHideTabs();
onAwesomeBarSearch(); onAwesomeBarSearch();
} }
}); });
mAwesomeBar.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
mLayout.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
@Override @Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
MenuInflater inflater = mActivity.getMenuInflater(); 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 = (ShapedButton) mLayout.findViewById(R.id.tabs);
mTabs.setOnClickListener(new Button.OnClickListener() { mTabs.setOnClickListener(new Button.OnClickListener() {
@Override @Override
@@ -317,11 +323,6 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
}); });
mShadow = (ImageView) mLayout.findViewById(R.id.shadow); mShadow = (ImageView) mLayout.findViewById(R.id.shadow);
mShadow.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
}
});
mHandler = new Handler(); mHandler = new Handler();
mSlideUpIn = new TranslateAnimation(0, 0, 40, 0); mSlideUpIn = new TranslateAnimation(0, 0, 40, 0);
@@ -380,7 +381,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
int tail = (width - height) / 2; int tail = (width - height) / 2;
Rect bounds = new Rect(0, 0, tail, height); Rect bounds = new Rect(0, 0, tail, height);
TailTouchDelegate delegate = new TailTouchDelegate(bounds, mShadow); TailTouchDelegate delegate = new TailTouchDelegate(bounds, mAddressBarView);
mTabs.setTouchDelegate(delegate); 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() { public View getLayout() {
@@ -498,7 +499,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
} }
public void setNextFocusDownId(int nextId) { public void setNextFocusDownId(int nextId) {
mLayout.setNextFocusDownId(nextId); mAwesomeBar.setNextFocusDownId(nextId);
mTabs.setNextFocusDownId(nextId); mTabs.setNextFocusDownId(nextId);
mBack.setNextFocusDownId(nextId); mBack.setNextFocusDownId(nextId);
mForward.setNextFocusDownId(nextId); mForward.setNextFocusDownId(nextId);
@@ -543,8 +544,52 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
return mInflater.inflate(R.layout.tabs_counter, null); return mInflater.inflate(R.layout.tabs_counter, null);
} }
private int getAwesomeBarAnimTranslation() { private int prepareAwesomeBarAnimation() {
return mLayout.getWidth() - mAwesomeBarEntry.getRight(); // 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) { 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 // 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 // case, we have to ensure the toolbar is in the correct initial state to
// shrink back. // shrink back.
if (!mLayout.isSelected()) { if (!mAwesomeBar.isSelected()) {
// Keep the entry highlighted during the animation int translation = prepareAwesomeBarAnimation();
mLayout.setSelected(true);
final int translation = getAwesomeBarAnimTranslation();
proxy = AnimatorProxy.create(mAwesomeBarRightEdge); proxy = AnimatorProxy.create(mAwesomeBarRightEdge);
proxy.setTranslationX(translation); proxy.setTranslationX(translation);
@@ -631,7 +673,27 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
@Override @Override
public void onPropertyAnimationEnd() { public void onPropertyAnimationEnd() {
// Turn off selected state on the entry // 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); PropertyAnimator buttonsAnimator = new PropertyAnimator(150);
@@ -673,10 +735,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
final PropertyAnimator contentAnimator = new PropertyAnimator(250); final PropertyAnimator contentAnimator = new PropertyAnimator(250);
contentAnimator.setUseHardwareLayer(false); contentAnimator.setUseHardwareLayer(false);
final int translation = getAwesomeBarAnimTranslation(); int translation = prepareAwesomeBarAnimation();
// Keep the entry highlighted during the animation
mLayout.setSelected(true);
if (mActionItemBar.getVisibility() == View.VISIBLE) { if (mActionItemBar.getVisibility() == View.VISIBLE) {
contentAnimator.attach(mFavicon, contentAnimator.attach(mFavicon,
@@ -800,7 +859,13 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
} }
public void prepareTabsAnimation(PropertyAnimator animator, int width) { 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, PropertyAnimator.Property.TRANSLATION_X,
width); width);
animator.attach(mAddressBarBg, animator.attach(mAddressBarBg,
@@ -842,7 +907,8 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
public void adjustTabsAnimation(boolean reset) { public void adjustTabsAnimation(boolean reset) {
int width = reset ? 0 : mTabsPaneWidth; int width = reset ? 0 : mTabsPaneWidth;
mAwesomeBarEntry.setTranslationX(width); mAwesomeBarRightEdge.setTranslationX(-width);
mAwesomeBar.setTranslationX(width);
mAddressBarBg.setTranslationX(width); mAddressBarBg.setTranslationX(width);
mTabs.setTranslationX(width); mTabs.setTranslationX(width);
mTabsCount.setTranslationX(width); mTabsCount.setTranslationX(width);
@@ -1005,7 +1071,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
title = null; title = null;
mTitle.setText(title); mTitle.setText(title);
mLayout.setContentDescription(title != null ? title : mTitle.getHint()); mAwesomeBar.setContentDescription(title != null ? title : mTitle.getHint());
} }
private void setFavicon(Bitmap image) { private void setFavicon(Bitmap image) {
@@ -1041,7 +1107,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
} }
public void requestFocusFromTouch() { public void requestFocusFromTouch() {
mLayout.requestFocusFromTouch(); mAwesomeBar.requestFocusFromTouch();
} }
public void updateBackButton(boolean enabled) { public void updateBackButton(boolean enabled) {
@@ -1064,7 +1130,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
return; return;
mForwardAnim = new PropertyAnimator(FORWARD_ANIMATION_DURATION); mForwardAnim = new PropertyAnimator(FORWARD_ANIMATION_DURATION);
final int width = mForward.getWidth() / 2; final int width = mForward.getWidth()/2;
mForwardAnim.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() { mForwardAnim.setPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
@Override @Override
@@ -1073,9 +1139,9 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
// Set the margin before the transition when hiding the forward button. We // 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 // have to do this so that the favicon isn't clipped during the transition
ViewGroup.MarginLayoutParams layoutParams = ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mAwesomeBarContent.getLayoutParams(); (ViewGroup.MarginLayoutParams)mAddressBarView.getLayoutParams();
layoutParams.leftMargin = 0; layoutParams.leftMargin = mAddressBarViewOffsetNoForward;
mAwesomeBarContent.requestLayout(); mAddressBarView.requestLayout();
// Note, we already translated the favicon, site security, and text field // Note, we already translated the favicon, site security, and text field
// in prepareForwardAnimation, so they should appear to have not moved at // in prepareForwardAnimation, so they should appear to have not moved at
// all at this point. // all at this point.
@@ -1086,7 +1152,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
public void onPropertyAnimationEnd() { public void onPropertyAnimationEnd() {
if (enabled) { if (enabled) {
ViewGroup.MarginLayoutParams layoutParams = ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mAwesomeBarContent.getLayoutParams(); (ViewGroup.MarginLayoutParams)mAddressBarView.getLayoutParams();
layoutParams.leftMargin = mAddressBarViewOffset; layoutParams.leftMargin = mAddressBarViewOffset;
AnimatorProxy proxy = AnimatorProxy.create(mTitle); AnimatorProxy proxy = AnimatorProxy.create(mTitle);
@@ -1095,19 +1161,19 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
proxy.setTranslationX(0); proxy.setTranslationX(0);
proxy = AnimatorProxy.create(mSiteSecurity); proxy = AnimatorProxy.create(mSiteSecurity);
proxy.setTranslationX(0); proxy.setTranslationX(0);
} }
ViewGroup.MarginLayoutParams layoutParams = ViewGroup.MarginLayoutParams layoutParams =
(ViewGroup.MarginLayoutParams)mForward.getLayoutParams(); (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); AnimatorProxy proxy = AnimatorProxy.create(mForward);
proxy.setTranslationX(0); proxy.setTranslationX(0);
mAwesomeBarContent.requestLayout(); mAddressBarView.requestLayout();
mForwardAnim = null; mForwardAnim = null;
} }
}); });
prepareForwardAnimation(mForwardAnim, enabled, width); prepareForwardAnimation(mForwardAnim, enabled, width);
mForwardAnim.start(); mForwardAnim.start();
} }
@@ -1116,7 +1182,7 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
if (!enabled) { if (!enabled) {
anim.attach(mForward, anim.attach(mForward,
PropertyAnimator.Property.TRANSLATION_X, PropertyAnimator.Property.TRANSLATION_X,
-width); -1*width);
anim.attach(mForward, anim.attach(mForward,
PropertyAnimator.Property.ALPHA, PropertyAnimator.Property.ALPHA,
0); 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 // 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 // the animation starts, so we shift these items to the right so that they don't
// appear to move initially. // appear to move initially.
int startTrans = mAddressBarViewOffset - mAddressBarViewOffsetNoForward;
AnimatorProxy proxy = AnimatorProxy.create(mTitle); AnimatorProxy proxy = AnimatorProxy.create(mTitle);
proxy.setTranslationX(mAddressBarViewOffset); proxy.setTranslationX(startTrans);
proxy = AnimatorProxy.create(mFavicon); proxy = AnimatorProxy.create(mFavicon);
proxy.setTranslationX(mAddressBarViewOffset); proxy.setTranslationX(startTrans);
proxy = AnimatorProxy.create(mSiteSecurity); proxy = AnimatorProxy.create(mSiteSecurity);
proxy.setTranslationX(mAddressBarViewOffset); proxy.setTranslationX(startTrans);
} else { } else {
anim.attach(mForward, anim.attach(mForward,
PropertyAnimator.Property.TRANSLATION_X, PropertyAnimator.Property.TRANSLATION_X,
@@ -1148,13 +1215,13 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
1); 1);
anim.attach(mTitle, anim.attach(mTitle,
PropertyAnimator.Property.TRANSLATION_X, PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset); mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
anim.attach(mFavicon, anim.attach(mFavicon,
PropertyAnimator.Property.TRANSLATION_X, PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset); mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
anim.attach(mSiteSecurity, anim.attach(mSiteSecurity,
PropertyAnimator.Property.TRANSLATION_X, PropertyAnimator.Property.TRANSLATION_X,
mAddressBarViewOffset); mAddressBarViewOffset - mAddressBarViewOffsetNoForward);
} }
} }
@@ -1201,7 +1268,11 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
mAddressBarBg.setPrivateMode(tab.isPrivate()); 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()); mTabs.setPrivateMode(tab.isPrivate());
mTitle.setPrivateMode(tab.isPrivate()); mTitle.setPrivateMode(tab.isPrivate());
mMenu.setPrivateMode(tab.isPrivate()); mMenu.setPrivateMode(tab.isPrivate());
@@ -1238,4 +1309,43 @@ public class BrowserToolbar implements ViewSwitcher.ViewFactory,
return true; 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,14 +14,72 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable; import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet; import android.util.AttributeSet;
public class BrowserToolbarBackground extends GeckoLinearLayout { public class BrowserToolbarBackground extends GeckoLinearLayout
implements CanvasDelegate.DrawManager {
private GeckoActivity mActivity; private GeckoActivity mActivity;
private Path mPath;
private CurveTowards mSide;
private CanvasDelegate mCanvasDelegate;
public enum CurveTowards { NONE, LEFT, RIGHT };
public BrowserToolbarBackground(Context context, AttributeSet attrs) { public BrowserToolbarBackground(Context context, AttributeSet attrs) {
super(context, 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; 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 @Override
public void onLightweightThemeChanged() { public void onLightweightThemeChanged() {
Drawable drawable = mActivity.getLightweightTheme().getDrawable(this); 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[] { R.attr.state_private }, new ColorDrawable(mActivity.getResources().getColor(R.color.background_private)));
stateList.addState(new int[] {}, drawable); stateList.addState(new int[] {}, drawable);
int[] padding = new int[] { getPaddingLeft(),
getPaddingTop(),
getPaddingRight(),
getPaddingBottom()
};
setBackgroundDrawable(stateList); setBackgroundDrawable(stateList);
setPadding(padding[0], padding[1], padding[2], padding[3]);
} }
@Override @Override
public void onLightweightThemeReset() { public void onLightweightThemeReset() {
int[] padding = new int[] { getPaddingLeft(),
getPaddingTop(),
getPaddingRight(),
getPaddingBottom()
};
setBackgroundResource(R.drawable.address_bar_bg); 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.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; 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"; private static final String LOGTAG = "GeckoToolbarLayout";
public BrowserToolbarLayout(Context context, AttributeSet attrs) { public BrowserToolbarLayout(Context context, AttributeSet attrs) {

View File

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

View File

@@ -401,6 +401,7 @@ RES_LAYOUT = \
res/layout/awesomebar_tab_indicator.xml \ res/layout/awesomebar_tab_indicator.xml \
res/layout/awesomebar_tabs.xml \ res/layout/awesomebar_tabs.xml \
res/layout/bookmark_edit.xml \ res/layout/bookmark_edit.xml \
res/layout/browser_toolbar.xml \
res/layout/browser_toolbar_menu.xml \ res/layout/browser_toolbar_menu.xml \
res/layout/datetime_picker.xml \ res/layout/datetime_picker.xml \
res/layout/doorhangerpopup.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.xml \
mobile/android/base/resources/drawable/address_bar_bg_shadow_repeat.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_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/address_bar_url.xml \
mobile/android/base/resources/drawable/awesomebar_header_row.xml \ mobile/android/base/resources/drawable/awesomebar_header_row.xml \
mobile/android/base/resources/drawable/awesomebar_row_favicon_bg.xml \ mobile/android/base/resources/drawable/awesomebar_row_favicon_bg.xml \

View File

@@ -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"/>

View File

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

View File

@@ -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>

View File

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

View File

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

View File

@@ -33,9 +33,9 @@
<style name="AddressBar.ImageButton.Forward"> <style name="AddressBar.ImageButton.Forward">
<item name="android:contentDescription">@string/forward</item> <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: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:paddingTop">7dp</item>
<item name="android:paddingBottom">7dp</item> <item name="android:paddingBottom">7dp</item>
<item name="android:layout_gravity">center_vertical</item> <item name="android:layout_gravity">center_vertical</item>
@@ -50,7 +50,9 @@
<style name="AddressBar.Button.Container"> <style name="AddressBar.Button.Container">
<item name="android:layout_marginTop">6dp</item> <item name="android:layout_marginTop">6dp</item>
<item name="android:layout_marginBottom">6dp</item> <item name="android:layout_marginBottom">6dp</item>
<item name="android:layout_marginRight">0dp</item>
<!-- Start with forward hidden --> <!-- Start with forward hidden -->
<item name="android:layout_marginLeft">@dimen/addressbar_offset_left_noforward</item>
<item name="android:orientation">horizontal</item> <item name="android:orientation">horizontal</item>
</style> </style>

View File

@@ -30,7 +30,7 @@
<dimen name="awesomebar_tab_transparency_height">38dp</dimen> <dimen name="awesomebar_tab_transparency_height">38dp</dimen>
<dimen name="browser_toolbar_height">48dp</dimen> <dimen name="browser_toolbar_height">48dp</dimen>
<dimen name="browser_toolbar_button_padding">12dp</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_lock_width">20dp</dimen>
<dimen name="browser_toolbar_favicon_size">29.33dip</dimen> <dimen name="browser_toolbar_favicon_size">29.33dip</dimen>
@@ -69,6 +69,7 @@
<dimen name="text_selection_handle_shadow">2dp</dimen> <dimen name="text_selection_handle_shadow">2dp</dimen>
<dimen name="validation_message_height">50dp</dimen> <dimen name="validation_message_height">50dp</dimen>
<dimen name="validation_message_margin_top">6dp</dimen> <dimen name="validation_message_margin_top">6dp</dimen>
<dimen name="forward_default_offset">-13dip</dimen> <dimen name="forward_default_offset">-11dip</dimen>
<dimen name="addressbar_offset_left">32dp</dimen> <dimen name="addressbar_offset_left">90dp</dimen>
<dimen name="addressbar_offset_left_noforward">50dip</dimen>
</resources> </resources>

View File

@@ -175,6 +175,15 @@
<item name="android:background">@android:color/transparent</item> <item name="android:background">@android:color/transparent</item>
</style> </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 --> <!-- Address bar - Image Button -->
<style name="AddressBar.ImageButton" parent="AddressBar.Button"> <style name="AddressBar.ImageButton" parent="AddressBar.Button">
<item name="android:scaleType">center</item> <item name="android:scaleType">center</item>
@@ -189,10 +198,6 @@
<item name="android:visibility">gone</item> <item name="android:visibility">gone</item>
</style> </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"> <style name="AddressBar.ImageButton.Forward" parent="AddressBar.ImageButton.Unused">
<item name="android:contentDescription">@string/forward</item> <item name="android:contentDescription">@string/forward</item>
</style> </style>