mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
[android] add support for schuko/type-E charge sockets
The commit is slightly more complicated that expected because: - it adds supports for both schuko and type-E, using the same icon (but maintaining the underlying type annotated in OSM) - it adds logic to *not* display the power of schuko socket as 'unknown' when not provided in OSM, as it is 'implicit' (3.7kW in most countries) Signed-off-by: Séverin Lemaignan <severin@guakamole.org>
This commit is contained in:
@@ -1,7 +1,33 @@
|
||||
package app.organicmaps.sdk.bookmarks.data;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
/**
|
||||
* represents the details of the socket available on a particular charging station
|
||||
*
|
||||
*/
|
||||
public record ChargeSocketDescriptor(String type, int count, double power) {}
|
||||
public record ChargeSocketDescriptor(String type, int count, double power) {
|
||||
|
||||
/**
|
||||
* Some charge sockets have the same visuals as other sockets, even though they are different and are tagged
|
||||
* differently in OSM. This method returns the 'visual' type that should be used for the socket.
|
||||
*
|
||||
* @return the 'equivalent' visual style that should be used for this socket
|
||||
*/
|
||||
public String visualType() {
|
||||
if (type.equals("typee")) {
|
||||
return "schuko";
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* For some sockets (eg, domestic sockets), the power is usually not provided, as it is 'implicit'
|
||||
*
|
||||
* @return true if this socket type does not require displaying the power
|
||||
*/
|
||||
public Boolean ignorePower() {
|
||||
return type.equals("typee") || type.equals("schuko");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="32"
|
||||
android:viewportHeight="32">
|
||||
<path
|
||||
android:pathData="M16.847,0.853L16.847,2.125h-1.693L15.153,0.855A8.965,8.965 0,0 0,8.245 5.281L8.245,8.496L7.128,8.496a8.965,8.965 0,0 0,-0.094 1.283,8.965 8.965,0 0,0 0.092,1.283L8.245,11.062v3.217a8.965,8.965 0,0 0,6.908 4.426v-1.361h1.693v1.361a8.965,8.965 0,0 0,6.908 -4.426v-3.217h1.119a8.965,8.965 0,0 0,0.092 -1.283,8.965 8.965,0 0,0 -0.092,-1.283h-1.119L23.755,5.279A8.965,8.965 0,0 0,16.847 0.853ZM11.519,8.183c0.881,0 1.594,0.715 1.594,1.596 0,0.881 -0.713,1.596 -1.594,1.596C10.637,11.375 9.923,10.66 9.923,9.779 9.923,8.898 10.637,8.183 11.519,8.183ZM20.483,8.183c0.881,0 1.594,0.715 1.594,1.596 0,0.881 -0.713,1.596 -1.594,1.596 -0.881,0 -1.596,-0.714 -1.596,-1.596 0,-0.881 0.715,-1.596 1.596,-1.596z"
|
||||
android:strokeWidth="0"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
Reference in New Issue
Block a user