diff --git a/.gitignore b/.gitignore
index dda0b2b..dab059c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,9 @@
-*.iml
-.gradle
-/local.properties
-.DS_Store
-/build
-/captures
-.externalNativeBuild
-/.idea/
+*.iml
+.gradle
+/local.properties
+.DS_Store
+/build
+/captures
+.externalNativeBuild
+/.idea/
+/.project
diff --git a/README.md b/README.md
index 29b2e0b..01516b0 100644
--- a/README.md
+++ b/README.md
@@ -1,44 +1,44 @@
-
-# Cabpool Application
-
-## Introduction
-This project is being made for the course CSD207 under the guidance of Professor Anuradha Ravi in the semester of Monsoon 2017.
-
-**The Latest APK of the app can be found [here](https://drive.google.com/open?id=1GlWsl18QL_FKUPz0u2B4vVFZ97shXbbv)**
--Don't forget to sign out and sign back in everytime you install the app...
-
-## About the Project
-Cabpooling is a huge concern in an isolated, residential university like Shiv Nadar University. It has become a part of the process while planning to go anywhere. Although Gmail is an easy platform for cabpool requests, it is not convenient at all because of the following reasons,
-1. Important messages might get lost in a flood of cabpool mails.
-2. It is essentially a spam message for people who do not want to cabpool.
-3. You require the mailing list to send cabpool requests, or reply all to an existing thread which is a slow process.
-4. It is not easy to keep a track of people interested in your offer unless they message you on Whatsapp or call.
-5. Privacy is a huge concern, as you do not want to share your number out there in the public.
-
-In such a scenario, there is a need for such an app which will be secure, and easy to use at the same time. Cabpool Application does the exact same thing.
-
-**The algorithm for sorting and filtering entries can be found [here](https://www.dropbox.com/sh/1aopsud1zbvs75u/AAAJ2PW5lYD140iJdiskG5JMa?dl=0)**
-
-## Contributors
-
-* **Abhishek Srivastava** - [abhesrivastava](https://github.com/abhesrivastava)
-
-* **Divya Raj** - [divya21raj](https://github.com/divya21raj)
-
-* **Atishay Jain** - [atishayjain](https://github.com/atishayjain708)
-
-* **Simran Srivastava** - [ss616](https://github.com/ss616)
-
-* **Rohan Datta** - [Rohan](https://github.com/Rohan-Datta)
-
-## Contributing
-To contribute, follow these guidelines,
-1. Fork the repository.
-2. Make your commits with concise and proper description.
-3. Make pull request.
-
-## Deadline
-Tentative Date for Presentation: Friday, November 24th, 2017
-
-## Acknowledgments
-* Anuradha Ravi - Assistant Professor
+
+# Cabpool Application
+
+## Introduction
+This project is being made for the course CSD207 under the guidance of Professor Anuradha Ravi in the semester of Monsoon 2017.
+
+**The Latest APK of the app can be found [here](https://drive.google.com/open?id=1GlWsl18QL_FKUPz0u2B4vVFZ97shXbbv)**
+-Don't forget to sign out and sign back in everytime you install the app...
+
+## About the Project
+Cabpooling is a huge concern in an isolated, residential university like Shiv Nadar University. It has become a part of the process while planning to go anywhere. Although Gmail is an easy platform for cabpool requests, it is not convenient at all because of the following reasons,
+1. Important messages might get lost in a flood of cabpool mails.
+2. It is essentially a spam message for people who do not want to cabpool.
+3. You require the mailing list to send cabpool requests, or reply all to an existing thread which is a slow process.
+4. It is not easy to keep a track of people interested in your offer unless they message you on Whatsapp or call.
+5. Privacy is a huge concern, as you do not want to share your number out there in the public.
+
+In such a scenario, there is a need for such an app which will be secure, and easy to use at the same time. Cabpool Application does the exact same thing.
+
+**The algorithm for sorting and filtering entries can be found [here](https://www.dropbox.com/sh/1aopsud1zbvs75u/AAAJ2PW5lYD140iJdiskG5JMa?dl=0)**
+
+## Contributors
+
+* **Abhishek Srivastava** - [abhesrivastava](https://github.com/abhesrivastava)
+
+* **Divya Raj** - [divya21raj](https://github.com/divya21raj)
+
+* **Atishay Jain** - [atishayjain](https://github.com/atishayjain708)
+
+* **Simran Srivastava** - [ss616](https://github.com/ss616)
+
+* **Rohan Datta** - [Rohan](https://github.com/Rohan-Datta)
+
+## Contributing
+To contribute, follow these guidelines,
+1. Fork the repository.
+2. Make your commits with concise and proper description.
+3. Make pull request.
+
+## Deadline
+Tentative Date for Presentation: Friday, November 24th, 2017
+
+## Acknowledgments
+* Anuradha Ravi - Assistant Professor
diff --git a/app/.gitignore b/app/.gitignore
index 796b96d..3543521 100644
--- a/app/.gitignore
+++ b/app/.gitignore
@@ -1 +1 @@
-/build
+/build
diff --git a/app/build.gradle b/app/build.gradle
index 0384e69..d546835 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,79 +1,77 @@
-plugins {
- id "me.tatarka.retrolambda" version "3.7.0"
-}
-apply plugin: 'com.android.application'
-//noinspection GradleCompatible
-apply plugin: 'com.android.application'
-apply plugin: 'me.tatarka.retrolambda'
-
-tasks.whenTaskAdded { task ->
- if (task.name.startsWith("lint")) {
- task.enabled = false
- }
-}
-
-
-retrolambda {
- jvmArgs '-noverify'
-
-}
-
-
-android {
- compileSdkVersion 25
- buildToolsVersion "26.0.2"
- defaultConfig {
- applicationId 'garbagecollectors.com.snucabpool'
- minSdkVersion 16
- targetSdkVersion 25
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
-
- multiDexEnabled true //important
- }
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- debug {
- debuggable true
- }
- }
- productFlavors {
- }
-
- // For Retrolambda
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
-}
-
-
-dependencies {
- compile fileTree(include: ['*.jar'], dir: 'libs')
- androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
- exclude group: 'com.android.support', module: 'support-annotations'
- })
- //noinspection GradleCompatible
-
-
- compile 'com.google.firebase:firebase-database:11.6.0'
- compile 'com.google.firebase:firebase-core:11.6.0'
- compile 'com.android.support:appcompat-v7:25.3.1'
- compile 'com.android.support:mediarouter-v7:25.3.1'
- compile 'com.android.support:design:25.3.1'
- compile 'com.android.support:cardview-v7:25.3.1'
- compile 'com.android.support:recyclerview-v7:25.3.1'
- compile 'com.google.firebase:firebase-auth:11.6.0'
- compile 'com.google.android.gms:play-services-auth:11.6.0'
- compile 'com.android.support.constraint:constraint-layout:1.0.2'
- compile 'com.google.android.gms:play-services:11.6.0'
- compile 'com.android.support:support-v4:25.3.1'
- testCompile 'junit:junit:4.12'
-}
-apply plugin: "com.google.gms.google-services"
-
-
+plugins {
+ id "me.tatarka.retrolambda" version "3.7.0"
+}
+apply plugin: 'com.android.application'
+//noinspection GradleCompatible
+apply plugin: 'com.android.application'
+
+tasks.whenTaskAdded { task ->
+ if (task.name.startsWith("lint")) {
+ task.enabled = false
+ }
+}
+
+
+retrolambda {
+ jvmArgs '-noverify'
+}
+
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion "26.0.2"
+ defaultConfig {
+ applicationId 'garbagecollectors.com.snucabpool'
+ minSdkVersion 16
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
+ multiDexEnabled true //important
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ debug {
+ debuggable true
+ }
+ }
+ productFlavors {
+ }
+
+ // For Retrolambda
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+}
+
+
+dependencies {
+ compile fileTree(include: ['*.jar'], dir: 'libs')
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ //noinspection GradleCompatible
+
+
+ compile 'com.google.firebase:firebase-database:11.6.0'
+ compile 'com.google.firebase:firebase-core:11.6.0'
+ compile 'com.android.support:appcompat-v7:25.3.1'
+ compile 'com.android.support:mediarouter-v7:25.3.1'
+ compile 'com.android.support:design:25.3.1'
+ compile 'com.android.support:cardview-v7:25.3.1'
+ compile 'com.android.support:recyclerview-v7:25.3.1'
+ compile 'com.google.firebase:firebase-auth:11.6.0'
+ compile 'com.google.android.gms:play-services-auth:11.6.0'
+ compile 'com.android.support.constraint:constraint-layout:1.0.2'
+ compile 'com.google.android.gms:play-services:11.6.0'
+ compile 'com.android.support:support-v4:25.3.1'
+ testCompile 'junit:junit:4.12'
+}
+apply plugin: "com.google.gms.google-services"
+
+
diff --git a/app/google-services.json b/app/google-services.json
index 2446de1..a80a783 100644
--- a/app/google-services.json
+++ b/app/google-services.json
@@ -1,63 +1,63 @@
-{
- "project_info": {
- "project_number": "560852588496",
- "firebase_url": "https://snu-cabpool-db611.firebaseio.com",
- "project_id": "snu-cabpool-db611",
- "storage_bucket": "snu-cabpool-db611.appspot.com"
- },
- "client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:560852588496:android:7f0a586268b8fc20",
- "android_client_info": {
- "package_name": "garbagecollectors.com.snucabpool"
- }
- },
- "oauth_client": [
- {
- "client_id": "560852588496-b6r1pudq3mv7gu6emsq0gvn6ljhnn63u.apps.googleusercontent.com",
- "client_type": 1,
- "android_info": {
- "package_name": "garbagecollectors.com.snucabpool",
- "certificate_hash": "22bb7869c9e5ec47b5061c7002e1a6e0fcc2ab1a"
- }
- },
- {
- "client_id": "560852588496-0s3msr6b2m8chbs8aks12kuv8j2233f5.apps.googleusercontent.com",
- "client_type": 1,
- "android_info": {
- "package_name": "garbagecollectors.com.snucabpool",
- "certificate_hash": "4f9e380dd6c2ed3f6b79a9f8f5daefa2f991a65a"
- }
- },
- {
- "client_id": "560852588496-baos0qb9om1qmvade33hbh1l2ic70l00.apps.googleusercontent.com",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": "AIzaSyAbviwwtxjwpZyiqvRzzulh6YycC11F1vQ"
- }
- ],
- "services": {
- "analytics_service": {
- "status": 1
- },
- "appinvite_service": {
- "status": 2,
- "other_platform_oauth_client": [
- {
- "client_id": "560852588496-baos0qb9om1qmvade33hbh1l2ic70l00.apps.googleusercontent.com",
- "client_type": 3
- }
- ]
- },
- "ads_service": {
- "status": 2
- }
- }
- }
- ],
- "configuration_version": "1"
+{
+ "project_info": {
+ "project_number": "560852588496",
+ "firebase_url": "https://snu-cabpool-db611.firebaseio.com",
+ "project_id": "snu-cabpool-db611",
+ "storage_bucket": "snu-cabpool-db611.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:560852588496:android:7f0a586268b8fc20",
+ "android_client_info": {
+ "package_name": "garbagecollectors.com.snucabpool"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "560852588496-b6r1pudq3mv7gu6emsq0gvn6ljhnn63u.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "garbagecollectors.com.snucabpool",
+ "certificate_hash": "22bb7869c9e5ec47b5061c7002e1a6e0fcc2ab1a"
+ }
+ },
+ {
+ "client_id": "560852588496-0s3msr6b2m8chbs8aks12kuv8j2233f5.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "garbagecollectors.com.snucabpool",
+ "certificate_hash": "4f9e380dd6c2ed3f6b79a9f8f5daefa2f991a65a"
+ }
+ },
+ {
+ "client_id": "560852588496-baos0qb9om1qmvade33hbh1l2ic70l00.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyAbviwwtxjwpZyiqvRzzulh6YycC11F1vQ"
+ }
+ ],
+ "services": {
+ "analytics_service": {
+ "status": 1
+ },
+ "appinvite_service": {
+ "status": 2,
+ "other_platform_oauth_client": [
+ {
+ "client_id": "560852588496-baos0qb9om1qmvade33hbh1l2ic70l00.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ },
+ "ads_service": {
+ "status": 2
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index ce3149c..e01b6b6 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,25 +1,25 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Android\sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# 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
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# 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
diff --git a/app/src/androidTest/java/garbagecollectors/com/snucabpool/ExampleInstrumentedTest.java b/app/src/androidTest/java/garbagecollectors/com/snucabpool/ExampleInstrumentedTest.java
index 7e99501..c73b02b 100644
--- a/app/src/androidTest/java/garbagecollectors/com/snucabpool/ExampleInstrumentedTest.java
+++ b/app/src/androidTest/java/garbagecollectors/com/snucabpool/ExampleInstrumentedTest.java
@@ -1,26 +1,26 @@
-package garbagecollectors.com.snucabpool;
-
-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.*;
-
-/**
- * Instrumentation 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("atishay.com.snucabpool", appContext.getPackageName());
- }
-}
+package garbagecollectors.com.snucabpool;
+
+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.*;
+
+/**
+ * Instrumentation 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("atishay.com.snucabpool", appContext.getPackageName());
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 8fc1b721..531ba4f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,56 +1,56 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/gen/garbagecollectors/com/snucabpool/BuildConfig.java b/app/src/main/gen/garbagecollectors/com/snucabpool/BuildConfig.java
index 247a8d9..f4b7a77 100644
--- a/app/src/main/gen/garbagecollectors/com/snucabpool/BuildConfig.java
+++ b/app/src/main/gen/garbagecollectors/com/snucabpool/BuildConfig.java
@@ -1,8 +1,8 @@
-/*___Generated_by_IDEA___*/
-
-package garbagecollectors.com.snucabpool;
-
-/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
-public final class BuildConfig {
- public final static boolean DEBUG = Boolean.parseBoolean(null);
+/*___Generated_by_IDEA___*/
+
+package garbagecollectors.com.snucabpool;
+
+/* This stub is only used by the IDE. It is NOT the BuildConfig class actually packed into the APK */
+public final class BuildConfig {
+ public final static boolean DEBUG = Boolean.parseBoolean(null);
}
\ No newline at end of file
diff --git a/app/src/main/gen/garbagecollectors/com/snucabpool/Manifest.java b/app/src/main/gen/garbagecollectors/com/snucabpool/Manifest.java
index 7d6cdee..f72cb1d 100644
--- a/app/src/main/gen/garbagecollectors/com/snucabpool/Manifest.java
+++ b/app/src/main/gen/garbagecollectors/com/snucabpool/Manifest.java
@@ -1,7 +1,7 @@
-/*___Generated_by_IDEA___*/
-
-package garbagecollectors.com.snucabpool;
-
-/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
-public final class Manifest {
+/*___Generated_by_IDEA___*/
+
+package garbagecollectors.com.snucabpool;
+
+/* This stub is only used by the IDE. It is NOT the Manifest class actually packed into the APK */
+public final class Manifest {
}
\ No newline at end of file
diff --git a/app/src/main/gen/garbagecollectors/com/snucabpool/R.java b/app/src/main/gen/garbagecollectors/com/snucabpool/R.java
index fdb81bf..9c7e9ca 100644
--- a/app/src/main/gen/garbagecollectors/com/snucabpool/R.java
+++ b/app/src/main/gen/garbagecollectors/com/snucabpool/R.java
@@ -1,7 +1,7 @@
-/*___Generated_by_IDEA___*/
-
-package garbagecollectors.com.snucabpool;
-
-/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
-public final class R {
+/*___Generated_by_IDEA___*/
+
+package garbagecollectors.com.snucabpool;
+
+/* This stub is only used by the IDE. It is NOT the R class actually packed into the APK */
+public final class R {
}
\ No newline at end of file
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/DatePickerFragment.java b/app/src/main/java/garbagecollectors/com/snucabpool/DatePickerFragment.java
index c1f58d4..42c2c97 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/DatePickerFragment.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/DatePickerFragment.java
@@ -1,69 +1,69 @@
-package garbagecollectors.com.snucabpool;
-
-/**
- * Created by SIMRAN on 22-11-2017.
- */
-
-import android.app.DatePickerDialog;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.os.Bundle;
-import android.widget.DatePicker;
-import android.widget.TextView;
-
-import java.util.Calendar;
-
-import garbagecollectors.com.snucabpool.activities.NewEntryActivity;
-
-public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener
-{
- String stringOfDate;
-
- public DatePickerFragment()
- {}
-
- int year_now,month_now,day_now;
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState)
- {
- //Use the current date as the default date in the date picker
- final Calendar c = Calendar.getInstance();
- int year = c.get(Calendar.YEAR);
- int month = c.get(Calendar.MONTH);
- int day = c.get(Calendar.DAY_OF_MONTH);
-
- //Create a new DatePickerDialog instance and return it
- /*
- DatePickerDialog Public Constructors - Here we uses first one
- public DatePickerDialog (Context context, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
- public DatePickerDialog (Context context, int theme, DatePickerDialog.OnDateSetListener listener, int year, int monthOfYear, int dayOfMonth)
- */
- setDateNow(year,month,day);
- return new DatePickerDialog(getActivity(), this, year, month, day);
- }
-
-
- private void setDateNow(int year, int month, int day)
- {
- this.day_now=day;
- this.month_now=month;
- this.year_now=year;
- }
-
- public void onDateSet(DatePicker view, int year, int month, int day)
- {
- //Do something with the date chosen by the user
- TextView text_date = (TextView) getActivity().findViewById(R.id.searched_date);
- if((year==year_now && month==month_now && day>=day_now)|| (year==year_now && month>month_now) ||
- (year>year_now))
- {
- stringOfDate = day + "/" + (++month) + "/" + year;
-
- text_date.setText(stringOfDate);
- NewEntryActivity.date=stringOfDate;
- }
- else
- text_date.setText("Invalid Date");
-
- }
-}
+package garbagecollectors.com.snucabpool;
+
+/**
+ * Created by SIMRAN on 22-11-2017.
+ */
+
+import android.app.DatePickerDialog;
+import android.app.Dialog;
+import android.app.DialogFragment;
+import android.os.Bundle;
+import android.widget.DatePicker;
+import android.widget.TextView;
+
+import java.util.Calendar;
+
+import garbagecollectors.com.snucabpool.activities.NewEntryActivity;
+
+public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener
+{
+ String stringOfDate;
+
+ public DatePickerFragment()
+ {}
+
+ int year_now,month_now,day_now;
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState)
+ {
+ //Use the current date as the default date in the date picker
+ final Calendar c = Calendar.getInstance();
+ int year = c.get(Calendar.YEAR);
+ int month = c.get(Calendar.MONTH);
+ int day = c.get(Calendar.DAY_OF_MONTH);
+
+ //Create a new DatePickerDialog instance and return it
+ /*
+ DatePickerDialog Public Constructors - Here we uses first one
+ public DatePickerDialog (Context context, DatePickerDialog.OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth)
+ public DatePickerDialog (Context context, int theme, DatePickerDialog.OnDateSetListener listener, int year, int monthOfYear, int dayOfMonth)
+ */
+ setDateNow(year,month,day);
+ return new DatePickerDialog(getActivity(), this, year, month, day);
+ }
+
+
+ private void setDateNow(int year, int month, int day)
+ {
+ this.day_now=day;
+ this.month_now=month;
+ this.year_now=year;
+ }
+
+ public void onDateSet(DatePicker view, int year, int month, int day)
+ {
+ //Do something with the date chosen by the user
+ TextView text_date = (TextView) getActivity().findViewById(R.id.searched_date);
+ if((year==year_now && month==month_now && day>=day_now)|| (year==year_now && month>month_now) ||
+ (year>year_now))
+ {
+ stringOfDate = day + "/" + (++month) + "/" + year;
+
+ text_date.setText(stringOfDate);
+ NewEntryActivity.date=stringOfDate;
+ }
+ else
+ text_date.setText("Invalid Date");
+
+ }
+}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/GenLocation.java b/app/src/main/java/garbagecollectors/com/snucabpool/GenLocation.java
index 3b63ce1..2d53ba5 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/GenLocation.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/GenLocation.java
@@ -1,61 +1,61 @@
-package garbagecollectors.com.snucabpool;
-
-public class GenLocation
-{
- String name;
- String address;
-
- Double latitude;
- Double longitude;
-
- public GenLocation(String name, String address, Double latitude, Double longitude)
- {
- this.name = name;
- this.address = address;
- this.latitude = latitude;
- this.longitude = longitude;
- }
-
- public GenLocation()
- {}
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getAddress()
- {
- return address;
- }
-
- public void setAddress(String address)
- {
- this.address = address;
- }
-
- public Double getLatitude()
- {
- return latitude;
- }
-
- public void setLatitude(Double latitude)
- {
- this.latitude = latitude;
- }
-
- public Double getLongitude()
- {
- return longitude;
- }
-
- public void setLongitude(Double longitude)
- {
- this.longitude = longitude;
- }
-}
+package garbagecollectors.com.snucabpool;
+
+public class GenLocation
+{
+ String name;
+ String address;
+
+ Double latitude;
+ Double longitude;
+
+ public GenLocation(String name, String address, Double latitude, Double longitude)
+ {
+ this.name = name;
+ this.address = address;
+ this.latitude = latitude;
+ this.longitude = longitude;
+ }
+
+ public GenLocation()
+ {}
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getAddress()
+ {
+ return address;
+ }
+
+ public void setAddress(String address)
+ {
+ this.address = address;
+ }
+
+ public Double getLatitude()
+ {
+ return latitude;
+ }
+
+ public void setLatitude(Double latitude)
+ {
+ this.latitude = latitude;
+ }
+
+ public Double getLongitude()
+ {
+ return longitude;
+ }
+
+ public void setLongitude(Double longitude)
+ {
+ this.longitude = longitude;
+ }
+}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/Message.java b/app/src/main/java/garbagecollectors/com/snucabpool/Message.java
index 3ec9de1..58dfd0e 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/Message.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/Message.java
@@ -1,49 +1,49 @@
-package garbagecollectors.com.snucabpool;
-
-public class Message
-{
- String message;
- String senderId;
- Long createdAtTime;
-
- public Message(String message, String senderId, Long createdAtTime)
- {
- this.message = message;
- this.senderId = senderId;
- this.createdAtTime = createdAtTime;
- }
-
- public Message()
- {
- }
-
- public String getMessage()
- {
- return message;
- }
-
- public void setMessage(String message)
- {
- this.message = message;
- }
-
- public String getSenderId()
- {
- return senderId;
- }
-
- public void setSenderId(String senderId)
- {
- this.senderId = senderId;
- }
-
- public Long getCreatedAtTime()
- {
- return createdAtTime;
- }
-
- public void setCreatedAtTime(Long createdAtTime)
- {
- this.createdAtTime = createdAtTime;
- }
-}
+package garbagecollectors.com.snucabpool;
+
+public class Message
+{
+ String message;
+ String senderId;
+ Long createdAtTime;
+
+ public Message(String message, String senderId, Long createdAtTime)
+ {
+ this.message = message;
+ this.senderId = senderId;
+ this.createdAtTime = createdAtTime;
+ }
+
+ public Message()
+ {
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ public String getSenderId()
+ {
+ return senderId;
+ }
+
+ public void setSenderId(String senderId)
+ {
+ this.senderId = senderId;
+ }
+
+ public Long getCreatedAtTime()
+ {
+ return createdAtTime;
+ }
+
+ public void setCreatedAtTime(Long createdAtTime)
+ {
+ this.createdAtTime = createdAtTime;
+ }
+}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/PairUp.java b/app/src/main/java/garbagecollectors/com/snucabpool/PairUp.java
index 098e402..1140770 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/PairUp.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/PairUp.java
@@ -1,66 +1,66 @@
-package garbagecollectors.com.snucabpool;
-
-import java.util.ArrayList;
-
-public class PairUp
-{
- String pairUpId;
-
- String creatorId; //person who created the tripEntry
- String requesterId;
-
- ArrayList messages;
-
- public PairUp(String pairUpId, String creatorId, String requesterId, ArrayList messages)
- {
- this.pairUpId = pairUpId;
- this.creatorId = creatorId;
- this.requesterId = requesterId;
- this.messages = messages;
- }
-
- public PairUp()
- {
- }
-
- public String getPairUpId()
- {
- return pairUpId;
- }
-
- public void setPairUpId(String pairUpId)
- {
- this.pairUpId = pairUpId;
- }
-
- public String getCreatorId()
- {
- return creatorId;
- }
-
- public void setCreatorId(String creatorId)
- {
- this.creatorId = creatorId;
- }
-
- public String getRequesterId()
- {
- return requesterId;
- }
-
- public void setRequesterId(String requesterId)
- {
- this.requesterId = requesterId;
- }
-
- public ArrayList getMessages()
- {
- return messages;
- }
-
- public void setMessages(ArrayList messages)
- {
- this.messages = messages;
- }
-
-}
+package garbagecollectors.com.snucabpool;
+
+import java.util.ArrayList;
+
+public class PairUp
+{
+ String pairUpId;
+
+ String creatorId; //person who created the tripEntry
+ String requesterId;
+
+ ArrayList messages;
+
+ public PairUp(String pairUpId, String creatorId, String requesterId, ArrayList messages)
+ {
+ this.pairUpId = pairUpId;
+ this.creatorId = creatorId;
+ this.requesterId = requesterId;
+ this.messages = messages;
+ }
+
+ public PairUp()
+ {
+ }
+
+ public String getPairUpId()
+ {
+ return pairUpId;
+ }
+
+ public void setPairUpId(String pairUpId)
+ {
+ this.pairUpId = pairUpId;
+ }
+
+ public String getCreatorId()
+ {
+ return creatorId;
+ }
+
+ public void setCreatorId(String creatorId)
+ {
+ this.creatorId = creatorId;
+ }
+
+ public String getRequesterId()
+ {
+ return requesterId;
+ }
+
+ public void setRequesterId(String requesterId)
+ {
+ this.requesterId = requesterId;
+ }
+
+ public ArrayList getMessages()
+ {
+ return messages;
+ }
+
+ public void setMessages(ArrayList messages)
+ {
+ this.messages = messages;
+ }
+
+}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/Sorting_Filtering.java b/app/src/main/java/garbagecollectors/com/snucabpool/Sorting_Filtering.java
new file mode 100644
index 0000000..a428b40
--- /dev/null
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/Sorting_Filtering.java
@@ -0,0 +1,86 @@
+package garbagecollectors.com.snucabpool;
+
+import android.location.Location;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+import static java.lang.Math.abs;
+
+/**
+ * Created by Rohan on 22-11-2017.
+ */
+
+public class Sorting_Filtering
+{
+ private GenLocation src1, dest1, src2, dest2;
+ java.text.DateFormat df = new java.text.SimpleDateFormat("hh:mm:ss");
+
+ private final int src_wt = 100;
+ private final int dest_wt = 50;
+ private final int time_wt = 25;
+
+ private static ArrayList tripEntry_list;
+
+ public float calc_lambda(TripEntry e1, TripEntry e2) throws ParseException
+ {
+ float lambda = 0;
+
+ src1 = e1.getSource();
+ src2 = e2.getSource();
+ dest1 = e1.getDestination();
+ dest2 = e2.getDestination();
+
+ java.util.Date t1 = df.parse(e1.getDate());
+ java.util.Date t2 = df.parse(e2.getDate());
+
+ long time_diff = abs(t2.getTime() - t1.getTime());
+
+ //lambda = (src_wt/src1.distanceTo(src2))+(dest_wt/dest1.distanceTo(dest2))+(time_wt/time_diff);
+
+ return lambda;
+ }
+
+ private void entry_sort()
+ {
+ Collections.sort(tripEntry_list, new Comparator()
+ {
+ @Override
+ public int compare(TripEntry o1, TripEntry o2) {
+ float lambda1 = o1.getLambdaMap().get(o1.getEntry_id());
+ float lambda2 = o2.getLambdaMap().get(o2.getEntry_id());
+
+ return lambda1 < lambda2 ? -1 : lambda1 == lambda2 ? 0 : 1;
+ }
+ });
+ }
+
+ public static void setTripEntry_list(ArrayList tripEntry_list)
+ {
+ Sorting_Filtering.tripEntry_list = tripEntry_list;
+ }
+
+ //Here getting distance in kilometers
+ private double distance(double lat1, double lon1, double lat2, double lon2) {
+ double theta = lon1 - lon2;
+ double dist = Math.sin(deg2rad(lat1))
+ * Math.sin(deg2rad(lat2))
+ + Math.cos(deg2rad(lat1))
+ * Math.cos(deg2rad(lat2))
+ * Math.cos(deg2rad(theta));
+ dist = Math.acos(dist);
+ dist = rad2deg(dist);
+ dist = dist * 60 * 1.1515;
+ return (dist);
+ }
+
+ private double deg2rad(double deg) {
+ return (deg * Math.PI / 180.0);
+ }
+
+ private double rad2deg(double rad) {
+ return (rad * 180.0 / Math.PI);
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/TripEntry.java b/app/src/main/java/garbagecollectors/com/snucabpool/TripEntry.java
index 1ac0aae..6df0254 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/TripEntry.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/TripEntry.java
@@ -1,112 +1,119 @@
-package garbagecollectors.com.snucabpool;
-
-import java.text.ParseException;
-import java.util.HashMap;
-
-public class TripEntry
-{
- private String entry_id;
-
- private String user_id; //Data type could be changed to long
-
- private String name;
-
- private String time, date;
-
- private GenLocation source, destination;
-
- public TripEntry(String name, String entry_id, String user_id, String time, String date, GenLocation source, GenLocation destination, HashMap lambdaMap) throws ParseException
- {
- this.entry_id = entry_id;
- this.user_id = user_id;
- this.time = time;
- this.date = date;
- this.source = source;
- this.destination = destination;
- this.name = name;
- }
-
- public TripEntry(TripEntry tripEntry) //copyConstructor
- {
- this.entry_id = tripEntry.getEntry_id();
- this.user_id = tripEntry.getUser_id();
- this.time = tripEntry.getTime();
- this.date = tripEntry.getDate();
- this.source = tripEntry.getSource();
- this.destination = tripEntry.getDestination();
- this.name = tripEntry.getName();
- }
-
- public TripEntry()
- {}
-
- public String getEntry_id()
- {
- return entry_id;
- }
-
- public void setEntry_id(String entry_id)
- {
- this.entry_id = entry_id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getUser_id()
- {
- return user_id;
- }
-
- public void setUser_id(String user_id)
- {
- this.user_id = user_id;
- }
-
- public String getTime()
- {
- return time;
- }
-
- public void setTime(String time)
- {
- this.time = time;
- }
-
- public String getDate()
- {
- return date;
- }
-
- public void setDate(String date)
- {
- this.date = date;
- }
-
- public GenLocation getSource()
- {
- return source;
- }
-
- public void setSource(GenLocation source)
- {
- this.source = source;
- }
-
- public GenLocation getDestination()
- {
- return destination;
- }
-
- public void setDestination(GenLocation destination)
- {
- this.destination = destination;
- }
-}
+package garbagecollectors.com.snucabpool;
+
+import java.text.ParseException;
+import java.util.HashMap;
+
+public class TripEntry
+{
+ private String entry_id;
+
+ private String user_id; //Data type could be changed to long
+
+ private String name;
+
+ private String time, date;
+
+ private GenLocation source, destination;
+
+ public HashMap lambdaMap = new HashMap<>(); //HashMap contains entry_id(String value) as key and lambda(Float value) as value
+
+ public TripEntry(String name, String entry_id, String user_id, String time, String date, GenLocation source, GenLocation destination, HashMap lambdaMap) throws ParseException
+ {
+ this.entry_id = entry_id;
+ this.user_id = user_id;
+ this.time = time;
+ this.date = date;
+ this.source = source;
+ this.destination = destination;
+ this.name = name;
+ }
+
+ public TripEntry(TripEntry tripEntry) //copyConstructor
+ {
+ this.entry_id = tripEntry.getEntry_id();
+ this.user_id = tripEntry.getUser_id();
+ this.time = tripEntry.getTime();
+ this.date = tripEntry.getDate();
+ this.source = tripEntry.getSource();
+ this.destination = tripEntry.getDestination();
+ this.name = tripEntry.getName();
+ }
+
+ public TripEntry()
+ {}
+
+ HashMap getLambdaMap()
+ {
+ return lambdaMap;
+ }
+
+ public String getEntry_id()
+ {
+ return entry_id;
+ }
+
+ public void setEntry_id(String entry_id)
+ {
+ this.entry_id = entry_id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getUser_id()
+ {
+ return user_id;
+ }
+
+ public void setUser_id(String user_id)
+ {
+ this.user_id = user_id;
+ }
+
+ public String getTime()
+ {
+ return time;
+ }
+
+ public void setTime(String time)
+ {
+ this.time = time;
+ }
+
+ public String getDate()
+ {
+ return date;
+ }
+
+ public void setDate(String date)
+ {
+ this.date = date;
+ }
+
+ public GenLocation getSource()
+ {
+ return source;
+ }
+
+ public void setSource(GenLocation source)
+ {
+ this.source = source;
+ }
+
+ public GenLocation getDestination()
+ {
+ return destination;
+ }
+
+ public void setDestination(GenLocation destination)
+ {
+ this.destination = destination;
+ }
+}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/User.java b/app/src/main/java/garbagecollectors/com/snucabpool/User.java
index edb6bef..796518b 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/User.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/User.java
@@ -1,88 +1,88 @@
-package garbagecollectors.com.snucabpool;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-/**
- * Created by D2R on 29/11/2017.
- */
-
-public class User
-{
- private String userId;
- private String name;
- private ArrayList userTripEntries =new ArrayList<>();
-
- private ArrayList requestSent;
- private HashMap> requestsRecieved;
- //Key is the entryId of entry requested, Value is list of userIDs who've requested that entry
- //We have Map because we're taking TripEntry object of the entry that we have made (that the other person has clicked on)
-
- ArrayList pairUps;
- //Key is userId paired up with, value is list of tripEntries paired up over.
-
-
- public User(String userId, String name, ArrayList userTripEntries, ArrayList requestSent, HashMap> requestsRecieved, ArrayList pairUps)
- {
- this.userId = userId;
- this.name = name;
- this.userTripEntries = userTripEntries;
- this.requestSent = requestSent;
- this.requestsRecieved = requestsRecieved;
- this.pairUps = pairUps;
- }
-
- public String getUserId()
- {
- return userId;
- }
-
- void setUserId(String userId)
- {
- this.userId = userId;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public ArrayList getRequestSent()
- {
- return requestSent;
- }
-
- public void setRequestSent(ArrayList requestSent)
- {
- this.requestSent = requestSent;
- }
-
- public HashMap> getRequestsRecieved()
- {
- return requestsRecieved;
- }
-
- public void setRequestsRecieved(HashMap> requestsRecieved)
- {
- this.requestsRecieved = requestsRecieved;
- }
-
- public User()
- {
- }
-
- public ArrayList getUserTripEntries()
- {
- return userTripEntries;
- }
-
- public ArrayList getPairUps()
- {
- return pairUps;
- }
-}
+package garbagecollectors.com.snucabpool;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * Created by D2R on 29/11/2017.
+ */
+
+public class User
+{
+ private String userId;
+ private String name;
+ private ArrayList userTripEntries =new ArrayList<>();
+
+ private ArrayList requestSent;
+ private HashMap> requestsRecieved;
+ //Key is the entryId of entry requested, Value is list of userIDs who've requested that entry
+ //We have Map because we're taking TripEntry object of the entry that we have made (that the other person has clicked on)
+
+ ArrayList pairUps;
+ //Key is userId paired up with, value is list of tripEntries paired up over.
+
+
+ public User(String userId, String name, ArrayList userTripEntries, ArrayList requestSent, HashMap> requestsRecieved, ArrayList pairUps)
+ {
+ this.userId = userId;
+ this.name = name;
+ this.userTripEntries = userTripEntries;
+ this.requestSent = requestSent;
+ this.requestsRecieved = requestsRecieved;
+ this.pairUps = pairUps;
+ }
+
+ public String getUserId()
+ {
+ return userId;
+ }
+
+ void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public ArrayList getRequestSent()
+ {
+ return requestSent;
+ }
+
+ public void setRequestSent(ArrayList requestSent)
+ {
+ this.requestSent = requestSent;
+ }
+
+ public HashMap> getRequestsRecieved()
+ {
+ return requestsRecieved;
+ }
+
+ public void setRequestsRecieved(HashMap> requestsRecieved)
+ {
+ this.requestsRecieved = requestsRecieved;
+ }
+
+ public User()
+ {
+ }
+
+ public ArrayList getUserTripEntries()
+ {
+ return userTripEntries;
+ }
+
+ public ArrayList getPairUps()
+ {
+ return pairUps;
+ }
+}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/UtilityMethods.java b/app/src/main/java/garbagecollectors/com/snucabpool/UtilityMethods.java
index 675e0e4..eefadb2 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/UtilityMethods.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/UtilityMethods.java
@@ -134,7 +134,7 @@ public static void updateTripList(ArrayList tripEntryList, TripEntry
}
}
- tripEntryList.add(tripEntry);
+ tripEntryList.add(0, tripEntry);
}
public static void updateUserList(ArrayList userList, User user)
@@ -155,42 +155,43 @@ public static void updateUserList(ArrayList userList, User user)
userList.add(user);
}
- public static ArrayList populateRecievedRequestsList(HashMap> recievedRequestsMap, ArrayList tripEntries)
+ public static Task populateRecievedRequestsList(ArrayList recievedRequestsList, HashMap> recievedRequestsMap, ArrayList tripEntries)
{
final TripEntry[] temp = new TripEntry[1];
- ArrayList recievedRequestsList = new ArrayList<>();
-
- for (Map.Entry> entry : recievedRequestsMap.entrySet())
+ Task userTask = accessUserDatabase(); //the user that created the clicked tripEntry
+ userTask.addOnSuccessListener(aVoid ->
{
- if(!entry.getKey().equals("dummy"))
- {
- TripEntry tripEntry = getTripEntryFromList(entry.getKey(), tripEntries);
+ DataSnapshot snapshot = (DataSnapshot) userTask.getResult();
- if(tripEntry != null)
+ for (Map.Entry> entry : recievedRequestsMap.entrySet())
+ {
+ if (!(entry.getKey().equals("dummy")))
{
- for(String userId : entry.getValue())
+ TripEntry tripEntry = getTripEntryFromList(entry.getKey(), tripEntries);
+
+ if (tripEntry != null)
{
- final User[] user = new User[1];
- Task userTask = accessUserDatabase(); //the user that created the clicked tripEntry
- userTask.addOnSuccessListener(aVoid ->
+ for (String userId : entry.getValue())
{
- DataSnapshot snapshot = (DataSnapshot) userTask.getResult();
-
+ final User[] user = new User[1];
user[0] = snapshot.child(userId).getValue(User.class);
- temp[0] = new TripEntry(tripEntry);
- temp[0].setName(user[0].getName());
- temp[0].setUser_id(user[0].getUserId());
+ if(user[0] != null)
+ {
+ temp[0] = new TripEntry(tripEntry);
+ temp[0].setName(user[0].getName());
+ temp[0].setUser_id(user[0].getUserId());
- recievedRequestsList.add(temp[0]);
- });
+ recievedRequestsList.add(temp[0]);
+ }
+ }
}
}
}
- }
+ });
- return recievedRequestsList;
+ return userTask;
}
private static TripEntry getTripEntryFromList(String key, ArrayList tripEntries)
@@ -267,10 +268,9 @@ public static void removeFromMap(HashMap> map, String
map.remove(keyToBeRemoved);
}
- public static boolean addPairUpInList(ArrayList pairUps, PairUp pairUp, String tripEntryId)
+ public static boolean addPairUpInList(ArrayList pairUps, PairUp pairUp)
{
- boolean flag = false, flag1 = false;
- PairUp temp = new PairUp();
+ boolean flag = false;
for (PairUp pu: pairUps)
{
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/BaseActivity.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/BaseActivity.java
index ec58693..83609ee 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/BaseActivity.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/BaseActivity.java
@@ -11,6 +11,7 @@
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
+import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
@@ -36,9 +37,9 @@ public abstract class BaseActivity extends AppCompatActivity implements BottomNa
protected static DatabaseReference entryDatabaseReference = FirebaseDatabase.getInstance().getReference("entries");
protected static DatabaseReference pairUpDatabaseReference = FirebaseDatabase.getInstance().getReference("pairUps");
- static User finalCurrentUser;
+ protected static User finalCurrentUser;
- static ArrayList tripEntryList = SplashActivity.getTripEntryList();
+ protected static ArrayList tripEntryList = SplashActivity.getTripEntryList();
@Override
protected void onCreate(Bundle savedInstanceState)
@@ -48,26 +49,47 @@ protected void onCreate(Bundle savedInstanceState)
mAuth = FirebaseAuth.getInstance();
currentUser = mAuth.getCurrentUser();
-
- entryDatabaseReference.addValueEventListener(new ValueEventListener()
+
+ entryDatabaseReference.addChildEventListener(new ChildEventListener()
{
@Override
- public void onDataChange(DataSnapshot dataSnapshot)
+ public void onChildAdded(DataSnapshot dataSnapshot, String s)
{
- // This method is called once with the initial value and again
- // whenever data at this location is updated.
- for(DataSnapshot dataSnapshot1 :dataSnapshot.getChildren())
- {
- TripEntry tripEntry = dataSnapshot1.getValue(TripEntry.class);
- UtilityMethods.updateTripList(tripEntryList, tripEntry);
- }
+ TripEntry tripEntry = dataSnapshot.getValue(TripEntry.class);
+ UtilityMethods.updateTripList(tripEntryList, tripEntry);
+
+ HomeActivity.updateRecycleAdapter();
}
@Override
- public void onCancelled(DatabaseError error)
+ public void onChildChanged(DataSnapshot dataSnapshot, String s)
+ {
+ TripEntry tripEntry = dataSnapshot.getValue(TripEntry.class);
+ UtilityMethods.updateTripList(tripEntryList, tripEntry);
+
+ HomeActivity.updateRecycleAdapter();
+ }
+
+ @Override
+ public void onChildRemoved(DataSnapshot dataSnapshot)
+ {
+ TripEntry tripEntry = dataSnapshot.getValue(TripEntry.class);
+ UtilityMethods.removeFromList(tripEntryList, tripEntry.getEntry_id());
+
+ HomeActivity.updateRecycleAdapter();
+ }
+
+ @Override
+ public void onChildMoved(DataSnapshot dataSnapshot, String s)
+ {
+ //IDK
+ }
+
+ @Override
+ public void onCancelled(DatabaseError databaseError)
{
// Failed to read value
- Log.w("Hello", "Failed to read value.", error.toException());
+ Log.w("Hello", "Failed to read value.", databaseError.toException());
}
});
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/HomeActivity.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/HomeActivity.java
index bb75ad2..01a45a6 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/HomeActivity.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/HomeActivity.java
@@ -1,32 +1,28 @@
package garbagecollectors.com.snucabpool.activities;
-import android.app.SearchManager;
-import android.content.Context;
import android.content.Intent;
-import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.RequiresApi;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
-import android.support.v7.widget.SearchView;
-import android.view.Menu;
import android.widget.Button;
import java.text.ParseException;
import garbagecollectors.com.snucabpool.R;
+import garbagecollectors.com.snucabpool.Sorting_Filtering;
import garbagecollectors.com.snucabpool.TripEntry;
import garbagecollectors.com.snucabpool.adapters.HomeActivityTEA;
public class HomeActivity extends BaseActivity
{
RecyclerView recycle;
+ Button signOutButton;
+ static HomeActivityTEA recyclerAdapter;
- Button viewButton, signOutButton;
+ Sorting_Filtering sf = new Sorting_Filtering();
- @RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState)
{
@@ -36,20 +32,15 @@ protected void onCreate(Bundle savedInstanceState)
navigationView = (BottomNavigationView) findViewById(R.id.navigation);
navigationView.setOnNavigationItemSelectedListener(this);
- viewButton = (Button) findViewById(R.id.viewButtonHome);
signOutButton = (Button) findViewById(R.id.sign_out_button);
recycle = (RecyclerView) findViewById(R.id.recycle);
- viewButton.setOnClickListener(v ->
- {
- HomeActivityTEA recyclerAdapter = new HomeActivityTEA(tripEntryList,HomeActivity.this);
- RecyclerView.LayoutManager layoutManager = new GridLayoutManager(HomeActivity.this,1);
-
- recycle.setLayoutManager(layoutManager);
- recycle.setItemAnimator( new DefaultItemAnimator());
- recycle.setAdapter(recyclerAdapter);
+ recyclerAdapter = new HomeActivityTEA(tripEntryList,HomeActivity.this);
+ RecyclerView.LayoutManager layoutManager = new GridLayoutManager(HomeActivity.this,1);
- });
+ recycle.setLayoutManager(layoutManager);
+ recycle.setItemAnimator( new DefaultItemAnimator());
+ recycle.setAdapter(recyclerAdapter);
signOutButton.setOnClickListener(v ->
{
@@ -60,6 +51,23 @@ protected void onCreate(Bundle savedInstanceState)
}
+ void setLambdaMapForAllEntries() throws ParseException
+ {
+ try
+ {
+ for(TripEntry e_user: finalCurrentUser.getUserTripEntries())
+ {
+ for(TripEntry e : tripEntryList)
+ {
+ e_user.lambdaMap.put(e.getEntry_id(), sf.calc_lambda(e_user, e));
+ }
+ }
+
+ }catch (NullPointerException ignored)
+ { }
+
+ }
+
@Override
protected int getNavigationMenuItemId()
{
@@ -71,4 +79,8 @@ protected int getContentViewId()
return R.layout.activity_home;
}
+ public static void updateRecycleAdapter()
+ {
+ recyclerAdapter.notifyDataSetChanged();
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/LoginActivity.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/LoginActivity.java
index 559476f..ba96e54 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/LoginActivity.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/LoginActivity.java
@@ -228,6 +228,7 @@ public void onCancelled(DatabaseError databaseError)
updateUI(user);
}
+
});
}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/NewEntryActivity.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/NewEntryActivity.java
index f2a4604..f17fe2a 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/NewEntryActivity.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/NewEntryActivity.java
@@ -1,280 +1,281 @@
-package garbagecollectors.com.snucabpool.activities;
-
-import android.app.DialogFragment;
-import android.app.TimePickerDialog;
-import android.app.TimePickerDialog.OnTimeSetListener;
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.design.widget.BottomNavigationView;
-import android.util.Log;
-import android.view.View;
-import android.widget.Button;
-import android.widget.TextView;
-import android.widget.TimePicker;
-import android.widget.Toast;
-
-import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
-import com.google.android.gms.common.GooglePlayServicesRepairableException;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.location.places.Place;
-import com.google.android.gms.location.places.ui.PlaceAutocomplete;
-import com.google.android.gms.maps.model.LatLng;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-
-import garbagecollectors.com.snucabpool.DatePickerFragment;
-import garbagecollectors.com.snucabpool.GenLocation;
-import garbagecollectors.com.snucabpool.R;
-import garbagecollectors.com.snucabpool.TripEntry;
-
-public class NewEntryActivity extends BaseActivity
-{
-
- GenLocation source, destination;
- String time, sourceSet, destinationSet;
- String AM_PM ;
- Button buttonstartSetDialog,buttonChangeDate, buttonFinalSave;
- TextView text_source,text_destination,text_time;
-
- public static String date;
-
- private HashMap map = new HashMap<>(); //HashMap contains entry_id(Long value) and lambda(Float value)
-
- TimePickerDialog timePickerDialog;
-
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_new_entry);
-
- source = null;
- destination = null;
-
- time = "";
-
- navigationView = (BottomNavigationView) findViewById(R.id.navigation);
- navigationView.setOnNavigationItemSelectedListener(this);
-
- text_source = (TextView)findViewById(R.id.searched_source);//Check
- text_source.setText("Select Pickup Point");
- text_destination = (TextView)findViewById(R.id.searched_destination);
- text_destination.setText("Select Drop Location");
- text_time = (TextView)findViewById(R.id.searched_time);
-
- buttonChangeDate = (Button)findViewById(R.id.SetTime);
-
- buttonChangeDate.setOnClickListener(v -> openTimePickerDialog(false));
-
- buttonstartSetDialog = (Button)findViewById(R.id.btnChangeDate);
- buttonstartSetDialog.setOnClickListener(v ->
- {
- DialogFragment newFragment = new DatePickerFragment();
- newFragment.show(getFragmentManager(),"Date Picker");
- });
-
- buttonFinalSave = (Button)findViewById(R.id.finalSave);
- buttonFinalSave.setOnClickListener(v ->
- {
- try
- {
- finalSave(v);
- } catch (ParseException e)
- {
- e.printStackTrace();
- }
- });
- }
-
- private void openTimePickerDialog(boolean is24r)
- {
- Calendar calendar = Calendar.getInstance();
-
- timePickerDialog = new TimePickerDialog(
- NewEntryActivity.this,
- onTimeSetListener,
- calendar.get(Calendar.HOUR_OF_DAY),
- calendar.get(Calendar.MINUTE),
- is24r);
- timePickerDialog.setTitle("Choose Time");
- timePickerDialog.show();
-
- }
-
- OnTimeSetListener onTimeSetListener
- = new OnTimeSetListener()
- {
- @Override
- public void onTimeSet(TimePicker view, int hourOfDay, int minute)
- {
- Calendar calNow = Calendar.getInstance();
- Calendar calSet = (Calendar) calNow.clone();
-
- calSet.set(Calendar.HOUR_OF_DAY, hourOfDay);
- calSet.set(Calendar.MINUTE, minute);
- int HourOfDay=calSet.get(Calendar.HOUR_OF_DAY);
- String minOfDay= String.valueOf(calSet.get(Calendar.MINUTE));
- if(minOfDay.length()==1){
- minOfDay="0"+minOfDay;
- }
-
- if(hourOfDay < 12)
- AM_PM = "AM";
- else
- AM_PM = "PM";
-
- time=HourOfDay+":"+minOfDay+" "+AM_PM;
- text_time.setText(time);
- }
- };
-
- public void findSource(View view)
- {
- try
- {
- Intent intent =
- new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
- .build(this);
- startActivityForResult(intent, 1);
-
- } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e)
- {
- Toast.makeText(this, "Google Play Service Error!", Toast.LENGTH_SHORT).show();
- }
-
- }
-
- // A place has been received; use requestCode to track the request.
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data)
- {
- if (resultCode == RESULT_OK)
- {
- Place place = PlaceAutocomplete.getPlace(this, data);
- Log.e("Tag", "Place: " + place.getAddress() + place.getPhoneNumber());
- LatLng latLng;
- switch (requestCode)
- {
-
- case 1:
- latLng = place.getLatLng();
- source = new GenLocation(place.getName().toString(), place.getAddress().toString(), latLng.latitude, latLng.longitude);//check
-
- sourceSet = (place.getName() + ",\n" +
- place.getAddress() + "\n" + place.getPhoneNumber());//check
- text_source.setText(sourceSet);
- break;
- case 2:
- latLng = place.getLatLng();
- destination = new GenLocation(place.getName().toString(), place.getAddress().toString(), latLng.latitude, latLng.longitude);//check
-
- destinationSet = (place.getName() + ",\n" +
- place.getAddress() + "\n" + place.getPhoneNumber());//check
- text_destination.setText(destinationSet);
- break;
- }
- } else if (resultCode == PlaceAutocomplete.RESULT_ERROR)
- {
- Status status = PlaceAutocomplete.getStatus(this, data);
- // TODO: Handle the error.
- Log.e("Tag", status.getStatusMessage());
-
- } else if (resultCode == RESULT_CANCELED)
- {
- // The user canceled the operation.
- }
- }
-
- public void findDestination(View view)
- {
- try
- {
- Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
- .build(this);
- startActivityForResult(intent, 2);
- } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e)
- {
- Toast.makeText(this, "Google Play Service Error!", Toast.LENGTH_SHORT).show();
- }
- }
-
- public void finalSave(View view) throws ParseException
- {
- switch (checkInvalidEntry())
- {
- case 0:
- String entryId = entryDatabaseReference.push().getKey();
- String name= currentUser.getDisplayName();
-
- TripEntry tripEntry = new TripEntry(name,entryId, currentUser.getUid(), time, date, source, destination, null);
-
- finalCurrentUser.getUserTripEntries().add(tripEntry);
-
- entryDatabaseReference.child(entryId).setValue(tripEntry);
-
- userDatabaseReference.child(finalCurrentUser.getUserId()).child("userTripEntries").setValue(finalCurrentUser.getUserTripEntries());
-
- Toast.makeText(this, "TripEntry created!", Toast.LENGTH_SHORT).show();
-
- finish();
- startActivity(new Intent(this, HomeActivity.class));
- break;
-
- case 1:
- Toast.makeText(this, "The pickup point and drop location can't be the same, silly!", Toast.LENGTH_SHORT).show();
- break;
-
- case 2:
- Toast.makeText(this, "The devs are still working on time travel...", Toast.LENGTH_SHORT).show();
- break;
-
- case 3:
- Toast.makeText(this, "Fill in all the details!", Toast.LENGTH_SHORT).show();
- break;
-
- }
- }
-
- private int checkInvalidEntry() throws ParseException
- {
- int flag = 0;
-
- SimpleDateFormat parser = new SimpleDateFormat("dd/MM/yyyy.HH:mm");
- Date currentTime = new Date();
- Date inputTime = null;
-
- if(date!=null)
- inputTime = parser.parse(date + "." + time);
-
- if((time.isEmpty()||source == null||destination == null))
- flag = 3;
-
- else if((source.getLatitude().compareTo(destination.getLatitude()) == 0) && (source.getLongitude().compareTo(destination.getLongitude()) == 0))
- flag = 1;
-
- else if(date == null)
- flag = 2;
-
- else if(inputTime.before(currentTime))
- flag = 2;
-
- return flag;
- }
-
- @Override
- protected int getContentViewId()
- {
- return R.layout.activity_new_entry;
- }
-
- @Override
- protected int getNavigationMenuItemId()
- {
- return R.id.navigation_newEntry;
- }
-
-}
+package garbagecollectors.com.snucabpool.activities;
+
+import android.app.DialogFragment;
+import android.app.TimePickerDialog;
+import android.app.TimePickerDialog.OnTimeSetListener;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.design.widget.BottomNavigationView;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.TimePicker;
+import android.widget.Toast;
+
+import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
+import com.google.android.gms.common.GooglePlayServicesRepairableException;
+import com.google.android.gms.common.api.Status;
+import com.google.android.gms.location.places.Place;
+import com.google.android.gms.location.places.ui.PlaceAutocomplete;
+import com.google.android.gms.maps.model.LatLng;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+
+import garbagecollectors.com.snucabpool.DatePickerFragment;
+import garbagecollectors.com.snucabpool.GenLocation;
+import garbagecollectors.com.snucabpool.R;
+import garbagecollectors.com.snucabpool.TripEntry;
+
+public class NewEntryActivity extends BaseActivity
+{
+
+ GenLocation source, destination;
+ String time, sourceSet, destinationSet;
+ String AM_PM ;
+ Button buttonstartSetDialog,buttonChangeDate, buttonFinalSave;
+ TextView text_source,text_destination,text_time;
+
+ public static String date;
+
+ private HashMap map = new HashMap<>(); //HashMap contains entry_id(Long value) and lambda(Float value)
+
+ TimePickerDialog timePickerDialog;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_new_entry);
+
+ source = null;
+ destination = null;
+
+ time = "";
+
+ navigationView = (BottomNavigationView) findViewById(R.id.navigation);
+ navigationView.setOnNavigationItemSelectedListener(this);
+
+ text_source = (TextView)findViewById(R.id.searched_source);//Check
+ text_source.setText("Select Pickup Point");
+ text_destination = (TextView)findViewById(R.id.searched_destination);
+ text_destination.setText("Select Drop Location");
+ text_time = (TextView)findViewById(R.id.searched_time);
+
+ buttonChangeDate = (Button)findViewById(R.id.SetTime);
+
+ buttonChangeDate.setOnClickListener(v -> openTimePickerDialog(false));
+
+ buttonstartSetDialog = (Button)findViewById(R.id.btnChangeDate);
+ buttonstartSetDialog.setOnClickListener(v ->
+ {
+ DialogFragment newFragment = new DatePickerFragment();
+ newFragment.show(getFragmentManager(),"Date Picker");
+ });
+
+ buttonFinalSave = (Button)findViewById(R.id.finalSave);
+ buttonFinalSave.setOnClickListener(v ->
+ {
+ try
+ {
+ finalSave(v);
+ } catch (ParseException e)
+ {
+ e.printStackTrace();
+ }
+ });
+ }
+
+ private void openTimePickerDialog(boolean is24r)
+ {
+ Calendar calendar = Calendar.getInstance();
+
+ timePickerDialog = new TimePickerDialog(
+ NewEntryActivity.this,
+ onTimeSetListener,
+ calendar.get(Calendar.HOUR_OF_DAY),
+ calendar.get(Calendar.MINUTE),
+ is24r);
+ timePickerDialog.setTitle("Choose Time");
+ timePickerDialog.show();
+
+ }
+
+ OnTimeSetListener onTimeSetListener
+ = new OnTimeSetListener()
+ {
+ @Override
+ public void onTimeSet(TimePicker view, int hourOfDay, int minute)
+ {
+ Calendar calNow = Calendar.getInstance();
+ Calendar calSet = (Calendar) calNow.clone();
+
+ calSet.set(Calendar.HOUR_OF_DAY, hourOfDay);
+ calSet.set(Calendar.MINUTE, minute);
+ int HourOfDay=calSet.get(Calendar.HOUR_OF_DAY);
+ String minOfDay= String.valueOf(calSet.get(Calendar.MINUTE));
+ if(minOfDay.length()==1){
+ minOfDay="0"+minOfDay;
+ }
+
+ if(hourOfDay < 12)
+ AM_PM = "AM";
+ else
+ AM_PM = "PM";
+
+ time=HourOfDay+":"+minOfDay+" "+AM_PM;
+ text_time.setText(time);
+ }
+ };
+
+ public void findSource(View view)
+ {
+ try
+ {
+ Intent intent =
+ new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
+ .build(this);
+ startActivityForResult(intent, 1);
+
+ } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e)
+ {
+ Toast.makeText(this, "Google Play Service Error!", Toast.LENGTH_SHORT).show();
+ }
+
+ }
+
+ // A place has been received; use requestCode to track the request.
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data)
+ {
+ if (resultCode == RESULT_OK)
+ {
+ Place place = PlaceAutocomplete.getPlace(this, data);
+ Log.e("Tag", "Place: " + place.getAddress() + place.getPhoneNumber());
+ LatLng latLng;
+ switch (requestCode)
+ {
+
+ case 1:
+ latLng = place.getLatLng();
+ source = new GenLocation(place.getName().toString(), place.getAddress().toString(), latLng.latitude, latLng.longitude);//check
+
+ sourceSet = (place.getName() + ",\n" +
+ place.getAddress() + "\n" + place.getPhoneNumber());//check
+ text_source.setText(sourceSet);
+ break;
+ case 2:
+ latLng = place.getLatLng();
+ destination = new GenLocation(place.getName().toString(), place.getAddress().toString(), latLng.latitude, latLng.longitude);//check
+
+ destinationSet = (place.getName() + ",\n" +
+ place.getAddress() + "\n" + place.getPhoneNumber());//check
+ text_destination.setText(destinationSet);
+ break;
+ }
+ } else if (resultCode == PlaceAutocomplete.RESULT_ERROR)
+ {
+ Status status = PlaceAutocomplete.getStatus(this, data);
+ // TODO: Handle the error.
+ Log.e("Tag", status.getStatusMessage());
+
+ } else if (resultCode == RESULT_CANCELED)
+ {
+ // The user canceled the operation.
+ }
+ }
+
+ public void findDestination(View view)
+ {
+ try
+ {
+ Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN)
+ .build(this);
+ startActivityForResult(intent, 2);
+ } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e)
+ {
+ Toast.makeText(this, "Google Play Service Error!", Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ public void finalSave(View view) throws ParseException
+ {
+ switch (checkInvalidEntry())
+ {
+ case 0:
+ String entryId = entryDatabaseReference.push().getKey();
+ String name= currentUser.getDisplayName();
+
+ //initialise lambda map for this tripEntry here!!!
+ TripEntry tripEntry = new TripEntry(name,entryId, currentUser.getUid(), time, date, source, destination, null);
+
+ finalCurrentUser.getUserTripEntries().add(tripEntry);
+
+ entryDatabaseReference.child(entryId).setValue(tripEntry);
+
+ userDatabaseReference.child(finalCurrentUser.getUserId()).child("userTripEntries").setValue(finalCurrentUser.getUserTripEntries());
+
+ Toast.makeText(this, "TripEntry created!", Toast.LENGTH_SHORT).show();
+
+ finish();
+ startActivity(new Intent(this, HomeActivity.class));
+ break;
+
+ case 1:
+ Toast.makeText(this, "The pickup point and drop location can't be the same, silly!", Toast.LENGTH_SHORT).show();
+ break;
+
+ case 2:
+ Toast.makeText(this, "The devs are still working on time travel...", Toast.LENGTH_SHORT).show();
+ break;
+
+ case 3:
+ Toast.makeText(this, "Fill in all the details!", Toast.LENGTH_SHORT).show();
+ break;
+
+ }
+ }
+
+ private int checkInvalidEntry() throws ParseException
+ {
+ int flag = 0;
+
+ SimpleDateFormat parser = new SimpleDateFormat("dd/MM/yyyy.HH:mm");
+ Date currentTime = new Date();
+ Date inputTime = null;
+
+ if(date!=null)
+ inputTime = parser.parse(date + "." + time);
+
+ if((time.isEmpty()||source == null||destination == null))
+ flag = 3;
+
+ else if((source.getLatitude().compareTo(destination.getLatitude()) == 0) && (source.getLongitude().compareTo(destination.getLongitude()) == 0))
+ flag = 1;
+
+ else if(date == null)
+ flag = 2;
+
+ else if(inputTime.before(currentTime))
+ flag = 2;
+
+ return flag;
+ }
+
+ @Override
+ protected int getContentViewId()
+ {
+ return R.layout.activity_new_entry;
+ }
+
+ @Override
+ protected int getNavigationMenuItemId()
+ {
+ return R.id.navigation_newEntry;
+ }
+
+}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/ChatFragment.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/ChatFragment.java
index ca01400..6833044 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/ChatFragment.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/ChatFragment.java
@@ -16,8 +16,10 @@ public ChatFragment()
}
@Override
- public void onCreate(Bundle savedInstanceState) {
+ public void onCreate(Bundle savedInstanceState)
+ {
super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
}
@Override
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/RecievedRequestsFragment.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/RecievedRequestsFragment.java
index 570f9c6..283c383 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/RecievedRequestsFragment.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/RecievedRequestsFragment.java
@@ -11,6 +11,9 @@
import android.view.ViewGroup;
import android.widget.Button;
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.android.gms.tasks.Task;
+
import java.util.ArrayList;
import java.util.HashMap;
@@ -20,16 +23,15 @@
import garbagecollectors.com.snucabpool.UtilityMethods;
import garbagecollectors.com.snucabpool.activities.HomeActivity;
import garbagecollectors.com.snucabpool.adapters.RecievedRequestsTEA;
-import garbagecollectors.com.snucabpool.adapters.SentRequestsTEA;
public class RecievedRequestsFragment extends Fragment
{
RecyclerView recycle;
- Button viewRecievedRequestsButton;
+ static RecievedRequestsTEA recyclerAdapter;
User user;
HashMap> recievedRequestsMap;
- ArrayList recievedRequestsList;
+ static ArrayList recievedRequestsList;
ArrayList tripEntries;
@@ -42,6 +44,7 @@ public RecievedRequestsFragment()
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
}
@Override
@@ -55,43 +58,39 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
alertDialogBuilder.setTitle("Confirm");
alertDialogBuilder.setMessage("Are you sure you want to accept?");
- user = HomeActivity.getFinalCurrentUser();
+ user = RequestActivity.getFinalCurrentUser();
+
recievedRequestsMap = user.getRequestsRecieved();
tripEntries = HomeActivity.getTripEntryList();
- recievedRequestsList = UtilityMethods.populateRecievedRequestsList(recievedRequestsMap, tripEntries);
+ recievedRequestsList = new ArrayList<>();
+ Task task = UtilityMethods.populateRecievedRequestsList(recievedRequestsList, recievedRequestsMap, tripEntries);
recycle = (RecyclerView) view.findViewById(R.id.recycle_requests);
- viewRecievedRequestsButton = (Button) view.findViewById(R.id.viewButtonRecievedRequests);
-
- viewRecievedRequestsButton.setOnClickListener(v ->
- {
- if(recievedRequestsList.size() >= 1)
- {
- RecievedRequestsTEA recyclerAdapter = new RecievedRequestsTEA(recievedRequestsList, getContext());
-
- RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(),1);
-
- recycle.setLayoutManager(layoutManager);
- recycle.setItemAnimator( new DefaultItemAnimator());
- recycle.setAdapter(recyclerAdapter);
- }
- });
-
- if(recievedRequestsList.size() >= 1)
+ task.addOnSuccessListener(o ->
{
- RecievedRequestsTEA recyclerAdapter = new RecievedRequestsTEA(recievedRequestsList, getContext());
+ recyclerAdapter = new RecievedRequestsTEA(recievedRequestsList, getContext());
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(),1);
recycle.setLayoutManager(layoutManager);
recycle.setItemAnimator( new DefaultItemAnimator());
recycle.setAdapter(recyclerAdapter);
- }
+ });
return view;
}
+ public static ArrayList getRecievedRequestsList()
+ {
+ return recievedRequestsList;
+ }
+
+ public static void refreshRecycler()
+ {
+ if(recyclerAdapter != null)
+ recyclerAdapter.notifyDataSetChanged();
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/RequestActivity.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/RequestActivity.java
index ae2b822..faf069d 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/RequestActivity.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/RequestActivity.java
@@ -1,6 +1,5 @@
package garbagecollectors.com.snucabpool.activities.RequestActivity;
-import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.BottomNavigationView;
import android.support.design.widget.TabLayout;
@@ -8,101 +7,218 @@
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ProgressBar;
+
+import com.google.android.gms.tasks.Task;
+import com.google.android.gms.tasks.TaskCompletionSource;
+import com.google.android.gms.tasks.Tasks;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.List;
import garbagecollectors.com.snucabpool.R;
+import garbagecollectors.com.snucabpool.TripEntry;
+import garbagecollectors.com.snucabpool.UtilityMethods;
import garbagecollectors.com.snucabpool.activities.BaseActivity;
public class RequestActivity extends BaseActivity
{
- private TabLayout tabLayout;
- private ViewPager viewPager;
-
- private static boolean refresh = false;
-
- @Override
- protected void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_request);
-
- navigationView = (BottomNavigationView) findViewById(R.id.navigation);
- navigationView.setOnNavigationItemSelectedListener(this);
-
- viewPager = (ViewPager) findViewById(R.id.viewpager);
- setupViewPager(viewPager);
-
- tabLayout = (TabLayout) findViewById(R.id.tabs);
- tabLayout.setupWithViewPager(viewPager);
- }
-
- private void setupViewPager(ViewPager viewPager)
- {
- ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
- adapter.addFragment(new SentRequestsFragment(), "Sent");
- adapter.addFragment(new RecievedRequestsFragment(), "Recieved");
- adapter.addFragment(new ChatFragment(), "Chat");
- viewPager.setAdapter(adapter);
- }
-
- class ViewPagerAdapter extends FragmentPagerAdapter
- {
- private final List mFragmentList = new ArrayList<>();
- private final List mFragmentTitleList = new ArrayList<>();
-
- public ViewPagerAdapter(FragmentManager manager)
- {
- super(manager);
- }
-
- @Override
- public Fragment getItem(int position)
- {
- return mFragmentList.get(position);
- }
-
- @Override
- public int getCount()
- {
- return mFragmentList.size();
- }
-
- public void addFragment(Fragment fragment, String title)
- {
- mFragmentList.add(fragment);
- mFragmentTitleList.add(title);
- }
-
- @Override
- public CharSequence getPageTitle(int position)
- {
- return mFragmentTitleList.get(position);
- }
- }
-
- public boolean isRefresh()
- {
- return refresh;
- }
-
- public void setRefresh(boolean refresh)
- {
- RequestActivity.refresh = refresh;
-
- finish();
- Intent intent = new Intent(RequestActivity.this, RequestActivity.class);
- startActivity(intent);
- }
-
- @Override
- protected int getContentViewId() {
- return R.layout.activity_request;
- }
-
- @Override
- protected int getNavigationMenuItemId() {
- return R.id.navigation_requests;
- }
+ private TabLayout tabLayout;
+ private ViewPager viewPager;
+
+ static ProgressBar progressBar;
+
+ static DatabaseReference sentRequestsDatabaseReference = FirebaseDatabase.getInstance().getReference("users/" + finalCurrentUser.getUserId() + "/requestSent");
+ static DatabaseReference recievedRequestsDatabaseReference = FirebaseDatabase.getInstance().getReference("users/" + finalCurrentUser.getUserId() + "/requestsRecieved");
+
+ static TaskCompletionSource sentRequestsSource;
+ static TaskCompletionSource recievedRequestsSource;
+
+ static Task sentRequestsDBTask;
+ static Task recievedRequestsDBTask;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_request);
+
+ navigationView = (BottomNavigationView) findViewById(R.id.navigation);
+ navigationView.setOnNavigationItemSelectedListener(this);
+
+ viewPager = (ViewPager) findViewById(R.id.viewpager);
+ setupViewPager(viewPager);
+
+ tabLayout = (TabLayout) findViewById(R.id.tabs);
+ tabLayout.setupWithViewPager(viewPager);
+
+ progressBar = (ProgressBar) findViewById(R.id.requests_progressBar);
+ progressBar.setVisibility(View.INVISIBLE);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu)
+ {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.menu_requests, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ switch (item.getItemId())
+ {
+ // action with ID action_refresh was selected
+ case R.id.action_refresh:
+ refreshRequests();
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+ }
+
+ public static void refreshRequests()
+ {
+ progressBar.setVisibility(View.VISIBLE);
+
+ sentRequestsSource = new TaskCompletionSource<>();
+ recievedRequestsSource = new TaskCompletionSource<>();
+
+ sentRequestsDBTask = sentRequestsSource.getTask();
+ recievedRequestsDBTask = recievedRequestsSource.getTask();
+
+ sentRequestsDatabaseReference.addListenerForSingleValueEvent(new ValueEventListener()
+ {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot)
+ {
+ sentRequestsSource.setResult(dataSnapshot);
+ }
+
+ @Override
+ public void onCancelled(DatabaseError databaseError)
+ {
+ sentRequestsSource.setException(databaseError.toException());
+ }
+ });
+
+ recievedRequestsDatabaseReference.addListenerForSingleValueEvent(new ValueEventListener()
+ {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot)
+ {
+ recievedRequestsSource.setResult(dataSnapshot);
+ }
+
+ @Override
+ public void onCancelled(DatabaseError databaseError)
+ {
+ recievedRequestsSource.setException(databaseError.toException());
+ }
+ });
+
+ Task allTask = Tasks.whenAll(sentRequestsDBTask, recievedRequestsDBTask);
+ allTask.addOnSuccessListener((Void aVoid) ->
+ {
+ finalCurrentUser.getRequestSent().clear();
+ finalCurrentUser.getRequestsRecieved().clear();
+
+ RecievedRequestsFragment.getRecievedRequestsList().clear();
+
+ DataSnapshot sentRequestsData = sentRequestsDBTask.getResult();
+ DataSnapshot recievedRequestsData = recievedRequestsDBTask.getResult();
+
+ for (DataSnapshot ds : sentRequestsData.getChildren())
+ finalCurrentUser.getRequestSent().add(ds.getValue(TripEntry.class));
+
+ ArrayList userIdList = new ArrayList<>();
+
+ for (DataSnapshot dataSnapshot : recievedRequestsData.getChildren())
+ {
+ for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren())
+ userIdList.add(dataSnapshot1.getValue(String.class));
+
+ finalCurrentUser.getRequestsRecieved().put(dataSnapshot.getKey(), userIdList);
+ }
+
+ Task task = UtilityMethods.populateRecievedRequestsList(RecievedRequestsFragment.getRecievedRequestsList(), finalCurrentUser.getRequestsRecieved(), tripEntryList);
+
+ task.addOnSuccessListener(o ->
+ {
+ RecievedRequestsFragment.refreshRecycler();
+ SentRequestsFragment.refreshRecycler();
+
+ progressBar.setVisibility(View.INVISIBLE);
+ });
+ });
+ }
+
+ private void setupViewPager(ViewPager viewPager)
+ {
+ ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
+ adapter.addFragment(new SentRequestsFragment(), "Sent");
+ adapter.addFragment(new RecievedRequestsFragment(), "Recieved");
+ adapter.addFragment(new ChatFragment(), "Chat");
+ viewPager.setAdapter(adapter);
+ }
+
+ class ViewPagerAdapter extends FragmentPagerAdapter
+ {
+ private final List mFragmentList = new ArrayList<>();
+ private final List mFragmentTitleList = new ArrayList<>();
+
+ ViewPagerAdapter(FragmentManager manager)
+ {
+ super(manager);
+ }
+
+ @Override
+ public Fragment getItem(int position)
+ {
+ return mFragmentList.get(position);
+ }
+
+ @Override
+ public int getCount()
+ {
+ return mFragmentList.size();
+ }
+
+ void addFragment(Fragment fragment, String title)
+ {
+ mFragmentList.add(fragment);
+ mFragmentTitleList.add(title);
+ }
+
+ @Override
+ public CharSequence getPageTitle(int position)
+ {
+ return mFragmentTitleList.get(position);
+ }
+ }
+
+ @Override
+ protected int getContentViewId()
+ {
+ return R.layout.activity_request;
+ }
+
+ @Override
+ protected int getNavigationMenuItemId()
+ {
+ return R.id.navigation_requests;
+ }
}
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/SentRequestsFragment.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/SentRequestsFragment.java
index 3edf4ea..97b3ddf 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/SentRequestsFragment.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/RequestActivity/SentRequestsFragment.java
@@ -8,7 +8,6 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.Button;
import java.util.ArrayList;
@@ -16,17 +15,15 @@
import garbagecollectors.com.snucabpool.TripEntry;
import garbagecollectors.com.snucabpool.User;
import garbagecollectors.com.snucabpool.UtilityMethods;
-import garbagecollectors.com.snucabpool.activities.HomeActivity;
-import garbagecollectors.com.snucabpool.adapters.HomeActivityTEA;
import garbagecollectors.com.snucabpool.adapters.SentRequestsTEA;
public class SentRequestsFragment extends Fragment
{
RecyclerView recycle;
- Button viewSentRequestsButton;
+ static SentRequestsTEA recyclerAdapter;
- User user;
- ArrayList sentRequests;
+ static User finalCurrentUser;
+ static ArrayList sentRequests;
public SentRequestsFragment()
{ }
@@ -35,6 +32,7 @@ public SentRequestsFragment()
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
+ setHasOptionsMenu(true);
}
@Override
@@ -44,29 +42,38 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_sent_requests, container, false);
- user = HomeActivity.getFinalCurrentUser();
- sentRequests = user.getRequestSent();
+ finalCurrentUser = RequestActivity.getFinalCurrentUser();
+
+ sentRequests = finalCurrentUser.getRequestSent();
recycle = (RecyclerView) view.findViewById(R.id.recycle_requests);
- viewSentRequestsButton = (Button) view.findViewById(R.id.viewButtonSentRequests);
- viewSentRequestsButton.setOnClickListener(v ->
+ if(sentRequests.size() >= 1)
{
- if(sentRequests.size() >= 1)
- {
- sentRequests = UtilityMethods.removeFromList(sentRequests, "0");
+ sentRequests = UtilityMethods.removeFromList(sentRequests, "0");
- SentRequestsTEA recyclerAdapter = new SentRequestsTEA(sentRequests,getContext());
+ recyclerAdapter = new SentRequestsTEA(sentRequests,getContext());
- RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(),1);
+ RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getContext(),1);
- recycle.setLayoutManager(layoutManager);
- recycle.setItemAnimator( new DefaultItemAnimator());
- recycle.setAdapter(recyclerAdapter);
- }
- });
+ recycle.setLayoutManager(layoutManager);
+ recycle.setItemAnimator( new DefaultItemAnimator());
+ recycle.setAdapter(recyclerAdapter);
+ }
return view;
}
+
+ public static void refreshRecycler()
+ {
+ finalCurrentUser = RequestActivity.getFinalCurrentUser();
+
+ sentRequests = finalCurrentUser.getRequestSent();
+
+ sentRequests = UtilityMethods.removeFromList(sentRequests, "0");
+
+ if(recyclerAdapter != null)
+ recyclerAdapter.notifyDataSetChanged();
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/activities/SplashActivity.java b/app/src/main/java/garbagecollectors/com/snucabpool/activities/SplashActivity.java
index 0abb2cc..3e9ed2a 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/activities/SplashActivity.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/activities/SplashActivity.java
@@ -2,7 +2,6 @@
import android.content.Intent;
import android.os.Bundle;
-import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
@@ -40,9 +39,6 @@ public class SplashActivity extends AppCompatActivity
private TaskCompletionSource EntryDBSource = new TaskCompletionSource<>();
private Task EntryDBTask = EntryDBSource.getTask();
- private TaskCompletionSource delaySource = new TaskCompletionSource<>();
- private Task delayTask = delaySource.getTask();
-
@Override
protected void onCreate(Bundle savedInstanceState)
{
@@ -80,9 +76,7 @@ public void onCancelled(DatabaseError databaseError)
}
});
- new Handler().postDelayed(() -> delaySource.setResult(null), 2000);
-
- Task allTask = Tasks.whenAll(UserDBTask, EntryDBTask, delayTask);
+ Task allTask = Tasks.whenAll(UserDBTask, EntryDBTask);
allTask.addOnSuccessListener(aVoid ->
{
DataSnapshot userData = (DataSnapshot) UserDBTask.getResult();
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/adapters/HomeActivityTEA.java b/app/src/main/java/garbagecollectors/com/snucabpool/adapters/HomeActivityTEA.java
index 543fa8b..1259f4c 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/adapters/HomeActivityTEA.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/adapters/HomeActivityTEA.java
@@ -1,183 +1,157 @@
-//TEA = TripEntryAdapter
-
-package garbagecollectors.com.snucabpool.adapters;
-
-import android.app.ProgressDialog;
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Toast;
-
-import com.google.android.gms.tasks.Task;
-import com.google.android.gms.tasks.Tasks;
-import com.google.firebase.database.DataSnapshot;
-import com.google.firebase.database.DatabaseReference;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import garbagecollectors.com.snucabpool.R;
-import garbagecollectors.com.snucabpool.TripEntry;
-import garbagecollectors.com.snucabpool.User;
-import garbagecollectors.com.snucabpool.UtilityMethods;
-import garbagecollectors.com.snucabpool.activities.BaseActivity;
-
-import static garbagecollectors.com.snucabpool.UtilityMethods.addRequestInList;
-import static garbagecollectors.com.snucabpool.UtilityMethods.accessUserDatabase;
-import static garbagecollectors.com.snucabpool.UtilityMethods.putInMap;
-
-public class HomeActivityTEA extends TripEntryAdapter
-{
- private List list;
- private List listCopy;
- private Context context;
-
- private boolean isRequestAlreadyInMap;
- private Boolean isAlreadyRequested;
-
- ProgressDialog progressDialog;
-
- public HomeActivityTEA(Context context)
- {
- super(context);
- }
-
- public HomeActivityTEA(List list, Context context)
- {
- this.list = list;
- this.context = context;
- }
-
- public HomeActivityTEA()
- {
- listCopy.addAll(list);
- }
- // Create new views (invoked by the layout manager)
- @Override
- public MyHolder onCreateViewHolder(ViewGroup parent, int viewType)
- {
- // create a new view
- View v = LayoutInflater.from(context).inflate(R.layout.card, parent, false);
-
- return new MyHolder(v);
- }
-
- // Replace the contents of a view (invoked by the layout manager)
- @Override
- public void onBindViewHolder(MyHolder holder, int position)
- {
- holder.itemView.setOnClickListener(view ->
- {
- progressDialog = new ProgressDialog(view.getContext());
- progressDialog.setMessage("Please wait...");
-
- User user = BaseActivity.getFinalCurrentUser();
-
- TripEntry tripEntry = list.get(position);
-
- if(tripEntry.getUser_id().equals(user.getUserId()))
- {
- Toast.makeText(view.getContext(), "Can't pool with yourself, that feature isn't ready yet...", Toast.LENGTH_SHORT).show();
- return;
- }
-
- progressDialog.show();
-
- final User[] tripEntryUser = new User[1];
- Task userTask = accessUserDatabase(); //the user that created the clicked tripEntry
- userTask.addOnSuccessListener(aVoid ->
- {
- DataSnapshot snapshot = (DataSnapshot) userTask.getResult();
-
- tripEntryUser[0] = snapshot.child(tripEntry.getUser_id()).getValue(User.class);
-
- DatabaseReference userDatabaseReference = BaseActivity.getUserDatabaseReference();
-
- ArrayList requestSent = user.getRequestSent();
- HashMap> requestsRecieved = tripEntryUser[0].getRequestsRecieved();
-
- isAlreadyRequested = addRequestInList(requestSent, user.getPairUps(), tripEntry);
-
- if(!isAlreadyRequested)
- isRequestAlreadyInMap = putInMap(requestsRecieved, tripEntry.getEntry_id(), user.getUserId());
-
- user.setRequestSent(requestSent);
- tripEntryUser[0].setRequestsRecieved(requestsRecieved);
-
- if(!isAlreadyRequested && !isRequestAlreadyInMap)
- {
- //update firebase database to include arrayList that contains name of the card clicked in requests sent...
- Task task1 = userDatabaseReference.child(user.getUserId()).child("requestSent").setValue(requestSent);
- Task task2 = userDatabaseReference.child(tripEntryUser[0].getUserId()).child("requestsRecieved").setValue(requestsRecieved);
-
- Task allTask = Tasks.whenAll(task1, task2);
- allTask.addOnSuccessListener(bVoid ->
- {
- progressDialog.dismiss();
- Toast.makeText(view.getContext(), "Request Sent!", Toast.LENGTH_LONG).show();
- });
-
- allTask.addOnFailureListener(e ->
- {
- progressDialog.dismiss();
- // apologize profusely to the user!
- Toast.makeText(view.getContext(), "FAIL", Toast.LENGTH_LONG).show();
- });
- }
-
- else
- {
- progressDialog.dismiss();
- Toast.makeText(view.getContext(), "You two are already paired up!", Toast.LENGTH_LONG).show();
- }
-
- });
- });
-
- TripEntry tripEntry = list.get(position);
-
- UtilityMethods.fillHolder(holder, tripEntry);
- }
-
- // Return the size of your dataset (invoked by the layout manager)
- @Override
- public int getItemCount()
- {
- int arr = 0;
-
- try
- {
- if(list.size()==0)
- arr = 0;
- else
- arr = list.size();
-
- }catch (Exception ignored){}
-
- return arr;
- }
-
- public void filter(String text)
- {
- list.clear();
- if(text.isEmpty())
- {
- list.addAll(listCopy);
- }
- else
- {
- text = text.toLowerCase();
- for(TripEntry trip : listCopy)
- {
- if((trip.getSource().toString().toLowerCase().contains(text))||(trip.getDestination().toString().toLowerCase().contains(text)))
- {
- list.add(trip);
- }
- }
- }
- notifyDataSetChanged();
- }
-}
-
+//TEA = TripEntryAdapter
+
+package garbagecollectors.com.snucabpool.adapters;
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Toast;
+
+import com.google.android.gms.tasks.Task;
+import com.google.android.gms.tasks.Tasks;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseReference;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import garbagecollectors.com.snucabpool.R;
+import garbagecollectors.com.snucabpool.TripEntry;
+import garbagecollectors.com.snucabpool.User;
+import garbagecollectors.com.snucabpool.UtilityMethods;
+import garbagecollectors.com.snucabpool.activities.BaseActivity;
+
+import static garbagecollectors.com.snucabpool.UtilityMethods.addRequestInList;
+import static garbagecollectors.com.snucabpool.UtilityMethods.accessUserDatabase;
+import static garbagecollectors.com.snucabpool.UtilityMethods.putInMap;
+
+public class HomeActivityTEA extends TripEntryAdapter
+{
+ private List list;
+ private Context context;
+
+ private boolean isRequestAlreadyInMap;
+ private Boolean isAlreadyRequested;
+
+ ProgressDialog progressDialog;
+
+ public HomeActivityTEA(Context context)
+ {
+ super(context);
+ }
+
+ public HomeActivityTEA(List list, Context context)
+ {
+ this.list = list;
+ this.context = context;
+ }
+
+ // Create new views (invoked by the layout manager)
+ @Override
+ public MyHolder onCreateViewHolder(ViewGroup parent, int viewType)
+ {
+ // create a new view
+ View v = LayoutInflater.from(context).inflate(R.layout.card, parent, false);
+
+ return new MyHolder(v);
+ }
+
+ // Replace the contents of a view (invoked by the layout manager)
+ @Override
+ public void onBindViewHolder(MyHolder holder, int position)
+ {
+ holder.itemView.setOnClickListener(view ->
+ {
+ progressDialog = new ProgressDialog(view.getContext());
+ progressDialog.setMessage("Please wait...");
+
+ User user = BaseActivity.getFinalCurrentUser();
+
+ TripEntry tripEntry = list.get(position);
+
+ if(tripEntry.getUser_id().equals(user.getUserId()))
+ {
+ Toast.makeText(view.getContext(), "Can't pool with yourself, that feature isn't ready yet...", Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ progressDialog.show();
+
+ final User[] tripEntryUser = new User[1];
+ Task userTask = accessUserDatabase(); //the user that created the clicked tripEntry
+ userTask.addOnSuccessListener(aVoid ->
+ {
+ DataSnapshot snapshot = (DataSnapshot) userTask.getResult();
+
+ tripEntryUser[0] = snapshot.child(tripEntry.getUser_id()).getValue(User.class);
+
+ DatabaseReference userDatabaseReference = BaseActivity.getUserDatabaseReference();
+
+ ArrayList requestSent = user.getRequestSent();
+ HashMap> requestsRecieved = tripEntryUser[0].getRequestsRecieved();
+
+ isAlreadyRequested = addRequestInList(requestSent, user.getPairUps(), tripEntry);
+
+ if(!isAlreadyRequested)
+ isRequestAlreadyInMap = putInMap(requestsRecieved, tripEntry.getEntry_id(), user.getUserId());
+
+ user.setRequestSent(requestSent);
+ tripEntryUser[0].setRequestsRecieved(requestsRecieved);
+
+ if(!isAlreadyRequested && !isRequestAlreadyInMap)
+ {
+ //update firebase database to include arrayList that contains name of the card clicked in requests sent...
+ Task task1 = userDatabaseReference.child(user.getUserId()).child("requestSent").setValue(requestSent);
+ Task task2 = userDatabaseReference.child(tripEntryUser[0].getUserId()).child("requestsRecieved").setValue(requestsRecieved);
+
+ Task allTask = Tasks.whenAll(task1, task2);
+ allTask.addOnSuccessListener(bVoid ->
+ {
+ progressDialog.dismiss();
+ Toast.makeText(view.getContext(), "Request Sent!", Toast.LENGTH_LONG).show();
+ });
+
+ allTask.addOnFailureListener(e ->
+ {
+ progressDialog.dismiss();
+ // apologize profusely to the user!
+ Toast.makeText(view.getContext(), "FAIL", Toast.LENGTH_LONG).show();
+ });
+ }
+
+ else
+ {
+ progressDialog.dismiss();
+ Toast.makeText(view.getContext(), "You two are already paired up!", Toast.LENGTH_LONG).show();
+ }
+
+ });
+ });
+
+ TripEntry tripEntry = list.get(position);
+
+ UtilityMethods.fillHolder(holder, tripEntry);
+ }
+
+ // Return the size of your dataset (invoked by the layout manager)
+ @Override
+ public int getItemCount()
+ {
+ int arr = 0;
+
+ try
+ {
+ if(list.size()==0)
+ arr = 0;
+ else
+ arr = list.size();
+
+ }catch (Exception ignored){}
+
+ return arr;
+ }
+}
+
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/adapters/RecievedRequestsTEA.java b/app/src/main/java/garbagecollectors/com/snucabpool/adapters/RecievedRequestsTEA.java
index e71e540..19f1830 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/adapters/RecievedRequestsTEA.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/adapters/RecievedRequestsTEA.java
@@ -79,7 +79,7 @@ public void onBindViewHolder(MyHolder holder, int position)
ArrayList currentUserPairUps = finalCurrentUser.getPairUps();
- HashMap> recievedRequests = finalCurrentUser.getRequestsRecieved();
+ HashMap> finalCurrentUserRecievedRequests = finalCurrentUser.getRequestsRecieved();
RecievedRequestsFragment.alertDialogBuilder.setPositiveButton("YES", (dialog, which) ->
{
@@ -94,27 +94,29 @@ public void onBindViewHolder(MyHolder holder, int position)
tripEntryUser[0] = snapshot.child(tripEntry.getUser_id()).getValue(User.class);
ArrayList tripEntryUserPairUps = tripEntryUser[0].getPairUps();
- ArrayList sentRequests = tripEntryUser[0].getRequestSent();
+ ArrayList tripEntryUserSentRequests = tripEntryUser[0].getRequestSent();
String pairUpId = finalCurrentUser.getUserId() + tripEntryUser[0].getUserId();
PairUp pairUp = new PairUp(pairUpId, finalCurrentUser.getUserId(), tripEntryUser[0].getUserId(), new ArrayList<>());
pairUp.getMessages().add(new Message("Your request was accepted :)", pairUp.getCreatorId(), UtilityMethods.getCurrentTime()));
- isAlreadyInList = UtilityMethods.addPairUpInList(currentUserPairUps, pairUp, tripEntry.getEntry_id());
+ isAlreadyInList = UtilityMethods.addPairUpInList(currentUserPairUps, pairUp);
if(!isAlreadyInList)
{
- UtilityMethods.addPairUpInList(tripEntryUserPairUps, pairUp, tripEntry.getEntry_id());
+ UtilityMethods.addPairUpInList(tripEntryUserPairUps, pairUp);
- UtilityMethods.removeFromMap(recievedRequests, tripEntry.getEntry_id(), tripEntryUser[0].getUserId());
- UtilityMethods.removeFromList(sentRequests, tripEntry.getEntry_id());
+ UtilityMethods.removeFromMap(finalCurrentUserRecievedRequests, tripEntry.getEntry_id(), tripEntryUser[0].getUserId());
+ UtilityMethods.removeFromList(tripEntryUserSentRequests, tripEntry.getEntry_id());
+
+ finalCurrentUser.setRequestsRecieved(finalCurrentUserRecievedRequests);
Task task1 = userDatabaseReference.child(finalCurrentUser.getUserId()).child("pairUps").setValue(currentUserPairUps);
Task task2 = userDatabaseReference.child(tripEntryUser[0].getUserId()).child("pairUps").setValue(tripEntryUserPairUps);
- Task task3 = userDatabaseReference.child(finalCurrentUser.getUserId()).child("requestsRecieved").setValue(recievedRequests);
- Task task4 = userDatabaseReference.child(tripEntryUser[0].getUserId()).child("requestSent").setValue(sentRequests);
+ Task task3 = userDatabaseReference.child(finalCurrentUser.getUserId()).child("requestsRecieved").setValue(finalCurrentUserRecievedRequests);
+ Task task4 = userDatabaseReference.child(tripEntryUser[0].getUserId()).child("requestSent").setValue(tripEntryUserSentRequests);
Task task5 = pairUpDatabaseReference.child(pairUpId).setValue(pairUp);
@@ -122,10 +124,7 @@ public void onBindViewHolder(MyHolder holder, int position)
allTask.addOnSuccessListener(bVoid ->
{
progressDialog.dismiss();
-
- if(context instanceof RequestActivity)
- ((RequestActivity)context).setRefresh(true);
-
+ RequestActivity.refreshRequests();
});
allTask.addOnFailureListener(e ->
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/adapters/SentRequestsTEA.java b/app/src/main/java/garbagecollectors/com/snucabpool/adapters/SentRequestsTEA.java
index e769ad8..8695578 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/adapters/SentRequestsTEA.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/adapters/SentRequestsTEA.java
@@ -1,74 +1,74 @@
-//TEA = TripEntryAdapter
-
-package garbagecollectors.com.snucabpool.adapters;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import java.util.List;
-
-import garbagecollectors.com.snucabpool.R;
-import garbagecollectors.com.snucabpool.TripEntry;
-import garbagecollectors.com.snucabpool.UtilityMethods;
-
-public class SentRequestsTEA extends TripEntryAdapter
-{
- private List list;
- private Context context;
-
- public SentRequestsTEA(Context context)
- {
- super(context);
- }
-
- public SentRequestsTEA(List list, Context context)
- {
- this.list = list;
- this.context = context;
- }
-
- // Provide a reference to the views for each data item
- // Complex data items may need more than one view per item, and
- // you provide access to all the views for a data item in a view holder
-
- // Create new views (invoked by the layout manager)
- @Override
- public MyHolder onCreateViewHolder(ViewGroup parent, int viewType)
- {
- // create a new view
- View v = LayoutInflater.from(context).inflate(R.layout.card, parent, false);
- // set the view's size, margins, padding and layout parameters...
-
- return new MyHolder(v);
- }
-
- // Replace the contents of a view (invoked by the layout manager)
- @Override
- public void onBindViewHolder(MyHolder holder, int position)
- {
- TripEntry tripEntry = list.get(position);
-
- UtilityMethods.fillHolder(holder, tripEntry);
- }
-
- // Return the size of your dataset (invoked by the layout manager)
- @Override
- public int getItemCount()
- {
- int arr = 0;
-
- try
- {
- if(list.size()==0)
- arr = 0;
- else
- arr = list.size();
-
- }catch (Exception ignored){}
-
- return arr;
- }
-}
-
+//TEA = TripEntryAdapter
+
+package garbagecollectors.com.snucabpool.adapters;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.List;
+
+import garbagecollectors.com.snucabpool.R;
+import garbagecollectors.com.snucabpool.TripEntry;
+import garbagecollectors.com.snucabpool.UtilityMethods;
+
+public class SentRequestsTEA extends TripEntryAdapter
+{
+ private List list;
+ private Context context;
+
+ public SentRequestsTEA(Context context)
+ {
+ super(context);
+ }
+
+ public SentRequestsTEA(List list, Context context)
+ {
+ this.list = list;
+ this.context = context;
+ }
+
+ // Provide a reference to the views for each data item
+ // Complex data items may need more than one view per item, and
+ // you provide access to all the views for a data item in a view holder
+
+ // Create new views (invoked by the layout manager)
+ @Override
+ public MyHolder onCreateViewHolder(ViewGroup parent, int viewType)
+ {
+ // create a new view
+ View v = LayoutInflater.from(context).inflate(R.layout.card, parent, false);
+ // set the view's size, margins, padding and layout parameters...
+
+ return new MyHolder(v);
+ }
+
+ // Replace the contents of a view (invoked by the layout manager)
+ @Override
+ public void onBindViewHolder(MyHolder holder, int position)
+ {
+ TripEntry tripEntry = list.get(position);
+
+ UtilityMethods.fillHolder(holder, tripEntry);
+ }
+
+ // Return the size of your dataset (invoked by the layout manager)
+ @Override
+ public int getItemCount()
+ {
+ int arr = 0;
+
+ try
+ {
+ if(list.size()==0)
+ arr = 0;
+ else
+ arr = list.size();
+
+ }catch (Exception ignored){}
+
+ return arr;
+ }
+}
+
diff --git a/app/src/main/java/garbagecollectors/com/snucabpool/adapters/TripEntryAdapter.java b/app/src/main/java/garbagecollectors/com/snucabpool/adapters/TripEntryAdapter.java
index 828ddf1..9780ff4 100644
--- a/app/src/main/java/garbagecollectors/com/snucabpool/adapters/TripEntryAdapter.java
+++ b/app/src/main/java/garbagecollectors/com/snucabpool/adapters/TripEntryAdapter.java
@@ -1,57 +1,56 @@
-package garbagecollectors.com.snucabpool.adapters;
-
-import android.content.Context;
-import android.support.v7.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.TextView;
-
-import java.util.List;
-
-import garbagecollectors.com.snucabpool.R;
-import garbagecollectors.com.snucabpool.TripEntry;
-
-public abstract class TripEntryAdapter extends RecyclerView.Adapter
-{
- private LayoutInflater inflater;
- private List list;
- private Context context;
-
- TripEntryAdapter(Context context)
- {
- this.context = context;
- inflater = LayoutInflater.from(context);
- }
-
- TripEntryAdapter()
- { }
-
- // Provide a reference to the views for each data item
- // Complex data items may need more than one view per item, and
- // you provide access to all the views for a data item in a view holder
- public class MyHolder extends RecyclerView.ViewHolder
- {
- // each data item is just a string in this case
- public TextView date;
- public TextView user_id;
- public TextView source;
- public TextView destination;
- public TextView name_user;
- public TextView travel_time;
-
-
- MyHolder(View v)
- {
- super(v);
- date = (TextView) v.findViewById(R.id.vdate);
- user_id = (TextView) v.findViewById(R.id.vuser_id);
- source = (TextView) v.findViewById(R.id.vsource);
- destination = (TextView) v.findViewById(R.id.vdestination);
- name_user = (TextView) v.findViewById(R.id.vname);
- travel_time = (TextView) v.findViewById(R.id.vtime);
- }
- }
-
-}
-
-
+package garbagecollectors.com.snucabpool.adapters;
+
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.TextView;
+
+import java.util.List;
+
+import garbagecollectors.com.snucabpool.R;
+import garbagecollectors.com.snucabpool.TripEntry;
+
+public abstract class TripEntryAdapter extends RecyclerView.Adapter
+{
+ private LayoutInflater inflater;
+ private List list;
+ private Context context;
+
+ TripEntryAdapter(Context context)
+ {
+ this.context = context;
+ inflater = LayoutInflater.from(context);
+ }
+
+ TripEntryAdapter()
+ { }
+
+ // Provide a reference to the views for each data item
+ // Complex data items may need more than one view per item, and
+ // you provide access to all the views for a data item in a view holder
+ public class MyHolder extends RecyclerView.ViewHolder
+ {
+ // each data item is just a string in this case
+ public TextView date;
+ public TextView user_id;
+ public TextView source;
+ public TextView destination;
+ public TextView name_user;
+ public TextView travel_time;
+
+
+ MyHolder(View v)
+ {
+ super(v);
+ date = (TextView) v.findViewById(R.id.vdate);
+ user_id = (TextView) v.findViewById(R.id.vuser_id);
+ source = (TextView) v.findViewById(R.id.vsource);
+ destination = (TextView) v.findViewById(R.id.vdestination);
+ name_user = (TextView) v.findViewById(R.id.vname);
+ travel_time = (TextView) v.findViewById(R.id.vtime);
+ }
+ }
+}
+
+
diff --git a/app/src/main/res/drawable/cardview_bg.xml b/app/src/main/res/drawable/cardview_bg.xml
index 0fedd58..68ea763 100644
--- a/app/src/main/res/drawable/cardview_bg.xml
+++ b/app/src/main/res/drawable/cardview_bg.xml
@@ -1,6 +1,6 @@
-
-
-
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_action_refresh.png b/app/src/main/res/drawable/ic_action_refresh.png
new file mode 100644
index 0000000..4f5d255
Binary files /dev/null and b/app/src/main/res/drawable/ic_action_refresh.png differ
diff --git a/app/src/main/res/drawable/ic_dashboard_black_24dp.xml b/app/src/main/res/drawable/ic_dashboard_black_24dp.xml
index ae6a446..b2a3195 100644
--- a/app/src/main/res/drawable/ic_dashboard_black_24dp.xml
+++ b/app/src/main/res/drawable/ic_dashboard_black_24dp.xml
@@ -1,9 +1,9 @@
-
-
-
+
+
+
diff --git a/app/src/main/res/drawable/ic_home_black_24dp.xml b/app/src/main/res/drawable/ic_home_black_24dp.xml
index 0c36320..78e078f 100644
--- a/app/src/main/res/drawable/ic_home_black_24dp.xml
+++ b/app/src/main/res/drawable/ic_home_black_24dp.xml
@@ -1,9 +1,9 @@
-
-
-
+
+
+
diff --git a/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/app/src/main/res/drawable/ic_notifications_black_24dp.xml
index 0262382..1c487d3 100644
--- a/app/src/main/res/drawable/ic_notifications_black_24dp.xml
+++ b/app/src/main/res/drawable/ic_notifications_black_24dp.xml
@@ -1,9 +1,9 @@
-
-
-
+
+
+
diff --git a/app/src/main/res/drawable/mybutton.xml b/app/src/main/res/drawable/mybutton.xml
index c89da3a..4a0a553 100644
--- a/app/src/main/res/drawable/mybutton.xml
+++ b/app/src/main/res/drawable/mybutton.xml
@@ -1,24 +1,24 @@
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
-
-
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/roun_rect_orange.xml b/app/src/main/res/drawable/roun_rect_orange.xml
index cac77f1..66f35a5 100644
--- a/app/src/main/res/drawable/roun_rect_orange.xml
+++ b/app/src/main/res/drawable/roun_rect_orange.xml
@@ -1,19 +1,19 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_home.xml b/app/src/main/res/layout/activity_home.xml
index 54a8997..22b4421 100644
--- a/app/src/main/res/layout/activity_home.xml
+++ b/app/src/main/res/layout/activity_home.xml
@@ -9,26 +9,11 @@
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".activities.HomeActivity">
-
-
+ android:id="@+id/recycle"
+ android:layout_above="@+id/sign_out_button">
@@ -36,34 +21,23 @@
android:id="@id/sign_out_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:background="@drawable/mybutton"
+ android:text="Sign Out"
+ android:textColor="#3E2723"
android:layout_above="@+id/navigation"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
- android:background="@drawable/mybutton"
- android:paddingBottom="5dp"
- android:text="Sign Out"
- android:textColor="#3E2723" />
+ android:paddingBottom="5dp"/>
-
-
-
+ android:layout_alignParentStart="true"/>
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index f71b75a..24a7e3e 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -1,31 +1,31 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_new_entry.xml b/app/src/main/res/layout/activity_new_entry.xml
index 1d873b9..1090670 100644
--- a/app/src/main/res/layout/activity_new_entry.xml
+++ b/app/src/main/res/layout/activity_new_entry.xml
@@ -1,99 +1,99 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_request.xml b/app/src/main/res/layout/activity_request.xml
index 1cfb8b3..a1cc40d 100644
--- a/app/src/main/res/layout/activity_request.xml
+++ b/app/src/main/res/layout/activity_request.xml
@@ -3,6 +3,7 @@
@@ -25,6 +26,23 @@
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/card.xml b/app/src/main/res/layout/card.xml
index 889ef88..49e9584 100644
--- a/app/src/main/res/layout/card.xml
+++ b/app/src/main/res/layout/card.xml
@@ -1,92 +1,92 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/element_bottom_navigation.xml b/app/src/main/res/layout/element_bottom_navigation.xml
index e8ec22d..ca9a406 100644
--- a/app/src/main/res/layout/element_bottom_navigation.xml
+++ b/app/src/main/res/layout/element_bottom_navigation.xml
@@ -1,12 +1,12 @@
-
-
-
-
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_chat.xml b/app/src/main/res/layout/fragment_chat.xml
index 0762e48..ca87b80 100644
--- a/app/src/main/res/layout/fragment_chat.xml
+++ b/app/src/main/res/layout/fragment_chat.xml
@@ -1,13 +1,13 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/app/src/main/res/layout/fragment_recieved_requests.xml b/app/src/main/res/layout/fragment_recieved_requests.xml
index e2c4ae9..6b5eb21 100644
--- a/app/src/main/res/layout/fragment_recieved_requests.xml
+++ b/app/src/main/res/layout/fragment_recieved_requests.xml
@@ -6,26 +6,10 @@
tools:context="garbagecollectors.com.snucabpool.activities.RequestActivity.SentRequestsFragment"
android:paddingTop="@dimen/activity_vertical_margin">
-
-
-
+ android:id="@+id/recycle_requests">
diff --git a/app/src/main/res/layout/fragment_sent_requests.xml b/app/src/main/res/layout/fragment_sent_requests.xml
index 82d0dc1..967b35a 100644
--- a/app/src/main/res/layout/fragment_sent_requests.xml
+++ b/app/src/main/res/layout/fragment_sent_requests.xml
@@ -6,24 +6,9 @@
tools:context="garbagecollectors.com.snucabpool.activities.RequestActivity.SentRequestsFragment"
android:paddingTop="@dimen/activity_vertical_margin">
-
-
diff --git a/app/src/main/res/layout/myview.xml b/app/src/main/res/layout/myview.xml
index 087b8f9..a608075 100644
--- a/app/src/main/res/layout/myview.xml
+++ b/app/src/main/res/layout/myview.xml
@@ -1,144 +1,144 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/menu_requests.xml b/app/src/main/res/menu/menu_requests.xml
index 0fe626f..e465e13 100644
--- a/app/src/main/res/menu/menu_requests.xml
+++ b/app/src/main/res/menu/menu_requests.xml
@@ -1,10 +1,11 @@
-
\ No newline at end of file
diff --git a/app/src/main/res/menu/navigation.xml b/app/src/main/res/menu/navigation.xml
index 37aa502..10dfbd4 100644
--- a/app/src/main/res/menu/navigation.xml
+++ b/app/src/main/res/menu/navigation.xml
@@ -1,19 +1,19 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
index 63fc816..62df187 100644
--- a/app/src/main/res/values-w820dp/dimens.xml
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -1,6 +1,6 @@
-
-
- 64dp
-
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index f472c2c..6e75b2f 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -1,15 +1,15 @@
-
-
- #00B873
- #303F9F
- #495C67
- #FF4081
- #F68159
- #a6abae
-
- #f0f2ea
-
-
- #f1f5f8
- #4c4c4c
+
+
+ #00B873
+ #303F9F
+ #495C67
+ #FF4081
+ #F68159
+ #a6abae
+
+ #f0f2ea
+
+
+ #f1f5f8
+ #4c4c4c
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 4cbc388..4ef8742 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -1,25 +1,25 @@
-
-
- 16dp
- 16dp
- 16dp
- 10dp
- 250dp
- 30dp
- 18dp
- 5dp
- 0dp
- 160dp
- 10dp
- 15dp
- 5dp
- 12dp
- 20dp
- 30dp
- 10dp
- 264dp
- 16dp
- 14sp
- 72dp
-
-
+
+
+ 16dp
+ 16dp
+ 16dp
+ 10dp
+ 250dp
+ 30dp
+ 18dp
+ 5dp
+ 0dp
+ 160dp
+ 10dp
+ 15dp
+ 5dp
+ 12dp
+ 20dp
+ 30dp
+ 10dp
+ 264dp
+ 16dp
+ 14sp
+ 72dp
+
+
diff --git a/app/src/main/res/values/ids.xml b/app/src/main/res/values/ids.xml
index 04c0718..dce52e3 100644
--- a/app/src/main/res/values/ids.xml
+++ b/app/src/main/res/values/ids.xml
@@ -1,4 +1,4 @@
-
-
- - signOutButton
+
+
+ - signOutButton
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index eb20a31..877debb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,18 +1,18 @@
-
- SNU Cabpool
- Home
- Dashboard
- Notifications
- 560852588496-baos0qb9om1qmvade33hbh1l2ic70l00.apps.googleusercontent.com
- Sign Out
- New Entry
- Settings
- Add to Favourites
- Play Next
- LOVE MUSIC
- This season top 20 albums
- Requests
-
-
- Hello blank fragment
-
+
+ SNU Cabpool
+ Home
+ Dashboard
+ Notifications
+ 560852588496-baos0qb9om1qmvade33hbh1l2ic70l00.apps.googleusercontent.com
+ Sign Out
+ New Entry
+ Settings
+ Add to Favourites
+ Play Next
+ LOVE MUSIC
+ This season top 20 albums
+ Requests
+
+
+ Hello blank fragment
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 545b9c6..80f09db 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,20 +1,20 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/garbagecollectors/com/snucabpool/ExampleUnitTest.java b/app/src/test/java/garbagecollectors/com/snucabpool/ExampleUnitTest.java
index f69c5b0..e1b562c 100644
--- a/app/src/test/java/garbagecollectors/com/snucabpool/ExampleUnitTest.java
+++ b/app/src/test/java/garbagecollectors/com/snucabpool/ExampleUnitTest.java
@@ -1,17 +1,17 @@
-package garbagecollectors.com.snucabpool;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
+package garbagecollectors.com.snucabpool;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f073a58..e007c67 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,29 +1,29 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-
-buildscript {
- repositories {
- jcenter()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:3.0.1'
-
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
- classpath 'com.google.gms:google-services:3.1.0'
- }
-}
-
-allprojects {
- repositories {
- jcenter()
-
- maven {
- url 'https://maven.google.com'
- // Alternative URL is 'https://dl.google.com/dl/android/maven2/'
- }
- }
-}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.0.1'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ classpath 'com.google.gms:google-services:3.1.0'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+
+ maven {
+ url 'https://maven.google.com'
+ // Alternative URL is 'https://dl.google.com/dl/android/maven2/'
+ }
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
index aac7c9b..3530b01 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,17 +1,17 @@
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx1536m
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2f3fb64..62edfd2 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
-#Sat Dec 09 17:52:04 IST 2017
-
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
+#Sat Dec 09 17:52:04 IST 2017
+
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
diff --git a/gradlew b/gradlew
index 9d82f78..e834973 100644
--- a/gradlew
+++ b/gradlew
@@ -1,160 +1,160 @@
-#!/usr/bin/env bash
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn ( ) {
- echo "$*"
-}
-
-die ( ) {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
-esac
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
-}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
-
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 8a0b282..aec9973 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,90 +1,90 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
index e7b4def..d3db109 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':app'
+include ':app'