|
@@ -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);
|