diff --git a/app/src/main/java/eu/csc/vehown/ui/base/ActivityBaseDetailContent.java b/app/src/main/java/eu/csc/vehown/ui/base/ActivityBaseDetailContent.java index 7aabb07..4ee3081 100644 --- a/app/src/main/java/eu/csc/vehown/ui/base/ActivityBaseDetailContent.java +++ b/app/src/main/java/eu/csc/vehown/ui/base/ActivityBaseDetailContent.java @@ -68,8 +68,6 @@ public class ActivityBaseDetailContent extends AbstractAppCompatActivity { Intent intent = new Intent(activity, ActivityBaseDetailContent.class); intent.putExtra(ARG_ITEM_TYPE, ARG_ITEM_TYPE_VEHICLE_AND_DEVICE); return intent; - - } @Override diff --git a/app/src/main/java/eu/csc/vehown/ui/fragments/UserProfileFragment.java b/app/src/main/java/eu/csc/vehown/ui/fragments/UserProfileFragment.java index fccfa34..156e827 100644 --- a/app/src/main/java/eu/csc/vehown/ui/fragments/UserProfileFragment.java +++ b/app/src/main/java/eu/csc/vehown/ui/fragments/UserProfileFragment.java @@ -68,7 +68,7 @@ public class UserProfileFragment getView().setEnabled(aBoolean); } - mViewModel.refreshContent(); + //mViewModel.refreshLocalContent(); } }); @@ -115,7 +115,7 @@ public class UserProfileFragment mViewModel.storeRemoteVehicles(vehicles); - mViewModel.refreshContent(); + mViewModel.refreshLocalContent(); } }, new DialogInterface.OnClickListener() { @Override @@ -139,7 +139,7 @@ public class UserProfileFragment //region Devices - mViewModel.getMStoredDevices().observe(getViewLifecycleOwner(), new Observer>() { + mViewModel.getMDevices().observe(getViewLifecycleOwner(), new Observer>() { @Override public void onChanged(List items) { binding.tvDeviceCount.setText(String.format(Helper.getString(getContext(), R.string.text_devices_count), items.size())); @@ -204,7 +204,7 @@ public class UserProfileFragment //endregion - mViewModel.refreshContent(); + mViewModel.refreshLocalContent(); // TODO: Use the ViewModel } diff --git a/app/src/main/java/eu/csc/vehown/ui/fragments/UserProfileViewModel.java b/app/src/main/java/eu/csc/vehown/ui/fragments/UserProfileViewModel.java index fd12da8..c8f5f1f 100644 --- a/app/src/main/java/eu/csc/vehown/ui/fragments/UserProfileViewModel.java +++ b/app/src/main/java/eu/csc/vehown/ui/fragments/UserProfileViewModel.java @@ -27,6 +27,8 @@ public class UserProfileViewModel extends AbstractBaseViewModel { @Getter private final MutableLiveData> mVehicles; @Getter + private final MutableLiveData> mDevices; + @Getter private final MutableLiveData> mStoredDevices; @@ -40,6 +42,7 @@ public class UserProfileViewModel extends AbstractBaseViewModel { mVehicles = new MutableLiveData<>(); mRefreshVehicles = new MutableLiveData<>(); mStoredDevices = new MutableLiveData<>(); + mDevices = new MutableLiveData<>(); } public void refreshVehicles() { @@ -69,9 +72,9 @@ public class UserProfileViewModel extends AbstractBaseViewModel { mutableLiveDataSuccess.postValue(true); } - public void refreshContent() { - refreshVehicles(); - refreshDevices(); + public void refreshLocalContent() { + mVehicles.setValue(localStorageClient.loadVehicles()); + mDevices.setValue(localStorageClient.loadDevices()); } public void storeRemoteVehicles(List items) { @@ -84,7 +87,7 @@ public class UserProfileViewModel extends AbstractBaseViewModel { } public void refreshDevices() { - mStoredDevices.postValue(repository.getStoredUserDevices()); + mDevices.postValue(repository.getStoredUserDevices()); } public void storeRemoteCustomerDevices(List items) { diff --git a/app/src/main/java/eu/csc/vehown/ui/logs/LogsFragment.java b/app/src/main/java/eu/csc/vehown/ui/logs/LogsFragment.java index 194e86e..d75b97f 100644 --- a/app/src/main/java/eu/csc/vehown/ui/logs/LogsFragment.java +++ b/app/src/main/java/eu/csc/vehown/ui/logs/LogsFragment.java @@ -75,8 +75,6 @@ public class LogsFragment recyclerView.setAdapter(new LogItemRecyclerViewAdapter(getDatabase().log().getLogs())); } - - return view; } } \ No newline at end of file diff --git a/app/src/main/java/eu/csc/vehown/ui/registration/data/CustomerContentRepository.java b/app/src/main/java/eu/csc/vehown/ui/registration/data/CustomerContentRepository.java index 414cb6a..a8bd9c4 100644 --- a/app/src/main/java/eu/csc/vehown/ui/registration/data/CustomerContentRepository.java +++ b/app/src/main/java/eu/csc/vehown/ui/registration/data/CustomerContentRepository.java @@ -138,7 +138,6 @@ public class CustomerContentRepository { public Result> fetchCustomerVehiclesRemote() { - return dataSource .fetchCustomerVehicles(localStorageClient.getLoggedInUser()); } diff --git a/app/src/main/res/layout/fragment_logs_list.xml b/app/src/main/res/layout/fragment_logs_list.xml index 1ad1af0..423ec29 100644 --- a/app/src/main/res/layout/fragment_logs_list.xml +++ b/app/src/main/res/layout/fragment_logs_list.xml @@ -1,5 +1,6 @@ - - - > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:layout_margin="8dp"> + android:orientation="vertical"> - - + + + + + + + + + + + + + + + + android:layout_margin="8dp" - + android:orientation="horizontal"> - + + + + + + + + - + + + + + + - android:orientation="horizontal"> + + - + + + + + + + + + + + + + android:layout_margin="8dp" - + android:orientation="horizontal"> - + + + + + + + + - - - - - - + + + \ No newline at end of file diff --git a/services/localstorage/src/main/java/eu/csc/vehown/persist/sharedPreferences/LocalStorageClientImpl.java b/services/localstorage/src/main/java/eu/csc/vehown/persist/sharedPreferences/LocalStorageClientImpl.java index c00da40..020ed9c 100644 --- a/services/localstorage/src/main/java/eu/csc/vehown/persist/sharedPreferences/LocalStorageClientImpl.java +++ b/services/localstorage/src/main/java/eu/csc/vehown/persist/sharedPreferences/LocalStorageClientImpl.java @@ -33,6 +33,7 @@ public class LocalStorageClientImpl implements LocalStorageClient { private static final String PREF_CUSTOMER = "customer"; private static final String PREF_VEHICLES = "vehicles"; private static final String PREF_DEVICES = "devices"; + private final ILogger logger; // private static final String KEY_LOGGEDINUSERNAME = "prefs_loggedin_username"; @@ -348,11 +349,11 @@ public class LocalStorageClientImpl implements LocalStorageClient { } private void d(String msg) { + if (logger != null) logger.d(TAG, msg); else { Log.d(TAG, msg); - } }