mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 00:59:35 -04:00
Fix(hotbar): make the hotbar aware of the quick setting resolution
This commit is contained in:
parent
2e9428d54c
commit
3f5baec1e6
@ -53,6 +53,7 @@ import net.kdt.pojavlaunch.customcontrols.EditorExitable;
|
||||
import net.kdt.pojavlaunch.customcontrols.keyboard.LwjglCharSender;
|
||||
import net.kdt.pojavlaunch.customcontrols.keyboard.TouchCharInput;
|
||||
import net.kdt.pojavlaunch.customcontrols.mouse.GyroControl;
|
||||
import net.kdt.pojavlaunch.customcontrols.mouse.HotbarView;
|
||||
import net.kdt.pojavlaunch.customcontrols.mouse.Touchpad;
|
||||
import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
|
||||
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
||||
@ -84,6 +85,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
||||
private View mDrawerPullButton;
|
||||
private GyroControl mGyroControl = null;
|
||||
private ControlLayout mControlLayout;
|
||||
private HotbarView mHotbarView;
|
||||
|
||||
MinecraftProfile minecraftProfile;
|
||||
|
||||
@ -259,6 +261,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
||||
mControlLayout = findViewById(R.id.main_control_layout);
|
||||
touchCharInput = findViewById(R.id.mainTouchCharInput);
|
||||
mDrawerPullButton = findViewById(R.id.drawer_button);
|
||||
mHotbarView = findViewById(R.id.hotbar_view);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -389,6 +392,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
||||
@Override
|
||||
public void onResolutionChanged() {
|
||||
minecraftGLView.refreshSize();
|
||||
mHotbarView.onResolutionChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -124,6 +124,13 @@ public class HotbarView extends View implements MCOptionUtils.MCOptionListener,
|
||||
return (int)((mGuiScale * input) / LauncherPreferences.PREF_SCALE_FACTOR);
|
||||
}
|
||||
|
||||
/** Forces the view to reposition itself. */
|
||||
public void onResolutionChanged() {
|
||||
if(getParent() == null) return;
|
||||
mGuiScale = MCOptionUtils.getMcScale();
|
||||
post(this::repositionView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOptionChanged() {
|
||||
post(this);
|
||||
|
@ -56,6 +56,7 @@
|
||||
android:elevation="10dp"
|
||||
android:layout_gravity="center_horizontal"/>
|
||||
<net.kdt.pojavlaunch.customcontrols.mouse.HotbarView
|
||||
android:id="@+id/hotbar_view"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="0px"/>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user