App 2.7.0: voice-key double press opens the app; no scroll jumps
Steering wheel: a double press of the voice key (code 287) opens the app. The floating button from 2.6.0 does not show over the MG4 launcher, so this is the way back into the app. The head unit reports keys as the broadcast com.saic.keyevent.hardkey.report, whose extras are not documented: the receiver tries the usual names (and an embedded KeyEvent), and counts one press per report whichever way the up/down field turns out to work; long presses never open the app. The last 20 reports are listed raw on the Logs tab, so if the guess misses, a photo of that list gives the real format. A switch in the Upload tab turns it off. DoublePressDetector (500 ms window) has 5 tests; on the emulator, simulated double presses open the app and single presses, other keys and long presses do not. Scrolling: pages jumped back to the top on every 2 s refresh. A stack trace on the emulator showed why: ViewPager2's RecyclerView lays the pages out while measuring, at a provisional height, and ScrollView.onLayout clamps the position to 0. StableScrollView keeps the driver's position across layouts and is now the root of every page; the scrolled Charging page stays put across refreshes. Vehicle tab: all six value tiles, including both range estimates, sit in one row at the top, so nothing needs scrolling at 1920x720. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
@@ -120,7 +120,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
private TextView connectionStatusText;
|
||||
|
||||
/** Upload page: live telemetry switch and cadence. */
|
||||
private SwitchMaterial liveTelemetrySwitch, boostSwitch, floatingButtonSwitch;
|
||||
private SwitchMaterial liveTelemetrySwitch, boostSwitch, floatingButtonSwitch, voiceKeySwitch;
|
||||
private TextView steeringKeysText;
|
||||
private View overlayPermissionNote;
|
||||
private android.widget.Spinner intervalSpinner;
|
||||
private TextInputLayout lowSocLayout;
|
||||
@@ -210,6 +211,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
@Override public void run() {
|
||||
refreshStatus();
|
||||
refreshCallLog();
|
||||
refreshSteeringKeys();
|
||||
refreshVehicle();
|
||||
refreshConsumption();
|
||||
refreshWifi();
|
||||
@@ -254,6 +256,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
statusText = servicePane.findViewById(R.id.status_text);
|
||||
callLogText = logPane.findViewById(R.id.call_log_text);
|
||||
steeringKeysText = logPane.findViewById(R.id.steering_keys_text);
|
||||
logPane.findViewById(R.id.flush_now_button).setOnClickListener(v -> manualFlush());
|
||||
|
||||
setUpPager();
|
||||
@@ -795,6 +798,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
// ---------- Upload page ----------
|
||||
|
||||
private void bindServicePane() {
|
||||
voiceKeySwitch = servicePane.findViewById(R.id.voice_key_switch);
|
||||
voiceKeySwitch.setChecked(UploadSettings.voiceKeyOpensApp(prefs));
|
||||
voiceKeySwitch.setOnCheckedChangeListener((btn, checked) ->
|
||||
prefs.edit().putBoolean(UploadSettings.KEY_VOICE_KEY_OPENS, checked).apply());
|
||||
floatingButtonSwitch = servicePane.findViewById(R.id.floating_button_switch);
|
||||
overlayPermissionNote = servicePane.findViewById(R.id.overlay_permission_note);
|
||||
floatingButtonSwitch.setChecked(UploadSettings.floatingButtonEnabled(prefs));
|
||||
@@ -1340,6 +1347,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
}, "cloud-refresh").start();
|
||||
}
|
||||
|
||||
/** What the car's steering-wheel key broadcasts looked like, newest first. */
|
||||
private void refreshSteeringKeys() {
|
||||
if (steeringKeysText == null) return;
|
||||
java.util.List<String> keys = SteeringKeyListener.recent();
|
||||
String text = keys.isEmpty() ? getString(R.string.steering_keys_empty)
|
||||
: android.text.TextUtils.join("\n", keys);
|
||||
if (!text.contentEquals(steeringKeysText.getText())) steeringKeysText.setText(text);
|
||||
}
|
||||
|
||||
private void refreshCallLog() {
|
||||
java.util.List<UploadLog.Entry> entries = AbrpUploadService.log().recent();
|
||||
if (entries.isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user