working on detail view
This commit is contained in:
parent
f1ec7fe26a
commit
9097ab4a5c
|
|
@ -18,7 +18,9 @@ import lombok.var;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class VehOwnAppClientDummy implements IVehOwnAppClient {
|
public class VehOwnAppClientDummy implements IVehOwnAppClient {
|
||||||
|
|
@ -81,6 +83,7 @@ public class VehOwnAppClientDummy implements IVehOwnAppClient {
|
||||||
customerVehicleA.setVin("12345");
|
customerVehicleA.setVin("12345");
|
||||||
customerVehicleA.setLicensePlate("HS-ABC");
|
customerVehicleA.setLicensePlate("HS-ABC");
|
||||||
customerVehicleA.setPropulsionType("gasoline");
|
customerVehicleA.setPropulsionType("gasoline");
|
||||||
|
customerVehicleA.setRegistrationDate(new Date());
|
||||||
|
|
||||||
customerVehicles = new ArrayList<>();
|
customerVehicles = new ArrayList<>();
|
||||||
customerVehicles.add(customerVehicleA);
|
customerVehicles.add(customerVehicleA);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import android.util.Log;
|
||||||
import eu.csc.vehown.R;
|
import eu.csc.vehown.R;
|
||||||
import eu.csc.vehown.ui.fragments.UserProfileFragment;
|
import eu.csc.vehown.ui.fragments.UserProfileFragment;
|
||||||
import eu.csc.vehown.ui.fragments.details.FragmentDetailDevice;
|
import eu.csc.vehown.ui.fragments.details.FragmentDetailDevice;
|
||||||
|
import eu.csc.vehown.ui.fragments.details.FragmentDetailVehicle;
|
||||||
import eu.csc.vehown.ui.registration.device.DeviceRegistrationFragment;
|
import eu.csc.vehown.ui.registration.device.DeviceRegistrationFragment;
|
||||||
import eu.csc.vehown.ui.registration.vehicle.VehicleRegistrationFragment;
|
import eu.csc.vehown.ui.registration.vehicle.VehicleRegistrationFragment;
|
||||||
|
|
||||||
|
|
@ -81,7 +82,7 @@ public class ActivityBaseDetailContent extends AbstractAppCompatActivity {
|
||||||
case ARG_ITEM_TYPE_VEHICLE:
|
case ARG_ITEM_TYPE_VEHICLE:
|
||||||
Log.d("DATA", id);
|
Log.d("DATA", id);
|
||||||
//switchFragment(R.id.flContent, FragmentDetailVehicle.newInstance(id));
|
//switchFragment(R.id.flContent, FragmentDetailVehicle.newInstance(id));
|
||||||
switchFragment(R.id.flContent, VehicleRegistrationFragment.editCurrentItem(id));
|
switchFragment(R.id.flContent, FragmentDetailVehicle.newInstance(id));
|
||||||
break;
|
break;
|
||||||
case ARG_ITEM_TYPE_DEVICE:
|
case ARG_ITEM_TYPE_DEVICE:
|
||||||
switchFragment(R.id.flContent, FragmentDetailDevice.newInstance(id));
|
switchFragment(R.id.flContent, FragmentDetailDevice.newInstance(id));
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,23 @@ import android.widget.EditText;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import eu.csc.vehown.Helper;
|
||||||
|
import eu.csc.vehown.data.model.Vehicle;
|
||||||
import eu.csc.vehown.databinding.FragmentDetailVehicleFragmentBinding;
|
import eu.csc.vehown.databinding.FragmentDetailVehicleFragmentBinding;
|
||||||
|
import eu.csc.vehown.ui.base.AbstractFragment;
|
||||||
|
import eu.csc.vehown.ui.registration.vehicle.VehicleRegistrationViewModel;
|
||||||
|
import eu.csc.vehown.ui.viewmodels.AppViewModelFactory;
|
||||||
|
|
||||||
import static eu.csc.vehown.ui.fragments.details.AbstractDetailFragment.ARG_ITEM_ID;
|
import static eu.csc.vehown.ui.fragments.details.AbstractDetailFragment.ARG_ITEM_ID;
|
||||||
|
|
||||||
public class FragmentDetailVehicle extends Fragment {
|
public class FragmentDetailVehicle extends AbstractFragment {
|
||||||
|
|
||||||
private FragmentDetailVehicleViewModel mViewModel;
|
private FragmentDetailVehicleViewModel mViewModel;
|
||||||
private FragmentDetailVehicleFragmentBinding binding;
|
private FragmentDetailVehicleFragmentBinding binding;
|
||||||
|
private static final String TAG = FragmentDetailVehicle.class.getSimpleName();
|
||||||
|
|
||||||
public static FragmentDetailVehicle newInstance(String vin) {
|
public static FragmentDetailVehicle newInstance(String vin) {
|
||||||
FragmentDetailVehicle f = new FragmentDetailVehicle();
|
FragmentDetailVehicle f = new FragmentDetailVehicle();
|
||||||
|
|
@ -34,21 +42,47 @@ public class FragmentDetailVehicle extends Fragment {
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
String vin = args.getString(ARG_ITEM_ID, "NO_VIN");
|
String vin = args.getString(ARG_ITEM_ID, "NO_VIN");
|
||||||
Log.d("FR", vin);
|
Log.d("FR", vin);
|
||||||
EditText tv = binding.editVIN;
|
|
||||||
binding.tvVIN.setText(vin);
|
|
||||||
binding.editVIN.setText(vin);
|
|
||||||
binding.editLicensePlate.setText(vin);
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
mViewModel = new ViewModelProvider(this).get(FragmentDetailVehicleViewModel.class);
|
mViewModel = new ViewModelProvider(this, new AppViewModelFactory(getContext())).get(FragmentDetailVehicleViewModel.class);
|
||||||
|
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
String vin = args.getString(ARG_ITEM_ID, "NO_VIN");
|
String vin = args.getString(ARG_ITEM_ID, "NO_VIN");
|
||||||
binding.editLicensePlate.setText(vin);
|
|
||||||
Log.d("FR", vin);
|
mViewModel.getMVehicle().observe(getViewLifecycleOwner(), new Observer<Vehicle>() {
|
||||||
|
@Override
|
||||||
|
public void onChanged(Vehicle vehicle) {
|
||||||
|
eu.csc.log.Log.d(TAG, vehicle.toString());
|
||||||
|
binding.tfVin.getEditText().setText(vehicle.getVin());
|
||||||
|
binding.tfModel.getEditText().setText(vehicle.getModel());
|
||||||
|
binding.tfBrand.getEditText().setText(vehicle.getBrand());
|
||||||
|
binding.tfLicensePlate.getEditText().setText(vehicle.getLicensePlate());
|
||||||
|
binding.tfRegistrationDate.getEditText().setText(Helper.getDateString(vehicle.getRegistrationDate()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
binding.tfRegistrationDate.getEditText().setEnabled(false);
|
||||||
|
binding.tfModel.getEditText().setEnabled(false);
|
||||||
|
binding.tfVin.getEditText().setEnabled(false);
|
||||||
|
binding.tfBrand.getEditText().setEnabled(false);
|
||||||
|
binding.tfPowertraint.getEditText().setEnabled(false);
|
||||||
|
binding.tfPropulsion.getEditText().setEnabled(false);
|
||||||
|
binding.tfLicensePlate.getEditText().setEnabled(false);
|
||||||
|
|
||||||
|
binding.ivVehicleImage.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mViewModel.searchVehicleByVin(vin);
|
||||||
// TODO: Use the ViewModel
|
// TODO: Use the ViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,27 @@
|
||||||
package eu.csc.vehown.ui.fragments.details;
|
package eu.csc.vehown.ui.fragments.details;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
import androidx.lifecycle.ViewModel;
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
public class FragmentDetailVehicleViewModel extends ViewModel {
|
import eu.csc.vehown.data.model.Vehicle;
|
||||||
|
import eu.csc.vehown.ui.viewmodels.AbstractBaseViewModel;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
public class FragmentDetailVehicleViewModel extends AbstractBaseViewModel {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final MutableLiveData<Vehicle> mVehicle;
|
||||||
|
|
||||||
|
public FragmentDetailVehicleViewModel(Context context) {
|
||||||
|
super(context);
|
||||||
|
mVehicle = new MutableLiveData<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void searchVehicleByVin(String vin){
|
||||||
|
mVehicle.setValue(localStorageClient.findVehicleByVin(vin).orElse(new Vehicle()));
|
||||||
|
}
|
||||||
// TODO: Implement the ViewModel
|
// TODO: Implement the ViewModel
|
||||||
}
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ package eu.csc.vehown.ui.logs;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.lifecycle.Observer;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
@ -11,9 +12,13 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import eu.csc.vehown.R;
|
import eu.csc.vehown.R;
|
||||||
|
import eu.csc.vehown.persist.localstorage.entity.EntityLog;
|
||||||
import eu.csc.vehown.ui.adapters.LogItemRecyclerViewAdapter;
|
import eu.csc.vehown.ui.adapters.LogItemRecyclerViewAdapter;
|
||||||
import eu.csc.vehown.ui.base.AbstractFragment;
|
import eu.csc.vehown.ui.base.AbstractFragment;
|
||||||
|
import lombok.var;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fragment representing a list of Items.
|
* A fragment representing a list of Items.
|
||||||
|
|
@ -67,6 +72,9 @@ public class LogsFragment extends AbstractFragment {
|
||||||
}
|
}
|
||||||
recyclerView.setAdapter(new LogItemRecyclerViewAdapter(getDatabase().log().getLogs()));
|
recyclerView.setAdapter(new LogItemRecyclerViewAdapter(getDatabase().log().getLogs()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -94,14 +94,17 @@ public class MainActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkRegistration() {
|
private void checkRegistration() {
|
||||||
if(SharedPreferencesFactory.isLoggedIn(getApplicationContext())){
|
|
||||||
Log.d(TAG, "NOT LOGGED IN");
|
|
||||||
}else{
|
|
||||||
|
|
||||||
|
|
||||||
|
if (SharedPreferencesFactory.isLoggedIn(getApplicationContext())) {
|
||||||
|
Log.d(TAG, "NOT LOGGED IN");
|
||||||
|
// startActivity(showLogin());
|
||||||
|
} else {
|
||||||
|
// showProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
//startActivity(ActivityBaseDetailContent.getProfileInstance(this));
|
//startActivity(ActivityBaseDetailContent.getProfileInstance(this));
|
||||||
showProfile();
|
showProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setup() {
|
private void setup() {
|
||||||
|
|
@ -127,7 +130,7 @@ showProfile();
|
||||||
|
|
||||||
public void menuItemOnClicked(MenuItem item) {
|
public void menuItemOnClicked(MenuItem item) {
|
||||||
|
|
||||||
Log.d("MainA", ""+ item.getItemId()+ item.getTitle());
|
Log.d("MainA", "" + item.getItemId() + item.getTitle());
|
||||||
Intent intent = null;
|
Intent intent = null;
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.nav_login:
|
case R.id.nav_login:
|
||||||
|
|
@ -197,6 +200,7 @@ showProfile();
|
||||||
fragmentTransaction.replace(R.id.content_frame, fragment);
|
fragmentTransaction.replace(R.id.content_frame, fragment);
|
||||||
fragmentTransaction.commit();
|
fragmentTransaction.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showProfile() {
|
private void showProfile() {
|
||||||
UserProfileFragment fragment = new UserProfileFragment();
|
UserProfileFragment fragment = new UserProfileFragment();
|
||||||
fragment.setArguments(new Bundle());
|
fragment.setArguments(new Bundle());
|
||||||
|
|
@ -208,9 +212,10 @@ showProfile();
|
||||||
private Intent showLogin() {
|
private Intent showLogin() {
|
||||||
return new Intent(this, LoginActivity.class);
|
return new Intent(this, LoginActivity.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showLogs() {
|
private void showLogs() {
|
||||||
LogsFragment fragment = new LogsFragment();
|
LogsFragment fragment = LogsFragment.newInstance(1);
|
||||||
fragment.setArguments(new Bundle());
|
//fragment.setArguments(new Bundle());
|
||||||
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
|
||||||
fragmentTransaction.replace(R.id.content_frame, fragment);
|
fragmentTransaction.replace(R.id.content_frame, fragment);
|
||||||
fragmentTransaction.commit();
|
fragmentTransaction.commit();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import eu.csc.vehown.R;
|
||||||
import eu.csc.vehown.databinding.FragmentItemListBinding;
|
import eu.csc.vehown.databinding.FragmentItemListBinding;
|
||||||
import eu.csc.vehown.databinding.ItemListContentBinding;
|
import eu.csc.vehown.databinding.ItemListContentBinding;
|
||||||
import eu.csc.vehown.persist.sharedPreferences.SharedPreferencesFactory;
|
import eu.csc.vehown.persist.sharedPreferences.SharedPreferencesFactory;
|
||||||
|
import eu.csc.vehown.ui.base.AbstractFragment;
|
||||||
import eu.csc.vehown.ui.md.placeholder.PlaceholderContent;
|
import eu.csc.vehown.ui.md.placeholder.PlaceholderContent;
|
||||||
import lombok.var;
|
import lombok.var;
|
||||||
|
|
||||||
|
|
@ -43,7 +44,7 @@ import static eu.csc.vehown.ui.md.ItemDetailHostActivity.TYPE_ID_VEHICLE;
|
||||||
* item details. On larger screens, the Navigation controller presents the list of items and
|
* item details. On larger screens, the Navigation controller presents the list of items and
|
||||||
* item details side-by-side using two vertical panes.
|
* item details side-by-side using two vertical panes.
|
||||||
*/
|
*/
|
||||||
public class ItemListFragment extends Fragment {
|
public class ItemListFragment extends AbstractFragment {
|
||||||
|
|
||||||
private static final String TAG = ItemListFragment.class.getSimpleName();
|
private static final String TAG = ItemListFragment.class.getSimpleName();
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,7 @@ public class CustomerContentDataSource {
|
||||||
item.setLicensePlate(remoteItem.getLicensePlate());
|
item.setLicensePlate(remoteItem.getLicensePlate());
|
||||||
item.setPropulsionType(remoteItem.getPropulsionType());
|
item.setPropulsionType(remoteItem.getPropulsionType());
|
||||||
item.setVin(remoteItem.getVin());
|
item.setVin(remoteItem.getVin());
|
||||||
|
item.setRegistrationDate(remoteItem.getRegistrationDate());
|
||||||
|
|
||||||
result.add(item);
|
result.add(item);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package eu.csc.vehown.ui.registration.vehicle;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.DatePickerDialog;
|
import android.app.DatePickerDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import eu.csc.vehown.persist.sharedPreferences.LocalStorageClient;
|
||||||
import eu.csc.vehown.persist.sharedPreferences.SharedPreferencesFactory;
|
import eu.csc.vehown.persist.sharedPreferences.SharedPreferencesFactory;
|
||||||
import eu.csc.vehown.ui.fragments.UserProfileViewModel;
|
import eu.csc.vehown.ui.fragments.UserProfileViewModel;
|
||||||
import eu.csc.vehown.ui.fragments.data.LoginRepository;
|
import eu.csc.vehown.ui.fragments.data.LoginRepository;
|
||||||
|
import eu.csc.vehown.ui.fragments.details.FragmentDetailVehicleViewModel;
|
||||||
import eu.csc.vehown.ui.fragments.ui.login.LoginViewModel;
|
import eu.csc.vehown.ui.fragments.ui.login.LoginViewModel;
|
||||||
import eu.csc.vehown.ui.registration.RegistrationViewModel;
|
import eu.csc.vehown.ui.registration.RegistrationViewModel;
|
||||||
import eu.csc.vehown.ui.registration.VehicleAndDevicesViewModel;
|
import eu.csc.vehown.ui.registration.VehicleAndDevicesViewModel;
|
||||||
|
|
@ -64,6 +65,9 @@ public class AppViewModelFactory implements ViewModelProvider.Factory {
|
||||||
new CustomerContentDataSource(),
|
new CustomerContentDataSource(),
|
||||||
localStorage), context);
|
localStorage), context);
|
||||||
}
|
}
|
||||||
|
else if(modelClass.isAssignableFrom(FragmentDetailVehicleViewModel.class)){
|
||||||
|
return (T) new FragmentDetailVehicleViewModel(context);
|
||||||
|
}
|
||||||
else if (modelClass.isAssignableFrom(DeviceRegistrationViewModel.class)) {
|
else if (modelClass.isAssignableFrom(DeviceRegistrationViewModel.class)) {
|
||||||
return (T) new DeviceRegistrationViewModel(localStorage, context, new CustomerContentDataSource());
|
return (T) new DeviceRegistrationViewModel(localStorage, context, new CustomerContentDataSource());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M18,13v7L4,20L4,6h5.02c0.05,-0.71 0.22,-1.38 0.48,-2L4,4c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2v-5l-2,-2zM16.5,18h-11l2.75,-3.53 1.96,2.36 2.75,-3.54zM19.3,8.89c0.44,-0.7 0.7,-1.51 0.7,-2.39C20,4.01 17.99,2 15.5,2S11,4.01 11,6.5s2.01,4.5 4.49,4.5c0.88,0 1.7,-0.26 2.39,-0.7L21,13.42 22.42,12 19.3,8.89zM15.5,9C14.12,9 13,7.88 13,6.5S14.12,4 15.5,4 18,5.12 18,6.5 16.88,9 15.5,9z"/>
|
||||||
|
</vector>
|
||||||
|
|
@ -11,168 +11,177 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="5dp"
|
android:layout_margin="5dp"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
android:id="@+id/tvBrand"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="@dimen/fontS"
|
|
||||||
android:text="@string/vehicle_brand"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
android:id="@+id/tfBrand"
|
||||||
android:id="@+id/edBrand"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/tvBrand"
|
android:hint="@string/vehicle_brand"
|
||||||
android:inputType="none"
|
>
|
||||||
/>
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/vehicle_brand"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvModel"
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
|
||||||
|
android:id="@+id/tfModel"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/edBrand"
|
android:layout_below="@+id/tfBrand"
|
||||||
android:layout_marginTop="10dp"
|
android:hint="@string/vehicle_model"
|
||||||
android:textSize="@dimen/fontS"
|
>
|
||||||
android:text="@string/vehicle_model"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Spinner
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/spModel"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="MODEL"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
|
||||||
|
android:id="@+id/tfPowertraint"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/tvModel"
|
android:layout_below="@+id/tfModel"
|
||||||
android:spinnerMode="dialog"
|
android:hint="@string/vehicle_model"
|
||||||
android:clickable="false"
|
>
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/tvPowertrain"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/powertrain"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
|
||||||
|
android:id="@+id/tfVariant"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/spModel"
|
android:layout_below="@+id/tfPowertraint"
|
||||||
android:layout_marginTop="10dp"
|
android:hint="@string/variant"
|
||||||
android:textSize="@dimen/fontS"
|
>
|
||||||
android:text="@string/powertrain"
|
|
||||||
android:labelFor="@id/editPowertrain"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/editPowertrain"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/variant"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
|
||||||
|
android:id="@+id/tfVin"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/tvPowertrain"
|
android:layout_below="@+id/tfVariant"
|
||||||
android:layout_marginTop="5dp"
|
android:hint="@string/variant"
|
||||||
android:inputType="text"
|
>
|
||||||
android:autofillHints="Powertrain"
|
|
||||||
android:ems="15"/>
|
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/tvVariant"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/variant"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
|
||||||
|
android:id="@+id/tfLicensePlate"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/editPowertrain"
|
android:layout_below="@+id/tfVin"
|
||||||
android:layout_marginTop="5dp"
|
android:hint="@string/license_plate"
|
||||||
android:textSize="@dimen/fontS"
|
>
|
||||||
android:text="@string/variant"
|
|
||||||
android:labelFor="@id/editVariant"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/editVariant"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/license_plate"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
|
||||||
|
android:id="@+id/tfPropulsion"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/tvVariant"
|
android:layout_below="@+id/tfLicensePlate"
|
||||||
android:inputType="text"
|
android:hint="@string/propulsion_type"
|
||||||
android:autofillHints="Variant"
|
>
|
||||||
android:ems="15"/>
|
|
||||||
|
|
||||||
<TextView
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/tvVIN"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/propulsion_type"
|
||||||
|
android:enabled="false"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
|
||||||
|
android:id="@+id/tfRegistrationDate"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/editVariant"
|
android:layout_below="@+id/tfPropulsion"
|
||||||
android:layout_marginTop="5dp"
|
android:hint="@string/registration_date"
|
||||||
android:textSize="@dimen/fontS"
|
>
|
||||||
android:text="@string/vin"
|
|
||||||
android:labelFor="@id/editVIN"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
android:id="@+id/editVIN"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/ivVehicleImage"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/tvVIN"
|
android:layout_below="@id/tfRegistrationDate"
|
||||||
android:inputType="text"
|
android:scaleType="fitCenter"
|
||||||
android:autofillHints="VIN"
|
android:src="@drawable/ic_baseline_image_search_24"
|
||||||
android:ems="15"/>
|
android:padding="50dp"/><!--set 30dp padding from all the sides-->
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvLicensePlate"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/editVIN"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:textSize="@dimen/fontS"
|
|
||||||
android:text="@string/license_plate"
|
|
||||||
android:labelFor="@id/editLicensePlate"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/editLicensePlate"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/tvLicensePlate"
|
|
||||||
android:inputType="text"
|
|
||||||
android:autofillHints="License Plate"
|
|
||||||
android:ems="15"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvPropulsion"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/editLicensePlate"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:textSize="@dimen/fontS"
|
|
||||||
android:text="@string/propulsion_type"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Spinner
|
|
||||||
android:id="@+id/spPropulsion"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/tvPropulsion"
|
|
||||||
android:spinnerMode="dialog"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tvRegistrationDate"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/spPropulsion"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:textSize="@dimen/fontS"
|
|
||||||
android:text="@string/registration_date"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<DatePicker
|
|
||||||
android:id="@+id/datePickerRegistration"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/tvRegistrationDate"
|
|
||||||
android:calendarViewShown="false"
|
|
||||||
android:datePickerMode="spinner"/>
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.Barrier
|
|
||||||
android:id="@+id/barrier"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="3dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_below="@id/datePickerRegistration"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:hint="@string/password"
|
android:hint="@string/password"
|
||||||
|
|
||||||
android:imeActionLabel="@string/action_sign_in_short"
|
android:imeActionLabel="@string/action_sign_in_short"
|
||||||
android:imeOptions="actionDone"
|
android:imeOptions="actionDone"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
|
|
|
||||||
|
|
@ -4,54 +4,53 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?android:windowBackground"
|
||||||
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1.0"
|
android:layout_marginStart="5dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_marginStart="5dp"
|
android:layout_weight="1.0">
|
||||||
>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvVehicles"
|
android:id="@+id/tvVehicles"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toStartOf="@id/btnAddVehicle"
|
android:layout_toStartOf="@id/btnAddVehicle"
|
||||||
android:text="@string/vehicles"
|
android:text="@string/vehicles"
|
||||||
android:textSize="@dimen/fontL"
|
android:textSize="@dimen/fontL"
|
||||||
android:textStyle="bold"/>
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/btnAddVehicle"
|
android:id="@+id/btnAddVehicle"
|
||||||
android:src="@drawable/ic_baseline_add_24"
|
android:layout_width="32dp"
|
||||||
android:layout_width="32dp"
|
android:layout_height="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:src="@drawable/ic_baseline_add_24"
|
||||||
app:tint="@android:color/black"
|
app:backgroundTint="@android:color/transparent"
|
||||||
app:backgroundTint="@android:color/transparent"
|
app:tint="@android:color/black" />
|
||||||
/>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/listVehicles"
|
android:id="@+id/listVehicles"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@+id/tvVehicles"
|
android:layout_below="@+id/tvVehicles"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
tools:listitem="@layout/content_vehicle_modern"
|
app:layoutManager="LinearLayoutManager"
|
||||||
app:layoutManager="LinearLayoutManager"/>
|
tools:listitem="@layout/content_vehicle_modern" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_marginStart="5dp"
|
android:layout_marginStart="5dp"
|
||||||
>
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_weight="1.0">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvDevices"
|
android:id="@+id/tvDevices"
|
||||||
|
|
@ -63,15 +62,14 @@
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/btnAddDevice"
|
android:id="@+id/btnAddDevice"
|
||||||
android:src="@drawable/ic_baseline_add_24"
|
android:layout_width="32dp"
|
||||||
android:layout_width="32dp"
|
android:layout_height="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginEnd="10dp"
|
||||||
android:layout_alignParentEnd="true"
|
android:src="@drawable/ic_baseline_add_24"
|
||||||
app:tint="@android:color/black"
|
app:backgroundTint="@android:color/transparent"
|
||||||
app:backgroundTint="@android:color/transparent"
|
app:tint="@android:color/black" />
|
||||||
/>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/listDevices"
|
android:id="@+id/listDevices"
|
||||||
|
|
@ -79,8 +77,8 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@+id/tvDevices"
|
android:layout_below="@+id/tvDevices"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
tools:listitem="@layout/content_device_modern"
|
app:layoutManager="LinearLayoutManager"
|
||||||
app:layoutManager="LinearLayoutManager"/>
|
tools:listitem="@layout/content_device_modern" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,9 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="?android:windowBackground"
|
||||||
|
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:scrollbarFadeDuration="0"
|
android:scrollbarFadeDuration="0"
|
||||||
android:scrollbarSize="5dip">
|
android:scrollbarSize="5dip">
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -13,7 +13,8 @@ import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
public class Helper {
|
public class Helper {
|
||||||
private static DateFormat dateFormat = new SimpleDateFormat("yyyy/dd/MM HH:mm",Locale.ENGLISH);
|
private static DateFormat dateTimeFormat = new SimpleDateFormat("yyyy/dd/MM HH:mm",Locale.ENGLISH);
|
||||||
|
private static DateFormat dateFormat = new SimpleDateFormat("yyyy/dd/MM",Locale.ENGLISH);
|
||||||
private static final DecimalFormat df = new DecimalFormat("@@");
|
private static final DecimalFormat df = new DecimalFormat("@@");
|
||||||
|
|
||||||
public static final ExecutorService executorService = Executors.newFixedThreadPool(4);
|
public static final ExecutorService executorService = Executors.newFixedThreadPool(4);
|
||||||
|
|
@ -53,4 +54,10 @@ public class Helper {
|
||||||
public static String getDateString(Long time) {
|
public static String getDateString(Long time) {
|
||||||
return dateFormat.format(new Date(time));
|
return dateFormat.format(new Date(time));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getDateString(Date date) {
|
||||||
|
if(date== null)
|
||||||
|
return "";
|
||||||
|
return getDateString(date.getTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ public interface EntityLogDao extends BaseDao<EntityLog> {
|
||||||
" LIMIT 2000")
|
" LIMIT 2000")
|
||||||
LiveData<List<EntityLog>> liveLogs(long from, Integer type);
|
LiveData<List<EntityLog>> liveLogs(long from, Integer type);
|
||||||
|
|
||||||
|
@Query("SELECT * FROM log")
|
||||||
|
LiveData<List<EntityLog>> liveLogs();
|
||||||
|
|
||||||
@Query("SELECT * FROM log" +
|
@Query("SELECT * FROM log" +
|
||||||
" WHERE time > :from" +
|
" WHERE time > :from" +
|
||||||
" AND (:type IS NULL OR type = :type)" +
|
" AND (:type IS NULL OR type = :type)" +
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue