mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 08:05:34 -04:00
Optimize the view remover procedure to fix the lag in builds with Ingame Custom Controls
This commit is contained in:
parent
a9322ffe0e
commit
0b41acac2b
@ -44,13 +44,14 @@ public class ControlLayout extends FrameLayout
|
||||
if (mModifiable) {
|
||||
hideAllHandleViews();
|
||||
}
|
||||
//if (getChildAt(0) instanceof MinecraftGLView) {
|
||||
// View viewGL = getChildAt(0);
|
||||
// View viewTouchpad = getChildAt(1);
|
||||
// removeAllViews();
|
||||
// addView(viewGL);
|
||||
// addView(viewTouchpad);
|
||||
//} else {
|
||||
/*if (getChildAt(0) instanceof MinecraftGLView) {
|
||||
View viewGL = getChildAt(0);
|
||||
View viewTouchpad = getChildAt(1);
|
||||
removeAllViews();
|
||||
addView(viewGL);
|
||||
addView(viewTouchpad);
|
||||
} else {
|
||||
removeAllViews();*/
|
||||
removeAllButtons();
|
||||
//}
|
||||
if (mLayout != null) {
|
||||
@ -99,13 +100,14 @@ public class ControlLayout extends FrameLayout
|
||||
}
|
||||
private void removeAllButtons() {
|
||||
List<View> viewList = new ArrayList<>();
|
||||
View v;
|
||||
for(int i = 0; i < getChildCount(); i++) {
|
||||
viewList.add(getChildAt(i));
|
||||
v = getChildAt(i);
|
||||
if(v instanceof ControlButton) viewList.add(v);
|
||||
}
|
||||
for(View v : viewList) {
|
||||
if(v instanceof ControlButton) {
|
||||
removeView(v);
|
||||
}
|
||||
v = null;
|
||||
for(View v2 : viewList) {
|
||||
removeView(v2);
|
||||
}
|
||||
viewList = null;
|
||||
System.gc();
|
||||
|
Loading…
x
Reference in New Issue
Block a user