Merge remote-tracking branch 'origin/master'
# Conflicts: # app/build.gradle
|
|
@ -1,6 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="1.7" />
|
||||
<annotationProcessing>
|
||||
<profile name="Gradle Imported" enabled="true">
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath useClasspath="false">
|
||||
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.20/18bcea7d5df4d49227b4a0743a536208ce4825bb/lombok-1.18.20.jar" />
|
||||
</processorPath>
|
||||
<module name="VehicleOwner.services.core.main" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="1.8">
|
||||
<module name="PersonalApp.app" target="11" />
|
||||
<module name="PersonalApp.services.appserverclient" target="11" />
|
||||
<module name="PersonalApp.services.asn" target="1.8" />
|
||||
<module name="PersonalApp.services.asn.main" target="1.8" />
|
||||
<module name="PersonalApp.services.asn.test" target="1.8" />
|
||||
<module name="PersonalApp.services.localstorage" target="11" />
|
||||
<module name="PersonalApp.services.ugp" target="11" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
<option value="$PROJECT_DIR$/services/asn" />
|
||||
<option value="$PROJECT_DIR$/services/core" />
|
||||
<option value="$PROJECT_DIR$/services/localstorage" />
|
||||
<option value="$PROJECT_DIR$/services/ugp" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
|
|
|
|||
|
|
@ -21,5 +21,10 @@
|
|||
<option name="name" value="Google" />
|
||||
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="MavenLocal" />
|
||||
<option name="name" value="MavenLocal" />
|
||||
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -88,6 +88,7 @@ dependencies {
|
|||
implementation 'androidx.navigation:navigation-ui:2.3.5'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.2.1'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
|
||||
|
|
@ -121,7 +122,6 @@ dependencies {
|
|||
// compile files('libs/org.eclipse.paho.client.mqttv3-1.1.1.jar')
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
|
||||
//implementation 'asnrt:asnrt:2020.07'
|
||||
implementation 'eu.csc.core:coregtdm:1.0-SNAPSHOT'
|
||||
implementation files('libs/log4j-1.2.17.jar')
|
||||
//implementation files('libs/asnrt-2020.07.jar')
|
||||
|
|
|
|||
|
|
@ -1,123 +1,125 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="eu.csc.vehown">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="eu.csc.vehown">
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<!--
|
||||
uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"
|
||||
tools:ignore="ScopedStorage"/
|
||||
-->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
android:required="false" />
|
||||
android:name="android.hardware.camera"
|
||||
android:required="false"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
|
||||
android:theme="@style/Theme.VehicleOwner"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="n">
|
||||
|
||||
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.VehicleOwner"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="n">
|
||||
<activity
|
||||
android:name=".ui.svi.SVIVehicleItemDetailActivity"
|
||||
android:label="@string/title_svivehicleitem_detail"
|
||||
android:parentActivityName=".ui.svi.SVIVehicleItemListActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="eu.csc.vehown.ui.svi.SVIVehicleItemListActivity" />
|
||||
android:name=".ui.events.EventItemListActivity"
|
||||
android:label="@string/title_eventitem_list"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.settings.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"></activity>
|
||||
android:name=".ui.events.EventItemDetailActivity"
|
||||
android:label="@string/title_eventitem_detail"
|
||||
android:parentActivityName=".ui.events.EventItemListActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar">
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="eu.csc.vehown.ui.events.EventItemListActivity"/>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.settings.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"/>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="eu.csc.app.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="eu.csc.app.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths"/>
|
||||
</provider>
|
||||
|
||||
<receiver android:name=".broadcast.VehicleEventReceivedReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="eu.csc.vehown.EVENTINTENT" />
|
||||
<action android:name="eu.csc.vehown.EVENTINTENT"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".broadcast.StartupReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
android:name=".broadcast.StartupReceiver"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".ugp.UGPService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
android:name=".ugp.UGPService"
|
||||
android:enabled="true"
|
||||
android:exported="true"/>
|
||||
<service
|
||||
android:name=".services.rest.UploadFileService"
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
<service android:name=".services.DataServiceIntent" />
|
||||
android:name=".services.rest.UploadFileService"
|
||||
android:enabled="true"
|
||||
android:exported="true"/>
|
||||
<service android:name=".services.DataServiceIntent"/>
|
||||
|
||||
<activity
|
||||
android:name=".ui.main.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar">
|
||||
android:name=".ui.main.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.svi.RegisterSVIActivity"
|
||||
android:label="@string/register_svi"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"></activity>
|
||||
android:name=".ui.svi.RegisterSVIActivity"
|
||||
android:label="@string/register_svi"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".ui.reportEvent.ReportEventActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"></activity>
|
||||
android:name=".ui.reportEvent.ReportEventActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".ui.reportEvent.SelectEventsActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"></activity>
|
||||
android:name=".ui.reportEvent.SelectEventsActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".ui.reportEvent.SelectRepairShopActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"></activity>
|
||||
android:name=".ui.reportEvent.SelectRepairShopActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".ui.tp.TreatmentPlanActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"></activity>
|
||||
android:name=".ui.tp.TreatmentPlanActivity"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".ui.FailureEvent.FailureEventActivity"
|
||||
android:label="@string/title_activity_failure_event"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar" />
|
||||
android:name=".ui.FailureEvent.FailureEventActivity"
|
||||
android:label="@string/title_activity_failure_event"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".ui.registerCustomer.RegisterCustomerActivity"
|
||||
android:label="@string/title_activity_register_customer"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar" />
|
||||
android:name=".ui.registerCustomer.RegisterCustomerActivity"
|
||||
android:label="@string/title_activity_register_customer"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"/>
|
||||
<activity
|
||||
android:name=".ui.login.LoginActivity"
|
||||
android:label="@string/app_name"></activity>
|
||||
android:name=".ui.login.LoginActivity"
|
||||
android:label="@string/app_name"/>
|
||||
<activity
|
||||
android:name=".ui.test.Test3Activity"
|
||||
android:label="@string/title_activity_test3"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"></activity>
|
||||
android:name=".ui.test.Test3Activity"
|
||||
android:label="@string/title_activity_test3"
|
||||
android:theme="@style/Theme.VehicleOwner.NoActionBar"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
After Width: | Height: | Size: 20 KiB |
|
|
@ -25,6 +25,13 @@ public class LoggedInUser implements Serializable, ICustomer {
|
|||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public LoggedInUser(String firstname, String lastname, String login, String token) {
|
||||
this.token = token;
|
||||
this.firstname = firstname;
|
||||
this.lastname = lastname;
|
||||
this.login = login;
|
||||
}
|
||||
|
||||
public static LoggedInUser getEmptyUser() {
|
||||
return new LoggedInUser();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ public class RepairShop implements Serializable, IRepairShop {
|
|||
private String email;
|
||||
private String phone;
|
||||
|
||||
|
||||
|
||||
public RepairShop(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class MqttClient {
|
|||
if (content.length == 2) {
|
||||
treatmentId = content[1];
|
||||
|
||||
RepairShopTreatmentProposalResponse response = RetrofitApiClientFactory.getClient().getTreatmentProposal(treatmentId).blockingGet();
|
||||
RepairShopTreatmentProposalResponse response = RetrofitApiClientFactory.getClient(context).getTreatmentProposal(treatmentId).blockingGet();
|
||||
|
||||
plan = new TreatmentPlan(response);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public class ExampleDataClient implements IPersistenceClient {
|
|||
|
||||
|
||||
public static String EXAMPLTE_TREATMENT_ID = "12d5b001-53bc-41d9-9267-6193aa6a6c2b";
|
||||
public static String JOHN_DOE_ACCESS_TOKEN = "6b0b88cdc2524ef0822b9fdebdd9e527";
|
||||
|
||||
public static final VehicleSystem System_GNSS = new VehicleSystem("gnss", "GNSS");
|
||||
public static final VehicleSystem System_IMU = new VehicleSystem("imu", "IMU");
|
||||
|
|
@ -23,7 +24,7 @@ public class ExampleDataClient implements IPersistenceClient {
|
|||
public static final VehicleSystem System_ABS = new VehicleSystem("abs", "ABS");
|
||||
public static final VehicleSystem System_WiFi = new VehicleSystem("wifi", "WiFi");
|
||||
|
||||
public static final LoggedInUser exampleLoggedInUser = new LoggedInUser();
|
||||
public static final LoggedInUser exampleLoggedInUser = new LoggedInUser("John", "Doe", "johndoe", "6b0b88cdc2524ef0822b9fdebdd9e527");
|
||||
|
||||
public static final Event exampleEvent1 = new Event("1", "P0100", "Mass or Volume Air Flow 'A' Circuit", "OBDII1", "Dodge Charger '265G21'", 1620649836986L, Event.EventStatus.CONFIRMED, Event.EventSeverity.HIGH);
|
||||
public static final Event exampleEvent2 = new Event("2", "P0200", "Injector Circuit/Open", "OBDII1", "Dodge Charger '265G21'", 1620649836987L, Event.EventStatus.CONFIRMED, Event.EventSeverity.HIGH);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package eu.csc.vehown.services.rest;
|
||||
|
||||
import eu.csc.vehown.services.rest.data.*;
|
||||
import io.reactivex.Single;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface AuthenticationApiClient {
|
||||
|
||||
|
||||
@Multipart
|
||||
@POST("token")
|
||||
Single<AuthenticateResponseDTO> getToken(@Part("login") String login, @Part("password") String password);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -12,6 +12,9 @@ import java.util.List;
|
|||
|
||||
public interface RetrofitApiClient {
|
||||
|
||||
@GET("api/customer/vehicles")
|
||||
Single<List<CustomerVehicleRequest>> getCustomerVehicles();
|
||||
|
||||
@GET("leases/{lease}")
|
||||
Single<ResponseBody> getLease(@Path("lease") String lease);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,25 +1,49 @@
|
|||
package eu.csc.vehown.services.rest;
|
||||
|
||||
import android.content.Context;
|
||||
import eu.csc.vehown.persist.sharedPreferences.SharedPreferencesFactory;
|
||||
import eu.csc.vehown.services.serialization.JSONHelper;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class RetrofitApiClientFactory {
|
||||
|
||||
private static final String API_URL = "http://10.10.101.30:8000/repair/";
|
||||
|
||||
public static final String AUTHENTICATION_API_URL = "http://127.0.0.1:8755/";
|
||||
|
||||
|
||||
//private static final String API_URL = "http://10.10.101.40:8000/repair/";
|
||||
|
||||
|
||||
|
||||
|
||||
public static RetrofitApiClient getClient() {
|
||||
return getClient(API_URL);
|
||||
public static RetrofitApiClient getClient(Context context) {
|
||||
|
||||
String token = SharedPreferencesFactory.getInstance(context).getApiToken();
|
||||
|
||||
return getClient(API_URL, token);
|
||||
}
|
||||
|
||||
public static RetrofitApiClient getClient(String url) {
|
||||
public static RetrofitApiClient getClient(String token) {
|
||||
|
||||
|
||||
return getClient(API_URL, token);
|
||||
}
|
||||
|
||||
|
||||
public static AuthenticationApiClient getAuthenticationClient() {
|
||||
return getAuthenticationClient(AUTHENTICATION_API_URL);
|
||||
}
|
||||
|
||||
public static AuthenticationApiClient getAuthenticationClient(String url) {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(url)
|
||||
.addConverterFactory(GsonConverterFactory.create(JSONHelper.getGson()))
|
||||
|
|
@ -28,6 +52,28 @@ public class RetrofitApiClientFactory {
|
|||
.build();
|
||||
|
||||
|
||||
return retrofit.create(AuthenticationApiClient.class);
|
||||
}
|
||||
|
||||
public static RetrofitApiClient getClient(String url, String token) {
|
||||
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(new Interceptor() {
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request newRequest = chain.request().newBuilder()
|
||||
.addHeader("Authorization", " Bearer " + token)
|
||||
.build();
|
||||
return chain.proceed(newRequest);
|
||||
}
|
||||
}).build();
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(url)
|
||||
.client(client)
|
||||
.addConverterFactory(GsonConverterFactory.create(JSONHelper.getGson()))
|
||||
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.build();
|
||||
|
||||
|
||||
return retrofit.create(RetrofitApiClient.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package eu.csc.vehown.services.rest.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class AuthenticateResponseDTO implements Serializable {
|
||||
|
||||
private String token;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthenticateResponseDTO{" +
|
||||
"token='" + token + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package eu.csc.vehown.services.rest.data;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class CustomerVehicleRequest implements Serializable {
|
||||
|
||||
private String vin;
|
||||
|
||||
private String licenseplate;
|
||||
|
||||
private String brand;
|
||||
private String model;
|
||||
private byte[] image;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CustomerVehicleRequest{" +
|
||||
"vin='" + vin + '\'' +
|
||||
", licenseplate='" + licenseplate + '\'' +
|
||||
", brand='" + brand + '\'' +
|
||||
", model='" + model + '\'' +
|
||||
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,8 @@
|
|||
package eu.csc.vehown.services.serialization;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
|
@ -25,12 +28,31 @@ public class JSONHelper {
|
|||
.registerTypeAdapter(Date.class, new DateDeserializer())
|
||||
.registerTypeAdapter(Date.class, new DateSerializer())
|
||||
|
||||
.registerTypeAdapter(byte[].class, new ByteArraySerializer())
|
||||
.registerTypeAdapter(byte[].class, new ByteArrayDeserializer())
|
||||
|
||||
.create();
|
||||
|
||||
}
|
||||
|
||||
return gson;
|
||||
}
|
||||
static class ByteArraySerializer implements JsonSerializer<byte[]> {
|
||||
public JsonElement serialize(byte[] image, Type typeOfSrc,
|
||||
JsonSerializationContext context) {
|
||||
return image == null ? null : new JsonPrimitive(Arrays.toString(image));
|
||||
}
|
||||
}
|
||||
static class ByteArrayDeserializer implements JsonDeserializer<byte[]> {
|
||||
|
||||
public byte[] deserialize(JsonElement json, Type typeOfT,
|
||||
JsonDeserializationContext context)
|
||||
throws JsonParseException {
|
||||
Charset charset = StandardCharsets.UTF_8;
|
||||
|
||||
return json == null ? null : charset.encode(json.getAsString()).array();
|
||||
}
|
||||
}
|
||||
|
||||
static class DateDeserializer implements JsonDeserializer<Date> {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
package eu.csc.vehown.services.storage;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.UUID;
|
||||
|
||||
public class StorageFactory {
|
||||
|
||||
public static LocalStorageClient getLocalStorageInstance(Activity activity){
|
||||
return new LocalStorageClientImpl(activity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static File getRandomFileName(Context context){
|
||||
|
||||
String filename = UUID.randomUUID().toString();
|
||||
return new File(context.getFilesDir(), filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package eu.csc.vehown.ui.events;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import eu.csc.vehown.R;
|
||||
import eu.csc.vehown.ui.events.dummy.DummyContent;
|
||||
|
||||
/**
|
||||
* A fragment representing a list of Items.
|
||||
*/
|
||||
public class EventItemFragment extends Fragment {
|
||||
|
||||
// TODO: Customize parameter argument names
|
||||
private static final String ARG_COLUMN_COUNT = "column-count";
|
||||
// TODO: Customize parameters
|
||||
private int mColumnCount = 2;
|
||||
|
||||
/**
|
||||
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||
* fragment (e.g. upon screen orientation changes).
|
||||
*/
|
||||
public EventItemFragment() {
|
||||
}
|
||||
|
||||
// TODO: Customize parameter initialization
|
||||
@SuppressWarnings("unused")
|
||||
public static EventItemFragment newInstance(int columnCount) {
|
||||
EventItemFragment fragment = new EventItemFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_COLUMN_COUNT, columnCount);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (getArguments() != null) {
|
||||
mColumnCount = getArguments().getInt(ARG_COLUMN_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_event_item_list, container, false);
|
||||
|
||||
// Set the adapter
|
||||
if (view instanceof RecyclerView) {
|
||||
Context context = view.getContext();
|
||||
RecyclerView recyclerView = (RecyclerView) view;
|
||||
if (mColumnCount <= 1) {
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||
} else {
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
|
||||
}
|
||||
recyclerView.setAdapter(new MyEventItemRecyclerViewAdapter(DummyContent.ITEMS));
|
||||
}
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
package eu.csc.vehown.ui.events;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import eu.csc.vehown.R;
|
||||
import eu.csc.vehown.ui.events.dummy.DummyContent.DummyItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* {@link RecyclerView.Adapter} that can display a {@link DummyItem}.
|
||||
* TODO: Replace the implementation with code for your data type.
|
||||
*/
|
||||
public class MyEventItemRecyclerViewAdapter extends RecyclerView.Adapter<MyEventItemRecyclerViewAdapter.ViewHolder> {
|
||||
|
||||
private final List<DummyItem> mValues;
|
||||
|
||||
public MyEventItemRecyclerViewAdapter(List<DummyItem> items) {
|
||||
mValues = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.content_fragment_event_item_list, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(final ViewHolder holder, int position) {
|
||||
holder.mItem = mValues.get(position);
|
||||
holder.mIdView.setText(mValues.get(position).id);
|
||||
holder.mContentView.setText(mValues.get(position).content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mValues.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public final View mView;
|
||||
public final TextView mIdView;
|
||||
public final TextView mContentView;
|
||||
public DummyItem mItem;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
super(view);
|
||||
mView = view;
|
||||
mIdView = (TextView) view.findViewById(R.id.item_number);
|
||||
mContentView = (TextView) view.findViewById(R.id.content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " '" + mContentView.getText() + "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package eu.csc.vehown.ui.events.dummy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Helper class for providing sample content for user interfaces created by
|
||||
* Android template wizards.
|
||||
* <p>
|
||||
* TODO: Replace all uses of this class before publishing your app.
|
||||
*/
|
||||
public class DummyContent {
|
||||
|
||||
/**
|
||||
* An array of sample (dummy) items.
|
||||
*/
|
||||
public static final List<DummyItem> ITEMS = new ArrayList<DummyItem>();
|
||||
|
||||
/**
|
||||
* A map of sample (dummy) items, by ID.
|
||||
*/
|
||||
public static final Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();
|
||||
|
||||
private static final int COUNT = 25;
|
||||
|
||||
static {
|
||||
// Add some sample items.
|
||||
for (int i = 1; i <= COUNT; i++) {
|
||||
addItem(createDummyItem(i));
|
||||
}
|
||||
}
|
||||
|
||||
private static void addItem(DummyItem item) {
|
||||
ITEMS.add(item);
|
||||
ITEM_MAP.put(item.id, item);
|
||||
}
|
||||
|
||||
private static DummyItem createDummyItem(int position) {
|
||||
return new DummyItem(String.valueOf(position), "Item " + position, makeDetails(position));
|
||||
}
|
||||
|
||||
private static String makeDetails(int position) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Details about Item: ").append(position);
|
||||
for (int i = 0; i < position; i++) {
|
||||
builder.append("\nMore details information here.");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* A dummy item representing a piece of content.
|
||||
*/
|
||||
public static class DummyItem {
|
||||
public final String id;
|
||||
public final String content;
|
||||
public final String details;
|
||||
|
||||
public DummyItem(String id, String content, String details) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,8 +7,8 @@ import android.util.Patterns;
|
|||
|
||||
import eu.csc.vehown.data.LoginRepository;
|
||||
import eu.csc.vehown.data.Result;
|
||||
import eu.csc.vehown.data.model.LoggedInUser;
|
||||
import eu.csc.vehown.R;
|
||||
import eu.csc.vehown.data.model.LoggedInUser;
|
||||
|
||||
public class LoginViewModel extends ViewModel {
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import eu.csc.vehown.services.DataServiceIntent;
|
|||
import eu.csc.vehown.services.mqtt.MqttClient;
|
||||
import eu.csc.vehown.services.notifications.NotificationService;
|
||||
import eu.csc.vehown.ugp.WifiConnectedReceiver;
|
||||
|
||||
|
||||
import eu.csc.vehown.ui.svi.RegisterSVIActivity;
|
||||
import eu.csc.vehown.ui.settings.SettingsActivity;
|
||||
|
||||
|
|
@ -103,6 +105,7 @@ for(int i = 0; i<10; ++i){
|
|||
intent = new Intent(this, SettingsActivity.class);
|
||||
break;
|
||||
case R.id.nav_reported_events:
|
||||
|
||||
break;
|
||||
case R.id.nav_svivehicles:
|
||||
//intent = new Intent(this, SVIVehicleItemListActivity.class);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public class ReportEventFragment extends Fragment {
|
|||
treatmentRequest.addAffectedSystem(x.getId(), x.getName());
|
||||
});
|
||||
|
||||
Call<ApiEventUploadResponse> call = RetrofitApiClientFactory.getClient().uploadTreatmentRequest(treatmentRequest);
|
||||
Call<ApiEventUploadResponse> call = RetrofitApiClientFactory.getClient(getContext()).uploadTreatmentRequest(treatmentRequest);
|
||||
call.enqueue(new Callback<ApiEventUploadResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<ApiEventUploadResponse> call, Response<ApiEventUploadResponse> response) {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class AcceptTreatmentPlanFragment extends Fragment {
|
|||
request.addGrantedSystem(system);
|
||||
});
|
||||
|
||||
Call<GrantedLeaseResponse> call = RetrofitApiClientFactory.getClient().grantTreatmentAndLease(treatmentPlan.getTreatmentId());
|
||||
Call<GrantedLeaseResponse> call = RetrofitApiClientFactory.getClient(getContext()).grantTreatmentAndLease(treatmentPlan.getTreatmentId());
|
||||
Callback<GrantedLeaseResponse> callback = new Callback<GrantedLeaseResponse>() {
|
||||
@Override
|
||||
public void onResponse(@NotNull Call<GrantedLeaseResponse> call, Response<GrantedLeaseResponse> response) {
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class TreatmentPlanFragment extends Fragment {
|
|||
request.addGrantedSystem(system);
|
||||
});
|
||||
|
||||
Call<GrantedLeaseResponse> call = RetrofitApiClientFactory.getClient().grantTreatmentAndLease(treatmentPlan.getTreatmentId());
|
||||
Call<GrantedLeaseResponse> call = RetrofitApiClientFactory.getClient(getContext()).grantTreatmentAndLease(treatmentPlan.getTreatmentId());
|
||||
|
||||
Callback<GrantedLeaseResponse> callback = new Callback<GrantedLeaseResponse>() {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108"
|
||||
android:tint="#000000">
|
||||
<group android:scaleX="2.61"
|
||||
android:scaleY="2.61"
|
||||
android:translateX="22.68"
|
||||
android:translateY="22.68">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20.01,15.38c-1.23,0 -2.42,-0.2 -3.53,-0.56 -0.35,-0.12 -0.74,-0.03 -1.01,0.24l-1.57,1.97c-2.83,-1.35 -5.48,-3.9 -6.89,-6.83l1.95,-1.66c0.27,-0.28 0.35,-0.67 0.24,-1.02 -0.37,-1.11 -0.56,-2.3 -0.56,-3.53 0,-0.54 -0.45,-0.99 -0.99,-0.99H4.19C3.65,3 3,3.24 3,3.99 3,13.28 10.73,21 20.01,21c0.71,0 0.99,-0.63 0.99,-1.18v-3.45c0,-0.54 -0.45,-0.99 -0.99,-0.99z"/>
|
||||
</group>
|
||||
</vector>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:textAppearance="?attr/textAppearanceListItem"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:textAppearance="?attr/textAppearanceListItem"/>
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/eventitem_detail"
|
||||
style="?android:attr/textAppearanceLarge"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:textIsSelectable="true"
|
||||
tools:context=".ui.events.EventItemDetailFragment"/>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:textAppearance="?attr/textAppearanceListItem"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:textAppearance="?attr/textAppearanceListItem"/>
|
||||
</LinearLayout>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/list"
|
||||
android:name="eu.csc.vehown.ui.events.EventItemFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
app:layoutManager="LinearLayoutManager"
|
||||
tools:context=".ui.events.EventItemFragment"
|
||||
tools:listitem="@layout/content_fragment_event_item_list"/>
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/storedeventitem_detail"
|
||||
style="?android:attr/textAppearanceLarge"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:textIsSelectable="true"
|
||||
tools:context=".ui.events.StoredEventItemDetailFragment">
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/left_text_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="#AAA"
|
||||
android:text="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/guideline"
|
||||
app:layout_constraintEnd_toStartOf="@+id/right_text_view"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/right_text_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="#DDD"
|
||||
android:text="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/guideline"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/left_text_view"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<Space
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
||||
app:layout_constraintGuide_percent="0.3" />
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
|
||||
app:layout_constraintTop_toTopOf="@id/guideline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
app:cardCornerRadius="4dp"
|
||||
tools:layout_editor_absoluteY="504dp"
|
||||
tools:layout_editor_absoluteX="175dp">
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:padding="5dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_height="30dp"
|
||||
android:layout_width="30dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
|
||||
android:id="@+id/payment_label"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="$123"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/payment_desc"
|
||||
android:includeFontPadding="false"
|
||||
android:layout_below="@id/payment_label"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:text="Balance"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:textAppearance="?attr/textAppearanceListItem"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/text_margin"
|
||||
android:textAppearance="?attr/textAppearanceListItem"/>
|
||||
</LinearLayout>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
android:id="@+id/nav_reported_events"
|
||||
android:icon="@drawable/ic_baseline_archive_24"
|
||||
android:title="@string/menu_reported_events"
|
||||
android:onClick="menuItemOnClicked"
|
||||
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/nav_settings"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_phone_call_image_background"/>
|
||||
<foreground android:drawable="@drawable/ic_phone_call_image_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_phone_call_image_background"/>
|
||||
<foreground android:drawable="@drawable/ic_phone_call_image_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
|
@ -106,5 +106,9 @@
|
|||
<string name="profile_header">Profile</string>
|
||||
<string name="profile_locale_title">Locale</string>
|
||||
<string name="lease_transferred">Lease successfully transferred to SVI.</string>
|
||||
<string name="title_storedeventitem_list">StoredEventItems</string>
|
||||
<string name="title_storedeventitem_detail">StoredEventItem Detail</string>
|
||||
<string name="title_eventitem_list">EventItems</string>
|
||||
<string name="title_eventitem_detail">EventItem Detail</string>
|
||||
|
||||
</resources>
|
||||
|
|
@ -21,7 +21,7 @@ public class RetrofitApiClientTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.client = RetrofitApiClientFactory.getClient();
|
||||
this.client = RetrofitApiClientFactory.getClient(ExampleDataClient.JOHN_DOE_ACCESS_TOKEN);
|
||||
this.gson = JSONHelper.getGson();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package eu.csc.vehown.services.rest;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import eu.csc.vehown.services.TestData;
|
||||
import eu.csc.vehown.services.persistence.ExampleDataClient;
|
||||
import eu.csc.vehown.services.rest.data.*;
|
||||
import eu.csc.vehown.services.serialization.JSONHelper;
|
||||
import okhttp3.ResponseBody;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class RetrofitApiClientTest2 {
|
||||
private RetrofitApiClient client;
|
||||
private Gson gson;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.client = RetrofitApiClientFactory.getClient(RetrofitApiClientFactory.AUTHENTICATION_API_URL, ExampleDataClient.JOHN_DOE_ACCESS_TOKEN);
|
||||
this.gson = JSONHelper.getGson();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getVehicleTest() {
|
||||
|
||||
List<CustomerVehicleRequest> result = client.getCustomerVehicles().blockingGet();
|
||||
System.out.println(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package eu.csc.vehown.services.rest;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import eu.csc.vehown.services.TestData;
|
||||
import eu.csc.vehown.services.rest.data.*;
|
||||
import eu.csc.vehown.services.serialization.JSONHelper;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class RetrofitAuthenticationTest {
|
||||
private AuthenticationApiClient client;
|
||||
private Gson gson;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.client = RetrofitApiClientFactory.getAuthenticationClient();
|
||||
this.gson = JSONHelper.getGson();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLeaseTest() {
|
||||
|
||||
AuthenticateResponseDTO token = client.getToken("johndoe", "yannyann1").blockingGet();
|
||||
|
||||
System.out.println(token);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -8,4 +8,6 @@ Vehicle model year 2018
|
|||
Vehicle propulsion type Gasoline
|
||||
Vehicle type Passcar
|
||||
Vehicle class M1 - passenger vehicle
|
||||
Model year range 2011-
|
||||
Model year range 2011-
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,4 @@ public interface IEvent {
|
|||
String getEcuId();
|
||||
EventStatus getStatus();
|
||||
EventSeverity getSeverity();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package eu.csc.vehown.data.model;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class LoggedInUser implements Serializable, ICustomer {
|
||||
|
||||
private String userId;
|
||||
private String displayName;
|
||||
private String firstname;
|
||||
private String lastname;
|
||||
private String phone;
|
||||
private String token;
|
||||
private String login;
|
||||
|
||||
public LoggedInUser(String userId, String displayName) {
|
||||
this.userId = userId;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public static LoggedInUser getEmptyUser() {
|
||||
return new LoggedInUser();
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ dependencies {
|
|||
|
||||
implementation project(":services:core")
|
||||
|
||||
|
||||
implementation group: 'com.google.code.gson', name: 'gson', version: '2.7'
|
||||
compileOnly 'org.projectlombok:lombok:1.18.16'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.16'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package eu.csc.vehown.services.storage;
|
||||
package eu.csc.vehown.persist.sharedPreferences;
|
||||
|
||||
import eu.csc.vehown.data.model.LoggedInUser;
|
||||
|
||||
|
|
@ -12,7 +12,5 @@ public interface LocalStorageClient {
|
|||
|
||||
boolean getIsLoggedIn();
|
||||
|
||||
|
||||
|
||||
|
||||
String getApiToken();
|
||||
}
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
package eu.csc.vehown.services.storage;
|
||||
|
||||
package eu.csc.vehown.persist.sharedPreferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import eu.csc.vehown.R;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import eu.csc.vehown.data.model.LoggedInUser;
|
||||
import eu.csc.vehown.services.serialization.JSONHelper;
|
||||
import eu.csc.vehown.persist.localstorage.R;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class LocalStorageClientImpl implements LocalStorageClient{
|
||||
public class LocalStorageClientImpl implements LocalStorageClient {
|
||||
|
||||
private static final String TAG = LocalStorageClientImpl.class.getSimpleName();
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ public class LocalStorageClientImpl implements LocalStorageClient{
|
|||
private File eventsDir;
|
||||
|
||||
|
||||
protected LocalStorageClientImpl(Context context){
|
||||
protected LocalStorageClientImpl(Context context) {
|
||||
this.sharedPreferences = context.getSharedPreferences(
|
||||
context.getString(R.string.preference_file_key), Context.MODE_PRIVATE);
|
||||
|
||||
|
|
@ -50,24 +50,42 @@ public class LocalStorageClientImpl implements LocalStorageClient{
|
|||
return eventsDir;
|
||||
}
|
||||
|
||||
public boolean getIsLoggedIn(){
|
||||
public boolean getIsLoggedIn() {
|
||||
return sharedPreferences.getBoolean(KEY_IS_LOGGED_IN, false);
|
||||
}
|
||||
|
||||
private SharedPreferences.Editor getEditor(){
|
||||
@Override
|
||||
public String getApiToken() {
|
||||
if(getIsLoggedIn()){
|
||||
return getLoggedInUser().getToken();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private SharedPreferences.Editor getEditor() {
|
||||
return sharedPreferences.edit();
|
||||
}
|
||||
|
||||
public void setLoggedIn(boolean value){
|
||||
public void setLoggedIn(boolean value) {
|
||||
SharedPreferences.Editor editor = getEditor();
|
||||
|
||||
editor.putBoolean(KEY_IS_LOGGED_IN, value);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
private Gson getGson() {
|
||||
return new GsonBuilder().setPrettyPrinting().create();
|
||||
}
|
||||
|
||||
public void setLoggedInUser(LoggedInUser loggedInUser){
|
||||
String content = JSONHelper.getJsonString(loggedInUser);
|
||||
|
||||
private String getJsonString(Object item)
|
||||
{
|
||||
return getGson().toJson(item);
|
||||
}
|
||||
|
||||
|
||||
public void setLoggedInUser(LoggedInUser loggedInUser) {
|
||||
String content = getJsonString(loggedInUser);
|
||||
|
||||
SharedPreferences.Editor editor = getEditor();
|
||||
|
||||
|
|
@ -76,23 +94,28 @@ public class LocalStorageClientImpl implements LocalStorageClient{
|
|||
}
|
||||
|
||||
|
||||
public void doLogout(){
|
||||
public void doLogout() {
|
||||
this.setLoggedIn(false);
|
||||
this.setLoggedInUser(LoggedInUser.getEmptyUser());
|
||||
}
|
||||
|
||||
|
||||
public LoggedInUser getLoggedInUser(){
|
||||
public LoggedInUser getLoggedInUser() {
|
||||
|
||||
String loggedInUser= sharedPreferences.getString(KEY_LOGGEDINUSER, null);
|
||||
String loggedInUser = sharedPreferences.getString(KEY_LOGGEDINUSER, null);
|
||||
|
||||
if(loggedInUser == null){
|
||||
if (loggedInUser == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return JSONHelper.fromJson(LoggedInUser.class, loggedInUser);
|
||||
return fromJson(LoggedInUser.class, loggedInUser);
|
||||
|
||||
}
|
||||
|
||||
private <T> T fromJson(Class clazz, String json) {
|
||||
|
||||
return (T) getGson().fromJson(json,clazz);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package eu.csc.vehown.persist.sharedPreferences;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class SharedPreferencesFactory {
|
||||
|
||||
public static LocalStorageClient getInstance(Context context){
|
||||
return new LocalStorageClientImpl(context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1 +1,3 @@
|
|||
<resources></resources>
|
||||
<resources>
|
||||
<string name="preference_file_key">vehownprefs</string>
|
||||
</resources>
|
||||
|
|
@ -0,0 +1 @@
|
|||
/build
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
plugins {
|
||||
id 'com.android.library'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
|
||||
implementation files('libs/log4j-1.2.17.jar')
|
||||
implementation files('libs/asnrt-2020.07.jar')
|
||||
implementation files('libs/coregtdm-1.0.jar')
|
||||
}
|
||||
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
|
@ -0,0 +1,21 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package eu.csc.ugp;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("eu.csc.ugp.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="eu.csc.ugp">
|
||||
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package eu.csc.ugp;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
include ':services:ugp'
|
||||
include ':services:asn'
|
||||
include ':services:core'
|
||||
|
||||
|
|
|
|||