mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-13 06:39:54 -04:00
fix[TouchController]: Fixed slider preferences of TouchController vibrate length
This commit is contained in:
parent
0765ce7991
commit
71a28fa5fb
@ -13,6 +13,7 @@ import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
|||||||
|
|
||||||
public class LauncherPreferenceControlFragment extends LauncherPreferenceFragment {
|
public class LauncherPreferenceControlFragment extends LauncherPreferenceFragment {
|
||||||
private boolean mGyroAvailable = false;
|
private boolean mGyroAvailable = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreatePreferences(Bundle b, String str) {
|
public void onCreatePreferences(Bundle b, String str) {
|
||||||
// Get values
|
// Get values
|
||||||
@ -20,6 +21,7 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
|
|||||||
int prefButtonSize = (int) LauncherPreferences.PREF_BUTTONSIZE;
|
int prefButtonSize = (int) LauncherPreferences.PREF_BUTTONSIZE;
|
||||||
int mouseScale = (int) (LauncherPreferences.PREF_MOUSESCALE * 100);
|
int mouseScale = (int) (LauncherPreferences.PREF_MOUSESCALE * 100);
|
||||||
int gyroSampleRate = LauncherPreferences.PREF_GYRO_SAMPLE_RATE;
|
int gyroSampleRate = LauncherPreferences.PREF_GYRO_SAMPLE_RATE;
|
||||||
|
int touchControllerVibrateLength = LauncherPreferences.PREF_TOUCHCONTROLLER_VIBRATE_LENGTH;
|
||||||
float mouseSpeed = LauncherPreferences.PREF_MOUSESPEED;
|
float mouseSpeed = LauncherPreferences.PREF_MOUSESPEED;
|
||||||
float gyroSpeed = LauncherPreferences.PREF_GYRO_SENSITIVITY;
|
float gyroSpeed = LauncherPreferences.PREF_GYRO_SENSITIVITY;
|
||||||
float joystickDeadzone = LauncherPreferences.PREF_DEADZONE_SCALE;
|
float joystickDeadzone = LauncherPreferences.PREF_DEADZONE_SCALE;
|
||||||
@ -45,7 +47,7 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
|
|||||||
|
|
||||||
CustomSeekBarPreference seek6 = requirePreference("mousespeed",
|
CustomSeekBarPreference seek6 = requirePreference("mousespeed",
|
||||||
CustomSeekBarPreference.class);
|
CustomSeekBarPreference.class);
|
||||||
seek6.setValue((int)(mouseSpeed *100f));
|
seek6.setValue((int) (mouseSpeed * 100f));
|
||||||
seek6.setSuffix(" %");
|
seek6.setSuffix(" %");
|
||||||
|
|
||||||
CustomSeekBarPreference deadzoneSeek = requirePreference("gamepad_deadzone_scale",
|
CustomSeekBarPreference deadzoneSeek = requirePreference("gamepad_deadzone_scale",
|
||||||
@ -55,7 +57,7 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
|
|||||||
|
|
||||||
|
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
if(context != null) {
|
if (context != null) {
|
||||||
mGyroAvailable = Tools.deviceSupportsGyro(context);
|
mGyroAvailable = Tools.deviceSupportsGyro(context);
|
||||||
}
|
}
|
||||||
PreferenceCategory gyroCategory = requirePreference("gyroCategory",
|
PreferenceCategory gyroCategory = requirePreference("gyroCategory",
|
||||||
@ -64,13 +66,20 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
|
|||||||
|
|
||||||
CustomSeekBarPreference gyroSensitivitySeek = requirePreference("gyroSensitivity",
|
CustomSeekBarPreference gyroSensitivitySeek = requirePreference("gyroSensitivity",
|
||||||
CustomSeekBarPreference.class);
|
CustomSeekBarPreference.class);
|
||||||
gyroSensitivitySeek.setValue((int) (gyroSpeed*100f));
|
gyroSensitivitySeek.setValue((int) (gyroSpeed * 100f));
|
||||||
gyroSensitivitySeek.setSuffix(" %");
|
gyroSensitivitySeek.setSuffix(" %");
|
||||||
|
|
||||||
CustomSeekBarPreference gyroSampleRateSeek = requirePreference("gyroSampleRate",
|
CustomSeekBarPreference gyroSampleRateSeek = requirePreference("gyroSampleRate",
|
||||||
CustomSeekBarPreference.class);
|
CustomSeekBarPreference.class);
|
||||||
gyroSampleRateSeek.setValue(gyroSampleRate);
|
gyroSampleRateSeek.setValue(gyroSampleRate);
|
||||||
gyroSampleRateSeek.setSuffix(" ms");
|
gyroSampleRateSeek.setSuffix(" ms");
|
||||||
|
|
||||||
|
CustomSeekBarPreference touchControllerVibrateLengthSeek = requirePreference(
|
||||||
|
"touchControllerVibrateLength",
|
||||||
|
CustomSeekBarPreference.class);
|
||||||
|
touchControllerVibrateLengthSeek.setValue(touchControllerVibrateLength);
|
||||||
|
touchControllerVibrateLengthSeek.setSuffix(" ms");
|
||||||
|
|
||||||
computeVisibility();
|
computeVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +89,7 @@ public class LauncherPreferenceControlFragment extends LauncherPreferenceFragmen
|
|||||||
computeVisibility();
|
computeVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void computeVisibility(){
|
private void computeVisibility() {
|
||||||
requirePreference("timeLongPressTrigger").setVisible(!LauncherPreferences.PREF_DISABLE_GESTURES);
|
requirePreference("timeLongPressTrigger").setVisible(!LauncherPreferences.PREF_DISABLE_GESTURES);
|
||||||
requirePreference("gyroSensitivity").setVisible(LauncherPreferences.PREF_ENABLE_GYRO);
|
requirePreference("gyroSensitivity").setVisible(LauncherPreferences.PREF_ENABLE_GYRO);
|
||||||
requirePreference("gyroSampleRate").setVisible(LauncherPreferences.PREF_ENABLE_GYRO);
|
requirePreference("gyroSampleRate").setVisible(LauncherPreferences.PREF_ENABLE_GYRO);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user