mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
Custom controls changes
- Try to get toggleable option works. - [Bug fix] Hidden buttons
This commit is contained in:
parent
7b2eaeac94
commit
1b04a74f5c
@ -174,9 +174,8 @@ public class ControlButton extends Button implements OnLongClickListener, OnTouc
|
||||
public boolean onTouch(View view, MotionEvent event) {
|
||||
if (!mModifiable) {
|
||||
mCanTriggerLongClick = false;
|
||||
|
||||
// if (!mProperties.isToggle) {
|
||||
if (mProperties.keycode >= 0) {
|
||||
if (mProperties.keycode >= 0) {
|
||||
if (!mProperties.isToggle) {
|
||||
boolean isDown;
|
||||
switch (event.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN: // 0
|
||||
@ -192,13 +191,12 @@ public class ControlButton extends Button implements OnLongClickListener, OnTouc
|
||||
return false;
|
||||
}
|
||||
MainActivity.sendKeyPress(mProperties.keycode, mMods, isDown);
|
||||
return true;
|
||||
} else if (mGestureDetector.onTouchEvent(event)) {
|
||||
mChecked = !mChecked;
|
||||
MainActivity.sendKeyPress(mProperties.keycode, mMods, mChecked);
|
||||
}
|
||||
/* } else if (mGestureDetector.onTouchEvent(event)) {
|
||||
mChecked = !mChecked;
|
||||
MainActivity.sendKeyPress(mProperties.keycode, mMods, mChecked);
|
||||
} */
|
||||
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (mGestureDetector.onTouchEvent(event)) {
|
||||
mCanTriggerLongClick = true;
|
||||
|
@ -69,6 +69,9 @@ public class ControlLayout extends FrameLayout
|
||||
private void addControlView(ControlData controlButton) {
|
||||
final ControlButton view = new ControlButton(this, controlButton);
|
||||
view.setModifiable(mModifiable);
|
||||
if (!mModifiable) {
|
||||
view.setAlpha(view.getProperties().hidden ? 0f : 1.0f);
|
||||
}
|
||||
addView(view);
|
||||
|
||||
setModified(true);
|
||||
|
Loading…
x
Reference in New Issue
Block a user