Merge pull request #9828 from JosJuice/android-pressed-opacity

Android: Apply opacity setting to pressed buttons too
This commit is contained in:
Léo Lam 2021-06-24 01:36:02 +02:00 committed by GitHub
commit 4979974a57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -117,6 +117,7 @@ public final class InputOverlayDrawableButton
public void setOpacity(int value) public void setOpacity(int value)
{ {
mDefaultStateBitmap.setAlpha(value); mDefaultStateBitmap.setAlpha(value);
mPressedStateBitmap.setAlpha(value);
} }
public Rect getBounds() public Rect getBounds()

View File

@ -186,6 +186,8 @@ public final class InputOverlayDrawableDpad
public void setOpacity(int value) public void setOpacity(int value)
{ {
mDefaultStateBitmap.setAlpha(value); mDefaultStateBitmap.setAlpha(value);
mPressedOneDirectionStateBitmap.setAlpha(value);
mPressedTwoDirectionsStateBitmap.setAlpha(value);
} }
public Rect getBounds() public Rect getBounds()

View File

@ -255,8 +255,20 @@ public final class InputOverlayDrawableJoystick
public void setOpacity(int value) public void setOpacity(int value)
{ {
mOpacity = value; mOpacity = value;
mDefaultStateInnerBitmap.setAlpha(value); mDefaultStateInnerBitmap.setAlpha(value);
mOuterBitmap.setAlpha(value); mPressedStateInnerBitmap.setAlpha(value);
if (trackId == -1)
{
mOuterBitmap.setAlpha(value);
mBoundsBoxBitmap.setAlpha(0);
}
else
{
mOuterBitmap.setAlpha(0);
mBoundsBoxBitmap.setAlpha(value);
}
} }
public Rect getBounds() public Rect getBounds()