mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 15:17:02 -04:00
WIP broken button repositionning on resize
This commit is contained in:
parent
64d03fc645
commit
4f82b94018
@ -197,8 +197,15 @@ public class BaseMainActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
Tools.getDisplayMetrics(this);
|
||||
|
||||
Tools.updateWindowSize(this);
|
||||
minecraftGLView.refreshSize();
|
||||
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mControlLayout.refreshControlButtonPositions();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
public static void fullyExit() {
|
||||
|
@ -395,8 +395,8 @@ public final class Tools {
|
||||
|
||||
public static DisplayMetrics currentDisplayMetrics;
|
||||
|
||||
public static void updateWindowSize(Activity ctx) {
|
||||
currentDisplayMetrics = getDisplayMetrics(ctx);
|
||||
public static void updateWindowSize(Activity activity) {
|
||||
currentDisplayMetrics = getDisplayMetrics(activity);
|
||||
|
||||
CallbackBridge.physicalWidth = (int) (currentDisplayMetrics.widthPixels);
|
||||
CallbackBridge.physicalHeight = (int) (currentDisplayMetrics.heightPixels);
|
||||
|
@ -251,6 +251,13 @@ public class ControlLayout extends FrameLayout {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void refreshControlButtonPositions(){
|
||||
for(ControlButton button : getButtonChildren()){
|
||||
button.setDynamicX(button.getProperties().dynamicX);
|
||||
button.setDynamicY(button.getProperties().dynamicY);
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<View, ControlButton> mapTable = new HashMap<>();
|
||||
//While this is called onTouch, this should only be called from a ControlButton.
|
||||
public boolean onTouch(View v, MotionEvent ev) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user