-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added insurances, inspections, taxes and revisions history to vehicle…
… details.
- Loading branch information
1 parent
5bdb521
commit 6bff5bd
Showing
9 changed files
with
298 additions
and
8 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/src/main/java/com/carlostojal/myvehicles/AddInsuranceInspectionTaxRevision.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.carlostojal.myvehicles; | ||
|
||
// | ||
// Copyright © Carlos Tojal (carlostojal) | ||
// AddInsuranceInspectionTaxRevision.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; | ||
|
||
public class AddInsuranceInspectionTaxRevision extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_add_insurance_inspection_tax_revision); | ||
} | ||
|
||
} |
152 changes: 152 additions & 0 deletions
152
app/src/main/java/com/carlostojal/myvehicles/InsurancesInspectionsTaxesRevisions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
package com.carlostojal.myvehicles; | ||
|
||
// | ||
// Copyright © Carlos Tojal (carlostojal) | ||
// InsurancesInspectionsTaxesRevisions.java | ||
// MyVehicles | ||
// github.com/carlostojal/MyVehicles | ||
// | ||
|
||
import android.content.Intent; | ||
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.Button; | ||
import android.widget.TextView; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class InsurancesInspectionsTaxesRevisions extends AppCompatActivity { | ||
|
||
ArrayList<Vehicle> vehicles; | ||
Vehicle vehicle; | ||
|
||
TextView label; | ||
TextView history; | ||
Button add; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_insurances_inspections_taxes_revisions); | ||
|
||
label = findViewById(R.id.label); | ||
history = findViewById(R.id.history); | ||
add = findViewById(R.id.addInsuranceInspectionTaxRevision); | ||
|
||
StringBuilder insurancesInspectionsTaxesRevisions = new StringBuilder(); | ||
VehicleManager vehicleManager = new VehicleManager(); | ||
Bundle extras = getIntent().getExtras(); | ||
String registration = extras.getString("registration"); //vehicle registration | ||
int vehicleType = extras.getInt("vehicleType"); | ||
int type = extras.getInt("type"); | ||
vehicles = vehicleManager.loadVehicles(getApplicationContext(),vehicleType); | ||
for(int i=0;i<vehicles.size();i++) { | ||
if(vehicles.get(i).getRegistration().equals(registration)) | ||
vehicle = vehicles.get(i); | ||
} | ||
if(type==1) { //insurance | ||
setTitle("Insurances"); | ||
label.setText("Vehicle insurance history:"); | ||
add.setText("Register insurance"); | ||
|
||
for(int i=0;i<vehicle.getInsurance().size();i++) { | ||
if(vehicle.getInsurance().get(i).getDate().getDay()!=0) { | ||
insurancesInspectionsTaxesRevisions.append("• "); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getInsurance().get(i).getDate().getDay())); | ||
insurancesInspectionsTaxesRevisions.append("/"); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getInsurance().get(i).getDate().getMonth())); | ||
insurancesInspectionsTaxesRevisions.append("/"); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getInsurance().get(i).getDate().getYear())); | ||
insurancesInspectionsTaxesRevisions.append(" - "); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getInsurance().get(i).getValue())); | ||
} | ||
} | ||
if(vehicle.getInsurance().size()==1&&vehicle.getInsurance().get(0).getDate().getDay()==0) { | ||
insurancesInspectionsTaxesRevisions.append("No information."); | ||
} | ||
|
||
history.setText(insurancesInspectionsTaxesRevisions); | ||
} | ||
else if(type==2) { //inspection | ||
setTitle("Inspections"); | ||
label.setText("Vehicle inspection history:"); | ||
add.setText("Register inspection"); | ||
|
||
for(int i=0;i<vehicle.getInsurance().size();i++) { | ||
if(vehicle.getInsurance().get(i).getDate().getDay()!=0) { | ||
insurancesInspectionsTaxesRevisions.append("• "); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getInspection().get(i).getDate().getDay())); | ||
insurancesInspectionsTaxesRevisions.append("/"); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getInspection().get(i).getDate().getMonth())); | ||
insurancesInspectionsTaxesRevisions.append("/"); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getInspection().get(i).getDate().getYear())); | ||
insurancesInspectionsTaxesRevisions.append(" - "); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getInspection().get(i).getValue())); | ||
} | ||
} | ||
if(vehicle.getInspection().size()==1&&vehicle.getInspection().get(0).getDate().getDay()==0) { | ||
insurancesInspectionsTaxesRevisions.append("No information."); | ||
} | ||
|
||
history.setText(insurancesInspectionsTaxesRevisions); | ||
} | ||
else if(type==3) { //tax | ||
setTitle("Taxes"); | ||
label.setText("Vehicle tax history:"); | ||
add.setText("Register tax"); | ||
|
||
for(int i=0;i<vehicle.getInsurance().size();i++) { | ||
if(vehicle.getInsurance().get(i).getDate().getDay()!=0) { | ||
insurancesInspectionsTaxesRevisions.append("• "); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getTax().get(i).getDate().getDay())); | ||
insurancesInspectionsTaxesRevisions.append("/"); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getTax().get(i).getDate().getMonth())); | ||
insurancesInspectionsTaxesRevisions.append("/"); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getTax().get(i).getDate().getYear())); | ||
insurancesInspectionsTaxesRevisions.append(" - "); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getTax().get(i).getValue())); | ||
} | ||
} | ||
if(vehicle.getTax().size()==1&&vehicle.getTax().get(0).getDate().getDay()==0) { | ||
insurancesInspectionsTaxesRevisions.append("No information."); | ||
} | ||
|
||
history.setText(insurancesInspectionsTaxesRevisions); | ||
} | ||
else if(type==4) { //revision | ||
setTitle("Revisions"); | ||
label.setText("Vehicle revision history:"); | ||
add.setText("Register revision"); | ||
|
||
for(int i=0;i<vehicle.getInsurance().size();i++) { | ||
if(vehicle.getInsurance().get(i).getDate().getDay()!=0) { | ||
insurancesInspectionsTaxesRevisions.append("• "); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getRevision().get(i).getDate().getDay())); | ||
insurancesInspectionsTaxesRevisions.append("/"); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getRevision().get(i).getDate().getMonth())); | ||
insurancesInspectionsTaxesRevisions.append("/"); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getRevision().get(i).getDate().getYear())); | ||
insurancesInspectionsTaxesRevisions.append(" - "); | ||
insurancesInspectionsTaxesRevisions.append(String.valueOf(vehicle.getRevision().get(i).getValue())); | ||
} | ||
} | ||
if(vehicle.getRevision().size()==1&&vehicle.getRevision().get(0).getDate().getDay()==0) { | ||
insurancesInspectionsTaxesRevisions.append("No information."); | ||
} | ||
|
||
history.setText(insurancesInspectionsTaxesRevisions); | ||
} | ||
} | ||
|
||
public void onRegister(View view) { | ||
Intent intent = new Intent(InsurancesInspectionsTaxesRevisions.this,AddInsuranceInspectionTaxRevision.class); | ||
startActivity(intent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
app/src/main/res/layout/activity_add_insurance_inspection_tax_revision.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout 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/coordinatorLayout4" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".AddInsuranceInspectionTaxRevision"> | ||
|
||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
47 changes: 47 additions & 0 deletions
47
app/src/main/res/layout/activity_insurances_inspections_taxes_revisions.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout 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/coordinatorLayout3" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".InsurancesInspectionsTaxesRevisions" > | ||
|
||
<TextView | ||
android:id="@+id/label" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="16dp" | ||
android:layout_marginTop="16dp" | ||
android:text="TextView" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Medium" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<TextView | ||
android:id="@+id/history" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="16dp" | ||
android:layout_marginEnd="16dp" | ||
android:text="TextView" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/label" /> | ||
|
||
<Button | ||
android:id="@+id/addInsuranceInspectionTaxRevision" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="16dp" | ||
android:layout_marginTop="24dp" | ||
android:layout_marginEnd="16dp" | ||
android:background="@color/colorPrimary" | ||
android:onClick="onRegister" | ||
android:text="Button" | ||
android:textColor="@color/colorAccent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/history" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters