App 2.19.8: charging curve labels clear of each other; Charging tab 35/65
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
+2
-2
@@ -34,8 +34,8 @@ android {
|
||||
applicationId "com.stinnesbeck.nilsmg4"
|
||||
minSdk 27
|
||||
targetSdk 36
|
||||
versionCode 106
|
||||
versionName "2.19.7"
|
||||
versionCode 107
|
||||
versionName "2.19.8"
|
||||
|
||||
// Nothing about the server ships in the APK: its URL and ingest token are entered in
|
||||
// the app's Server tab (ServerConfig), and the database is only reachable by the server.
|
||||
|
||||
@@ -41,12 +41,39 @@ public final class ChargingGraphView extends View {
|
||||
}
|
||||
return found ? out.toString().trim() : "No charging measurements yet";
|
||||
}
|
||||
/**
|
||||
* Axes with their labels clear of each other: "kW" in a row of its own above the plot, the
|
||||
* power values right-aligned against the y axis, and the SOC ticks as "0 %" … "100 %",
|
||||
* centred under their lines, the last one kept inside the view.
|
||||
*/
|
||||
@Override protected synchronized void onDraw(Canvas c) {
|
||||
super.onDraw(c); float left=58, right=getWidth()-12, top=12, bottom=getHeight()-38;
|
||||
float max=20; for(float[] p:points) max=Math.max(max,p[1]); max=(float)Math.ceil(max/20f)*20f;
|
||||
for(int i=0;i<=5;i++){float y=bottom-(bottom-top)*i/5f; c.drawLine(left,y,right,y,grid); c.drawText(String.format(Locale.US,"%.0f",max*i/5f),4,y+7,text);}
|
||||
for(int soc=0;soc<=100;soc+=20){float x=left+(right-left)*soc/100f; c.drawLine(x,top,x,bottom,grid); c.drawText(String.valueOf(soc),x-10,getHeight()-8,text);}
|
||||
c.drawText("kW",5,20,text); c.drawText("SOC %",right-52,getHeight()-8,text);
|
||||
for(int i=1;i<points.size();i++){float[] a=points.get(i-1),b=points.get(i); float ax=left+a[0]*(right-left)/100, ay=bottom-a[1]*(bottom-top)/max, bx=left+b[0]*(right-left)/100, by=bottom-b[1]*(bottom-top)/max; c.drawLine(ax,ay,bx,by,line); c.drawCircle(bx,by,4,line);}
|
||||
super.onDraw(c);
|
||||
float left = 58, right = getWidth() - 12, top = 36, bottom = getHeight() - 38;
|
||||
float max = 20; for (float[] p : points) max = Math.max(max, p[1]); max = (float) Math.ceil(max / 20f) * 20f;
|
||||
text.setTextAlign(Paint.Align.RIGHT);
|
||||
for (int i = 0; i <= 5; i++) {
|
||||
float y = bottom - (bottom - top) * i / 5f;
|
||||
c.drawLine(left, y, right, y, grid);
|
||||
c.drawText(String.format(Locale.US, "%.0f", max * i / 5f), left - 8, y + 7, text);
|
||||
}
|
||||
text.setTextAlign(Paint.Align.LEFT);
|
||||
c.drawText("kW", 4, 20, text);
|
||||
for (int soc = 0; soc <= 100; soc += 20) {
|
||||
float x = left + (right - left) * soc / 100f;
|
||||
c.drawLine(x, top, x, bottom, grid);
|
||||
String label = soc + " %";
|
||||
float half = text.measureText(label) / 2f;
|
||||
float cx = Math.min(x, getWidth() - 2 - half);
|
||||
text.setTextAlign(Paint.Align.CENTER);
|
||||
c.drawText(label, cx, getHeight() - 8, text);
|
||||
}
|
||||
text.setTextAlign(Paint.Align.LEFT);
|
||||
for (int i = 1; i < points.size(); i++) {
|
||||
float[] a = points.get(i - 1), b = points.get(i);
|
||||
float ax = left + a[0] * (right - left) / 100, ay = bottom - a[1] * (bottom - top) / max;
|
||||
float bx = left + b[0] * (right - left) / 100, by = bottom - b[1] * (bottom - top) / max;
|
||||
c.drawLine(ax, ay, bx, by, line);
|
||||
c.drawCircle(bx, by, 4, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.evsuite.abrp.StableScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true">
|
||||
<!-- Two columns: live values | curve. The table scrolls inside its card so a long session does not push the page. -->
|
||||
<!-- Two columns, 35/65: live values | curve. The table scrolls inside its card so a long session does not push the page. -->
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:paddingStart="24dp" android:paddingEnd="24dp" android:paddingTop="12dp" android:paddingBottom="12dp" android:baselineAligned="false">
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:layout_marginEnd="16dp" android:orientation="vertical" android:padding="20dp" android:background="@drawable/bg_glass">
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="35" android:layout_marginEnd="16dp" android:orientation="vertical" android:padding="20dp" android:background="@drawable/bg_glass">
|
||||
<TextView android:id="@+id/charge_status" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/charging_not_charging" android:textAppearance="@style/Text.EV.Title" android:textColor="?attr/evAccentLight"/>
|
||||
<GridLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="2" android:layout_marginTop="12dp">
|
||||
<TextView android:layout_width="0dp" android:layout_columnWeight="1" android:padding="10dp" android:text="@string/charging_soc" android:textAppearance="@style/DataLabel"/><TextView android:id="@+id/charge_soc" android:layout_width="0dp" android:layout_columnWeight="1" android:padding="10dp" android:text="@string/no_value" android:textAppearance="@style/DataValue"/>
|
||||
@@ -16,7 +16,7 @@
|
||||
<TextView android:layout_width="0dp" android:layout_columnWeight="1" android:padding="10dp" android:text="@string/charging_total_cost" android:textAppearance="@style/DataLabel"/><TextView android:id="@+id/charge_total_cost" android:layout_width="0dp" android:layout_columnWeight="1" android:padding="10dp" android:text="@string/no_value" android:textAppearance="@style/DataValue"/>
|
||||
</GridLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" android:padding="20dp" android:background="@drawable/bg_glass">
|
||||
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="65" android:orientation="vertical" android:padding="20dp" android:background="@drawable/bg_glass">
|
||||
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/charging_curve_title" android:textAppearance="@style/Text.EV.Eyebrow"/>
|
||||
<com.evsuite.abrp.ChargingGraphView android:id="@+id/charge_graph" android:layout_width="match_parent" android:layout_height="250dp" android:layout_marginTop="12dp"/>
|
||||
<androidx.core.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="170dp" android:layout_marginTop="16dp" android:scrollbars="none">
|
||||
|
||||
Reference in New Issue
Block a user