mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 787627: Proper curve for croppped tabs button. [r=mfinkle]
--HG-- extra : rebase_source : dcf1beccbf9f62cb504b098c90b212b41493cc3c
This commit is contained in:
parent
ea087e77f3
commit
1e19ebd265
@ -31,6 +31,7 @@ public class CanvasDelegate {
|
||||
mPaint = new Paint();
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setColor(0xFFFF0000);
|
||||
mPaint.setStrokeWidth(0.0f);
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas, Path path, int width, int height) {
|
||||
|
@ -23,7 +23,6 @@ public class TabsButton extends ShapedButton {
|
||||
private Path mRightCurve;
|
||||
|
||||
private boolean mCropped;
|
||||
private int mFullWidth;
|
||||
|
||||
public TabsButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
@ -36,6 +35,7 @@ public class TabsButton extends ShapedButton {
|
||||
mPaint = new Paint();
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setColor(0xFF000000);
|
||||
mPaint.setStrokeWidth(0.0f);
|
||||
|
||||
// Path is masked.
|
||||
mPath = new Path();
|
||||
@ -43,9 +43,6 @@ public class TabsButton extends ShapedButton {
|
||||
mLeftCurve = new Path();
|
||||
mRightCurve = new Path();
|
||||
mCanvasDelegate = new CanvasDelegate(this, Mode.DST_IN);
|
||||
|
||||
// Path might extend beyond the screen for smaller tabs button.
|
||||
mFullWidth = (int) context.getResources().getDimension(R.dimen.tabs_button_full_width);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -64,11 +61,11 @@ public class TabsButton extends ShapedButton {
|
||||
|
||||
if (mSide == CurveTowards.RIGHT) {
|
||||
left = 0;
|
||||
right = mFullWidth;
|
||||
right = width;
|
||||
top = 0;
|
||||
bottom = height;
|
||||
} else {
|
||||
left = width - mFullWidth;
|
||||
left = 0;
|
||||
right = width;
|
||||
top = height;
|
||||
bottom = 0;
|
||||
@ -78,9 +75,8 @@ public class TabsButton extends ShapedButton {
|
||||
mLeftCurve.moveTo(left, top);
|
||||
|
||||
if (mCropped && mSide == CurveTowards.LEFT) {
|
||||
mLeftCurve.cubicTo(left + curve, top,
|
||||
left, bottom,
|
||||
left + curve, bottom);
|
||||
mLeftCurve.lineTo(left, top/2);
|
||||
mLeftCurve.quadTo(left * 0.95f, top * 0.05f, left + curve/2, bottom);
|
||||
} else {
|
||||
mLeftCurve.cubicTo(left + (curve * 0.75f), top,
|
||||
left + (curve * 0.25f), bottom,
|
||||
@ -91,9 +87,8 @@ public class TabsButton extends ShapedButton {
|
||||
mRightCurve.moveTo(right, bottom);
|
||||
|
||||
if (mCropped && mSide == CurveTowards.RIGHT) {
|
||||
mRightCurve.cubicTo(right - curve, bottom,
|
||||
right, top,
|
||||
right - curve, top);
|
||||
mRightCurve.lineTo(right, bottom/2);
|
||||
mRightCurve.quadTo(right * 0.95f, bottom * 0.05f, right - (curve/2), top);
|
||||
} else {
|
||||
mRightCurve.cubicTo(right - (curve * 0.75f), bottom,
|
||||
right - (curve * 0.25f), top,
|
||||
|
@ -8,6 +8,5 @@
|
||||
<dimen name="browser_toolbar_height">40dp</dimen>
|
||||
<dimen name="browser_toolbar_icon_width">46dp</dimen>
|
||||
<dimen name="tabs_counter_size">18sp</dimen>
|
||||
<dimen name="tabs_button_full_width">80dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
@ -8,6 +8,5 @@
|
||||
<dimen name="browser_toolbar_height">56dp</dimen>
|
||||
<dimen name="browser_toolbar_icon_width">45dp</dimen>
|
||||
<dimen name="tabs_counter_size">26sp</dimen>
|
||||
<dimen name="tabs_button_full_width">115dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
@ -16,6 +16,5 @@
|
||||
<dimen name="remote_tab_child_row_height">48dp</dimen>
|
||||
<dimen name="remote_tab_group_row_height">28dp</dimen>
|
||||
<dimen name="tabs_counter_size">26sp</dimen>
|
||||
<dimen name="tabs_button_full_width">115dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
@ -32,7 +32,6 @@
|
||||
<dimen name="popup_width">400dp</dimen>
|
||||
<dimen name="tab_thumbnail_height">78dp</dimen>
|
||||
<dimen name="tab_thumbnail_width">136dp</dimen>
|
||||
<dimen name="tabs_button_full_width">98dp</dimen>
|
||||
<dimen name="tabs_counter_size">22sp</dimen>
|
||||
<dimen name="tabs_list_divider_height">2dp</dimen>
|
||||
<dimen name="text_selection_handle_width">30dp</dimen>
|
||||
|
Loading…
Reference in New Issue
Block a user