mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -04:00
Fix[controls]: incorrect activated overlay on rounded controls
This commit is contained in:
parent
b4a3e18b9a
commit
6e194302f5
@ -31,6 +31,9 @@ public class ControlButton extends TextView implements ControlInterface {
|
|||||||
protected ControlData mProperties;
|
protected ControlData mProperties;
|
||||||
private final ControlLayout mControlLayout;
|
private final ControlLayout mControlLayout;
|
||||||
|
|
||||||
|
/* Cache value from the ControlData radius for drawing purposes */
|
||||||
|
private float mComputedRadius;
|
||||||
|
|
||||||
protected boolean mIsToggled = false;
|
protected boolean mIsToggled = false;
|
||||||
protected boolean mIsPointerOutOfBounds = false;
|
protected boolean mIsPointerOutOfBounds = false;
|
||||||
|
|
||||||
@ -61,6 +64,7 @@ public class ControlButton extends TextView implements ControlInterface {
|
|||||||
public void setProperties(ControlData properties, boolean changePos) {
|
public void setProperties(ControlData properties, boolean changePos) {
|
||||||
mProperties = properties;
|
mProperties = properties;
|
||||||
ControlInterface.super.setProperties(properties, changePos);
|
ControlInterface.super.setProperties(properties, changePos);
|
||||||
|
mComputedRadius = ControlInterface.super.computeCornerRadius(mProperties.cornerRadius);
|
||||||
|
|
||||||
if (mProperties.isToggle) {
|
if (mProperties.isToggle) {
|
||||||
//For the toggle layer
|
//For the toggle layer
|
||||||
@ -85,7 +89,7 @@ public class ControlButton extends TextView implements ControlInterface {
|
|||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
if (mIsToggled || (!mProperties.isToggle && isActivated()))
|
if (mIsToggled || (!mProperties.isToggle && isActivated()))
|
||||||
canvas.drawRoundRect(0, 0, getWidth(), getHeight(), mProperties.cornerRadius, mProperties.cornerRadius, mRectPaint);
|
canvas.drawRoundRect(0, 0, getWidth(), getHeight(), mComputedRadius, mComputedRadius, mRectPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user