mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-19 09:39:25 -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.LwjglCharSender;
|
||||||
import net.kdt.pojavlaunch.customcontrols.keyboard.TouchCharInput;
|
import net.kdt.pojavlaunch.customcontrols.keyboard.TouchCharInput;
|
||||||
import net.kdt.pojavlaunch.customcontrols.mouse.GyroControl;
|
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.customcontrols.mouse.Touchpad;
|
||||||
import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
|
import net.kdt.pojavlaunch.lifecycle.ContextExecutor;
|
||||||
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
||||||
@ -84,6 +85,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
|||||||
private View mDrawerPullButton;
|
private View mDrawerPullButton;
|
||||||
private GyroControl mGyroControl = null;
|
private GyroControl mGyroControl = null;
|
||||||
private ControlLayout mControlLayout;
|
private ControlLayout mControlLayout;
|
||||||
|
private HotbarView mHotbarView;
|
||||||
|
|
||||||
MinecraftProfile minecraftProfile;
|
MinecraftProfile minecraftProfile;
|
||||||
|
|
||||||
@ -259,6 +261,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
|||||||
mControlLayout = findViewById(R.id.main_control_layout);
|
mControlLayout = findViewById(R.id.main_control_layout);
|
||||||
touchCharInput = findViewById(R.id.mainTouchCharInput);
|
touchCharInput = findViewById(R.id.mainTouchCharInput);
|
||||||
mDrawerPullButton = findViewById(R.id.drawer_button);
|
mDrawerPullButton = findViewById(R.id.drawer_button);
|
||||||
|
mHotbarView = findViewById(R.id.hotbar_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -389,6 +392,7 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
|||||||
@Override
|
@Override
|
||||||
public void onResolutionChanged() {
|
public void onResolutionChanged() {
|
||||||
minecraftGLView.refreshSize();
|
minecraftGLView.refreshSize();
|
||||||
|
mHotbarView.onResolutionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,6 +124,13 @@ public class HotbarView extends View implements MCOptionUtils.MCOptionListener,
|
|||||||
return (int)((mGuiScale * input) / LauncherPreferences.PREF_SCALE_FACTOR);
|
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
|
@Override
|
||||||
public void onOptionChanged() {
|
public void onOptionChanged() {
|
||||||
post(this);
|
post(this);
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
android:elevation="10dp"
|
android:elevation="10dp"
|
||||||
android:layout_gravity="center_horizontal"/>
|
android:layout_gravity="center_horizontal"/>
|
||||||
<net.kdt.pojavlaunch.customcontrols.mouse.HotbarView
|
<net.kdt.pojavlaunch.customcontrols.mouse.HotbarView
|
||||||
|
android:id="@+id/hotbar_view"
|
||||||
android:layout_width="0px"
|
android:layout_width="0px"
|
||||||
android:layout_height="0px"/>
|
android:layout_height="0px"/>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user