Commit 62d12f28 authored by samuel.hobman's avatar samuel.hobman

This should work!

parents
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.carrental"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.navigation:navigation-fragment:2.2.2'
implementation 'androidx.navigation:navigation-ui:2.2.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.example.carrental;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.carrental", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.carrental">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".DisplayBooking"
android:label="@string/title_activity_display_booking"
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity android:name=".Raffle" />
<activity android:name=".DisplayRefreshments" />
<activity android:name=".DisplayCars" />
<activity android:name=".LogInUser" />
<activity android:name=".RegisterUser" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>
\ No newline at end of file
package com.example.carrental;
public class Audi extends Car {
String carName = "Audi";
int carPrice = 8;
String carSpecs = "Power steering, power brakes, power locks\n" +
"power windows, air bags, automatic\n" +
"air conditioning, ABS brakes, 2 people ";
boolean carAvailable = true;
}
package com.example.carrental;
public class Benz extends Car {
String carName ="Benz";
int carPrice =8;
String carSpecs = "Power steering, power brakes, power locks\n" +
"power windows, air bags, automatic\n" +
"air conditioning, ABS brakes, 2 people";
boolean carAvailable = true;
}
package com.example.carrental;
public class Car {
private static String carName;
private static int carPrice;
private static String carSpecs;
private static boolean carAvailable;
public static String getCarName() {
return carName;
}
public static int getCarPrice() {
return carPrice;
}
public static String getCarSpecs() {
return carSpecs;
}
public static boolean isCarAvailable() {
return carAvailable;
}
public static void setCarAvailable(){
if (Car.carAvailable) {
Car.carAvailable = false;
}
else {
Car.carAvailable = true;
}
}
}
\ No newline at end of file
package com.example.carrental;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.InputType;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class DisplayBooking extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_booking2);
TextView nameText = findViewById(R.id.entryText);
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras == null) {
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setMessage("Critical error. You must restart the app.");
msgbox.setNegativeButton("Okay", null);
msgbox.show();
System.exit(0); // we can not work if the extras are null. We do not know their name, their car, or their current booking price. We must exit.
return;
}
String userName = extras.getString("USER_NAME");
String carRented = extras.getString("CAR_RENTED");
String text = getString(R.string.second_hello, userName, carRented);
nameText.setText(text);
int hours = extras.getInt("TIME_RENTED");
long longHours = (long) (hours * 3.6e+6);
final EditText timeLeft = findViewById(R.id.timeLeft);
new CountDownTimer(longHours, 1000) {
@Override
public void onTick(long millisUntilFinished) {
String numberText = getString(R.string.remaining_time, (millisUntilFinished / 3.6e+6), millisUntilFinished / 60000, millisUntilFinished / 10000); // This will work for up to a few weeks.
timeLeft.setText(numberText);
}
@Override
public void onFinish() {
String returnText = getString(R.string.return_car);
timeLeft.setText(returnText);
}
};
}
public void returnHome(View v) {
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_TEXT); // allows the user to input text.
msgbox.setView(input);
msgbox.setPositiveButton("Finished!", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String review = input.getText().toString(); // this isn't a version that works. However, if an sqllite database was used, you could then use it further.
// it'd be a simple matter of placing it in the database.
}
});
msgbox.setNegativeButton("No, thanks.", null);
Intent intent = new Intent(this, DisplayCars.class);
Bundle extras = intent.getExtras();
String carName = extras.getString("CAR_NAME");
switch(carName){ // switch to change back to available.
case("Audi"):
Audi.setCarAvailable();
break;
case("Honda"):
Honda.setCarAvailable();
break;
case("Benz"):
Benz.setCarAvailable();
break;
case("Toyota"):
Toyota.setCarAvailable();
break;
case("Jaguar"):
Jaguar.setCarAvailable();
break;
}
extras.remove("HOURS_RENTED"); // the car no longer has hours rented.
extras.remove("CAR_RENTED"); // nor has the user got a car. Both of these are removed.
startActivity(intent);
}
}
package com.example.carrental;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputType;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class DisplayCars extends AppCompatActivity {
public final String CAR_NAME = "com.example.carrental.CAR";
public final String CAR_PRICE = "com.example.carrental.PRICE";
public final String USER_NAME = "com.example.carrental.NAME";
public final String TIME_RENTED = "com.example.carrental.TIME";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_cars);
Intent intent = getIntent();
String name = intent.getStringExtra("USER_NAME");
String text = getString(R.string.well_hello, name);
TextView welcomeMessage = findViewById(R.id.mainText);
welcomeMessage.setText(text);
if(!Audi.isCarAvailable()) { // this is on create to hide the instances.
Button hireAudi = findViewById(R.id.hireAudi);
hireAudi.setVisibility(View.GONE);
}
if(!Benz.isCarAvailable()) {
Button hireBenz = findViewById(R.id.hireBenz);
hireBenz.setVisibility(View.GONE);
}
if(!Honda.isCarAvailable()) {
Button hireHonda = findViewById(R.id.hireHonda);
hireHonda.setVisibility(View.GONE);
}
if (!Jaguar.isCarAvailable()) {
Button hireJag = findViewById(R.id.hireJag);
hireJag.setVisibility(View.GONE);
}
if (!Toyota.isCarAvailable()) {
Button hireToy = findViewById(R.id.hireToy);
hireToy.setVisibility(View.GONE);
}
}
public void confirmChoice(Car carName ) {
final AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setPositiveButton("Ok", null);
msgbox.setTitle("How many hours for?");
msgbox.setMessage("How many hours do you want to rent this car for?");
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_NUMBER);
msgbox.setView(input);
final boolean[] flagged = {false};
final int[] time = new int[1];
msgbox.setPositiveButton("Book!", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
int hours = Integer.parseInt(String.valueOf(input.getText()));
if (hours == 0 || hours < 0) {
Toast.makeText(getApplicationContext(), "You can't enter a number less than zero!", Toast.LENGTH_LONG).show();
dialog.cancel();
}
else {
time[0] = hours; // I accept this is pretty weird. However to return an int, we have to make it final, and apparently we cannot have a single instance of a final int.
flagged[0] = true; // this has to be final to be changed by the scope.
}
}
});
msgbox.setNegativeButton("Nevermind.", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
if (flagged[0]) { // while we want access to the view elements, we can't have it running if they hit an error.
Intent firstIntent = getIntent();
String name = firstIntent.getStringExtra(LogInUser.USER_NAME);
Intent intent = new Intent(this, DisplayRefreshments.class);
int total = time[0] * carName.getCarPrice(); // this is really hacky but probably works?
intent.putExtra(TIME_RENTED, time[0]);
intent.putExtra(CAR_NAME, carName.getCarName());
intent.putExtra(CAR_PRICE, total);
intent.putExtra(USER_NAME, name);
startActivity(intent);
}
}
public void checkHire(View v){
switch(v.getId()) {
case (R.id.hireAudi):
if (Audi.isCarAvailable()){
Audi audi = new Audi();
confirmChoice(audi);
}
break;
case (R.id.hireBenz):
if (Benz.isCarAvailable()) {
Benz benz = new Benz();
confirmChoice(benz);
}
break;
case (R.id.hireHonda):
if (Honda.isCarAvailable()) {
Honda honda = new Honda();
confirmChoice(honda);
}
break;
case (R.id.hireJag):
if (Jaguar.isCarAvailable()) {
Jaguar jag = new Jaguar();
confirmChoice(jag);
}
break;
case (R.id.hireToy):
if (Toyota.isCarAvailable()) {
Toyota toy = new Toyota();
confirmChoice(toy);
}
break;
}
}
public void checkSpecs(View v){
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setNegativeButton("Okay", null);
switch(v.getId()) {
case (R.id.showAudi):
msgbox.setMessage(Audi.getCarSpecs());
break;
case (R.id.showBenz):
msgbox.setMessage(Benz.getCarSpecs());
break;
case (R.id.showHonda):
msgbox.setMessage(Honda.getCarSpecs());
break;
case (R.id.showJag):
msgbox.setMessage(Jaguar.getCarSpecs());
break;
case (R.id.showToy):
msgbox.setMessage(Toyota.getCarSpecs());
break;
}
}
}
package com.example.carrental;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.ArrayList;
import static java.lang.System.in;
public class DisplayRefreshments extends AppCompatActivity {
public static final String ORDER_TOTAL = "com.example.carrental.TOTAL";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display_refreshments);
}
public void returnToCar(View V) {
Intent firstIntent = getIntent();
Bundle extras = firstIntent.getExtras();
if (extras == null ) {
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setMessage("Critical error. You must restart the app.");
msgbox.setNegativeButton("Okay", null);
msgbox.show();
System.exit(0); // we can not work if the extras are null. We do not know their name, their car, or their current booking price. We must exit.
return; // This line makes the colours better but is functionally useless. Don't hate me, hate my OCD.
}
Intent intent = new Intent(this, DisplayCars.class);
startActivity(intent);
}
public void finishBooking(View v) {
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras == null ) {
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setMessage("Critical error. You must restart the app.");
msgbox.setNegativeButton("Okay", null);
msgbox.show();
System.exit(0);
return;
}
String userName = extras.getString("name");
String carName = extras.getString("carName");
int carPrice = extras.getInt("carPrice");
ArrayList<TextView> prices = new ArrayList<TextView>();
prices.add((TextView) findViewById(R.id.cakePrice));
prices.add((TextView) findViewById(R.id.biscuitPrice));
prices.add((TextView) findViewById(R.id.sandwichPrice));
prices.add((TextView) findViewById(R.id.sweetPrice));
prices.add((TextView) findViewById(R.id.chocolatePrice));
prices.add((TextView) findViewById(R.id.waterPrice));
prices.add((TextView) findViewById(R.id.juicePrice));
ArrayList<TextView> amount = new ArrayList<TextView>(); // these means we can iteratively check if they've been checked.
amount.add((TextView) findViewById(R.id.cakeAmount));
amount.add((TextView) findViewById(R.id.biscuitAmount));
amount.add((TextView) findViewById(R.id.sandwichAmount));
amount.add((TextView) findViewById(R.id.sweetAmount));
amount.add((TextView) findViewById(R.id.chocolateAmount));
amount.add((TextView) findViewById(R.id.waterAmount));
amount.add((TextView) findViewById(R.id.juiceAmount));
TextView total = findViewById(R.id.refreshmentTotal);
double tracker = 0;
for (int i = 0; i < amount.size() ; i++) {
String unbuffedAmount = amount.get(i).toString();
int intAmount = Integer.parseInt(unbuffedAmount);
if (intAmount < 0 ) { //negative numbers could mean that WE end up paying them money. Which would be terrible.
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setMessage("You cannot enter negative numbers!");
msgbox.setNegativeButton("Okay", null);
msgbox.show();
return; // we need to return here. Or else we WILL end up paying them money.
}
else if (intAmount > 10 ) {
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setMessage("Limit of ten or less refreshments!");
msgbox.setNegativeButton("Okay", null);
msgbox.show();
return; //We cannot fulfil orders of 2,147,483,647. These admittedly are good problems to have.
}
else {
String unbuffedPrice = prices.get(i).toString().trim().substring(1);
double doublePrice = Double.parseDouble(unbuffedPrice);
tracker += doublePrice;
total.setText(String.valueOf(tracker));
}
}
// if we get to here without returning, it's fair to say we can move on.
Intent secondIntent = new Intent(this, Raffle.class);
double totalPrice = carPrice + tracker;
secondIntent.putExtra(ORDER_TOTAL, totalPrice);
secondIntent.putExtras(extras);
startActivity(secondIntent);
}
}
package com.example.carrental;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
public class FirstFragment extends Fragment {
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_first, container, false);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.button_first).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(FirstFragment.this)
.navigate(R.id.action_FirstFragment_to_SecondFragment);
}
});
}
}
package com.example.carrental;
public class Honda extends Car {
String carName = "Honda";
int carPrice = 9;
String carSpecs = "Power Locks/Windows, air bags,\n" +
"automatic, air conditioning, 5 people";
boolean carAvailable = true;
}
package com.example.carrental;
public class Jaguar extends Car {
String carName= "Jaguar";
int carPrice =10;
String carSpecs = "Cruise control, leather interior, automatic,\n" +
"air conditioning, tilt steering wheel,\n" +
"power mirrors, power door locks, 4 people ";
boolean carAvailable = true;
}
package com.example.carrental;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
public class LogInUser extends AppCompatActivity {
public static final String USER_NAME = "com.example.carRental.USERNAME";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log_in_user);
}
public void logUser(View v) {
EditText password = findViewById(R.id.password);
EditText username = findViewById(R.id.username);
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setPositiveButton("Ok", null);
if (username.length() == 0 || password.length() == 0) {
msgbox.setMessage("You need to ensure both password and username fields are filled.");
msgbox.show();
}
else if(username.toString().toLowerCase().equals("Billy") && password.toString().equals("WeeWoo12")) {
Intent intent = new Intent(this, DisplayCars.class);
String user = username.getText().toString();
intent.putExtra(USER_NAME, user);
startActivity(intent);
}
else {
msgbox.setMessage("Those credentials don't match anything on our system. Try again?" );
msgbox.show();
}
}
public void returnToRegister(View v) {
Intent intent = new Intent(this, RegisterUser.class);
startActivity(intent);
}
}
package com.example.carrental;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void registerUser(View v) {
Intent intent = new Intent(this, RegisterUser.class);
startActivity(intent);
}
public void logInUser(View v){
Intent intent = new Intent(this, LogInUser.class);
startActivity(intent);
}
}
package com.example.carrental;
public class Order {
}
package com.example.carrental;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import java.util.Random;
public class Raffle extends AppCompatActivity {
public static final String TOTAL_PRICE = "com.example.carrental.TOTALPRICE";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_raffle);
Intent intent = getIntent();
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setNegativeButton("Okay", null);
Bundle extras = intent.getExtras(); // import everything.
if (extras == null ) {
msgbox.setMessage("Critical error. You must restart the app.");
msgbox.show();
System.exit(0); // we can not work if the extras are null. We do not know their name, their car, or their current booking price. We must exit.
return; // This line makes the colours better but is functionally useless. Don't hate me, hate my OCD.
}
int total = extras.getInt("totalPrice");
Random rng = new Random();
int raffle = rng.nextInt(50); // we get an int since we only want whole numbers, we'll cast this to double later
if (raffle == 0) { // celebrating them on their loss would be insensitive.
msgbox.setMessage("You didn't win anything this time. Always next time!");
Intent zeroIntent = new Intent(this, DisplayBooking.class);
zeroIntent.putExtras(extras);
startActivity(zeroIntent);
}
msgbox.setMessage("Congrats, you have saved %" + raffle + " off your booking!");
double prePrice = extras.getDouble("totalPrice");
double rafflePercent = (double) raffle;
rafflePercent = rafflePercent / 100; // move everything to decimal places.
prePrice = prePrice / rafflePercent;
Intent raffleIntent = new Intent(this, DisplayBooking.class);
raffleIntent.putExtra(TOTAL_PRICE, prePrice);
raffleIntent.putExtras(extras);
startActivity(raffleIntent);
}
}
package com.example.carrental;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
public class RegisterUser extends AppCompatActivity {
private static final String USER_NAME = "com.example.carrental.USER" ;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register_user);
}
public void logUser(View v) {
Intent intent = new Intent(this, LogInUser.class);
startActivity(intent);
}
public void registerUser(View v){
final View thisView = v;
EditText userName = findViewById(R.id.userUsername);
EditText email = findViewById(R.id.userEmail);
EditText firstPassword = findViewById(R.id.firstPassword);
EditText secondAttempt = findViewById(R.id.repeatPassword);
AlertDialog.Builder msgbox = new AlertDialog.Builder(this);
msgbox.setNegativeButton("Okay", null);
if (firstPassword.length() < 8 || secondAttempt.length() < 8) { // check length, this means that they cannot be empty or too small.
msgbox.setMessage("You need a longer password.");
msgbox.show();
return; // breaks out of the function and returns them.
}
if (!firstPassword.toString().equals(secondAttempt.toString())) { // simply getting text could throw an error. This ensures type similarity.
msgbox.setMessage("Your passwords needs to be same!");
msgbox.show();
return;
}
if (userName.length() > 0 || email.length() > 0) { // this is a primitive version of user names and emails, but it'll do for the prototype.
msgbox.setMessage("Both userName and Email length need to be filled!");
msgbox.show();
return;
}
Intent intent = new Intent(this, DisplayCars.class);
String user = userName.getText().toString(); // we are not saving the user just yet. This could easily done by a sqlLite database, however.
intent.putExtra(USER_NAME, user); // saves the user.
startActivity(intent);
}
public void moveToExisting(View v){
Intent intent = new Intent(this, LogInUser.class);
startActivity(intent);
}
}
package com.example.carrental;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
public class SecondFragment extends Fragment {
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState
) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_second, container, false);
}
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.button_second).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
NavHostFragment.findNavController(SecondFragment.this)
.navigate(R.id.action_SecondFragment_to_FirstFragment);
}
});
}
}
package com.example.carrental;
import java.sql.Time;
import java.util.Date;
public class ThisUser implements java.io.Serializable {
private String userName;
private String carBooked;
private Time bookedUntil;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getCarBooked() {
return carBooked;
}
public void setCarBooked(String carBooked) {
this.carBooked = carBooked;
}
public Time getBookedUntil() {
return bookedUntil;
}
public void setBookedUntil(Time bookedUntil) {
this.bookedUntil = bookedUntil;
}
public ThisUser(String userName){
this.userName = userName;
}
}
package com.example.carrental;
public class Toyota extends Car {
String carName = "Toyota";
int carPrice = 7;
String carSpecs = "Manual, air conditioning, diesel,\n" +
"8 people ";
boolean carAvailable = true;
}
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:app="http://schemas.android.com/apk/res-auto"
app:fontProviderAuthority="com.google.android.gms.fonts"
app:fontProviderPackage="com.google.android.gms"
app:fontProviderQuery="casual"
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs">
</font-family>
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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=".DisplayBooking">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="@layout/content_display_booking" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ 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=".DisplayBooking">
<TextView
android:id="@+id/entryText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="TextView"
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/second_hello" />
<EditText
android:id="@+id/timeLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="135dp"
android:ems="10"
android:hint="Time go here"
android:inputType="time"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/returnButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="456dp"
android:onClick="returnHome"
android:text="Return booking early? You'll need to drive the car back!"
android:textSize="36sp"
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=".DisplayCars">
<TextView
android:id="@+id/mainText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/well_hello"
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TableLayout
android:layout_width="424dp"
android:layout_height="476dp"
android:layout_marginTop="259dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top">
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="84dp"
android:text="Benz"
android:textSize="36sp" />
<TextView
android:id="@+id/benzPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="36sp"
tools:text="£11/hr" />
<Button
android:id="@+id/hireBenz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="checkHire"
android:text="@string/hire"
android:textAllCaps="false"
android:textSize="18sp" />
<Button
android:id="@+id/showBenz"
android:layout_width="116dp"
android:layout_height="wrap_content"
android:onClick="checkSpecs"
android:text="@string/specs"
android:textAllCaps="false"
android:textSize="18sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:orientation="vertical">
<TextView
android:id="@+id/toyName"
android:layout_width="wrap_content"
android:layout_height="84dp"
android:text="Toyota"
android:textSize="36sp" />
<TextView
android:id="@+id/toyPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="36sp"
tools:text="£7/hr" />
<Button
android:id="@+id/hireToy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="checkHire"
android:text="@string/hire"
android:textAllCaps="false"
android:textSize="18sp" />
<Button
android:id="@+id/showToy"
android:layout_width="116dp"
android:layout_height="wrap_content"
android:onClick="checkSpecs"
android:text="@string/specs"
android:textAllCaps="false"
android:textSize="18sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top">
<TextView
android:id="@+id/hondaName"
android:layout_width="wrap_content"
android:layout_height="84dp"
android:text="Honda"
android:textSize="36sp" />
<TextView
android:id="@+id/hondaPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="36sp"
tools:text="£9/hr" />
<Button
android:id="@+id/hireHonda"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="checkHire"
android:text="@string/hire"
android:textAllCaps="false"
android:textSize="18sp" />
<Button
android:id="@+id/showHonda"
android:layout_width="116dp"
android:layout_height="wrap_content"
android:onClick="checkSpecs"
android:text="@string/specs"
android:textAllCaps="false"
android:textSize="18sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top">
<TextView
android:id="@+id/jagName"
android:layout_width="wrap_content"
android:layout_height="84dp"
android:text="Jaguar"
android:textSize="36sp" />
<TextView
android:id="@+id/jagPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="36sp"
tools:text="£10/hr" />
<Button
android:id="@+id/hireJag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="checkHire"
android:text="@string/hire"
android:textAllCaps="false"
android:textSize="18sp" />
<Button
android:id="@+id/showJag"
android:layout_width="116dp"
android:layout_height="wrap_content"
android:onClick="checkSpecs"
android:text="@string/specs"
android:textAllCaps="false"
android:textSize="18sp" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top">
<TextView
android:id="@+id/audiName"
android:layout_width="wrap_content"
android:layout_height="84dp"
android:text="Audi"
android:textSize="36sp" />
<TextView
android:id="@+id/audiPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="36sp"
tools:text="£8/hr" />
<Button
android:id="@+id/hireAudi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="checkHire"
android:text="@string/hire"
android:textAllCaps="false"
android:textSize="18sp" />
<Button
android:id="@+id/showAudi"
android:layout_width="116dp"
android:layout_height="wrap_content"
android:onClick="checkSpecs"
android:text="@string/specs"
android:textAllCaps="false"
android:textSize="18sp" />
</TableRow>
</TableLayout>
</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=".DisplayRefreshments">
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Before you book, any refreshments?"
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TableLayout
android:id="@+id/refreshmentTable"
android:layout_width="434dp"
android:layout_height="350dp"
android:layout_marginTop="91dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/cakeName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cake"
android:textSize="36sp" />
<TextView
android:id="@+id/cakePrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" £1"
android:textSize="36sp" />
<EditText
android:id="@+id/cakeAmount"
android:layout_width="198dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="How many do you want?"
android:inputType="number" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/biscuitName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Biscuit"
android:textSize="36sp" />
<TextView
android:id="@+id/biscuitPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" £1.2"
android:textSize="36sp" />
<EditText
android:id="@+id/biscuitAmount"
android:layout_width="124dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="How many do you want?"
android:inputType="number" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/sandwichName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sandwich"
android:textSize="24sp" />
<TextView
android:id="@+id/sandwichPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" £2"
android:textSize="36sp" />
<EditText
android:id="@+id/sandwichAmount"
android:layout_width="124dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="How many do you want?"
android:inputType="number" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/sweetName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sweet"
android:textSize="36sp" />
<TextView
android:id="@+id/sweetPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" £0.5"
android:textSize="36sp" />
<EditText
android:id="@+id/sweetAmount"
android:layout_width="124dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="How many do you want?"
android:inputType="number" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/chocolateName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="chocolate"
android:textSize="36sp" />
<TextView
android:id="@+id/chocolatePrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" £0.5"
android:textSize="36sp" />
<EditText
android:id="@+id/chocolateAmount"
android:layout_width="198dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="How many do you want?"
android:inputType="number" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/waterName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="water"
android:textSize="36sp" />
<TextView
android:id="@+id/waterPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" £0.5"
android:textSize="36sp" />
<EditText
android:id="@+id/waterAmount"
android:layout_width="198dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="How many do you want?"
android:inputType="number" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/juiceName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Juice"
android:textSize="36sp" />
<TextView
android:id="@+id/juicePrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" £1"
android:textSize="36sp" />
<EditText
android:id="@+id/juiceAmount"
android:layout_width="198dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="How many do you want?"
android:inputType="number" />
</TableRow>
</TableLayout>
<TextView
android:id="@+id/textView8"
android:layout_width="257dp"
android:layout_height="46dp"
android:layout_marginTop="441dp"
android:text="Current total is: "
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/refreshmentTotal"
android:layout_width="110dp"
android:layout_height="44dp"
android:layout_marginStart="298dp"
android:layout_marginLeft="298dp"
android:layout_marginTop="443dp"
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button6"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="647dp"
android:onClick="returnToCar"
android:text="Return to car hire?"
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/bookCar"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="545dp"
android:onClick="finishBooking"
android:text="Finish booking"
android:textSize="36sp"
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=".LogInUser">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Please use your credentials to log in. Password is cap sensitive!"
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="234dp"
android:ems="10"
android:hint="Username?"
android:inputType="textEmailAddress"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="343dp"
android:layout_marginBottom="343dp"
android:ems="10"
android:hint="Password?"
android:inputType="textPassword"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button3"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginTop="433dp"
android:onClick="logUser"
android:text="Log in!"
android:textAllCaps="false"
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="528dp"
android:onClick="returnToRegister"
android:text="Not already an existing customer? Register here!"
android:textAllCaps="false"
android:textSize="36sp"
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=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="16dp"
android:lineSpacingExtra="8sp"
android:text="Welcome to Lorem Ipsum's car rental! "
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="482dp"
android:onClick="registerUser"
android:text="Register here!"
android:textAllCaps="false"
android:textSize="30sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button2"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="330dp"
android:onClick="logInUser"
android:text="Already an existing customer?"
android:textAllCaps="false"
android:textSize="30sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="20dp" />
</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=".Raffle">
</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=".RegisterUser">
<Button
android:id="@+id/userExisting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="472dp"
android:onClick="moveToExisting"
android:text="Already an existing customer? Log in here!"
android:textAllCaps="false"
android:textSize="36sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/firstPassword"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="172dp"
android:ems="10"
android:hint="Password are case-sensitive!"
android:inputType="textPassword"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/repeatPassword"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="263dp"
android:ems="10"
android:hint="Repeat password?"
android:inputType="textPassword"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/userEmail"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="85dp"
android:ems="10"
android:hint="Enter your email."
android:inputType="textEmailAddress"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/userUsername"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter your username!"
android:inputType="textPersonName"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button7"
android:layout_width="409dp"
android:layout_height="wrap_content"
android:layout_marginStart="1dp"
android:layout_marginLeft="1dp"
android:layout_marginTop="369dp"
android:onClick="registerUser"
android:text="Register with us!"
android:textSize="36sp"
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<fragment
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:navGraph="@navigation/nav_graph" />
</androidx.constraintlayout.widget.ConstraintLayout>
<?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=".FirstFragment">
<TextView
android:id="@+id/textview_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_first_fragment"
app:layout_constraintBottom_toTopOf="@id/button_first"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button_first"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/next"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textview_first" />
</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=".SecondFragment">
<TextView
android:id="@+id/textview_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@id/button_second"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button_second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/previous"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/textview_second" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<navigation 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/nav_graph"
app:startDestination="@id/FirstFragment">
<fragment
android:id="@+id/FirstFragment"
android:name="com.example.carrental.FirstFragment"
android:label="@string/first_fragment_label"
tools:layout="@layout/fragment_first">
<action
android:id="@+id/action_FirstFragment_to_SecondFragment"
app:destination="@id/SecondFragment" />
</fragment>
<fragment
android:id="@+id/SecondFragment"
android:name="com.example.carrental.SecondFragment"
android:label="@string/second_fragment_label"
tools:layout="@layout/fragment_second">
<action
android:id="@+id/action_SecondFragment_to_FirstFragment"
app:destination="@id/FirstFragment" />
</fragment>
</navigation>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#6200EE</color>
<color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#03DAC5</color>
</resources>
<resources>
<dimen name="fab_margin">16dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="com_google_android_gms_fonts_certs">
<item>@array/com_google_android_gms_fonts_certs_dev</item>
<item>@array/com_google_android_gms_fonts_certs_prod</item>
</array>
<string-array name="com_google_android_gms_fonts_certs_dev">
<item>
MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
</item>
</string-array>
<string-array name="com_google_android_gms_fonts_certs_prod">
<item>
MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
</item>
</string-array>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<array name="preloaded_fonts" translatable="false">
<item>@font/</item>
</array>
</resources>
<resources>
<string name="app_name">CarRental</string>
<string name="name">Name</string>
<string name="second_name">Second name?</string>
<string name="enter_your_name">Enter your name</string>
<string name="test">Test</string>
<string name="you_shouldn_t_be_seeing_this">You shouldn\'t be seeing this.</string>
<string name="well_hello">Hello, %1$s! What car would you like?.</string>
<string name="hire">Hire car</string>
<string name="second_hello">Hello, %1$s! You have the %2$s for this long</string>
<string name="remaining_time">%1$d hours, %2$d minutes, %3$d seconds left.</string>
<string name="return_car">Hours have run out, please return the car!</string>
<string name="specs">Specifications or reviews</string>
<string name="title_activity_display_booking">DisplayBooking</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
<string name="second_fragment_label">Second Fragment</string>
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="hello_first_fragment">Hello first fragment</string>
<string name="hello_second_fragment">Hello second fragment. Arg: %1$s</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
package com.example.carrental;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ 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