Commit 0a4a6166 authored by christopher.foster's avatar christopher.foster

All review pages work now and the app is fully functional

parent d013ac11
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".audiReview"></activity> <activity android:name=".reviewToy"></activity>
<activity android:name=".reviewBenz" />
<activity android:name=".reviewHon" />
<activity android:name=".reviewJag" />
<activity android:name=".audiReview" />
<activity android:name=".returnCar" /> <activity android:name=".returnCar" />
<activity android:name=".orderDetails" /> <activity android:name=".orderDetails" />
<activity android:name=".carPurchase" /> <activity android:name=".carPurchase" />
......
...@@ -28,4 +28,24 @@ public class Carlist extends AppCompatActivity { ...@@ -28,4 +28,24 @@ public class Carlist extends AppCompatActivity {
Intent I = new Intent(this, audiReview.class); Intent I = new Intent(this, audiReview.class);
startActivity(I); startActivity(I);
} }
public void reviewBenz(View v)
{
Intent I = new Intent(this, reviewBenz.class);
startActivity(I);
}
public void reviewHon(View v)
{
Intent I = new Intent(this, reviewHon.class);
startActivity(I);
}
public void reviewToy(View v)
{
Intent I = new Intent(this, reviewToy.class);
startActivity(I);
}
public void reviewJag(View v)
{
Intent I = new Intent(this, reviewJag.class);
startActivity(I);
}
} }
package com.example.assignment;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
public class reviewBenz extends AppCompatActivity {
File review;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_review_benz);
review = new File(getApplicationContext().getFilesDir(), "benzReview.txt");
}
public void addReview(View v)
{
String leaveReview = ((EditText)findViewById(R.id.benzReview)).getText().toString();
try
{
FileWriter stream = new FileWriter(review, true);
stream.append("- " + leaveReview + "\n");
stream.close();
Toast.makeText(getApplicationContext(), "You have successfully left a review", Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
public void displayReview(View v)
{
try {
Scanner read = new Scanner(review);
String s = "";
while (read.hasNextLine()) {
s = s + "\n" + read.nextLine();
}
((TextView) (findViewById(R.id.display4))).setText(s);
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
}
package com.example.assignment;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
public class reviewHon extends AppCompatActivity {
File review;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_review_hon);
review = new File(getApplicationContext().getFilesDir(), "honReview.txt");
}
public void addReview(View v)
{
String leaveReview = ((EditText)findViewById(R.id.honReview)).getText().toString();
try
{
FileWriter stream = new FileWriter(review, true);
stream.append("- " + leaveReview + "\n");
stream.close();
Toast.makeText(getApplicationContext(), "You have successfully left a review", Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
public void displayReview(View v)
{
try {
Scanner read = new Scanner(review);
String s = "";
while (read.hasNextLine()) {
s = s + "\n" + read.nextLine();
}
((TextView) (findViewById(R.id.display3))).setText(s);
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
}
package com.example.assignment;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
public class reviewJag extends AppCompatActivity {
File review;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_review_jag);
review = new File(getApplicationContext().getFilesDir(), "jagReview.txt");
}
public void addReview(View v)
{
String leaveReview = ((EditText)findViewById(R.id.jagReview)).getText().toString();
try
{
FileWriter stream = new FileWriter(review, true);
stream.append("- " + leaveReview + "\n");
stream.close();
Toast.makeText(getApplicationContext(), "You have successfully left a review", Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
public void displayReview(View v)
{
try {
Scanner read = new Scanner(review);
String s = "";
while (read.hasNextLine()) {
s = s + "\n" + read.nextLine();
}
((TextView) (findViewById(R.id.display2))).setText(s);
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
}
package com.example.assignment;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;
public class reviewToy extends AppCompatActivity {
File review;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_review_toy);
review = new File(getApplicationContext().getFilesDir(), "toyReview.txt");
}
public void addReview(View v)
{
String leaveReview = ((EditText)findViewById(R.id.toyReview)).getText().toString();
try
{
FileWriter stream = new FileWriter(review, true);
stream.append("- " + leaveReview + "\n");
stream.close();
Toast.makeText(getApplicationContext(), "You have successfully left a review", Toast.LENGTH_LONG).show();
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
public void displayReview(View v)
{
try {
Scanner read = new Scanner(review);
String s = "";
while (read.hasNextLine()) {
s = s + "\n" + read.nextLine();
}
((TextView) (findViewById(R.id.display5))).setText(s);
}
catch (Exception e)
{
Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();
}
}
}
...@@ -245,6 +245,7 @@ air conditioning, ABS brakes, 2 people " ...@@ -245,6 +245,7 @@ air conditioning, ABS brakes, 2 people "
android:layout_marginStart="2dp" android:layout_marginStart="2dp"
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:layout_marginTop="7dp" android:layout_marginTop="7dp"
android:onClick="reviewBenz"
android:text="Review" android:text="Review"
android:textSize="11sp" android:textSize="11sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -257,6 +258,7 @@ air conditioning, ABS brakes, 2 people " ...@@ -257,6 +258,7 @@ air conditioning, ABS brakes, 2 people "
android:layout_marginStart="2dp" android:layout_marginStart="2dp"
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:layout_marginTop="7dp" android:layout_marginTop="7dp"
android:onClick="reviewToy"
android:text="Review" android:text="Review"
android:textSize="11sp" android:textSize="11sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -269,6 +271,7 @@ air conditioning, ABS brakes, 2 people " ...@@ -269,6 +271,7 @@ air conditioning, ABS brakes, 2 people "
android:layout_marginStart="2dp" android:layout_marginStart="2dp"
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:layout_marginTop="7dp" android:layout_marginTop="7dp"
android:onClick="reviewHon"
android:text="Review" android:text="Review"
android:textSize="11sp" android:textSize="11sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
...@@ -281,6 +284,7 @@ air conditioning, ABS brakes, 2 people " ...@@ -281,6 +284,7 @@ air conditioning, ABS brakes, 2 people "
android:layout_marginStart="2dp" android:layout_marginStart="2dp"
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:layout_marginTop="7dp" android:layout_marginTop="7dp"
android:onClick="reviewJag"
android:text="Review" android:text="Review"
android:textSize="11sp" android:textSize="11sp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
......
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".reviewBenz">
<Button
android:id="@+id/button8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp"
android:onClick="addReview"
android:text="Add Review"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button9"
android:layout_width="382dp"
android:layout_height="55dp"
android:layout_marginTop="72dp"
android:layout_marginEnd="15dp"
android:layout_marginRight="15dp"
android:onClick="displayReview"
android:text="Display"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/display4"
android:layout_width="372dp"
android:layout_height="563dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="19dp"
android:layout_marginRight="19dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button9" />
<EditText
android:id="@+id/benzReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="5dp"
android:ems="10"
android:gravity="start|top"
android:inputType="textMultiLine"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".reviewHon">
<Button
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp"
android:onClick="addReview"
android:text="Add Review"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button7"
android:layout_width="382dp"
android:layout_height="0dp"
android:layout_marginTop="72dp"
android:layout_marginEnd="15dp"
android:layout_marginRight="15dp"
android:onClick="displayReview"
android:text="Display"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/display3"
android:layout_width="372dp"
android:layout_height="563dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="19dp"
android:layout_marginRight="19dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button7" />
<EditText
android:id="@+id/honReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="5dp"
android:ems="10"
android:gravity="start|top"
android:inputType="textMultiLine"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".reviewJag">
<Button
android:id="@+id/addJag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp"
android:onClick="addReview"
android:text="Add Review"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button5"
android:layout_width="382dp"
android:layout_height="55dp"
android:layout_marginTop="72dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:onClick="displayReview"
android:text="Display"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/display2"
android:layout_width="372dp"
android:layout_height="563dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button5" />
<EditText
android:id="@+id/jagReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="5dp"
android:ems="10"
android:gravity="start|top"
android:inputType="textMultiLine"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".reviewToy">
<Button
android:id="@+id/button10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginEnd="40dp"
android:layout_marginRight="40dp"
android:onClick="addReview"
android:text="Add Review"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button11"
android:layout_width="382dp"
android:layout_height="0dp"
android:layout_marginTop="72dp"
android:layout_marginEnd="15dp"
android:layout_marginRight="15dp"
android:onClick="displayReview"
android:text="Display"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/display5"
android:layout_width="372dp"
android:layout_height="563dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="19dp"
android:layout_marginRight="19dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button11" />
<EditText
android:id="@+id/toyReview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginLeft="24dp"
android:layout_marginTop="5dp"
android:ems="10"
android:gravity="start|top"
android:inputType="textMultiLine"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment