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) {
mModifiable = z;
public void setModifiable(boolean isModifiable) {
mModifiable = isModifiable;
}
private void setModified(boolean modified) {

View File

@ -44,20 +44,12 @@ 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 {
removeAllViews();*/
removeAllButtons();
//}
if (mLayout != null) {
mLayout.mControlDataList = null;
mLayout = null;
}
removeAllButtons();
if(mLayout != null) {
mLayout.mControlDataList = null;
mLayout = null;
}
System.gc();
// 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.height = button.height / controlLayout.scaledAt * LauncherPreferences.PREF_BUTTONSIZE;
if (!button.isDynamicBtn) {
button.dynamicX = Float.toString(button.x / CallbackBridge.physicalWidth) + " * ${screen_width}";
button.dynamicY = Float.toString(button.y / CallbackBridge.physicalHeight) + " * ${screen_height}";
button.dynamicX = button.x / CallbackBridge.physicalWidth + " * ${screen_width}";
button.dynamicY = button.y / CallbackBridge.physicalHeight + " * ${screen_height}";
}
button.update();
addControlView(button);
@ -138,7 +130,7 @@ public class ControlLayout extends FrameLayout
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
if (view instanceof ControlButton && ((ControlButton) view).getProperties().isHideable) {
((ControlButton) view).setVisibility(mControlVisible ? View.VISIBLE : View.GONE);
view.setVisibility(mControlVisible ? View.VISIBLE : View.GONE);
}
}
}