Bug 1076260 - Adjust new tablet divider size and color. r=lucasr

This commit is contained in:
Michael Comella 2014-10-03 18:00:59 -07:00
parent dfee244955
commit 3c4b4b5713
2 changed files with 13 additions and 6 deletions

View File

@ -6,12 +6,13 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#D1D5DA"
android:endColor="@android:color/transparent"
android:angle="90"/>
<solid android:color="#555555"/>
<size android:width="1dp"
android:height="32dp"/>
android:height="30dp"/>
<!-- We draw this ourselves in TabStripView.draw() and to avoid implementing more
than we have to, only bottom padding is taken into account. -->
<padding android:bottom="6dp"/>
</shape>

View File

@ -8,6 +8,7 @@ package org.mozilla.gecko.tabs;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
@ -27,6 +28,10 @@ public class TabStripView extends TwoWayView {
private final TabStripAdapter adapter;
private final Drawable divider;
// Filled by calls to ShapeDrawable.getPadding();
// saved to prevent allocation in draw().
private final Rect dividerPadding = new Rect();
private boolean isPrivate;
public TabStripView(Context context, AttributeSet attrs) {
@ -41,6 +46,7 @@ public class TabStripView extends TwoWayView {
final Resources resources = getResources();
divider = resources.getDrawable(R.drawable.new_tablet_tab_strip_divider);
divider.getPadding(dividerPadding);
final int itemMargin =
resources.getDimensionPixelSize(R.dimen.new_tablet_tab_strip_item_margin);
@ -141,7 +147,7 @@ public class TabStripView extends TwoWayView {
public void draw(Canvas canvas) {
super.draw(canvas);
final int bottom = getHeight() - getPaddingBottom();
final int bottom = getHeight() - getPaddingBottom() - dividerPadding.bottom;
final int top = bottom - divider.getIntrinsicHeight();
final int dividerWidth = divider.getIntrinsicWidth();