diff --git a/apk/MyVehicles.apk b/apk/MyVehicles.apk index 0f738a5..a13f33a 100644 Binary files a/apk/MyVehicles.apk and b/apk/MyVehicles.apk differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d604d9b..2ee0c18 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,10 +9,14 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> + + android:theme="@style/AppTheme.NoActionBar" /> adapterView, View view, int i, long l) { + Vehicle selectedVehicle = (Vehicle) adapterView.getItemAtPosition(i); + Intent intent = new Intent(Cars.this.getActivity(), VehicleDetails.class); + intent.putExtra("registration",selectedVehicle.getRegistration()); + intent.putExtra("type",1); + startActivity(intent); + } + }); + return view; } diff --git a/app/src/main/java/com/carlostojal/myvehicles/Motorcycles.java b/app/src/main/java/com/carlostojal/myvehicles/Motorcycles.java index fe58318..e173b22 100644 --- a/app/src/main/java/com/carlostojal/myvehicles/Motorcycles.java +++ b/app/src/main/java/com/carlostojal/myvehicles/Motorcycles.java @@ -15,6 +15,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; @@ -49,6 +50,17 @@ public void onClick(View view) { } }); + motorcycleList.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + Vehicle selectedVehicle = (Vehicle) adapterView.getItemAtPosition(i); + Intent intent = new Intent(Motorcycles.this.getActivity(), VehicleDetails.class); + intent.putExtra("registration",selectedVehicle.getRegistration()); + intent.putExtra("type",2); + startActivity(intent); + } + }); + return view; } diff --git a/app/src/main/java/com/carlostojal/myvehicles/Other.java b/app/src/main/java/com/carlostojal/myvehicles/Other.java index 14af072..67343ed 100644 --- a/app/src/main/java/com/carlostojal/myvehicles/Other.java +++ b/app/src/main/java/com/carlostojal/myvehicles/Other.java @@ -17,6 +17,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; @@ -51,6 +52,17 @@ public void onClick(View view) { } }); + otherList.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + Vehicle selectedVehicle = (Vehicle) adapterView.getItemAtPosition(i); + Intent intent = new Intent(Other.this.getActivity(), VehicleDetails.class); + intent.putExtra("registration",selectedVehicle.getRegistration()); + intent.putExtra("type",3); + startActivity(intent); + } + }); + return view; } diff --git a/app/src/main/java/com/carlostojal/myvehicles/VehicleDetails.java b/app/src/main/java/com/carlostojal/myvehicles/VehicleDetails.java new file mode 100644 index 0000000..db1a3b2 --- /dev/null +++ b/app/src/main/java/com/carlostojal/myvehicles/VehicleDetails.java @@ -0,0 +1,68 @@ +package com.carlostojal.myvehicles; + +// +// Copyright © Carlos Tojal (carlostojal) +// VehicleDetails.java +// MyVehicles +// github.com/carlostojal/MyVehicles +// + +import android.os.Bundle; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.google.android.material.snackbar.Snackbar; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import android.view.View; +import android.widget.TextView; + +import java.util.ArrayList; + +public class VehicleDetails extends AppCompatActivity { + + ArrayList vehicles; + Vehicle vehicle; + VehicleManager vehicleManager; + + TextView brand; + TextView model; + TextView displacement; + TextView year; + TextView registration; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_vehicle_details); + + brand = (TextView) findViewById(R.id.brand_value_details); + model = (TextView) findViewById(R.id.model_value_details); + displacement = (TextView) findViewById(R.id.displacement_value_details); + year = (TextView) findViewById(R.id.year_value_details); + registration = (TextView) findViewById(R.id.registration_value_details); + + vehicleManager = new VehicleManager(); + + Bundle extras = getIntent().getExtras(); + String searchedRegistration = extras.getString("registration"); + int searchedType = extras.getInt("type"); + vehicles = vehicleManager.loadVehicles(getApplicationContext(),searchedType); + for(int i=0;i + + + + + + + + + + + + + + + + + + + + + + +