Skip to content

Commit 9d74791

Browse files
malysclaude
andcommitted
feat(chargepilot): the car's own viewport, and bars that stop spending it
The emulator profile gave the app 908dp of height where the MG4 gives 720: nothing overflowed at a desk and anything could in the car. `emulator-viewport` sizes the panel to 1920x892 so the configuration reports the car's `w1920dp h720dp`, and fails loudly if this image's system bars are not the 172px it assumes — `wm size reset` restores the panel, not the viewport, and was the wrong instrument. Measured in that box, three things were wrong. The navigation strip was 1300dp of fixed widths that a sixth tab would have pushed to 1500dp, so it is weights now and each host gives it what its own actions leave. Every top bar was 72dp or 88dp of overhead, which the soft keyboard makes expensive; they are all `chargepilot_bar_height` — 48dp, the platform's touch-target floor — with everything inside taking the bar's height rather than naming its own, and the gap under them is `chargepilot_bar_gap` instead of 24dp. The plot's cursor row was a fixed 84dp holding a label over a 26sp value, which cut the values off at the bottom; it is a floor now, as its own token always said it should be. Battery is a primary page between Trips and Diagnostics, swipeable like the others, so the dashboard button that used to open it is gone. Import USB and Export USB are Import and Export. And every screen that reads history starts with some: `seed-trips` writes a recorded 38.2 km drive with its samples, a short errand, and eight measurable discharges into the app's own files, and `run` calls it. Empty states are not a rendering anyone can review. Both fixtures are read in a test the way the app reads them, so a schema or threshold change fails there and not on a screen nobody is watching. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 677bea8 commit 9d74791

26 files changed

Lines changed: 1932 additions & 117 deletions

‎app/src/main/java/com/evsuite/chargepilot/BatteryHealthActivity.kt‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import android.content.ServiceConnection
77
import android.os.Bundle
88
import android.os.IBinder
99
import android.view.View
10-
import androidx.appcompat.app.AppCompatActivity
1110
import com.evsuite.chargepilot.databinding.ActivityBatteryHealthBinding
1211
import com.evsuite.hardware.telemetry.BatteryExposure
1312
import com.evsuite.hardware.telemetry.BatteryExposureReport
@@ -37,7 +36,9 @@ import java.util.concurrent.Executors
3736
* — so it is offered as a suggestion, gated parked-only like every other setting, and the
3837
* driver's figure stays theirs until they tap.
3938
*/
40-
class BatteryHealthActivity : AppCompatActivity() {
39+
class BatteryHealthActivity : PrimaryNavigationActivity() {
40+
override val primaryPage = PrimaryPage.BATTERY
41+
4142

4243
private lateinit var binding: ActivityBatteryHealthBinding
4344
private val disk = Executors.newSingleThreadExecutor { runnable ->
@@ -83,7 +84,6 @@ class BatteryHealthActivity : AppCompatActivity() {
8384
super.onCreate(savedInstanceState)
8485
binding = ActivityBatteryHealthBinding.inflate(layoutInflater)
8586
setContentView(binding.root)
86-
binding.backAction.setOnClickListener { finish() }
8787
binding.applyAction.setOnClickListener { apply() }
8888
load()
8989
}
@@ -357,8 +357,5 @@ class BatteryHealthActivity : AppCompatActivity() {
357357

358358
companion object {
359359
private const val PATTERN_TREND = "%+.1f pt"
360-
361-
fun intent(context: Context): Intent =
362-
Intent(context, BatteryHealthActivity::class.java)
363360
}
364361
}

‎app/src/main/java/com/evsuite/chargepilot/MainActivity.kt‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,6 @@ class MainActivity : PrimaryNavigationActivity() {
135135
binding.driftLine.setOnClickListener { forgetPlan() }
136136
binding.aboutAction.text = getString(R.string.about_version_badge, appVersion())
137137
binding.aboutAction.setOnClickListener { showAbout() }
138-
// A reading screen, so it opens while moving like the trip history does; the one thing
139-
// on it that changes a setting carries the parked gate itself.
140-
binding.batteryHealthAction.setOnClickListener {
141-
startActivity(BatteryHealthActivity.intent(this))
142-
}
143138
renderUnavailable()
144139
requestVehiclePermissions()
145140
if (TripRecordingService.isAutomaticDetectionEnabled(this)) {

‎app/src/main/java/com/evsuite/chargepilot/PrimaryNavigationActivity.kt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ abstract class PrimaryNavigationActivity : AppCompatActivity() {
8181
R.id.navEnergy -> PrimaryPage.ENERGY
8282
R.id.navArrival -> PrimaryPage.ARRIVAL
8383
R.id.navTrips -> PrimaryPage.TRIPS
84+
R.id.navBattery -> PrimaryPage.BATTERY
8485
R.id.navDiagnostics -> PrimaryPage.DIAGNOSTICS
8586
R.id.navSettings -> PrimaryPage.SETTINGS
8687
else -> null
@@ -90,6 +91,7 @@ abstract class PrimaryNavigationActivity : AppCompatActivity() {
9091
PrimaryPage.ENERGY -> R.id.navEnergy
9192
PrimaryPage.ARRIVAL -> R.id.navArrival
9293
PrimaryPage.TRIPS -> R.id.navTrips
94+
PrimaryPage.BATTERY -> R.id.navBattery
9395
PrimaryPage.DIAGNOSTICS -> R.id.navDiagnostics
9496
PrimaryPage.SETTINGS -> R.id.navSettings
9597
}
@@ -98,6 +100,7 @@ abstract class PrimaryNavigationActivity : AppCompatActivity() {
98100
PrimaryPage.ENERGY -> MainActivity::class.java
99101
PrimaryPage.ARRIVAL -> ArrivalForecastActivity::class.java
100102
PrimaryPage.TRIPS -> TripHistoryActivity::class.java
103+
PrimaryPage.BATTERY -> BatteryHealthActivity::class.java
101104
PrimaryPage.DIAGNOSTICS -> DiagnosticsActivity::class.java
102105
PrimaryPage.SETTINGS -> SettingsActivity::class.java
103106
}

‎app/src/main/java/com/evsuite/chargepilot/PrimaryPage.kt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ enum class PrimaryPage {
44
ENERGY,
55
ARRIVAL,
66
TRIPS,
7+
BATTERY,
78
DIAGNOSTICS,
89
SETTINGS;
910

‎app/src/main/res/layout/activity_arrival_forecast.xml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414

1515
<LinearLayout
1616
android:layout_width="match_parent"
17-
android:layout_height="@dimen/touch_target"
17+
android:layout_height="@dimen/chargepilot_bar_height"
1818
android:background="@drawable/bg_topbar"
1919
android:gravity="center_vertical"
2020
android:orientation="horizontal"
2121
android:paddingStart="@dimen/spacing_lg"
2222
android:paddingEnd="@dimen/spacing_lg">
2323

24-
<include layout="@layout/view_primary_navigation" />
25-
26-
<Space
24+
<include
25+
layout="@layout/view_primary_navigation"
2726
android:layout_width="0dp"
28-
android:layout_height="1dp"
27+
android:layout_height="match_parent"
2928
android:layout_weight="1" />
29+
3030
</LinearLayout>
3131

3232
<ScrollView
@@ -40,7 +40,10 @@
4040
android:layout_height="wrap_content"
4141
android:gravity="center_horizontal"
4242
android:orientation="vertical"
43-
android:padding="@dimen/spacing_lg">
43+
android:paddingStart="@dimen/spacing_lg"
44+
android:paddingTop="@dimen/chargepilot_bar_gap"
45+
android:paddingEnd="@dimen/spacing_lg"
46+
android:paddingBottom="@dimen/spacing_lg">
4447

4548
<TextView
4649
android:id="@+id/arrivalStatus"

‎app/src/main/res/layout/activity_battery_health.xml‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,18 @@
1515

1616
<LinearLayout
1717
android:layout_width="match_parent"
18-
android:layout_height="@dimen/touch_target"
18+
android:layout_height="@dimen/chargepilot_bar_height"
1919
android:background="@drawable/bg_topbar"
2020
android:gravity="center_vertical"
2121
android:orientation="horizontal"
2222
android:paddingStart="@dimen/spacing_lg"
2323
android:paddingEnd="@dimen/spacing_lg">
2424

25-
<TextView
25+
<include
26+
layout="@layout/view_primary_navigation"
2627
android:layout_width="0dp"
27-
android:layout_height="wrap_content"
28-
android:layout_weight="1"
29-
android:text="@string/battery_health_title"
30-
android:textAppearance="@style/Text.EV.Title" />
31-
32-
<com.google.android.material.button.MaterialButton
33-
android:id="@+id/backAction"
34-
style="@style/Widget.EV.Button.Outlined"
35-
android:layout_width="180dp"
36-
android:layout_height="@dimen/touch_target"
37-
android:text="@string/action_back" />
28+
android:layout_height="match_parent"
29+
android:layout_weight="1" />
3830
</LinearLayout>
3931

4032
<LinearLayout
@@ -43,7 +35,10 @@
4335
android:layout_weight="1"
4436
android:baselineAligned="false"
4537
android:orientation="horizontal"
46-
android:padding="@dimen/spacing_lg">
38+
android:paddingStart="@dimen/spacing_lg"
39+
android:paddingTop="@dimen/chargepilot_bar_gap"
40+
android:paddingEnd="@dimen/spacing_lg"
41+
android:paddingBottom="@dimen/spacing_lg">
4742

4843
<LinearLayout
4944
style="@style/Widget.EV.Readout"

‎app/src/main/res/layout/activity_charge_stop.xml‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<LinearLayout
1717
android:layout_width="match_parent"
18-
android:layout_height="@dimen/touch_target"
18+
android:layout_height="@dimen/chargepilot_bar_height"
1919
android:background="@drawable/bg_topbar"
2020
android:gravity="center_vertical"
2121
android:orientation="horizontal"
@@ -44,15 +44,19 @@
4444
android:id="@+id/navigateAction"
4545
style="@style/Widget.EVChargePilot.Button"
4646
android:layout_width="360dp"
47-
android:layout_height="@dimen/touch_target"
47+
android:layout_height="match_parent"
48+
android:insetTop="0dp"
49+
android:insetBottom="0dp"
4850
android:layout_marginEnd="@dimen/spacing_md"
4951
android:text="@string/charge_stop_navigate" />
5052

5153
<com.google.android.material.button.MaterialButton
5254
android:id="@+id/backAction"
5355
style="@style/Widget.EV.Button.Outlined"
5456
android:layout_width="180dp"
55-
android:layout_height="@dimen/touch_target"
57+
android:layout_height="match_parent"
58+
android:insetTop="0dp"
59+
android:insetBottom="0dp"
5660
android:text="@string/action_back" />
5761
</LinearLayout>
5862

@@ -67,7 +71,10 @@
6771
android:layout_height="wrap_content"
6872
android:gravity="center_horizontal"
6973
android:orientation="vertical"
70-
android:padding="@dimen/spacing_lg">
74+
android:paddingStart="@dimen/spacing_lg"
75+
android:paddingTop="@dimen/chargepilot_bar_gap"
76+
android:paddingEnd="@dimen/spacing_lg"
77+
android:paddingBottom="@dimen/spacing_lg">
7178

7279
<TextView
7380
android:id="@+id/chargeStopStatus"

‎app/src/main/res/layout/activity_destination.xml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<LinearLayout
1717
android:layout_width="match_parent"
18-
android:layout_height="88dp"
18+
android:layout_height="@dimen/chargepilot_bar_height"
1919
android:background="@drawable/bg_topbar"
2020
android:gravity="center_vertical"
2121
android:orientation="horizontal"
@@ -33,7 +33,9 @@
3333
android:id="@+id/backAction"
3434
style="@style/Widget.EV.Button.Outlined"
3535
android:layout_width="180dp"
36-
android:layout_height="@dimen/touch_target"
36+
android:layout_height="match_parent"
37+
android:insetTop="0dp"
38+
android:insetBottom="0dp"
3739
android:text="@string/action_back" />
3840
</LinearLayout>
3941

@@ -43,7 +45,7 @@
4345
android:layout_height="wrap_content"
4446
android:accessibilityLiveRegion="polite"
4547
android:paddingStart="@dimen/spacing_lg"
46-
android:paddingTop="@dimen/spacing_md"
48+
android:paddingTop="@dimen/chargepilot_bar_gap"
4749
android:paddingEnd="@dimen/spacing_lg"
4850
android:textAppearance="@style/Text.EV.Body" />
4951

‎app/src/main/res/layout/activity_diagnostics.xml‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@
1414

1515
<LinearLayout
1616
android:layout_width="match_parent"
17-
android:layout_height="@dimen/touch_target"
17+
android:layout_height="@dimen/chargepilot_bar_height"
1818
android:background="@drawable/bg_topbar"
1919
android:gravity="center_vertical"
2020
android:orientation="horizontal"
2121
android:paddingStart="@dimen/spacing_lg"
2222
android:paddingEnd="@dimen/spacing_lg">
2323

24-
<include layout="@layout/view_primary_navigation" />
24+
<include
25+
layout="@layout/view_primary_navigation"
26+
android:layout_width="0dp"
27+
android:layout_height="match_parent"
28+
android:layout_weight="1" />
2529
</LinearLayout>
2630

2731
<LinearLayout
@@ -30,7 +34,10 @@
3034
android:layout_weight="1"
3135
android:gravity="center_horizontal"
3236
android:orientation="vertical"
33-
android:padding="@dimen/spacing_lg">
37+
android:paddingStart="@dimen/spacing_lg"
38+
android:paddingTop="@dimen/chargepilot_bar_gap"
39+
android:paddingEnd="@dimen/spacing_lg"
40+
android:paddingBottom="@dimen/spacing_lg">
3441

3542
<TextView
3643
android:layout_width="1720dp"

‎app/src/main/res/layout/activity_energy_breakdown.xml‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<LinearLayout
1616
android:layout_width="match_parent"
17-
android:layout_height="88dp"
17+
android:layout_height="@dimen/chargepilot_bar_height"
1818
android:background="@drawable/bg_topbar"
1919
android:gravity="center_vertical"
2020
android:orientation="horizontal"
@@ -32,7 +32,9 @@
3232
android:id="@+id/backAction"
3333
style="@style/Widget.EV.Button.Outlined"
3434
android:layout_width="180dp"
35-
android:layout_height="@dimen/touch_target"
35+
android:layout_height="match_parent"
36+
android:insetTop="0dp"
37+
android:insetBottom="0dp"
3638
android:text="@string/action_back" />
3739
</LinearLayout>
3840

@@ -46,7 +48,10 @@
4648
android:layout_width="match_parent"
4749
android:layout_height="match_parent"
4850
android:orientation="vertical"
49-
android:padding="@dimen/spacing_lg"
51+
android:paddingStart="@dimen/spacing_lg"
52+
android:paddingTop="@dimen/chargepilot_bar_gap"
53+
android:paddingEnd="@dimen/spacing_lg"
54+
android:paddingBottom="@dimen/spacing_lg"
5055
android:visibility="gone">
5156

5257
<TextView

0 commit comments

Comments
 (0)