Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7bc7dab21 | ||
|
|
d12d214c12 | ||
|
|
9840632527 | ||
|
|
736ee68a50 | ||
|
|
d8098c95e9 | ||
|
|
0bc6e783c2 | ||
|
|
3feb6927c9 | ||
|
|
b57a0cdab7 | ||
|
|
f205209613 |
No files matched your search
@@ -2,9 +2,15 @@ package com.kdt;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import net.kdt.pojavlaunch.R;
|
||||
|
||||
/**
|
||||
* Seekbar with ability to handle ranges and increments
|
||||
*/
|
||||
@@ -14,27 +20,67 @@ public class CustomSeekbar extends SeekBar {
|
||||
private int mIncrement = 1;
|
||||
private SeekBar.OnSeekBarChangeListener mListener;
|
||||
|
||||
/** When using increments, this flag is used to prevent double calls to the listener */
|
||||
private boolean mInternalChanges = false;
|
||||
private final OnSeekBarChangeListener mInternalListener = new OnSeekBarChangeListener() {
|
||||
/** When using increments, this flag is used to prevent double calls to the listener */
|
||||
private boolean internalChanges = false;
|
||||
/** Store the previous progress to prevent double calls with increments */
|
||||
private int previousProgress = 0;
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (internalChanges) return;
|
||||
internalChanges = true;
|
||||
|
||||
progress += mMin;
|
||||
progress = applyIncrement(progress);
|
||||
|
||||
if (progress != previousProgress) {
|
||||
if (mListener != null) {
|
||||
previousProgress = progress;
|
||||
mListener.onProgressChanged(seekBar, progress, fromUser);
|
||||
}
|
||||
}
|
||||
|
||||
// Forces the thumb to snap to the increment
|
||||
setProgress(progress);
|
||||
internalChanges = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
if (internalChanges) return;
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onStartTrackingTouch(seekBar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
if (internalChanges) return;
|
||||
internalChanges = true;
|
||||
|
||||
setProgress(seekBar.getProgress());
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onStopTrackingTouch(seekBar);
|
||||
}
|
||||
internalChanges = false;
|
||||
}
|
||||
};
|
||||
|
||||
public CustomSeekbar(Context context) {
|
||||
super(context);
|
||||
setup();
|
||||
setup(null);
|
||||
}
|
||||
|
||||
public CustomSeekbar(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setup();
|
||||
setup(attrs);
|
||||
}
|
||||
|
||||
public CustomSeekbar(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setup();
|
||||
}
|
||||
|
||||
public CustomSeekbar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
setup();
|
||||
setup(attrs);
|
||||
}
|
||||
|
||||
public void setIncrement(int increment) {
|
||||
@@ -63,10 +109,15 @@ public class CustomSeekbar extends SeekBar {
|
||||
|
||||
@Override
|
||||
public synchronized void setMin(int min) {
|
||||
super.setMin(min);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
super.setMin(0);
|
||||
}
|
||||
mMin = min;
|
||||
//todo perform something to update the progress ?
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper to allow for a listener to be set around the internal listener
|
||||
*/
|
||||
@@ -75,52 +126,27 @@ public class CustomSeekbar extends SeekBar {
|
||||
mListener = l;
|
||||
}
|
||||
|
||||
public void setup() {
|
||||
super.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
|
||||
/** Store the previous progress to prevent double calls with increments */
|
||||
private int previousProgress = 0;
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
if (mInternalChanges) return;
|
||||
mInternalChanges = true;
|
||||
|
||||
progress += mMin;
|
||||
progress = applyIncrement(progress);
|
||||
|
||||
if (progress != previousProgress) {
|
||||
if (mListener != null) {
|
||||
previousProgress = progress;
|
||||
mListener.onProgressChanged(seekBar, progress, fromUser);
|
||||
}
|
||||
}
|
||||
|
||||
// Forces the thumb to snap to the increment
|
||||
setProgress(progress);
|
||||
mInternalChanges = false;
|
||||
public void setup(@Nullable AttributeSet attrs) {
|
||||
try (TypedArray attributes = getContext().obtainStyledAttributes(attrs, R.styleable.CustomSeekbar)) {
|
||||
setIncrement(attributes.getInt(R.styleable.CustomSeekbar_seekBarIncrement, 1));
|
||||
int min = attributes.getInt(R.styleable.CustomSeekbar_android_min, 0);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
super.setMin(0);
|
||||
}
|
||||
setRange(min, super.getMax());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
if (mInternalChanges) return;
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onStartTrackingTouch(seekBar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
if (mInternalChanges) return;
|
||||
mInternalChanges = true;
|
||||
|
||||
setProgress(seekBar.getProgress());
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onStopTrackingTouch(seekBar);
|
||||
}
|
||||
mInternalChanges = false;
|
||||
}
|
||||
});
|
||||
// Due to issues with negative progress when setting up the seekbar
|
||||
// We need to set a random progress to force the refresh of the thumb
|
||||
if(super.getProgress() == 0) {
|
||||
super.setProgress(super.getProgress() + 1);
|
||||
post(() -> {
|
||||
super.setProgress(super.getProgress() - 1);
|
||||
post(() -> super.setOnSeekBarChangeListener(mInternalListener));
|
||||
});
|
||||
} else {
|
||||
super.setOnSeekBarChangeListener(mInternalListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -243,8 +243,8 @@ public class MainActivity extends BaseActivity implements ControlButtonMenuListe
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
// Post to get the correct display dimensions after layout.
|
||||
LauncherPreferences.computeNotchSize(this);
|
||||
mControlLayout.post(()->{
|
||||
LauncherPreferences.computeNotchSize(this);
|
||||
Tools.getDisplayMetrics(this);
|
||||
loadControls();
|
||||
});
|
||||
|
||||
@@ -27,6 +27,7 @@ import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Process;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.OpenableColumns;
|
||||
import android.util.ArrayMap;
|
||||
@@ -40,7 +41,6 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
@@ -513,33 +513,7 @@ public final class Tools {
|
||||
return displayMetrics;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void setFullscreenLegacy(Activity activity, boolean fullscreen) {
|
||||
final View decorView = activity.getWindow().getDecorView();
|
||||
View.OnSystemUiVisibilityChangeListener visibilityChangeListener = visibility -> {
|
||||
boolean multiWindowMode = SDK_INT >= 24 && activity.isInMultiWindowMode();
|
||||
// When in multi-window mode, asking for fullscreen makes no sense (cause the launcher runs in a window)
|
||||
// So, ignore the fullscreen setting when activity is in multi window mode
|
||||
if(fullscreen && !multiWindowMode){
|
||||
if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
}else{
|
||||
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||
}
|
||||
|
||||
};
|
||||
decorView.setOnSystemUiVisibilityChangeListener(visibilityChangeListener);
|
||||
visibilityChangeListener.onSystemUiVisibilityChange(decorView.getSystemUiVisibility()); //call it once since the UI state may not change after the call, so the activity wont become fullscreen
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
private static void setFullscreenSdk30(Activity activity, boolean fullscreen) {
|
||||
public static void setFullscreen(Activity activity, boolean fullscreen) {
|
||||
WindowInsetsControllerCompat windowInsetsController =
|
||||
WindowCompat.getInsetsController(activity.getWindow(), activity.getWindow().getDecorView());
|
||||
if (windowInsetsController == null) {
|
||||
@@ -555,27 +529,24 @@ public final class Tools {
|
||||
ViewCompat.setOnApplyWindowInsetsListener(
|
||||
activity.getWindow().getDecorView(),
|
||||
(view, windowInsets) -> {
|
||||
if (fullscreen && !activity.isInMultiWindowMode()) {
|
||||
boolean fullscreenImpl = fullscreen;
|
||||
if (SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode())
|
||||
fullscreenImpl = false;
|
||||
|
||||
if (fullscreenImpl) {
|
||||
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars());
|
||||
activity.getWindow().setDecorFitsSystemWindows(false);
|
||||
} else {
|
||||
windowInsetsController.show(WindowInsetsCompat.Type.systemBars());
|
||||
activity.getWindow().setDecorFitsSystemWindows(true);
|
||||
}
|
||||
|
||||
if(SDK_INT >= Build.VERSION_CODES.R)
|
||||
activity.getWindow().setDecorFitsSystemWindows(!fullscreenImpl);
|
||||
|
||||
return ViewCompat.onApplyWindowInsets(view, windowInsets);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void setFullscreen(Activity activity, boolean fullscreen) {
|
||||
if (SDK_INT >= Build.VERSION_CODES.R) {
|
||||
setFullscreenSdk30(activity, fullscreen);
|
||||
}else {
|
||||
setFullscreenLegacy(activity, fullscreen);
|
||||
}
|
||||
}
|
||||
|
||||
public static DisplayMetrics currentDisplayMetrics;
|
||||
|
||||
public static void updateWindowSize(Activity activity) {
|
||||
|
||||
+5
-7
@@ -43,6 +43,7 @@ import static net.kdt.pojavlaunch.customcontrols.gamepad.GamepadJoystick.DIRECTI
|
||||
import static net.kdt.pojavlaunch.customcontrols.gamepad.GamepadJoystick.DIRECTION_WEST;
|
||||
import static net.kdt.pojavlaunch.customcontrols.gamepad.GamepadJoystick.isJoystickEvent;
|
||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_DEADZONE_SCALE;
|
||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_SCALE_FACTOR;
|
||||
import static net.kdt.pojavlaunch.utils.MCOptionUtils.getMcScale;
|
||||
import static org.lwjgl.glfw.CallbackBridge.sendKeyPress;
|
||||
import static org.lwjgl.glfw.CallbackBridge.sendMouseButton;
|
||||
@@ -52,9 +53,6 @@ import fr.spse.gamepad_remapper.Settings;
|
||||
|
||||
public class Gamepad implements GrabListener, GamepadHandler {
|
||||
|
||||
/* Resolution scaler option, allow downsizing a window */
|
||||
private final float mScaleFactor = LauncherPreferences.DEFAULT_PREF.getInt("resolutionRatio",100)/100f;
|
||||
|
||||
/* Sensitivity, adjusted according to screen size */
|
||||
private final double mSensitivityFactor = (1.4 * (1080f/ currentDisplayMetrics.heightPixels));
|
||||
|
||||
@@ -116,7 +114,7 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
mPointerImageView.setImageDrawable(ResourcesCompat.getDrawable(ctx.getResources(), R.drawable.ic_gamepad_pointer, ctx.getTheme()));
|
||||
mPointerImageView.getDrawable().setFilterBitmap(false);
|
||||
|
||||
int size = (int) ((22 * getMcScale()) / mScaleFactor);
|
||||
int size = (int) ((22 * getMcScale()) / PREF_SCALE_FACTOR);
|
||||
mPointerImageView.setLayoutParams(new FrameLayout.LayoutParams(size, size));
|
||||
|
||||
mMapProvider = mapProvider;
|
||||
@@ -155,7 +153,7 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
|
||||
public void notifyGUISizeChange(int newSize){
|
||||
//Change the pointer size to match UI
|
||||
int size = (int) ((22 * newSize) / mScaleFactor);
|
||||
int size = (int) ((22 * newSize) / PREF_SCALE_FACTOR);
|
||||
mPointerImageView.post(() -> mPointerImageView.setLayoutParams(new FrameLayout.LayoutParams(size, size)));
|
||||
|
||||
}
|
||||
@@ -228,7 +226,7 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
if(!isGrabbing){
|
||||
CallbackBridge.mouseX = MathUtils.clamp(CallbackBridge.mouseX, 0, CallbackBridge.windowWidth);
|
||||
CallbackBridge.mouseY = MathUtils.clamp(CallbackBridge.mouseY, 0, CallbackBridge.windowHeight);
|
||||
placePointerView((int) (CallbackBridge.mouseX / mScaleFactor), (int) (CallbackBridge.mouseY/ mScaleFactor));
|
||||
placePointerView((int) (CallbackBridge.mouseX / PREF_SCALE_FACTOR), (int) (CallbackBridge.mouseY/ PREF_SCALE_FACTOR));
|
||||
}
|
||||
|
||||
//Send the mouse to the game
|
||||
@@ -340,7 +338,7 @@ public class Gamepad implements GrabListener, GamepadHandler {
|
||||
placePointerView(CallbackBridge.physicalWidth/2, CallbackBridge.physicalHeight/2);
|
||||
mPointerImageView.setVisibility(View.VISIBLE);
|
||||
// Sensitivity in menu is MC and HARDWARE resolution dependent
|
||||
mMouseSensitivity = 19 * mScaleFactor / mSensitivityFactor;
|
||||
mMouseSensitivity = 19 * PREF_SCALE_FACTOR / mSensitivityFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-4
@@ -28,10 +28,10 @@ public class CustomSeekBarPreference extends SeekBarPreference {
|
||||
@SuppressLint("PrivateResource")
|
||||
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
TypedArray a = context.obtainStyledAttributes(
|
||||
attrs, R.styleable.SeekBarPreference, defStyleAttr, defStyleRes);
|
||||
mMin = a.getInt(R.styleable.SeekBarPreference_min, 0);
|
||||
a.recycle();
|
||||
try (TypedArray a = context.obtainStyledAttributes(
|
||||
attrs, R.styleable.SeekBarPreference, defStyleAttr, defStyleRes)) {
|
||||
mMin = a.getInt(R.styleable.SeekBarPreference_min, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public CustomSeekBarPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
|
||||
+53
-24
@@ -10,17 +10,15 @@ import android.content.*;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.view.DisplayCutoutCompat;
|
||||
import androidx.core.view.WindowCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.core.view.WindowInsetsControllerCompat;
|
||||
|
||||
import net.kdt.pojavlaunch.*;
|
||||
import net.kdt.pojavlaunch.multirt.MultiRTUtils;
|
||||
import net.kdt.pojavlaunch.utils.JREUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LauncherPreferences {
|
||||
public static final String PREF_KEY_CURRENT_PROFILE = "currentProfile";
|
||||
public static final String PREF_KEY_SKIP_NOTIFICATION_CHECK = "skipNotificationPermissionCheck";
|
||||
@@ -28,11 +26,6 @@ public class LauncherPreferences {
|
||||
public static SharedPreferences DEFAULT_PREF;
|
||||
public static String PREF_RENDERER = "opengles2";
|
||||
|
||||
public static boolean PREF_VERTYPE_RELEASE = true;
|
||||
public static boolean PREF_VERTYPE_SNAPSHOT = false;
|
||||
public static boolean PREF_VERTYPE_OLDALPHA = false;
|
||||
public static boolean PREF_VERTYPE_OLDBETA = false;
|
||||
public static boolean PREF_HIDE_SIDEBAR = false;
|
||||
public static boolean PREF_IGNORE_NOTCH = false;
|
||||
public static int PREF_NOTCH_SIZE = 0;
|
||||
public static float PREF_BUTTONSIZE = 100f;
|
||||
@@ -54,14 +47,14 @@ public class LauncherPreferences {
|
||||
public static boolean PREF_USE_ALTERNATE_SURFACE = true;
|
||||
public static boolean PREF_JAVA_SANDBOX = true;
|
||||
public static float PREF_SCALE_FACTOR = 1f;
|
||||
|
||||
public static boolean PREF_ENABLE_GYRO = false;
|
||||
public static float PREF_GYRO_SENSITIVITY = 1f;
|
||||
public static int PREF_GYRO_SAMPLE_RATE = 16;
|
||||
public static boolean PREF_GYRO_SMOOTHING = true;
|
||||
|
||||
public static boolean PREF_GYRO_INVERT_X = false;
|
||||
|
||||
public static boolean PREF_GYRO_INVERT_Y = false;
|
||||
|
||||
public static boolean PREF_FORCE_VSYNC = false;
|
||||
|
||||
public static boolean PREF_BUTTON_ALL_CAPS = true;
|
||||
@@ -79,17 +72,13 @@ public class LauncherPreferences {
|
||||
public static void loadPreferences(Context ctx) {
|
||||
//Required for the data folder.
|
||||
Tools.initContextConstants(ctx);
|
||||
boolean isDevicePowerful = isDevicePowerful(ctx);
|
||||
|
||||
PREF_RENDERER = DEFAULT_PREF.getString("renderer", "opengles2");
|
||||
PREF_BUTTONSIZE = DEFAULT_PREF.getInt("buttonscale", 100);
|
||||
PREF_MOUSESCALE = DEFAULT_PREF.getInt("mousescale", 100)/100f;
|
||||
PREF_MOUSESPEED = ((float)DEFAULT_PREF.getInt("mousespeed",100))/100f;
|
||||
PREF_HIDE_SIDEBAR = DEFAULT_PREF.getBoolean("hideSidebar", false);
|
||||
PREF_IGNORE_NOTCH = DEFAULT_PREF.getBoolean("ignoreNotch", false);
|
||||
PREF_VERTYPE_RELEASE = DEFAULT_PREF.getBoolean("vertype_release", true);
|
||||
PREF_VERTYPE_SNAPSHOT = DEFAULT_PREF.getBoolean("vertype_snapshot", false);
|
||||
PREF_VERTYPE_OLDALPHA = DEFAULT_PREF.getBoolean("vertype_oldalpha", false);
|
||||
PREF_VERTYPE_OLDBETA = DEFAULT_PREF.getBoolean("vertype_oldbeta", false);
|
||||
PREF_MOUSESPEED = ((float)DEFAULT_PREF.getInt("mousespeed",100))/100f;
|
||||
PREF_IGNORE_NOTCH = DEFAULT_PREF.getBoolean("ignoreNotch", false);
|
||||
PREF_LONGPRESS_TRIGGER = DEFAULT_PREF.getInt("timeLongPressTrigger", 300);
|
||||
PREF_DEFAULTCTRL_PATH = DEFAULT_PREF.getString("defaultCtrl", Tools.CTRLDEF_FILE);
|
||||
PREF_FORCE_ENGLISH = DEFAULT_PREF.getBoolean("force_english", false);
|
||||
@@ -98,19 +87,19 @@ public class LauncherPreferences {
|
||||
PREF_DISABLE_SWAP_HAND = DEFAULT_PREF.getBoolean("disableDoubleTap", false);
|
||||
PREF_RAM_ALLOCATION = DEFAULT_PREF.getInt("allocation", findBestRAMAllocation(ctx));
|
||||
PREF_CUSTOM_JAVA_ARGS = DEFAULT_PREF.getString("javaArgs", "");
|
||||
PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", false);
|
||||
PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", isDevicePowerful);
|
||||
PREF_VIRTUAL_MOUSE_START = DEFAULT_PREF.getBoolean("mouse_start", false);
|
||||
PREF_ARC_CAPES = DEFAULT_PREF.getBoolean("arc_capes",false);
|
||||
PREF_USE_ALTERNATE_SURFACE = DEFAULT_PREF.getBoolean("alternate_surface", false);
|
||||
PREF_USE_ALTERNATE_SURFACE = DEFAULT_PREF.getBoolean("alternate_surface", isDevicePowerful);
|
||||
PREF_JAVA_SANDBOX = DEFAULT_PREF.getBoolean("java_sandbox", true);
|
||||
PREF_SCALE_FACTOR = DEFAULT_PREF.getInt("resolutionRatio", 100)/100f;
|
||||
PREF_SCALE_FACTOR = DEFAULT_PREF.getInt("resolutionRatio", findBestResolution(ctx, isDevicePowerful))/100f;
|
||||
PREF_ENABLE_GYRO = DEFAULT_PREF.getBoolean("enableGyro", false);
|
||||
PREF_GYRO_SENSITIVITY = ((float)DEFAULT_PREF.getInt("gyroSensitivity", 100))/100f;
|
||||
PREF_GYRO_SAMPLE_RATE = DEFAULT_PREF.getInt("gyroSampleRate", 16);
|
||||
PREF_GYRO_SMOOTHING = DEFAULT_PREF.getBoolean("gyroSmoothing", true);
|
||||
PREF_GYRO_INVERT_X = DEFAULT_PREF.getBoolean("gyroInvertX", false);
|
||||
PREF_GYRO_INVERT_Y = DEFAULT_PREF.getBoolean("gyroInvertY", false);
|
||||
PREF_FORCE_VSYNC = DEFAULT_PREF.getBoolean("force_vsync", false);
|
||||
PREF_FORCE_VSYNC = DEFAULT_PREF.getBoolean("force_vsync", isDevicePowerful);
|
||||
PREF_BUTTON_ALL_CAPS = DEFAULT_PREF.getBoolean("buttonAllCaps", true);
|
||||
PREF_DUMP_SHADERS = DEFAULT_PREF.getBoolean("dump_shaders", false);
|
||||
PREF_DEADZONE_SCALE = ((float) DEFAULT_PREF.getInt("gamepad_deadzone_scale", 100))/100f;
|
||||
@@ -132,7 +121,7 @@ public class LauncherPreferences {
|
||||
if(DEFAULT_PREF.contains("defaultRuntime")) {
|
||||
PREF_DEFAULT_RUNTIME = DEFAULT_PREF.getString("defaultRuntime","");
|
||||
}else{
|
||||
if(MultiRTUtils.getRuntimes().size() < 1) {
|
||||
if(MultiRTUtils.getRuntimes().isEmpty()) {
|
||||
PREF_DEFAULT_RUNTIME = "";
|
||||
return;
|
||||
}
|
||||
@@ -164,6 +153,46 @@ public class LauncherPreferences {
|
||||
return 2048; //Default RAM allocation for 64 bits
|
||||
}
|
||||
|
||||
/// Find a correct resolution for the device
|
||||
///
|
||||
/// Some devices are shipped with a ridiculously high resolution, which can cause performance issues
|
||||
/// This function will try to find a resolution that is good enough for the device
|
||||
private static int findBestResolution(Context context, boolean isDevicePowerful) {
|
||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||
int minSide = Math.min(metrics.widthPixels, metrics.heightPixels);
|
||||
int targetSide = isDevicePowerful ? 1080 : 720;
|
||||
if (minSide <= targetSide) return 100; // No need to scale down
|
||||
|
||||
float ratio = (100f * targetSide / minSide);
|
||||
// The value must match the seekbar values
|
||||
int increment = context.getResources().getInteger(R.integer.resolution_seekbar_increment);
|
||||
return (int) (Math.ceil(ratio / increment) * increment);
|
||||
}
|
||||
|
||||
/// Check if the device is considered powerful.
|
||||
/// Powerful devices will have some energy saving tweaks enabled by default
|
||||
private static boolean isDevicePowerful(Context context) {
|
||||
if (SDK_INT < Build.VERSION_CODES.Q) return false;
|
||||
if (Tools.getTotalDeviceMemory(context) <= 4096) return false;
|
||||
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
|
||||
if (Math.min(metrics.widthPixels, metrics.heightPixels) < 1080) return false;
|
||||
if (Runtime.getRuntime().availableProcessors() <= 4) return false;
|
||||
if (hasAllCoreSameFreq()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean hasAllCoreSameFreq() {
|
||||
int coreCount = Runtime.getRuntime().availableProcessors();
|
||||
try {
|
||||
String freq0 = Tools.read("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq");
|
||||
String freqX = Tools.read("/sys/devices/system/cpu/cpu" + (coreCount - 1) + "/cpufreq/cpuinfo_max_freq");
|
||||
if(freq0.equals(freqX)) return true;
|
||||
} catch (IOException e) {
|
||||
Log.e("LauncherPreferences", "Failed to read CPU frequencies", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Compute the notch size to avoid being out of bounds */
|
||||
public static void computeNotchSize(Activity activity) {
|
||||
if (Build.VERSION.SDK_INT < P) return;
|
||||
|
||||
@@ -122,8 +122,6 @@ public abstract class QuickSettingSideDialog extends com.kdt.SideDialogView {
|
||||
mEditor.putBoolean("disableGestures", isChecked);
|
||||
});
|
||||
|
||||
mGyroSensitivityBar.setRange(25, 300);
|
||||
mGyroSensitivityBar.setIncrement(5);
|
||||
mGyroSensitivityBar.setOnSeekBarChangeListener((SimpleSeekBarListener) (seekBar, progress, fromUser) -> {
|
||||
PREF_GYRO_SENSITIVITY = progress / 100f;
|
||||
mEditor.putInt("gyroSensitivity", progress);
|
||||
@@ -132,8 +130,6 @@ public abstract class QuickSettingSideDialog extends com.kdt.SideDialogView {
|
||||
mGyroSensitivityBar.setProgress((int) (mOriginalGyroSensitivity * 100f));
|
||||
setSeekTextPercent(mGyroSensitivityText, mGyroSensitivityBar.getProgress());
|
||||
|
||||
mMouseSpeedBar.setRange(25, 300);
|
||||
mMouseSpeedBar.setIncrement(5);
|
||||
mMouseSpeedBar.setOnSeekBarChangeListener((SimpleSeekBarListener) (seekBar, progress, fromUser) -> {
|
||||
PREF_MOUSESPEED = progress / 100f;
|
||||
mEditor.putInt("mousespeed", progress);
|
||||
@@ -142,8 +138,6 @@ public abstract class QuickSettingSideDialog extends com.kdt.SideDialogView {
|
||||
mMouseSpeedBar.setProgress((int) (mOriginalMouseSpeed * 100f));
|
||||
setSeekTextPercent(mMouseSpeedText, mMouseSpeedBar.getProgress());
|
||||
|
||||
mGestureDelayBar.setRange(100, 1000);
|
||||
mGestureDelayBar.setIncrement(10);
|
||||
mGestureDelayBar.setOnSeekBarChangeListener((SimpleSeekBarListener) (seekBar, progress, fromUser) -> {
|
||||
PREF_LONGPRESS_TRIGGER = progress;
|
||||
mEditor.putInt("timeLongPressTrigger", progress);
|
||||
@@ -152,8 +146,6 @@ public abstract class QuickSettingSideDialog extends com.kdt.SideDialogView {
|
||||
mGestureDelayBar.setProgress(mOriginalGestureDelay);
|
||||
setSeekTextMillisecond(mGestureDelayText, mGestureDelayBar.getProgress());
|
||||
|
||||
mResolutionBar.setRange(25, 100);
|
||||
mResolutionBar.setIncrement(5);
|
||||
mResolutionBar.setOnSeekBarChangeListener((SimpleSeekBarListener) (seekBar, progress, fromUser) -> {
|
||||
PREF_SCALE_FACTOR = progress/100f;
|
||||
mEditor.putInt("resolutionRatio", progress);
|
||||
|
||||
-7
@@ -32,31 +32,26 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
|
||||
|
||||
CustomSeekBarPreference seek2 = requirePreference("timeLongPressTrigger",
|
||||
CustomSeekBarPreference.class);
|
||||
seek2.setRange(100, 1000);
|
||||
seek2.setValue(longPressTrigger);
|
||||
seek2.setSuffix(" ms");
|
||||
|
||||
CustomSeekBarPreference seek3 = requirePreference("buttonscale",
|
||||
CustomSeekBarPreference.class);
|
||||
seek3.setRange(80, 250);
|
||||
seek3.setValue(prefButtonSize);
|
||||
seek3.setSuffix(" %");
|
||||
|
||||
CustomSeekBarPreference seek4 = requirePreference("mousescale",
|
||||
CustomSeekBarPreference.class);
|
||||
seek4.setRange(25, 300);
|
||||
seek4.setValue(mouseScale);
|
||||
seek4.setSuffix(" %");
|
||||
|
||||
CustomSeekBarPreference seek6 = requirePreference("mousespeed",
|
||||
CustomSeekBarPreference.class);
|
||||
seek6.setRange(25, 300);
|
||||
seek6.setValue((int)(mouseSpeed *100f));
|
||||
seek6.setSuffix(" %");
|
||||
|
||||
CustomSeekBarPreference deadzoneSeek = requirePreference("gamepad_deadzone_scale",
|
||||
CustomSeekBarPreference.class);
|
||||
deadzoneSeek.setRange(50, 200);
|
||||
deadzoneSeek.setValue((int) (joystickDeadzone * 100f));
|
||||
deadzoneSeek.setSuffix(" %");
|
||||
|
||||
@@ -71,13 +66,11 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
|
||||
|
||||
CustomSeekBarPreference gyroSensitivitySeek = requirePreference("gyroSensitivity",
|
||||
CustomSeekBarPreference.class);
|
||||
gyroSensitivitySeek.setRange(25, 300);
|
||||
gyroSensitivitySeek.setValue((int) (gyroSpeed*100f));
|
||||
gyroSensitivitySeek.setSuffix(" %");
|
||||
|
||||
CustomSeekBarPreference gyroSampleRateSeek = requirePreference("gyroSampleRate",
|
||||
CustomSeekBarPreference.class);
|
||||
gyroSampleRateSeek.setRange(5, 50);
|
||||
gyroSampleRateSeek.setValue(gyroSampleRate);
|
||||
gyroSampleRateSeek.setSuffix(" ms");
|
||||
computeVisibility();
|
||||
|
||||
+5
-6
@@ -29,19 +29,18 @@ public class LauncherPreferenceJavaFragment extends LauncherPreferenceFragment {
|
||||
// Triggers a write for some reason
|
||||
addPreferencesFromResource(R.xml.pref_java);
|
||||
|
||||
CustomSeekBarPreference seek7 = requirePreference("allocation",
|
||||
CustomSeekBarPreference memorySeekbar = requirePreference("allocation",
|
||||
CustomSeekBarPreference.class);
|
||||
|
||||
int maxRAM;
|
||||
int deviceRam = getTotalDeviceMemory(seek7.getContext());
|
||||
int deviceRam = getTotalDeviceMemory(memorySeekbar.getContext());
|
||||
|
||||
if(is32BitsDevice() || deviceRam < 2048) maxRAM = Math.min(1024, deviceRam);
|
||||
else maxRAM = deviceRam - (deviceRam < 3064 ? 800 : 1024); //To have a minimum for the device to breathe
|
||||
|
||||
seek7.setMin(256);
|
||||
seek7.setMax(maxRAM);
|
||||
seek7.setValue(ramAllocation);
|
||||
seek7.setSuffix(" MB");
|
||||
memorySeekbar.setMax(maxRAM);
|
||||
memorySeekbar.setValue(ramAllocation);
|
||||
memorySeekbar.setSuffix(" MB");
|
||||
|
||||
EditTextPreference editJVMArgs = findPreference("javaArgs");
|
||||
if (editJVMArgs != null) {
|
||||
|
||||
+12
-8
@@ -1,7 +1,5 @@
|
||||
package net.kdt.pojavlaunch.prefs.screens;
|
||||
|
||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_NOTCH_SIZE;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
@@ -22,24 +20,30 @@ public class LauncherPreferenceVideoFragment extends LauncherPreferenceFragment
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle b, String str) {
|
||||
addPreferencesFromResource(R.xml.pref_video);
|
||||
int resolution = (int) (LauncherPreferences.PREF_SCALE_FACTOR * 100);
|
||||
|
||||
//Disable notch checking behavior on android 8.1 and below.
|
||||
requirePreference("ignoreNotch").setVisible(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && PREF_NOTCH_SIZE > 0);
|
||||
requirePreference("ignoreNotch").setVisible(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && LauncherPreferences.PREF_NOTCH_SIZE > 0);
|
||||
|
||||
CustomSeekBarPreference seek5 = requirePreference("resolutionRatio",
|
||||
CustomSeekBarPreference resolutionSeekbar = requirePreference("resolutionRatio",
|
||||
CustomSeekBarPreference.class);
|
||||
seek5.setMin(25);
|
||||
seek5.setSuffix(" %");
|
||||
resolutionSeekbar.setSuffix(" %");
|
||||
|
||||
// #724 bug fix
|
||||
if (seek5.getValue() < 25) {
|
||||
seek5.setValue(100);
|
||||
if (resolution < 25) {
|
||||
resolutionSeekbar.setValue(100);
|
||||
} else {
|
||||
resolutionSeekbar.setValue(resolution);
|
||||
}
|
||||
|
||||
// Sustained performance is only available since Nougat
|
||||
SwitchPreference sustainedPerfSwitch = requirePreference("sustainedPerformance",
|
||||
SwitchPreference.class);
|
||||
sustainedPerfSwitch.setVisible(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N);
|
||||
sustainedPerfSwitch.setChecked(LauncherPreferences.PREF_SUSTAINED_PERFORMANCE);
|
||||
|
||||
requirePreference("alternate_surface", SwitchPreferenceCompat.class).setChecked(LauncherPreferences.PREF_USE_ALTERNATE_SURFACE);
|
||||
requirePreference("force_vsync", SwitchPreferenceCompat.class).setChecked(LauncherPreferences.PREF_FORCE_VSYNC);
|
||||
|
||||
ListPreference rendererListPreference = requirePreference("renderer",
|
||||
ListPreference.class);
|
||||
|
||||
@@ -95,21 +95,21 @@ public class ProfileAdapter extends BaseAdapter {
|
||||
Drawable cachedIcon = ProfileIconCache.fetchIcon(v.getResources(), nm, minecraftProfile.icon);
|
||||
extendedTextView.setCompoundDrawablesRelative(cachedIcon, null, extendedTextView.getCompoundsDrawables()[2], null);
|
||||
|
||||
if(Tools.isValidString(minecraftProfile.name))
|
||||
extendedTextView.setText(minecraftProfile.name);
|
||||
else
|
||||
extendedTextView.setText(R.string.unnamed);
|
||||
// Historically, the profile name "New" was hardcoded as the default profile name
|
||||
// We consider "New" the same as putting no name at all
|
||||
String profileName = (Tools.isValidString(minecraftProfile.name) && !"New".equalsIgnoreCase(minecraftProfile.name)) ? minecraftProfile.name : null;
|
||||
String versionName = minecraftProfile.lastVersionId;
|
||||
|
||||
if(minecraftProfile.lastVersionId != null){
|
||||
if(minecraftProfile.lastVersionId.equalsIgnoreCase("latest-release")){
|
||||
extendedTextView.setText( String.format("%s - %s", extendedTextView.getText(), v.getContext().getText(R.string.profiles_latest_release)));
|
||||
} else if(minecraftProfile.lastVersionId.equalsIgnoreCase("latest-snapshot")){
|
||||
extendedTextView.setText( String.format("%s - %s", extendedTextView.getText(), v.getContext().getText(R.string.profiles_latest_snapshot)));
|
||||
} else {
|
||||
extendedTextView.setText( String.format("%s - %s", extendedTextView.getText(), minecraftProfile.lastVersionId));
|
||||
}
|
||||
if (MinecraftProfile.LATEST_RELEASE.equalsIgnoreCase(versionName))
|
||||
versionName = v.getContext().getString(R.string.profiles_latest_release);
|
||||
else if (MinecraftProfile.LATEST_SNAPSHOT.equalsIgnoreCase(versionName))
|
||||
versionName = v.getContext().getString(R.string.profiles_latest_snapshot);
|
||||
|
||||
} else extendedTextView.setText(extendedTextView.getText());
|
||||
if (versionName == null && profileName != null)
|
||||
extendedTextView.setText(profileName);
|
||||
else if (versionName != null && profileName == null)
|
||||
extendedTextView.setText(versionName);
|
||||
else extendedTextView.setText(String.format("%s - %s", profileName, versionName));
|
||||
|
||||
// Set selected background if needed
|
||||
if(displaySelection){
|
||||
|
||||
+3
-2
@@ -3,13 +3,14 @@ package net.kdt.pojavlaunch.tasks;
|
||||
import net.kdt.pojavlaunch.JMinecraftVersionList;
|
||||
import net.kdt.pojavlaunch.extra.ExtraConstants;
|
||||
import net.kdt.pojavlaunch.extra.ExtraCore;
|
||||
import net.kdt.pojavlaunch.value.launcherprofiles.MinecraftProfile;
|
||||
|
||||
public class AsyncMinecraftDownloader {
|
||||
public static String normalizeVersionId(String versionString) {
|
||||
JMinecraftVersionList versionList = (JMinecraftVersionList) ExtraCore.getValue(ExtraConstants.RELEASE_TABLE);
|
||||
if(versionList == null || versionList.versions == null) return versionString;
|
||||
if("latest-release".equals(versionString)) versionString = versionList.latest.get("release");
|
||||
if("latest-snapshot".equals(versionString)) versionString = versionList.latest.get("snapshot");
|
||||
if(MinecraftProfile.LATEST_RELEASE.equals(versionString)) versionString = versionList.latest.get("release");
|
||||
if(MinecraftProfile.LATEST_SNAPSHOT.equals(versionString)) versionString = versionList.latest.get("snapshot");
|
||||
return versionString;
|
||||
}
|
||||
|
||||
|
||||
@@ -295,6 +295,8 @@ public class JREUtils {
|
||||
purgeArg(userArgs, "-Dorg.lwjgl.opengl.libname");
|
||||
// Don't let the user specify a custom Freetype library (as the user is unlikely to specify a version compiled for Android)
|
||||
purgeArg(userArgs, "-Dorg.lwjgl.freetype.libname");
|
||||
// Overridden by us to specify the exact number of cores that the android system has
|
||||
purgeArg(userArgs, "-XX:ActiveProcessorCount");
|
||||
|
||||
//Add automatically generated args
|
||||
userArgs.add("-Xms" + LauncherPreferences.PREF_RAM_ALLOCATION + "M");
|
||||
@@ -305,6 +307,9 @@ public class JREUtils {
|
||||
// that we ship with Java (since it may be older than what's needed)
|
||||
userArgs.add("-Dorg.lwjgl.freetype.libname="+ NATIVE_LIB_DIR+"/libfreetype.so");
|
||||
|
||||
// Some phones are not using the right number of cores, fix that
|
||||
userArgs.add("-XX:ActiveProcessorCount=" + java.lang.Runtime.getRuntime().availableProcessors());
|
||||
|
||||
userArgs.addAll(JVMArgs);
|
||||
activity.runOnUiThread(() -> Toast.makeText(activity, activity.getString(R.string.autoram_info_msg,LauncherPreferences.PREF_RAM_ALLOCATION), Toast.LENGTH_SHORT).show());
|
||||
System.out.println(JVMArgs);
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.kdt.pojavlaunch.utils;
|
||||
|
||||
|
||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.DEFAULT_PREF;
|
||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_FORCE_ENGLISH;
|
||||
|
||||
import android.content.*;
|
||||
import android.content.res.*;
|
||||
@@ -24,7 +25,7 @@ public class LocaleUtils extends ContextWrapper {
|
||||
LauncherPreferences.loadPreferences(context);
|
||||
}
|
||||
|
||||
if(DEFAULT_PREF.getBoolean("force_english", false)){
|
||||
if(PREF_FORCE_ENGLISH){
|
||||
Resources resources = context.getResources();
|
||||
Configuration configuration = resources.getConfiguration();
|
||||
|
||||
|
||||
+5
-2
@@ -5,6 +5,9 @@ import androidx.annotation.Keep;
|
||||
@Keep
|
||||
public class MinecraftProfile {
|
||||
|
||||
public static String LATEST_RELEASE = "latest-release";
|
||||
public static String LATEST_SNAPSHOT= "latest-snapshot";
|
||||
|
||||
public String name;
|
||||
public String type;
|
||||
public String created;
|
||||
@@ -23,8 +26,8 @@ public class MinecraftProfile {
|
||||
|
||||
public static MinecraftProfile createTemplate(){
|
||||
MinecraftProfile TEMPLATE = new MinecraftProfile();
|
||||
TEMPLATE.name = "New";
|
||||
TEMPLATE.lastVersionId = "latest-release";
|
||||
TEMPLATE.name = "";
|
||||
TEMPLATE.lastVersionId = LATEST_RELEASE;
|
||||
return TEMPLATE;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
android:id="@+id/editResolution_seekbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/_36sdp"
|
||||
android:min="@integer/resolution_seekbar_min"
|
||||
app:seekBarIncrement="@integer/resolution_seekbar_increment"
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.538"
|
||||
@@ -34,9 +36,9 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editResolution_textView_percent"
|
||||
android:layout_width="50dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:gravity="end"
|
||||
tools:text="50%"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="@id/editResolution_textView"
|
||||
@@ -92,6 +94,10 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/_36sdp"
|
||||
|
||||
android:min="@integer/gyro_speed_seekbar_min"
|
||||
android:max="@integer/gyro_speed_seekbar_max"
|
||||
app:seekBarIncrement="@integer/gyro_speed_seekbar_increment"
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.538"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -99,9 +105,9 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editGyro_textView_percent"
|
||||
android:layout_width="50dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:gravity="end"
|
||||
tools:text="100%"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="@id/editGyro_textView"
|
||||
@@ -127,6 +133,10 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/_36sdp"
|
||||
|
||||
android:min="@integer/mouse_speed_seekbar_min"
|
||||
android:max="@integer/mouse_speed_seekbar_max"
|
||||
app:seekBarIncrement="@integer/mouse_speed_seekbar_increment"
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.538"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -134,9 +144,9 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editMouseSpeed_textView_percent"
|
||||
android:layout_width="50dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
android:gravity="end"
|
||||
tools:text="100%"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="@id/editMouseSpeed_textView"
|
||||
@@ -172,6 +182,10 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/_36sdp"
|
||||
|
||||
android:min="@integer/gesture_delay_seekbar_min"
|
||||
android:max="@integer/gesture_delay_seekbar_max"
|
||||
app:seekBarIncrement="@integer/gesture_delay_seekbar_increment"
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.538"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -179,10 +193,10 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editGestureDelay_textView_percent"
|
||||
android:layout_width="50dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="0dp"
|
||||
android:gravity="center"
|
||||
tools:text="270ms"
|
||||
android:gravity="end"
|
||||
tools:text="270 ms"
|
||||
|
||||
app:layout_constraintBottom_toBottomOf="@id/editGestureDelay_textView"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<attr name="seekBarIncrement" format="integer" />
|
||||
<declare-styleable name="CustomSeekbar">
|
||||
<attr name="seekBarIncrement" />
|
||||
<!-- Redefine to be able to fetch the value -->
|
||||
<attr name="android:min" />
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<integer name="resolution_seekbar_increment">5</integer>
|
||||
<integer name="resolution_seekbar_min">25</integer>
|
||||
|
||||
<integer name="gesture_delay_seekbar_increment">10</integer>
|
||||
<integer name="gesture_delay_seekbar_min">100</integer>
|
||||
<integer name="gesture_delay_seekbar_max">1000</integer>
|
||||
|
||||
|
||||
<integer name="button_scale_seekbar_increment">5</integer>
|
||||
<integer name="button_scale_seekbar_min">80</integer>
|
||||
<integer name="button_scale_seekbar_max">250</integer>
|
||||
|
||||
<integer name="mouse_scale_seekbar_increment">5</integer>
|
||||
<integer name="mouse_scale_seekbar_min">25</integer>
|
||||
<integer name="mouse_scale_seekbar_max">300</integer>
|
||||
|
||||
<integer name="mouse_speed_seekbar_increment">5</integer>
|
||||
<integer name="mouse_speed_seekbar_min">25</integer>
|
||||
<integer name="mouse_speed_seekbar_max">300</integer>
|
||||
|
||||
<integer name="gyro_speed_seekbar_increment">5</integer>
|
||||
<integer name="gyro_speed_seekbar_min">25</integer>
|
||||
<integer name="gyro_speed_seekbar_max">300</integer>
|
||||
|
||||
<integer name="gyro_rate_seekbar_min">5</integer>
|
||||
<integer name="gyro_rate_seekbar_max">50</integer>
|
||||
|
||||
<integer name="gamepad_deadzone_seekbar_increment">5</integer>
|
||||
<integer name="gamepad_deadzone_seekbar_min">50</integer>
|
||||
<integer name="gamepad_deadzone_seekbar_max">200</integer>
|
||||
|
||||
<integer name="memory_seekbar_increment">8</integer>
|
||||
<integer name="memory_seekbar_min">256</integer>
|
||||
|
||||
</resources>
|
||||
@@ -35,7 +35,9 @@
|
||||
android:title="@string/mcl_setting_title_longpresstrigger"
|
||||
app2:showSeekBarValue="true"
|
||||
app2:selectable="false"
|
||||
app2:seekBarIncrement="10"
|
||||
app2:min="@integer/gesture_delay_seekbar_min"
|
||||
android:max="@integer/gesture_delay_seekbar_max"
|
||||
app2:seekBarIncrement="@integer/gesture_delay_seekbar_increment"
|
||||
android:icon="@drawable/ic_setting_gesture_time"
|
||||
/>
|
||||
|
||||
@@ -50,7 +52,9 @@
|
||||
android:summary="@string/mcl_setting_subtitle_buttonscale"
|
||||
app2:showSeekBarValue="true"
|
||||
app2:selectable="false"
|
||||
app2:seekBarIncrement="5"
|
||||
app2:min="@integer/button_scale_seekbar_min"
|
||||
android:max="@integer/button_scale_seekbar_max"
|
||||
app2:seekBarIncrement="@integer/button_scale_seekbar_increment"
|
||||
android:icon="@drawable/ic_setting_control_scale"
|
||||
/>
|
||||
<SwitchPreference
|
||||
@@ -71,7 +75,9 @@
|
||||
android:title="@string/mcl_setting_title_mousescale"
|
||||
|
||||
app2:selectable="false"
|
||||
app2:seekBarIncrement="5"
|
||||
app2:min="@integer/mouse_scale_seekbar_min"
|
||||
android:max="@integer/mouse_scale_seekbar_max"
|
||||
app2:seekBarIncrement="@integer/mouse_scale_seekbar_increment"
|
||||
app2:showSeekBarValue="true"
|
||||
android:icon="@drawable/ic_setting_pointer_scale"
|
||||
/>
|
||||
@@ -82,7 +88,9 @@
|
||||
android:title="@string/mcl_setting_title_mousespeed"
|
||||
android:icon="@drawable/ic_setting_mouse_speed"
|
||||
app2:selectable="false"
|
||||
app2:seekBarIncrement="5"
|
||||
app2:min="@integer/mouse_speed_seekbar_min"
|
||||
android:max="@integer/mouse_speed_seekbar_max"
|
||||
app2:seekBarIncrement="@integer/mouse_speed_seekbar_increment"
|
||||
app2:showSeekBarValue="true" />
|
||||
<SwitchPreference
|
||||
android:key="mouse_start"
|
||||
@@ -104,12 +112,16 @@
|
||||
android:title="@string/preference_gyro_sensitivity_title"
|
||||
android:summary="@string/preference_gyro_sensitivity_description"
|
||||
app2:selectable="false"
|
||||
app2:seekBarIncrement="5"
|
||||
app2:min="@integer/gyro_speed_seekbar_min"
|
||||
android:max="@integer/gyro_speed_seekbar_max"
|
||||
app2:seekBarIncrement="@integer/gyro_speed_seekbar_increment"
|
||||
app2:showSeekBarValue="true"/>
|
||||
<net.kdt.pojavlaunch.prefs.CustomSeekBarPreference
|
||||
android:key="gyroSampleRate"
|
||||
android:title="@string/preference_gyro_sample_rate_title"
|
||||
android:summary="@string/preference_gyro_sample_rate_description"
|
||||
app2:min="@integer/gyro_rate_seekbar_min"
|
||||
android:max="@integer/gyro_rate_seekbar_max"
|
||||
app2:selectable="false"
|
||||
app2:showSeekBarValue="true"/>
|
||||
<SwitchPreferenceCompat
|
||||
@@ -145,7 +157,9 @@
|
||||
android:title="@string/preference_deadzone_scale_title"
|
||||
android:summary="@string/preference_deadzone_scale_description"
|
||||
app2:showSeekBarValue="true"
|
||||
app2:seekBarIncrement="5"
|
||||
app2:min="@integer/gamepad_deadzone_seekbar_min"
|
||||
android:max="@integer/gamepad_deadzone_seekbar_max"
|
||||
app2:seekBarIncrement="@integer/gamepad_deadzone_seekbar_increment"
|
||||
/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
android:summary="@string/mcl_memory_allocation_subtitle"
|
||||
android:title="@string/mcl_memory_allocation"
|
||||
app2:showSeekBarValue="true"
|
||||
app2:seekBarIncrement="8"
|
||||
app2:min="@integer/memory_seekbar_min"
|
||||
app2:seekBarIncrement="@integer/memory_seekbar_increment"
|
||||
app2:selectable="false"/>
|
||||
|
||||
<SwitchPreference
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
android:title="@string/mcl_setting_title_resolution_scaler"
|
||||
app2:showSeekBarValue="true"
|
||||
app2:selectable="false"
|
||||
app2:seekBarIncrement="5"
|
||||
app2:min="@integer/resolution_seekbar_min"
|
||||
app2:seekBarIncrement="@integer/resolution_seekbar_increment"
|
||||
android:icon="@drawable/ic_setting_screen_resolution"
|
||||
/>
|
||||
|
||||
|
||||
Reference in new issue
Block a user