Clean some code

This commit is contained in:
SerpentSpirale 2021-04-30 11:46:48 +02:00
parent 0fa13e2328
commit e2f35f3f6f
2 changed files with 11 additions and 19 deletions

View File

@ -271,8 +271,8 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
} }
} }
public void setModifiable(boolean z) { public void setModifiable(boolean isModifiable) {
mModifiable = z; mModifiable = isModifiable;
} }
private void setModified(boolean modified) { private void setModified(boolean modified) {

View File

@ -44,20 +44,12 @@ public class ControlLayout extends FrameLayout
if (mModifiable) { if (mModifiable) {
hideAllHandleViews(); hideAllHandleViews();
} }
/*if (getChildAt(0) instanceof MinecraftGLView) {
View viewGL = getChildAt(0);
View viewTouchpad = getChildAt(1);
removeAllViews();
addView(viewGL);
addView(viewTouchpad);
} else {
removeAllViews();*/
removeAllButtons(); removeAllButtons();
//}
if(mLayout != null) { if(mLayout != null) {
mLayout.mControlDataList = null; mLayout.mControlDataList = null;
mLayout = null; mLayout = null;
} }
System.gc(); System.gc();
// Cleanup buttons only when input layout is null // Cleanup buttons only when input layout is null
@ -70,8 +62,8 @@ public class ControlLayout extends FrameLayout
button.width = button.width / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE; button.width = button.width / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE;
button.height = button.height / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE; button.height = button.height / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE;
if (!button.isDynamicBtn) { if (!button.isDynamicBtn) {
button.dynamicX = Float.toString(button.x / CallbackBridge.physicalWidth) + " * ${screen_width}"; button.dynamicX = button.x / CallbackBridge.physicalWidth + " * ${screen_width}";
button.dynamicY = Float.toString(button.y / CallbackBridge.physicalHeight) + " * ${screen_height}"; button.dynamicY = button.y / CallbackBridge.physicalHeight + " * ${screen_height}";
} }
button.update(); button.update();
addControlView(button); addControlView(button);
@ -138,7 +130,7 @@ public class ControlLayout extends FrameLayout
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i); View view = getChildAt(i);
if (view instanceof ControlButton && ((ControlButton) view).getProperties().isHideable) { if (view instanceof ControlButton && ((ControlButton) view).getProperties().isHideable) {
((ControlButton) view).setVisibility(mControlVisible ? View.VISIBLE : View.GONE); view.setVisibility(mControlVisible ? View.VISIBLE : View.GONE);
} }
} }
} }