App 2.17.5: Server tab fits; installation ID is read-only

- The "Your private connection" card is gone; its text was out of date
  (the ABRP credentials are no longer on the server).
- Import from file moved next to Save and Test, in one row.
- The installation ID is shown as text instead of an editable field:
  it is derived from the head unit, and changing it by hand only risked
  splitting the history. A config file can still carry an older one
  over, as before.
- The page fits the car's 1778x640 window without scrolling (checked
  on the emulator), and the subtitle no longer says the server passes
  data on to ABRP.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLJfZQZeAKAwSqViTmLzki
This commit is contained in:
2026-10-18 20:53:05 +02:00
co-authored by Claude Opus 5.5
parent 5ead905e5f
commit 5a82fe3dc1
5 changed files with 27 additions and 41 deletions
@@ -114,8 +114,10 @@ public class MainActivity extends AppCompatActivity {
private ChargingGraphView chargeGraph;
/** Server page. */
private TextInputLayout serverUrlLayout, serverTokenLayout, installationIdLayout;
private TextInputEditText serverUrlInput, serverTokenInput, installationIdInput;
private TextInputLayout serverUrlLayout, serverTokenLayout;
private TextInputEditText serverUrlInput, serverTokenInput;
/** Shown, not edited: derived from the head unit (ServerConfig.installationIdFor). */
private TextView installationIdText;
private View connectionStatusRow, connectionIndicator;
private TextView connectionStatusText;
@@ -460,19 +462,17 @@ public class MainActivity extends AppCompatActivity {
private void bindServerPane() {
serverUrlLayout = serverPane.findViewById(R.id.server_url_layout);
serverTokenLayout = serverPane.findViewById(R.id.server_token_layout);
installationIdLayout = serverPane.findViewById(R.id.installation_id_layout);
serverUrlInput = serverPane.findViewById(R.id.server_url_input);
serverTokenInput = serverPane.findViewById(R.id.server_token_input);
installationIdInput = serverPane.findViewById(R.id.installation_id_input);
installationIdText = serverPane.findViewById(R.id.installation_id_text);
connectionStatusRow = serverPane.findViewById(R.id.connection_status_row);
connectionIndicator = serverPane.findViewById(R.id.connection_indicator);
connectionStatusText = serverPane.findViewById(R.id.connection_status_text);
showServerConfig();
((TextView) serverPane.findViewById(R.id.import_hint))
.setText(getString(R.string.import_hint, configDirHint()));
serverPane.findViewById(R.id.server_save_button).setOnClickListener(v -> {
if (saveServerConfig(textOf(serverUrlInput), textOf(serverTokenInput), textOf(installationIdInput))) {
if (saveServerConfig(textOf(serverUrlInput), textOf(serverTokenInput),
ServerConfig.get(this).installationId)) {
setConnectionStatus(COLOR_OK, getString(R.string.server_saved));
}
});
@@ -485,7 +485,7 @@ public class MainActivity extends AppCompatActivity {
ServerConfig config = ServerConfig.get(this);
serverUrlInput.setText(config.url);
serverTokenInput.setText(config.token);
installationIdInput.setText(config.installationId);
installationIdText.setText(getString(R.string.installation_id_info, config.installationId));
}
/** Validates, marks the bad fields, and saves only when all three are good. */
@@ -495,9 +495,12 @@ public class MainActivity extends AppCompatActivity {
String id = rawId == null ? "" : rawId.trim().toLowerCase(java.util.Locale.US);
serverUrlLayout.setError(url == null ? getString(R.string.server_err_url) : null);
serverTokenLayout.setError(ServerConfig.isValidToken(token) ? null : getString(R.string.server_err_token));
installationIdLayout.setError(ServerConfig.isValidInstallationId(id)
? null : getString(R.string.server_err_installation_id));
if (url == null || !ServerConfig.isValidToken(token) || !ServerConfig.isValidInstallationId(id)) return false;
// Only an imported config file can bring a different id; the field is not editable.
if (!ServerConfig.isValidInstallationId(id)) {
setConnectionStatus(COLOR_ERROR, getString(R.string.server_err_installation_id));
return false;
}
if (url == null || !ServerConfig.isValidToken(token)) return false;
ServerConfig.save(this, url, token, id);
if (consumptionCloudClient != null) consumptionCloudClient.invalidateHistory();
showServerConfig();
@@ -513,15 +516,11 @@ public class MainActivity extends AppCompatActivity {
private void testConnection() {
String url = ServerConfig.normalizeUrl(textOf(serverUrlInput));
String token = textOf(serverTokenInput);
String id = textOf(installationIdInput).toLowerCase(java.util.Locale.US);
String id = ServerConfig.get(this).installationId;
if (url == null) {
serverUrlLayout.setError(getString(R.string.server_err_url));
return;
}
if (!ServerConfig.isValidInstallationId(id)) {
installationIdLayout.setError(getString(R.string.server_err_installation_id));
return;
}
setConnectionStatus(COLOR_PENDING, getString(R.string.conn_testing));
new Thread(() -> {
String message;
@@ -563,9 +562,7 @@ public class MainActivity extends AppCompatActivity {
return;
}
serverUrlLayout.setError(null);
String typedId = textOf(installationIdInput).toLowerCase(java.util.Locale.US);
String installationId = ServerConfig.isValidInstallationId(typedId)
? typedId : ServerConfig.get(this).installationId;
String installationId = ServerConfig.get(this).installationId;
PhoneQrDialog ui = new PhoneQrDialog(R.string.pair_title, R.string.pair_starting);
final boolean[] cancelled = ui.cancelled;
@@ -973,7 +970,6 @@ public class MainActivity extends AppCompatActivity {
// Show what the file said, so the marked field is the one to fix in the file.
if (config.serverUrl != null) serverUrlInput.setText(config.serverUrl);
if (config.token != null) serverTokenInput.setText(config.token);
if (config.installationId != null) installationIdInput.setText(config.installationId);
return false;
}
}