The attached Android App is about a closed parking system. The user can sign in and sign up to the app. Once the user signs in they will see a parking slot ranges from 1 to 50. A user can book any...

The attached Android App is about a closed parking system. The user can sign in and sign up to the app. Once the user signs in they will see a parking slot ranges from 1 to 50. A user can book any spot for up to 8 hours. The booked slot colour changes from red to green. The booked slot can be cancelled or become available when the time limit has passed. The only problem with the app right now is that it doesn't pre-populate the data into the FireBase database. The parking data is not stored, meaning that a second user cannot see what the first user has booked, which result in two users booking the same parking slot by mistake. The app uses FireBase as a backend database to store the data. Currently, the firebase provides authentication only, but it doesn't store the booking details or the user details on the database. The objective now is to ensure that FireBase stores the booking details as well as the user details so all the users can view the booked slots. I already created a firebase account, but I will share it once I am confident you can do the required work accordingly.
I have also attached screenshots for the current App.


Thanks


ParkIt/.gitignore *.iml .gradle /local.properties /.idea/workspace.xml /.idea/libraries .DS_Store /build /captures .externalNativeBuild ParkIt/app/.gitignore /build ParkIt/app/build.gradle apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 26 defaultConfig { applicationId "com.r.parkit" minSdkVersion 16 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:design:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:support-v4:26.1.0' implementation 'com.google.firebase:firebase-core:16.0.1' implementation 'com.google.firebase:firebase-auth:16.0.1' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } ParkIt/app/google-services.json { "project_info": { "project_number": "375230842812", "firebase_url": "https://parking-2cdc2.firebaseio.com", "project_id": "parking-2cdc2", "storage_bucket": "parking-2cdc2.appspot.com" }, "client": [ { "client_info": { "mobilesdk_app_id": "1:375230842812:android:088e654963841217", "android_client_info": { "package_name": "com.r.parkit" } }, "oauth_client": [ { "client_id": "375230842812-0ggus1hb2nifvvpngh49vveibsvmkutm.apps.googleusercontent.com", "client_type": 1, "android_info": { "package_name": "com.r.parkit", "certificate_hash": "bbb9907180e847e228bc8221429d8e95df07665c" } }, { "client_id": "375230842812-k410psk5fq2lmv9c0s6h6crjmoim4nra.apps.googleusercontent.com", "client_type": 3 } ], "api_key": [ { "current_key": "AIzaSyAsoAxW0B80hadbJ9zQZJuVvQFSrt_kC-A" } ], "services": { "analytics_service": { "status": 1 }, "appinvite_service": { "status": 2, "other_platform_oauth_client": [ { "client_id": "375230842812-k410psk5fq2lmv9c0s6h6crjmoim4nra.apps.googleusercontent.com", "client_type": 3 } ] }, "ads_service": { "status": 2 } } } ], "configuration_version": "1" } ParkIt/app/proguard-rules.pro # 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 ParkIt/app/src/androidTest/java/com/r/parkit/ExampleInstrumentedTest.java ParkIt/app/src/androidTest/java/com/r/parkit/ExampleInstrumentedTest.java package com.r.parkit; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.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 Testing documentation  */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest {     @Test     public void useAppContext() throws Exception {         // Context of the app under test.         Context appContext = InstrumentationRegistry.getTargetContext();         assertEquals("com.r.parkit", appContext.getPackageName());     } } ParkIt/app/src/main/AndroidManifest.xml ParkIt/app/src/main/java/com/r/parkit/extradialogues/AlreadyBooked.java ParkIt/app/src/main/java/com/r/parkit/extradialogues/AlreadyBooked.java package com.r.parkit.extradialogues; import android.app.DialogFragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import com.r.parkit.R; public class AlreadyBooked extends DialogFragment{     Button okbtn;     @Nullable     @Override     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {         View rootView = inflater.inflate(R.layout.alreadybooked, container,                 false);         getDialog().setTitle("Successfull");         okbtn = (Button)rootView.findViewById(R.id.okbtn);         okbtn.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View view) {                 getDialog().dismiss();             }         });         return rootView;     } } ParkIt/app/src/main/java/com/r/parkit/extradialogues/Dialogues.java ParkIt/app/src/main/java/com/r/parkit/extradialogues/Dialogues.java package com.r.parkit.extradialogues; import android.app.DialogFragment; import android.content.Context; public class Dialogues {     DialogFragment df;     Context context;     public Dialogues(Context context) {         this.context = context;     }     public DialogFragment getDf() {         return df;     }     public void setDf(DialogFragment df) {         this.df = df;     } } ParkIt/app/src/main/java/com/r/parkit/extradialogues/Successfull.java ParkIt/app/src/main/java/com/r/parkit/extradialogues/Successfull.java package com.r.parkit.extradialogues; import android.app.DialogFragment; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.Toast; import com.r.parkit.R; public class Successfull extends DialogFragment {     Button done;     @Nullable     @Override     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {         View rootView = inflater.inflate(R.layout.successfull, container,                 false);         getDialog().setTitle("Successfull");         int dialogWidth = 1000 ;// specify a value here         int dialogHeight = 500; // specify a value here         getDialog().getWindow().setLayout(dialogWidth, dialogHeight);         done = (Button)rootView.findViewById(R.id.done);         done.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View view) {                 Toast.makeText(getActivity(),"Succeffully booked",Toast.LENGTH_SHORT).show();                 getDialog().dismiss();             }         });         return rootView;     } } ParkIt/app/src/main/java/com/r/parkit/home/Homefragment.java ParkIt/app/src/main/java/com/r/parkit/home/Homefragment.java package com.r.parkit.home; import android.content.Context; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.GridLayout; import com.r.parkit.R; import com.r.parkit.extradialogues.Dialogues; import com.r.parkit.parking1.BookTheParking; import com.r.parkit.parking1.CancelTheParking; import com.r.parkit.parking1.ParkingStats; //This is fragment public class Homefragment extends Fragment {     Button[] mybtns;     private OnFragmentInteractionListener mListener;     GridLayout myGridLayout;     public Homefragment() {         // Required empty public constructor     }     @Override     public View onCreateView(LayoutInflater inflater, ViewGroup container,                              Bundle savedInstanceState) {         //if at least one slot book has been done then isFirtTime will be 1 and we will show booked parking slot option on home screen,otherwise welcome screen         if(ParkingStats.isFirstTime == 0){             View view = inflater.inflate(R.layout.fragment_homefragment, container, false);             return view;         }          return getGridFragment(inflater,container);     }     View getGridFragment(LayoutInflater inflater, ViewGroup container){         View view = inflater.inflate(R.layout.booked_slot_layout, container, false);         //This method will create slot for booked parking on the home screen , so we can cancel it from there itself         myGridLayout = (GridLayout)view.findViewById(R.id.mygrid);         int numOfCol = myGridLayout.getColumnCount();         int numOfRow = myGridLayout.getRowCount();         mybtns = new Button[numOfCol * numOfRow];         Integer parking_name = 1;         for( int yPos=0; yPos() {                             @Override                             public void onComplete(@NonNull Task task) {                                 if(!task.isSuccessful()){                                     Toast.makeText(LoginActivity.this, getString(R.string.auth_failed), Toast.LENGTH_LONG).show();                                 }else{                                     Intent intent = new Intent(LoginActivity.this, MainActivity.class);                                     startActivity(intent);                                     finish();                                 }                             }                         });             }         });         register = (TextView)findViewById(R.id.link_signup);         register.setOnClickListener(new View.OnClickListener() {             @Override             public void onClick(View view) {                 Intent i = new Intent(LoginActivity.this,RegisterActivity.class);                 startActivity(i);             }         });     } } ParkIt/app/src/main/java/com/r/parkit/MainActivity.java ParkIt/app/src/main/java/com/r/parkit/MainActivity.java package com.r.parkit; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.r.parkit.home.Homefragment; import com.r.parkit.parking1.AllParkingSlots; public class MainActivity extends AppCompatActivity         implements NavigationView.OnNavigationItemSelectedListener,Homefragment.OnFragmentInteractionListener,         AllParkingSlots.OnFragmentInteractionListener { //    This is Firebase authentication variable     private FirebaseAuth auth;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         auth = FirebaseAuth.getInstance();         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);         setSupportActionBar(toolbar); //        Title of the app         this.setTitle("Parking Finder");         DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);         ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(                 this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);         drawer.addDrawerListener(toggle);         toggle.syncState(); //        This is navigation drawer         NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);         navigationView.setNavigationItemSelectedListener(this); //        Inititally Main Page contains the HomePage         Fragment fragment = new Homefragment();         FragmentManager fragmentManager = getSupportFragmentManager();         FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();         fragmentTransaction.replace(R.id.homepage, fragment);         fragmentTransaction.commit();     } //    Inbuilt Function     @Override     public void onBackPressed() {         DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);         if (drawer.isDrawerOpen(GravityCompat.START)) {             drawer.closeDrawer(GravityCompat.START);         } else {             super.onBackPressed();         }     } //    Inbuilt Function     @Override     public boolean onCreateOptionsMenu(Menu menu) {         // Inflate the menu; this adds items to the action bar if it is present.         getMenuInflater().inflate(R.menu.main, menu);         return true;     } //    Inbuilt Function For Item Selected in right menu     @Override     public boolean onOptionsItemSelected(MenuItem item) {         // Handle action bar item clicks here. The action bar will         // automatically handle clicks on the Home/Up button, so long         // as you specify a parent activity in AndroidManifest.xml.         int id = item.getItemId();         //noinspection SimplifiableIfStatement         if (id == R.id.action_settings) {             return true;         }         return super.onOptionsItemSelected(item);     } //    This is item selector function from navigation drawer     @SuppressWarnings("StatementWithEmptyBody")     @Override     public boolean onNavigationItemSelected(MenuItem item) {         // Handle navigation view item clicks here.         int id = item.getItemId();         Fragment fragment = null; //        this is home menu in navigation         if (id == R.id.nav_camera) {             fragment = new Homefragment();             FragmentManager fragmentManager = getSupportFragmentManager();             FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();             fragmentTransaction.replace(R.id.homepage, fragment);             fragmentTransaction.commit();         } else if (id == R.id.nav_slideshow) { //            This is parking slot menu             fragment = new AllParkingSlots();             FragmentManager fragmentManager = getSupportFragmentManager();             FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();             fragmentTransaction.replace(R.id.homepage, fragment);             fragmentTransaction.commit();         } else if (id == R.id.nav_manage) {             Toast.makeText(MainActivity.this,"Coming Soon",Toast.LENGTH_LONG).show();         } else if (id == R.id.nav_share) {             Toast.makeText(MainActivity.this
Apr 16, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here