mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-15 15:48:26 -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
|
@Override
|
||||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
Tools.getDisplayMetrics(this);
|
|
||||||
|
Tools.updateWindowSize(this);
|
||||||
minecraftGLView.refreshSize();
|
minecraftGLView.refreshSize();
|
||||||
|
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mControlLayout.refreshControlButtonPositions();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fullyExit() {
|
public static void fullyExit() {
|
||||||
|
@ -395,8 +395,8 @@ public final class Tools {
|
|||||||
|
|
||||||
public static DisplayMetrics currentDisplayMetrics;
|
public static DisplayMetrics currentDisplayMetrics;
|
||||||
|
|
||||||
public static void updateWindowSize(Activity ctx) {
|
public static void updateWindowSize(Activity activity) {
|
||||||
currentDisplayMetrics = getDisplayMetrics(ctx);
|
currentDisplayMetrics = getDisplayMetrics(activity);
|
||||||
|
|
||||||
CallbackBridge.physicalWidth = (int) (currentDisplayMetrics.widthPixels);
|
CallbackBridge.physicalWidth = (int) (currentDisplayMetrics.widthPixels);
|
||||||
CallbackBridge.physicalHeight = (int) (currentDisplayMetrics.heightPixels);
|
CallbackBridge.physicalHeight = (int) (currentDisplayMetrics.heightPixels);
|
||||||
|
@ -251,6 +251,13 @@ public class ControlLayout extends FrameLayout {
|
|||||||
return children;
|
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<>();
|
HashMap<View, ControlButton> mapTable = new HashMap<>();
|
||||||
//While this is called onTouch, this should only be called from a ControlButton.
|
//While this is called onTouch, this should only be called from a ControlButton.
|
||||||
public boolean onTouch(View v, MotionEvent ev) {
|
public boolean onTouch(View v, MotionEvent ev) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user