mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-15 19:10:10 -07:00
Mouse speed slider
This commit is contained in:
parent
4979167651
commit
0e299636c5
6 changed files with 86 additions and 285 deletions
|
|
@ -39,14 +39,6 @@ public class BaseMainActivity extends BaseActivity {
|
||||||
decorView.setSystemUiVisibility(uiOptions);
|
decorView.setSystemUiVisibility(uiOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
if (CallbackBridge.isGrabbing()){
|
|
||||||
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
|
|
||||||
}
|
|
||||||
super.onPause();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void fullyExit() {
|
public static void fullyExit() {
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import net.kdt.pojavlaunch.prefs.*;
|
||||||
import net.kdt.pojavlaunch.utils.*;
|
import net.kdt.pojavlaunch.utils.*;
|
||||||
import org.lwjgl.glfw.*;
|
import org.lwjgl.glfw.*;
|
||||||
|
|
||||||
|
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;
|
||||||
import static net.kdt.pojavlaunch.Tools.getFileName;
|
import static net.kdt.pojavlaunch.Tools.getFileName;
|
||||||
import static net.kdt.pojavlaunch.utils.MathUtils.map;
|
import static net.kdt.pojavlaunch.utils.MathUtils.map;
|
||||||
|
|
||||||
|
|
@ -34,7 +35,6 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTou
|
||||||
private int totalMovement;
|
private int totalMovement;
|
||||||
|
|
||||||
String specialChars = "/*!@#$%^&*()\"{}_[+:;=-_]'|\\?/<>,.";
|
String specialChars = "/*!@#$%^&*()\"{}_[+:;=-_]'|\\?/<>,.";
|
||||||
private LoggerView loggerView;
|
|
||||||
private boolean mouseState = false;
|
private boolean mouseState = false;
|
||||||
|
|
||||||
private LinearLayout touchPad;
|
private LinearLayout touchPad;
|
||||||
|
|
@ -42,10 +42,8 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTou
|
||||||
private GestureDetector gestureDetector;
|
private GestureDetector gestureDetector;
|
||||||
private long lastPress = 0;
|
private long lastPress = 0;
|
||||||
ScaleGestureDetector scaleGestureDetector;
|
ScaleGestureDetector scaleGestureDetector;
|
||||||
GestureDetector longTapGestureDetector;
|
|
||||||
private long touchStart = 0;
|
private long touchStart = 0;
|
||||||
boolean longPressTriggered = false;
|
boolean longPressTriggered = false;
|
||||||
boolean longPressShouldClick = false;
|
|
||||||
|
|
||||||
private boolean rcState = false;
|
private boolean rcState = false;
|
||||||
|
|
||||||
|
|
@ -54,10 +52,6 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTou
|
||||||
private float scaleFactor;
|
private float scaleFactor;
|
||||||
public float[] scaleFactors = initScaleFactors();
|
public float[] scaleFactors = initScaleFactors();
|
||||||
|
|
||||||
private final int fingerStillThreshold = 8;
|
|
||||||
private int initialX;
|
|
||||||
private int initialY;
|
|
||||||
|
|
||||||
public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
|
public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -66,7 +60,7 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTou
|
||||||
if (scaleFactor > 1) { //Send F4 To Zoom Out
|
if (scaleFactor > 1) { //Send F4 To Zoom Out
|
||||||
AWTInputBridge.sendKey((char)115,115);
|
AWTInputBridge.sendKey((char)115,115);
|
||||||
} else { //116 F5 To Zoom In
|
} else { //116 F5 To Zoom In
|
||||||
AWTInputBridge.sendKey((char) 116, 116);
|
AWTInputBridge.sendKey((char)116, 116);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -209,8 +203,9 @@ public class JavaGUILauncherActivity extends BaseActivity implements View.OnTou
|
||||||
case MotionEvent.ACTION_POINTER_UP: // 6
|
case MotionEvent.ACTION_POINTER_UP: // 6
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_MOVE: // 2
|
case MotionEvent.ACTION_MOVE: // 2
|
||||||
mouseX = Math.max(0, Math.min(CallbackBridge.physicalWidth, mouseX + x - prevX));
|
System.out.println("DEBUG: MOUSESPEED"+LauncherPreferences.PREF_MOUSESPEED);
|
||||||
mouseY = Math.max(0, Math.min(CallbackBridge.physicalHeight, mouseY + y - prevY));
|
mouseX = Math.max(0, Math.min(currentDisplayMetrics.widthPixels, mouseX + (x - prevX) * LauncherPreferences.PREF_MOUSESPEED));
|
||||||
|
mouseY = Math.max(0, Math.min(currentDisplayMetrics.heightPixels, mouseY + (y - prevY) * LauncherPreferences.PREF_MOUSESPEED));
|
||||||
placeMouseAt(mouseX, mouseY);
|
placeMouseAt(mouseX, mouseY);
|
||||||
sendScaledMousePosition(mouseX,mouseY);
|
sendScaledMousePosition(mouseX,mouseY);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package net.kdt.pojavlaunch;
|
package net.kdt.pojavlaunch;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
@ -15,12 +16,17 @@ import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.SeekBar;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import com.google.android.material.switchmaterial.SwitchMaterial;
|
||||||
|
|
||||||
|
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
|
@ -49,33 +55,32 @@ public class SettingsMenu extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
switch (requestCode) {
|
if (requestCode == FILE_SELECT_CODE) {
|
||||||
case FILE_SELECT_CODE:
|
if (resultCode == RESULT_OK) {
|
||||||
if (resultCode == RESULT_OK) {
|
Uri uri = data.getData();
|
||||||
Uri uri = data.getData();
|
File config = new File(getFilesDir(), "config.json");
|
||||||
File config = new File(getFilesDir(), "config.json");
|
try {
|
||||||
try {
|
Log.d("TAG", "Starting copy: " + uri.getPath());
|
||||||
Log.d("TAG", "Starting copy: " + uri.getPath());
|
InputStream inputStream = getContentResolver().openInputStream(uri);
|
||||||
InputStream inputStream = getContentResolver().openInputStream(uri);
|
FileOutputStream fileOutputStream = new FileOutputStream(config);
|
||||||
FileOutputStream fileOutputStream = new FileOutputStream(config);
|
byte buf[] = new byte[1024];
|
||||||
byte buf[]=new byte[1024];
|
int len;
|
||||||
int len;
|
while ((len = inputStream.read(buf)) > 0) {
|
||||||
while((len=inputStream.read(buf))>0) {
|
fileOutputStream.write(buf, 0, len);
|
||||||
fileOutputStream.write(buf,0,len);
|
|
||||||
}
|
|
||||||
fileOutputStream.close();
|
|
||||||
inputStream.close();
|
|
||||||
Toast.makeText(this, "Config loaded. Please restart the app.",
|
|
||||||
Toast.LENGTH_SHORT).show();
|
|
||||||
} catch (IOException e1) {
|
|
||||||
Log.d("error", "Error with file " + e1);
|
|
||||||
}
|
}
|
||||||
|
fileOutputStream.close();
|
||||||
|
inputStream.close();
|
||||||
|
Toast.makeText(this, "Config loaded. Please restart the app.",
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
Log.d("error", "Error with file " + e1);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
@ -88,26 +93,18 @@ public class SettingsMenu extends Activity {
|
||||||
|
|
||||||
final EditText username = findViewById(R.id.username);
|
final EditText username = findViewById(R.id.username);
|
||||||
final EditText password = findViewById(R.id.password);
|
final EditText password = findViewById(R.id.password);
|
||||||
final Switch righthanded = findViewById(R.id.righthanded);
|
final SwitchMaterial righthanded = findViewById(R.id.righthanded);
|
||||||
|
final SeekBar mouseSpeed = findViewById(R.id.mouseslider);
|
||||||
final Button loadConfig = findViewById(R.id.loadconfig);
|
final Button loadConfig = findViewById(R.id.loadconfig);
|
||||||
|
|
||||||
loadConfig.setOnTouchListener(new View.OnTouchListener() {
|
loadConfig.setOnTouchListener((v, event) -> {
|
||||||
@Override
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
showFileChooser();
|
||||||
switch(event.getAction()) {
|
return true; // if you want to handle the touch event
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
Log.i("Pressed","Button");
|
|
||||||
showFileChooser();
|
|
||||||
return true; // if you want to handle the touch event
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
// RELEASED
|
|
||||||
return true; // if you want to handle the touch event
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//For storing string value in sharedPreference
|
//For storing string value in sharedPreference
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
|
|
@ -115,8 +112,8 @@ public class SettingsMenu extends Activity {
|
||||||
// Restore from saved values
|
// Restore from saved values
|
||||||
username.setText(preferences.getString("username",""));
|
username.setText(preferences.getString("username",""));
|
||||||
password.setText(preferences.getString("password",""));
|
password.setText(preferences.getString("password",""));
|
||||||
righthanded.setChecked(Boolean.parseBoolean(preferences.getString("righthanded","")));
|
mouseSpeed.setProgress((int)LauncherPreferences.PREF_MOUSESPEED);
|
||||||
|
righthanded.setChecked(Boolean.parseBoolean(preferences.getString("righthanded","false")));
|
||||||
|
|
||||||
username.setOnKeyListener((v, keyCode, event) -> {
|
username.setOnKeyListener((v, keyCode, event) -> {
|
||||||
if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||||
|
|
@ -137,10 +134,25 @@ public class SettingsMenu extends Activity {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mouseSpeed.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
|
||||||
|
editor.putInt("mousespeed",mouseSpeed.getProgress());
|
||||||
|
editor.commit();
|
||||||
|
LauncherPreferences.PREF_MOUSESPEED = mouseSpeed.getProgress();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
righthanded.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
righthanded.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
// do something, the isChecked will be
|
|
||||||
// true if the switch is in the On position
|
|
||||||
System.out.println(isChecked);
|
|
||||||
editor.putString("righthanded",""+isChecked);
|
editor.putString("righthanded",""+isChecked);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
Toast.makeText(this, "Relaunch required to update GUI.",
|
Toast.makeText(this, "Relaunch required to update GUI.",
|
||||||
|
|
|
||||||
|
|
@ -1,194 +0,0 @@
|
||||||
package net.kdt.pojavlaunch;
|
|
||||||
|
|
||||||
import static net.kdt.pojavlaunch.Tools.currentDisplayMetrics;
|
|
||||||
import static net.kdt.pojavlaunch.prefs.LauncherPreferences.DEFAULT_PREF;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.GestureDetector;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.FrameLayout;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.core.content.res.ResourcesCompat;
|
|
||||||
|
|
||||||
import net.kdt.pojavlaunch.prefs.LauncherPreferences;
|
|
||||||
|
|
||||||
import org.lwjgl.glfw.CallbackBridge;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class dealing with the virtual mouse
|
|
||||||
*/
|
|
||||||
public class Touchpad extends FrameLayout {
|
|
||||||
private static final int FINGER_SCROLL_THRESHOLD = 10;
|
|
||||||
/* Whether the Touchpad should be displayed */
|
|
||||||
private boolean displayState;
|
|
||||||
|
|
||||||
/* Mouse pointer icon used by the touchpad */
|
|
||||||
private final ImageView mousePointer = new ImageView(getContext());
|
|
||||||
/* Detect a classic android Tap */
|
|
||||||
private final GestureDetector singleTapDetector = new GestureDetector(getContext(), new SingleTapConfirm());
|
|
||||||
/* Mc mouse position, scaled by the scaleFactor */
|
|
||||||
float mouse_x, mouse_y;
|
|
||||||
/* Resolution scaler option, allow downsizing a window */
|
|
||||||
private final float scaleFactor = DEFAULT_PREF.getInt("resolutionRatio",100)/100f;
|
|
||||||
/* Current pointer ID to move the mouse */
|
|
||||||
private int currentPointerID = -1000;
|
|
||||||
/* Previous MotionEvent position, not scale */
|
|
||||||
private float prevX, prevY;
|
|
||||||
/* Last first pointer positions non-scaled, used to scroll distance */
|
|
||||||
private float scrollLastInitialX, scrollLastInitialY;
|
|
||||||
|
|
||||||
public Touchpad(@NonNull Context context) {
|
|
||||||
this(context, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Touchpad(@NonNull Context context, @Nullable AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
init();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init(){
|
|
||||||
// Setup mouse pointer
|
|
||||||
mousePointer.setImageDrawable(ResourcesCompat.getDrawable(getResources(), R.drawable.mouse_pointer, getContext().getTheme()));
|
|
||||||
mousePointer.post(() -> {
|
|
||||||
ViewGroup.LayoutParams params = mousePointer.getLayoutParams();
|
|
||||||
params.width = (int) (36 / 100f * LauncherPreferences.PREF_MOUSESCALE);
|
|
||||||
params.height = (int) (54 / 100f * LauncherPreferences.PREF_MOUSESCALE);
|
|
||||||
});
|
|
||||||
addView(mousePointer);
|
|
||||||
setFocusable(false);
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
setDefaultFocusHighlightEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// When the game is grabbing, we should not display the mouse
|
|
||||||
disable();
|
|
||||||
displayState = false;
|
|
||||||
Thread virtualMouseGrabThread = new Thread(() -> {
|
|
||||||
while (true) {
|
|
||||||
if (!CallbackBridge.isGrabbing() && displayState && getVisibility() != VISIBLE) {
|
|
||||||
post(this::enable);
|
|
||||||
}else{
|
|
||||||
if ((CallbackBridge.isGrabbing() && getVisibility() != View.GONE) || !displayState && getVisibility() == VISIBLE) {
|
|
||||||
post(this::disable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}, "VirtualMouseGrabThread");
|
|
||||||
virtualMouseGrabThread.setPriority(Thread.MIN_PRIORITY);
|
|
||||||
virtualMouseGrabThread.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Enable the touchpad */
|
|
||||||
public void enable(){
|
|
||||||
setVisibility(VISIBLE);
|
|
||||||
placeMouseAt(currentDisplayMetrics.widthPixels / 2, currentDisplayMetrics.heightPixels / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Disable the touchpad and hides the mouse */
|
|
||||||
public void disable(){
|
|
||||||
setVisibility(GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return The new state, enabled or disabled */
|
|
||||||
public boolean switchState(){
|
|
||||||
displayState = !displayState;
|
|
||||||
return displayState;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
|
||||||
// MotionEvent reports input details from the touch screen
|
|
||||||
// and other input controls. In this case, you are only
|
|
||||||
// interested in events where the touch position changed.
|
|
||||||
// int index = event.getActionIndex();
|
|
||||||
if(CallbackBridge.isGrabbing()) {
|
|
||||||
disable();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int action = event.getActionMasked();
|
|
||||||
|
|
||||||
float x = event.getX();
|
|
||||||
float y = event.getY();
|
|
||||||
float mouseX = mousePointer.getX();
|
|
||||||
float mouseY = mousePointer.getY();
|
|
||||||
|
|
||||||
if (singleTapDetector.onTouchEvent(event)) {
|
|
||||||
mouse_x = (mouseX * scaleFactor);
|
|
||||||
mouse_y = (mouseY * scaleFactor);
|
|
||||||
CallbackBridge.sendCursorPos(mouse_x, mouse_y);
|
|
||||||
CallbackBridge.sendMouseKeycode(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
case MotionEvent.ACTION_POINTER_DOWN: // 5
|
|
||||||
scrollLastInitialX = event.getX();
|
|
||||||
scrollLastInitialY = event.getY();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MotionEvent.ACTION_DOWN:
|
|
||||||
prevX = x;
|
|
||||||
prevY = y;
|
|
||||||
currentPointerID = event.getPointerId(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MotionEvent.ACTION_MOVE: // 2
|
|
||||||
//Scrolling feature
|
|
||||||
if (!LauncherPreferences.PREF_DISABLE_GESTURES && !CallbackBridge.isGrabbing() && event.getPointerCount() >= 2) {
|
|
||||||
int hScroll = ((int) (event.getX() - scrollLastInitialX)) / FINGER_SCROLL_THRESHOLD;
|
|
||||||
int vScroll = ((int) (event.getY() - scrollLastInitialY)) / FINGER_SCROLL_THRESHOLD;
|
|
||||||
|
|
||||||
if(vScroll != 0 || hScroll != 0){
|
|
||||||
CallbackBridge.sendScroll(hScroll, vScroll);
|
|
||||||
scrollLastInitialX = event.getX();
|
|
||||||
scrollLastInitialY = event.getY();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mouse movement
|
|
||||||
if(currentPointerID == event.getPointerId(0)) {
|
|
||||||
mouseX = Math.max(0, Math.min(currentDisplayMetrics.widthPixels, mouseX + (x - prevX) * LauncherPreferences.PREF_MOUSESPEED));
|
|
||||||
mouseY = Math.max(0, Math.min(currentDisplayMetrics.heightPixels, mouseY + (y - prevY) * LauncherPreferences.PREF_MOUSESPEED));
|
|
||||||
|
|
||||||
placeMouseAt(mouseX, mouseY);
|
|
||||||
CallbackBridge.sendCursorPos(mouse_x, mouse_y);
|
|
||||||
}else currentPointerID = event.getPointerId(0);
|
|
||||||
|
|
||||||
prevX = x;
|
|
||||||
prevY = y;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MotionEvent.ACTION_UP:
|
|
||||||
prevX = x;
|
|
||||||
prevY = y;
|
|
||||||
currentPointerID = -1000;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//debugText.setText(CallbackBridge.DEBUG_STRING.toString());
|
|
||||||
CallbackBridge.DEBUG_STRING.setLength(0);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void placeMouseAt(float x, float y) {
|
|
||||||
mousePointer.setX(x);
|
|
||||||
mousePointer.setY(y);
|
|
||||||
mouse_x = (x * scaleFactor);
|
|
||||||
mouse_y = (y * scaleFactor);
|
|
||||||
CallbackBridge.sendCursorPos(mouse_x, mouse_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class LauncherPreferences
|
||||||
|
|
||||||
PREF_BUTTONSIZE = DEFAULT_PREF.getInt("buttonscale", 100);
|
PREF_BUTTONSIZE = DEFAULT_PREF.getInt("buttonscale", 100);
|
||||||
PREF_MOUSESCALE = DEFAULT_PREF.getInt("mousescale", 100);
|
PREF_MOUSESCALE = DEFAULT_PREF.getInt("mousescale", 100);
|
||||||
PREF_MOUSESPEED = ((float)DEFAULT_PREF.getInt("mousespeed",100))/100f;
|
PREF_MOUSESPEED = ((float)DEFAULT_PREF.getInt("mousespeed",1));
|
||||||
PREF_HIDE_SIDEBAR = DEFAULT_PREF.getBoolean("hideSidebar", false);
|
PREF_HIDE_SIDEBAR = DEFAULT_PREF.getBoolean("hideSidebar", false);
|
||||||
PREF_IGNORE_NOTCH = DEFAULT_PREF.getBoolean("ignoreNotch", false);
|
PREF_IGNORE_NOTCH = DEFAULT_PREF.getBoolean("ignoreNotch", false);
|
||||||
PREF_VERTYPE_RELEASE = DEFAULT_PREF.getBoolean("vertype_release", true);
|
PREF_VERTYPE_RELEASE = DEFAULT_PREF.getBoolean("vertype_release", true);
|
||||||
|
|
@ -65,33 +65,6 @@ public class LauncherPreferences
|
||||||
PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", false);
|
PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", false);
|
||||||
PREF_GLES_SHRINK_HACK = DEFAULT_PREF.getString("gl4es_shrink_hack", "0");
|
PREF_GLES_SHRINK_HACK = DEFAULT_PREF.getString("gl4es_shrink_hack", "0");
|
||||||
|
|
||||||
/*
|
|
||||||
if (PREF_CUSTOM_JAVA_ARGS.isEmpty()) {
|
|
||||||
String DEFAULT_JAVA_ARGS = "";
|
|
||||||
"-Xms" + (androidHeap > 800 ? 800 : androidHeap) + "m " +
|
|
||||||
// (32bit) More than 800mb may make JVM not allocateable and crash
|
|
||||||
"-Xmx" + (doubleAndroidHeap > 800 ? 800 : doubleAndroidHeap) + "m" +
|
|
||||||
"-XX:+UseG1GC " +
|
|
||||||
"-XX:+ParallelRefProcEnabled " +
|
|
||||||
"-XX:MaxGCPauseMillis=200 " +
|
|
||||||
"-XX:+UnlockExperimentalVMOptions " +
|
|
||||||
"-XX:+AlwaysPreTouch " +
|
|
||||||
"-XX:G1NewSizePercent=30 " +
|
|
||||||
"-XX:G1MaxNewSizePercent=40 " +
|
|
||||||
"-XX:G1HeapRegionSize=8M " +
|
|
||||||
"-XX:G1ReservePercent=20 " +
|
|
||||||
"-XX:G1HeapWastePercent=5 " +
|
|
||||||
"-XX:G1MixedGCCountTarget=4 " +
|
|
||||||
"-XX:InitiatingHeapOccupancyPercent=15 " +
|
|
||||||
"-XX:G1MixedGCLiveThresholdPercent=90 " +
|
|
||||||
"-XX:G1RSetUpdatingPauseTimePercent=5 " +
|
|
||||||
"-XX:SurvivorRatio=32 " +
|
|
||||||
"-XX:+PerfDisableSharedMem " +
|
|
||||||
"-XX:MaxTenuringThreshold=1";
|
|
||||||
PREF_CUSTOM_JAVA_ARGS = DEFAULT_JAVA_ARGS;
|
|
||||||
DEFAULT_PREF.edit().putString("javaArgs", DEFAULT_JAVA_ARGS).commit();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (PREF_RENDERER.equals("2") || PREF_RENDERER.equals("3")) {
|
if (PREF_RENDERER.equals("2") || PREF_RENDERER.equals("3")) {
|
||||||
PREF_RENDERER = "opengles" + PREF_RENDERER;
|
PREF_RENDERER = "opengles" + PREF_RENDERER;
|
||||||
|
|
|
||||||
|
|
@ -45,16 +45,39 @@
|
||||||
app:layout_constraintTop_toBottomOf="@+id/username"
|
app:layout_constraintTop_toBottomOf="@+id/username"
|
||||||
tools:layout_editor_absoluteX="-1dp" />
|
tools:layout_editor_absoluteX="-1dp" />
|
||||||
|
|
||||||
<Switch
|
<TextView
|
||||||
|
android:id="@+id/mousespeed_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="32dp"
|
||||||
|
android:text="Mouse Speed"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/password" />
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/mouseslider"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:max="10"
|
||||||
|
android:min="1"
|
||||||
|
android:layout_marginEnd="16dp"
|
||||||
|
android:layout_marginTop="35dp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/mousespeed_text" />
|
||||||
|
|
||||||
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/righthanded"
|
android:id="@+id/righthanded"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginTop="35dp"
|
android:layout_marginTop="16dp"
|
||||||
android:text="Right Handed Mode"
|
android:text="Right Handed Mode"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/password" />
|
app:layout_constraintTop_toBottomOf="@+id/mouseslider" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/loadconfig"
|
android:id="@+id/loadconfig"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue