Browse Source

AC rem0t0: plus/minus butt0n anim00tion was still a little fucked xd

Wazakindjes 10 months ago
parent
commit
664a0ad7f1

BIN
app/rem0t0.apk


+ 19 - 9
app/src/app_rem0t0/src/main/java/com/jemoeder/lief/rem0t0/MainActivity.java

@@ -19,6 +19,7 @@ import android.content.res.Resources;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
+import android.os.Handler;
 import android.os.Vibrator;
 import android.preference.PreferenceManager;
 
@@ -532,10 +533,11 @@ public class MainActivity extends AppCompatActivity {
 
 	private String transformCommand(String orig_cmd) {
 		String cmd = orig_cmd;
+
 		switch(orig_cmd) {
 			case "servo_minus":
 			case "servo_plus":
-				SeekBar sb = findViewById(R.id.sb_servo_rotate);
+				final SeekBar sb = findViewById(R.id.sb_servo_rotate);
 				int max = sb.getMax();
 				int progress = sb.getProgress();
 				progress += (orig_cmd.equals("servo_plus") ? seekbar_stepsize : -seekbar_stepsize);
@@ -544,10 +546,18 @@ public class MainActivity extends AppCompatActivity {
 				else if(progress > max)
 					progress = max;
 
-				// Adjust progress and "click" on the bar, which makes our custom listener act as if we stopped dragging =]
-				sb.performLongClick(); // Start dragging
-				sb.setProgress(progress); // Actually drag
-				sb.performClick(); // Release drag
+				// Need a little delay to give the button some time to actually start animating xd
+				final int fprogress = progress;
+				new Handler().postDelayed(new Runnable() {
+					@Override
+					public void run() {
+						// Adjust progress and "click" on the bar, which makes our custom listener act as if we stopped dragging =]
+						sb.performLongClick(); // Start dragging
+						sb.setProgress(fprogress); // Actually drag
+						sb.performClick(); // Release drag
+					}
+				}, 100);
+
 				cmd = null; // Cancel this command and let the seekbar listener do the rest ;]
 				break;
 			default:
@@ -864,13 +874,13 @@ public class MainActivity extends AppCompatActivity {
 							muhmain.muhcmds.add(cmdbase + cmdsuffix_holdstop + " " + cmd);
 						}
 						else {
+							// Always need to perform the click though, so the button is actually anim00ted =]
+							v.performClick();
+
 							// For now we may only need to transform shit for single taps (AC rem0te etc)
 							cmd = muhmain.transformCommand(cmd);
-							if(cmd == null || cmd.length() == 0) {
-								// Still need to perform the click though, so the button is actually anim00ted =]
-								v.performClick();
+							if(cmd == null || cmd.length() == 0)
 								return false;
-							}
 
 							muhmain.doHapticc(wrapass.VIBEMS_DEFAULT);
 							muhmain.muhcmds.add(cmdbase + " " + cmd);

+ 2 - 2
app/src/app_rem0t0/version.properties

@@ -1,2 +1,2 @@
-#Sat Mar 26 17:26:25 CET 2022
-VERSION_CODE=431
+#Sat Mar 26 18:17:27 CET 2022
+VERSION_CODE=436