mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 17:15:40 -04:00
Fix[controls]: sub button visibility lifecycle
This commit is contained in:
parent
876c97fe2e
commit
3729230c42
@ -185,11 +185,12 @@ public class ControlLayout extends FrameLayout {
|
||||
view.setFocusable(false);
|
||||
view.setFocusableInTouchMode(false);
|
||||
}else{
|
||||
view.setVisible(drawer.areButtonsVisible);
|
||||
view.setVisible(true);
|
||||
}
|
||||
|
||||
drawer.addButton(view);
|
||||
addView(view);
|
||||
drawer.addButton(view);
|
||||
|
||||
|
||||
setModified(true);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package net.kdt.pojavlaunch.customcontrols.buttons;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.kdt.pojavlaunch.Tools;
|
||||
import net.kdt.pojavlaunch.customcontrols.ControlData;
|
||||
@ -40,12 +41,12 @@ public class ControlDrawer extends ControlButton {
|
||||
|
||||
public void addButton(ControlSubButton button){
|
||||
buttons.add(button);
|
||||
setControlButtonVisibility(button, areButtonsVisible);
|
||||
syncButtons();
|
||||
setControlButtonVisibility(button, areButtonsVisible);
|
||||
}
|
||||
|
||||
private void setControlButtonVisibility(ControlButton button, boolean isVisible){
|
||||
button.setVisible(isVisible);
|
||||
post(() -> button.setVisible(isVisible));
|
||||
}
|
||||
|
||||
private void switchButtonVisibility(){
|
||||
@ -124,10 +125,12 @@ public class ControlDrawer extends ControlButton {
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean isVisible) {
|
||||
//TODO replicate changes to his children ?
|
||||
setVisibility(isVisible ? VISIBLE : GONE);
|
||||
if(!isVisible){
|
||||
areButtonsVisible = false;
|
||||
int visibility = isVisible ? VISIBLE : GONE;
|
||||
setVisibility(visibility);
|
||||
if(visibility == GONE || areButtonsVisible) {
|
||||
for(ControlSubButton button : buttons){
|
||||
button.setVisible(isVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,12 @@ public class ControlSubButton extends ControlButton {
|
||||
|
||||
@Override
|
||||
public void setVisible(boolean isVisible) {
|
||||
setVisibility(isVisible ? (parentDrawer.areButtonsVisible ? VISIBLE : GONE) : (!mProperties.isHideable && parentDrawer.getVisibility() == GONE) ? VISIBLE : View.GONE);
|
||||
setVisibility(isVisible ? VISIBLE : (!mProperties.isHideable && parentDrawer.getVisibility() == GONE) ? VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGrabState(boolean isGrabbing) {
|
||||
// STUB, visibility lifecycle handled by the ControlDrawer
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user