зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1019035 - Rounded top-left corner on the toolbar while in display mode (r=mcomella)
This commit is contained in:
Родитель
30428e0984
Коммит
dad2cec69f
|
@ -40,8 +40,11 @@ import org.mozilla.gecko.widget.ThemedRelativeLayout;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
@ -160,6 +163,9 @@ public class BrowserToolbar extends ThemedRelativeLayout
|
|||
private int urlBarViewOffset;
|
||||
private int defaultForwardMargin;
|
||||
|
||||
private Path roundCornerShape;
|
||||
private Paint roundCornerPaint;
|
||||
|
||||
private static final Interpolator buttonsInterpolator = new AccelerateInterpolator();
|
||||
|
||||
private static final int FORWARD_ANIMATION_DURATION = 450;
|
||||
|
@ -173,6 +179,8 @@ public class BrowserToolbar extends ThemedRelativeLayout
|
|||
|
||||
public BrowserToolbar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setWillNotDraw(false);
|
||||
|
||||
theme = ((GeckoApplication) context.getApplicationContext()).getLightweightTheme();
|
||||
|
||||
// BrowserToolbar is attached to BrowserApp only.
|
||||
|
@ -245,6 +253,19 @@ public class BrowserToolbar extends ThemedRelativeLayout
|
|||
focusOrder.addAll(Arrays.asList(tabsButton, menuButton));
|
||||
}
|
||||
|
||||
if (!HardwareUtils.isTablet()) {
|
||||
roundCornerShape = new Path();
|
||||
roundCornerShape.moveTo(0, 0);
|
||||
roundCornerShape.lineTo(30, 0);
|
||||
roundCornerShape.cubicTo(0, 0, 0, 0, 0, 30);
|
||||
roundCornerShape.lineTo(0, 0);
|
||||
|
||||
roundCornerPaint = new Paint();
|
||||
roundCornerPaint.setAntiAlias(true);
|
||||
roundCornerPaint.setColor(res.getColor(R.color.background_tabs));
|
||||
roundCornerPaint.setStrokeWidth(0.0f);
|
||||
}
|
||||
|
||||
setUIMode(UIMode.DISPLAY);
|
||||
|
||||
// Create these listeners here, once, to avoid constructing new listeners
|
||||
|
@ -478,6 +499,15 @@ public class BrowserToolbar extends ThemedRelativeLayout
|
|||
prefs.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
super.draw(canvas);
|
||||
|
||||
if (!HardwareUtils.isTablet() && uiMode == UIMode.DISPLAY) {
|
||||
canvas.drawPath(roundCornerShape, roundCornerPaint);
|
||||
}
|
||||
}
|
||||
|
||||
public void setProgressBar(ToolbarProgressView progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче