diff --git a/mobile/android/base/java/org/mozilla/gecko/ActionModeCompatView.java b/mobile/android/base/java/org/mozilla/gecko/ActionModeCompatView.java index ad4311b9fc4e..c9021b7105d2 100644 --- a/mobile/android/base/java/org/mozilla/gecko/ActionModeCompatView.java +++ b/mobile/android/base/java/org/mozilla/gecko/ActionModeCompatView.java @@ -4,6 +4,9 @@ package org.mozilla.gecko; +import android.content.res.TypedArray; +import android.graphics.Canvas; +import android.graphics.Paint; import org.mozilla.gecko.animation.AnimationUtils; import org.mozilla.gecko.menu.GeckoMenu; import org.mozilla.gecko.widget.GeckoPopupMenu; @@ -36,22 +39,20 @@ class ActionModeCompatView extends LinearLayout implements GeckoMenu.ActionItemB private int mActionButtonsWidth; - public ActionModeCompatView(Context context) { - super(context); - init(context); - } + private Paint mBottomDividerPaint; + private int mBottomDividerOffset; public ActionModeCompatView(Context context, AttributeSet attrs) { super(context, attrs); - init(context); + init(context, attrs, 0); } public ActionModeCompatView(Context context, AttributeSet attrs, int style) { super(context, attrs, style); - init(context); + init(context, attrs, style); } - public void init(Context context) { + public void init(final Context context, final AttributeSet attrs, final int defStyle) { LayoutInflater.from(context).inflate(R.layout.actionbar, this); mTitleView = (Button) findViewById(R.id.actionmode_title); @@ -67,6 +68,15 @@ class ActionModeCompatView extends LinearLayout implements GeckoMenu.ActionItemB openMenu(); } }); + + // The built-in action bar uses colorAccent for the divider so we duplicate that here. + final TypedArray arr = context.obtainStyledAttributes(attrs, new int[] { R.attr.colorAccent }, defStyle, 0); + final int bottomDividerColor = arr.getColor(0, 0); + arr.recycle(); + + mBottomDividerPaint = new Paint(); + mBottomDividerPaint.setColor(bottomDividerColor); + mBottomDividerOffset = getResources().getDimensionPixelSize(R.dimen.action_bar_divider_height); } public void initForMode(final ActionModeCompat mode) { @@ -178,4 +188,15 @@ class ActionModeCompatView extends LinearLayout implements GeckoMenu.ActionItemB mMenuButton.startAnimation(s); } } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + + // Draw the divider at the bottom of the screen. We could do this with a layer-list + // but then we'd have overdraw (http://stackoverflow.com/a/13509472). + final int bottom = getHeight(); + final int top = bottom - mBottomDividerOffset; + canvas.drawRect(0, top, getWidth(), bottom, mBottomDividerPaint); + } } diff --git a/mobile/android/base/resources/layout/gecko_app.xml b/mobile/android/base/resources/layout/gecko_app.xml index 7549e66d6c92..60e99499663e 100644 --- a/mobile/android/base/resources/layout/gecko_app.xml +++ b/mobile/android/base/resources/layout/gecko_app.xml @@ -146,7 +146,7 @@ + style="@style/GeckoActionBar.ActionMode"/> diff --git a/mobile/android/base/resources/values/colors.xml b/mobile/android/base/resources/values/colors.xml index 32b90d95e73e..1571bcf14dc3 100644 --- a/mobile/android/base/resources/values/colors.xml +++ b/mobile/android/base/resources/values/colors.xml @@ -138,4 +138,6 @@ #FFFFFF + @color/toolbar_grey + diff --git a/mobile/android/base/resources/values/dimens.xml b/mobile/android/base/resources/values/dimens.xml index 3ba37679e8ac..b30e6297763c 100644 --- a/mobile/android/base/resources/values/dimens.xml +++ b/mobile/android/base/resources/values/dimens.xml @@ -207,6 +207,10 @@ 2dip 1.5dp + + 2dp + -1 -2 diff --git a/mobile/android/base/resources/values/styles.xml b/mobile/android/base/resources/values/styles.xml index 3fc182c4e83c..85237b5000b3 100644 --- a/mobile/android/base/resources/values/styles.xml +++ b/mobile/android/base/resources/values/styles.xml @@ -662,11 +662,17 @@ bold + +