mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 00:59:35 -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) {
|
public boolean onTouch(View view, MotionEvent event) {
|
||||||
if (!mModifiable) {
|
if (!mModifiable) {
|
||||||
mCanTriggerLongClick = false;
|
mCanTriggerLongClick = false;
|
||||||
|
if (mProperties.keycode >= 0) {
|
||||||
// if (!mProperties.isToggle) {
|
if (!mProperties.isToggle) {
|
||||||
if (mProperties.keycode >= 0) {
|
|
||||||
boolean isDown;
|
boolean isDown;
|
||||||
switch (event.getActionMasked()) {
|
switch (event.getActionMasked()) {
|
||||||
case MotionEvent.ACTION_DOWN: // 0
|
case MotionEvent.ACTION_DOWN: // 0
|
||||||
@ -192,13 +191,12 @@ public class ControlButton extends Button implements OnLongClickListener, OnTouc
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MainActivity.sendKeyPress(mProperties.keycode, mMods, isDown);
|
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)) {
|
return true;
|
||||||
mChecked = !mChecked;
|
}
|
||||||
MainActivity.sendKeyPress(mProperties.keycode, mMods, mChecked);
|
|
||||||
} */
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (mGestureDetector.onTouchEvent(event)) {
|
if (mGestureDetector.onTouchEvent(event)) {
|
||||||
mCanTriggerLongClick = true;
|
mCanTriggerLongClick = true;
|
||||||
|
@ -69,6 +69,9 @@ public class ControlLayout extends FrameLayout
|
|||||||
private void addControlView(ControlData controlButton) {
|
private void addControlView(ControlData controlButton) {
|
||||||
final ControlButton view = new ControlButton(this, controlButton);
|
final ControlButton view = new ControlButton(this, controlButton);
|
||||||
view.setModifiable(mModifiable);
|
view.setModifiable(mModifiable);
|
||||||
|
if (!mModifiable) {
|
||||||
|
view.setAlpha(view.getProperties().hidden ? 0f : 1.0f);
|
||||||
|
}
|
||||||
addView(view);
|
addView(view);
|
||||||
|
|
||||||
setModified(true);
|
setModified(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user