├── .firebaserc
├── .gitattributes
├── .gitignore
├── README.md
├── app
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── shareit
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-playstore.png
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── shareit
│ │ │ ├── ClothAdapter.java
│ │ │ ├── ClothItem.java
│ │ │ ├── ContributionsClothAdapter.java
│ │ │ ├── ContributionsFoodAdapter.java
│ │ │ ├── ContributionsShelterAdapter.java
│ │ │ ├── DonateItem.java
│ │ │ ├── Donor_Side.java
│ │ │ ├── FoodAdapter.java
│ │ │ ├── FoodItem.java
│ │ │ ├── Geohash.java
│ │ │ ├── Login.java
│ │ │ ├── MainActivity.java
│ │ │ ├── OtpVerification.java
│ │ │ ├── Receiver_Side.java
│ │ │ ├── Register.java
│ │ │ ├── ShelterAdapter.java
│ │ │ ├── ShelterItem.java
│ │ │ ├── Spinner.java
│ │ │ ├── User.java
│ │ │ ├── ViewClothes.java
│ │ │ ├── ViewFood.java
│ │ │ ├── ViewShelters.java
│ │ │ ├── View_Contributions.java
│ │ │ ├── WrapContentLinearLayoutManager.java
│ │ │ ├── change_user_details.java
│ │ │ ├── change_user_email.java
│ │ │ ├── change_user_password.java
│ │ │ ├── change_user_phone.java
│ │ │ ├── donation_cloth.java
│ │ │ ├── donation_shelter.java
│ │ │ ├── sendFood.java
│ │ │ └── user_details_register.java
│ └── res
│ │ ├── drawable-v24
│ │ ├── ic_launcher_foreground.xml
│ │ ├── mainbg.png
│ │ ├── peep.png
│ │ └── peep2.png
│ │ ├── drawable
│ │ ├── background_box_blue.xml
│ │ ├── background_box_purple.xml
│ │ ├── background_button_purple.xml
│ │ ├── baseline_add_24.xml
│ │ ├── baseline_archive_24.xml
│ │ ├── baseline_autorenew_24.xml
│ │ ├── baseline_call_24.xml
│ │ ├── baseline_close_24.xml
│ │ ├── baseline_delete_sweep_24.xml
│ │ ├── baseline_email_24.xml
│ │ ├── baseline_local_phone_24.xml
│ │ ├── baseline_logout_24.xml
│ │ ├── baseline_map_24.xml
│ │ ├── baseline_menu_open_24.xml
│ │ ├── baseline_message_24.xml
│ │ ├── baseline_password_24.xml
│ │ ├── baseline_person_24.xml
│ │ ├── baseline_save_alt_24.xml
│ │ ├── baseline_verified_24.xml
│ │ ├── bg_round.xml
│ │ ├── black_verified_mark.xml
│ │ ├── cafe.png
│ │ ├── cloth.png
│ │ ├── clothes.png
│ │ ├── contribution.png
│ │ ├── diet.png
│ │ ├── donate.png
│ │ ├── drawer_bdr.xml
│ │ ├── header_bkg.xml
│ │ ├── house.png
│ │ ├── ic_launcher_background.xml
│ │ ├── log_out.png
│ │ ├── mail_sent_amico.png
│ │ ├── messages_rafiki.png
│ │ ├── personal_settings_rafiki.png
│ │ ├── push_notifications_pana.png
│ │ ├── received.png
│ │ ├── reset_password_pana.png
│ │ └── shelter.png
│ │ ├── layout
│ │ ├── activity_change_user_details.xml
│ │ ├── activity_change_user_email.xml
│ │ ├── activity_change_user_password.xml
│ │ ├── activity_change_user_phone.xml
│ │ ├── activity_donate_item.xml
│ │ ├── activity_donation_cloth.xml
│ │ ├── activity_donation_shelter.xml
│ │ ├── activity_donor_side.xml
│ │ ├── activity_login.xml
│ │ ├── activity_main.xml
│ │ ├── activity_otp_verification.xml
│ │ ├── activity_receiver_side.xml
│ │ ├── activity_register.xml
│ │ ├── activity_send_food.xml
│ │ ├── activity_spinner.xml
│ │ ├── activity_user_details_register.xml
│ │ ├── activity_view_clothes.xml
│ │ ├── activity_view_contributions.xml
│ │ ├── activity_view_food.xml
│ │ ├── activity_view_shelters.xml
│ │ ├── clothcard_item.xml
│ │ ├── contributionscard_item.xml
│ │ ├── foodcard_item.xml
│ │ ├── nav_drawer.xml
│ │ ├── progress_dialog.xml
│ │ ├── sheltercard_item.xml
│ │ ├── toolbar.xml
│ │ └── userclass.xml
│ │ ├── menu
│ │ ├── new_donation_menu.xml
│ │ ├── view_cloth_menu.xml
│ │ ├── view_contribution_menu.xml
│ │ ├── view_food_menu.xml
│ │ └── view_shelter_menu.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_foreground.png
│ │ └── ic_launcher_round.png
│ │ ├── values-night
│ │ └── themes.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── headings_array.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ │ └── xml
│ │ ├── backup_rules.xml
│ │ └── data_extraction_rules.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── shareit
│ └── ExampleUnitTest.java
├── build.gradle
├── firebase.json
├── functions
├── .eslintrc.js
├── index.js
├── package-lock.json
└── package.json
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── strings.xml
/.firebaserc:
--------------------------------------------------------------------------------
1 | {
2 | "projects": {
3 | "default": "share-it-6d179"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Gradle files
2 | .gradle/
3 | build/
4 |
5 | # Local configuration file (sdk path, etc)
6 | local.properties
7 |
8 | # Log/OS Files
9 | *.log
10 |
11 | # Android Studio generated files and folders
12 | captures/
13 | .externalNativeBuild/
14 | .cxx/
15 | *.apk
16 | output.json
17 |
18 | # IntelliJ
19 | *.iml
20 | .idea/
21 |
22 | # Keystore files
23 | *.jks
24 | *.keystore
25 |
26 | # Google Services (e.g. APIs or Firebase)
27 | google-services.json
28 |
29 | # Android Profiling
30 | *.hprof
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Nest Aid
2 |
3 | A GPS-based Community Service Application for Donating Food, Clothes, and Shelter
4 |
5 | The proposed app is designed to deal with the demanding situations confronted with the aid of donors and receivers in terms of locating and gaining access to vital sources together with meals, clothing, and refuge. The app presents a platform that simplifies donating and receiving those sources by supplying a streamlined and person-friendly interface. Through the app, donors can without difficulty sign up and offer their donations of food, garb, and refuge. Donors can imply the forms of assets they're willing to provide and their availability. The app additionally presents a simple and steady price system that lets donors make financial contributions to the purpose. On the other hand, receivers can access the app to find donors in their region. By using the app's place-primarily based offerings, receivers can quickly pick out close-by donors who have the assets they need. Receivers can then initiate touch with the donors via the app to set up the pickup or shipping of the donated sources. The app's use of technology performs an essential function in simplifying the donation and receiving technique. By leveraging region-based total offerings, the app allows connecting donors and receivers in real time. Additionally, the app's user-pleasant interface and steady charge machine make the technique of donating and receiving assets convenient and efficient. Overall, the app's goals are to make a contribution in the direction of the betterment of society by means of enhancing admission to vital assets and fostering a sense of network engagement. By offering a platform for donors and receivers to connect and work in the direction of a commonplace cause, the app allows for bridging the space between the ones in need and those who are willing to assist.
6 |
7 |
8 | # Flowchart of the proposed system
9 |
10 |
11 | # Screenshots of the application
12 |
13 | User's registration and Login:
14 |
15 |
16 |
17 | Donor's dashboard and donation form:
18 |
19 |
20 |
21 | Contributions can be either deactivated or eliminated by the donor:
22 |
23 |
24 |
25 | Receiver's dashboard and donation list:
26 |
27 |
28 |
29 | # Methodology
30 |
31 | * Sharing -
32 | When a donor makes a donation their current location is grabbed and a document comprising of the item and donor info is added to a list of donations and stored according to the geohashes. A donor can opt to share his exact location or just the geohash and later talk to the receiver about it.
33 |
34 | * Receiving -
35 | A receiver is provided with a list of donations and information about the donors from the nearby area allowing them to choose whom they want to approach. They can approach by calling & messaging.
36 |
37 | * Geohashes -
38 | Geo-hashes encode a geographic location into a short string of letters and digits. Further, the receiver’s vicinity is scanned in a rectangular fashion covering a circular area of about 10 sq km. The area comprises adjacent hashes of the receiver’s location.
39 |
40 |
41 | # Technologies, libraries, and packages used
42 |
43 | * Java
44 | * Firebase
45 | * Android Studio
46 | * Geohashes
47 |
48 | # Local Setup
49 |
50 | 1. Fork this repository
51 | 2. Clone it in your local system
52 | 3. Open Android Studio and select 'Open Project'. You can just browse through the file chooser to the folder where you have cloned the project. The file chooser will show an Android face as the folder icon, which you can select to open the project.
53 | 4. Link the project to your Firebase Account and your RESTFUL server (we have included sockets too)
54 | 5. After opening the project Android Studio will try to build the project directly. To create it manually, follow the menu path 'Build'/'Make Project', or just click the 'Play' button in the toolbar to build and run it on a mobile device or an emulator. The resulting .apk file will be saved in the 'build/outputs/apk/' subdirectory in the project folder.
55 | 6. You can install the .apk file on your device and enjoy its enriching features.
56 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'com.google.gms.google-services'
4 | }
5 |
6 | android {
7 | namespace 'com.example.shareit'
8 | compileSdk 33
9 |
10 | defaultConfig {
11 | applicationId "com.example.shareit"
12 | minSdk 28
13 | targetSdk 33
14 | versionCode 1
15 | versionName "1.0"
16 |
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled false
23 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24 | }
25 | }
26 | compileOptions {
27 | sourceCompatibility JavaVersion.VERSION_1_8
28 | targetCompatibility JavaVersion.VERSION_1_8
29 | }
30 | }
31 |
32 | dependencies {
33 |
34 | implementation 'androidx.appcompat:appcompat:1.6.1'
35 | // implementation 'com.android.support:design:28.0.0'
36 | // implementation 'com.android.support:cardview-v7:28.0.0'
37 | implementation "androidx.cardview:cardview:1.0.0"
38 | // implementation 'com.github.imperiumlabs:GeoFirestore-Android:v1.5.0'
39 | // implementation 'com.github.User:Repo:Tag'
40 | implementation 'it.xabaras.android:recyclerview-swipedecorator:1.4'
41 | implementation 'com.google.android.material:material:1.9.0'
42 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
43 | implementation 'com.google.android.gms:play-services-location:21.0.1'
44 | implementation 'com.google.firebase:firebase-auth:22.0.0'
45 | implementation 'com.google.firebase:firebase-firestore:24.6.1'
46 | //geo fire
47 | implementation 'ch.hsr:geohash:1.3.0'
48 | implementation 'com.firebaseui:firebase-ui-firestore:8.0.2'
49 | implementation 'com.google.firebase:firebase-database:20.2.2'
50 | implementation 'com.firebase:geofire-android-common:3.1.0'
51 | implementation platform('com.google.firebase:firebase-bom:32.1.0')
52 | implementation 'com.google.firebase:firebase-auth'
53 | testImplementation 'junit:junit:4.13.2'
54 | androidTestImplementation 'androidx.test.ext:junit:1.1.5'
55 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
56 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/shareit/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.example.shareit", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
21 |
24 |
27 |
30 |
33 |
36 |
39 |
42 |
45 |
48 |
51 |
54 |
57 |
60 |
63 |
67 |
71 |
75 |
79 |
83 |
84 |
85 |
86 |
87 |
88 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/ClothAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 | import android.content.Context;
3 | import android.view.LayoutInflater;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 | import android.widget.Button;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 | import android.widget.Toast;
10 | import androidx.annotation.NonNull;
11 | import androidx.cardview.widget.CardView;
12 | import androidx.recyclerview.widget.RecyclerView;
13 | import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
14 | import com.firebase.ui.firestore.FirestoreRecyclerOptions;
15 | import com.google.firebase.firestore.DocumentSnapshot;
16 |
17 | public class ClothAdapter extends FirestoreRecyclerAdapter {
18 |
19 | // private onClothItemClickListener listener;
20 | Context context;
21 | private onClothItemMessageButtonClickListener messageButtonClickListener;
22 | private onClothItemCallButtonClickListener callButtonClickListener;
23 | private onClothItemTrackButtonClickListener trackButtonClickListener;
24 |
25 | public ClothAdapter(@NonNull FirestoreRecyclerOptions options) {
26 | super(options);
27 | }
28 |
29 | @NonNull
30 | @Override
31 | public ClothAdapter.ClothViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
32 |
33 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.clothcard_item, parent, false);
34 | return new ClothViewHolder(v);
35 | }
36 |
37 | @Override
38 | public void onDataChanged() {
39 | super.onDataChanged();
40 | if (getItemCount() == 0){
41 |
42 | }
43 | // Toast.makeText(context, "There are no clothes available at this moment", Toast.LENGTH_SHORT).show();
44 | }
45 |
46 | @Override
47 | protected void onBindViewHolder(@NonNull ClothViewHolder holder, int position, @NonNull ClothItem model) {
48 |
49 | holder.DonorName.setText(String.valueOf(model.DonorName));
50 | holder.DonorNumber.setText(String.valueOf(model.DonorNumber));
51 | holder.ClothName.setText(String.valueOf(model.ClothName));
52 | holder.ClothCount.setText(String.valueOf(model.ClothCount));
53 | if(model.getVerification()){
54 | holder.donor_verification.setVisibility(View.VISIBLE);
55 | }
56 | }
57 |
58 | class ClothViewHolder extends RecyclerView.ViewHolder {
59 |
60 | TextView DonorName, DonorNumber, ClothName, ClothCount;
61 | CardView cardView;
62 | Button send_message, call_donor, track_location;
63 | ImageView donor_verification;
64 | public ClothViewHolder(@NonNull View itemView) {
65 | super(itemView);
66 | DonorName = itemView.findViewById(R.id.clothDonorName);
67 | DonorNumber = itemView.findViewById(R.id.clothDonorNumber);
68 | ClothName = itemView.findViewById(R.id.clothItemName);
69 | ClothCount = itemView.findViewById(R.id.clothItemCount);
70 | cardView = itemView.findViewById(R.id.clothItemCard);
71 | donor_verification = itemView.findViewById(R.id.donor_verification);
72 | send_message = itemView.findViewById(R.id.message_donor);
73 | call_donor = itemView.findViewById(R.id.call_donor);
74 | track_location = itemView.findViewById(R.id.track_map);
75 |
76 | send_message.setOnClickListener(new View.OnClickListener() {
77 | @Override
78 | public void onClick(View v) {
79 | int position = getAdapterPosition();
80 | if (position != RecyclerView.NO_POSITION && messageButtonClickListener != null) {
81 | messageButtonClickListener.onMessageButtonClick(getSnapshots().getSnapshot(position), position);
82 | }
83 | }
84 | });
85 |
86 | call_donor.setOnClickListener(new View.OnClickListener() {
87 | @Override
88 | public void onClick(View v) {
89 | int position = getAdapterPosition();
90 | if (position != RecyclerView.NO_POSITION && callButtonClickListener != null) {
91 | callButtonClickListener.onCallButtonClick(getSnapshots().getSnapshot(position), position);
92 | }
93 | }
94 | });
95 |
96 | track_location.setOnClickListener(new View.OnClickListener() {
97 | @Override
98 | public void onClick(View v) {
99 | int position = getAdapterPosition();
100 | if (position != RecyclerView.NO_POSITION && trackButtonClickListener != null) {
101 | trackButtonClickListener.onTrackButtonClick(getSnapshots().getSnapshot(position), position);
102 | }
103 | }
104 | });
105 |
106 |
107 | // itemView.setOnClickListener(new View.OnClickListener() {
108 | // @Override
109 | // public void onClick(View v) {
110 | // int position = getAdapterPosition();
111 | // if (position != RecyclerView.NO_POSITION && listener != null) {
112 | // listener.onClothItemClick(getSnapshots().getSnapshot(position), position);
113 | // }
114 | // }
115 | // });
116 |
117 | }
118 | }
119 |
120 | public interface onClothItemMessageButtonClickListener {
121 | void onMessageButtonClick(DocumentSnapshot documentSnapshot, int position);
122 | }
123 | public void setOnMessageButtonClickListener(onClothItemMessageButtonClickListener listener){
124 | this.messageButtonClickListener = listener;
125 | }
126 |
127 | public interface onClothItemCallButtonClickListener {
128 | void onCallButtonClick(DocumentSnapshot documentSnapshot, int position);
129 | }
130 |
131 | public void setOnCallButtonClickListener(onClothItemCallButtonClickListener listener){
132 | this.callButtonClickListener = listener;
133 | }
134 |
135 | public interface onClothItemTrackButtonClickListener {
136 | void onTrackButtonClick(DocumentSnapshot documentSnapshot, int position);
137 | }
138 |
139 | public void setOnTrackButtonClickListener(onClothItemTrackButtonClickListener listener){
140 | this.trackButtonClickListener = listener;
141 | }
142 |
143 | // public interface onClothItemClickListener{
144 | // void onClothItemClick(DocumentSnapshot documentSnapshot, int position);
145 | // }
146 | //
147 | // public void setOnClothItemClickListener(onClothItemClickListener listener){
148 | // this.listener = listener;
149 | // }
150 |
151 | }
152 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/ClothItem.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import com.google.firebase.Timestamp;
4 | import com.google.firebase.firestore.GeoPoint;
5 |
6 | public class ClothItem {
7 |
8 | String DonorID, DonorName, DonorNumber, ClothName, ClothCount;
9 | GeoPoint Location;
10 | Timestamp TimeStamp;
11 | Boolean Status, Verification;
12 |
13 | public ClothItem(String donorID, String donorName, String donorNumber, String clothName, String clothCount, GeoPoint location, Timestamp timestamp, Boolean status, Boolean verification) {
14 | DonorID = donorID;
15 | DonorName = donorName;
16 | DonorNumber = donorNumber;
17 | ClothName = clothName;
18 | ClothCount = clothCount;
19 | Location = location;
20 | TimeStamp = timestamp;
21 | Status = status;
22 | Verification = verification;
23 | }
24 |
25 | public Boolean getVerification() {
26 | return Verification;
27 | }
28 |
29 | public void setVerification(Boolean verification) {
30 | Verification = verification;
31 | }
32 |
33 | public GeoPoint getLocation() {
34 | return Location;
35 | }
36 |
37 | public void setLocation(GeoPoint location) {
38 | Location = location;
39 | }
40 |
41 | public com.google.firebase.Timestamp getTimestamp() {
42 | return TimeStamp;
43 | }
44 |
45 | public void setTimestamp(com.google.firebase.Timestamp timestamp) {
46 | TimeStamp = timestamp;
47 | }
48 |
49 | public ClothItem() {
50 | }
51 |
52 | public Boolean getStatus() {
53 | return Status;
54 | }
55 |
56 | public void setStatus(Boolean status) {
57 | Status = status;
58 | }
59 |
60 | public String getDonorID() {
61 | return DonorID;
62 | }
63 |
64 | public void setDonorID(String donorID) {
65 | DonorID = donorID;
66 | }
67 |
68 | public String getDonorName() {
69 | return DonorName;
70 | }
71 |
72 | public void setDonorName(String donorName) {
73 | DonorName = donorName;
74 | }
75 |
76 | public String getDonorNumber() {
77 | return DonorNumber;
78 | }
79 |
80 | public void setDonorNumber(String donorNumber) {
81 | DonorNumber = donorNumber;
82 | }
83 |
84 | public String getClothName() {
85 | return ClothName;
86 | }
87 |
88 | public void setClothName(String clothName) {
89 | ClothName = clothName;
90 | }
91 |
92 | public String getClothCount() {
93 | return ClothCount;
94 | }
95 |
96 | public void setClothCount(String clothCount) {
97 | ClothCount = clothCount;
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/ContributionsClothAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 | import android.widget.Toast;
10 |
11 | import androidx.annotation.NonNull;
12 | import androidx.cardview.widget.CardView;
13 | import androidx.recyclerview.widget.RecyclerView;
14 |
15 | import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
16 | import com.firebase.ui.firestore.FirestoreRecyclerOptions;
17 |
18 | public class ContributionsClothAdapter extends FirestoreRecyclerAdapter {
19 |
20 | Context context;
21 |
22 | public ContributionsClothAdapter(@NonNull FirestoreRecyclerOptions options) {
23 | super(options);
24 | }
25 |
26 | @NonNull
27 | @Override
28 | public ContributionsClothAdapter.ClothViewHolder onCreateViewHolder (@NonNull ViewGroup parent,int viewType){
29 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.contributionscard_item, parent, false);
30 | return new ContributionsClothAdapter.ClothViewHolder(v);
31 | }
32 |
33 | public void rightSwiped(int position){
34 | deleteItem(position);
35 | }
36 |
37 | public void leftSwiped(int position){
38 | if(getSnapshots().getSnapshot(position).getBoolean("Status")){
39 | changeStatus(position);
40 | }else {
41 | deleteItem(position);
42 | }
43 | }
44 |
45 | public void deleteItem(int position){
46 | getSnapshots().getSnapshot(position).getReference().delete();
47 | }
48 |
49 | public void changeStatus(int position){
50 | getSnapshots().getSnapshot(position).getReference().update("Status", false);
51 | }
52 |
53 | @Override
54 | protected void onBindViewHolder (@NonNull ContributionsClothAdapter.ClothViewHolder holder,
55 | int position, @NonNull ClothItem model){
56 |
57 | holder.Date.setText(String.valueOf(model.TimeStamp.toDate().toLocaleString()));
58 | holder.ClothName.setText(String.valueOf(model.ClothName));
59 | holder.ClothCount.setText(String.valueOf(model.ClothCount));
60 |
61 | if(!model.Status)
62 | holder.cardView.setCardBackgroundColor(Color.parseColor("#EEFC5E"));
63 |
64 | }
65 |
66 |
67 | class ClothViewHolder extends RecyclerView.ViewHolder {
68 |
69 | TextView Date, ClothName, ClothCount;
70 | CardView cardView;
71 |
72 | public ClothViewHolder(@NonNull View itemView) {
73 | super(itemView);
74 | ClothName = itemView.findViewById(R.id.contributionsItemName);
75 | ClothCount = itemView.findViewById(R.id.contributionsItemCount);
76 | Date = itemView.findViewById(R.id.contributionsItemDate);
77 | cardView = itemView.findViewById(R.id.contributionsItemCard);
78 |
79 | }
80 | }
81 |
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/ContributionsFoodAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.graphics.Color;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 | import android.widget.Toast;
11 |
12 | import androidx.annotation.NonNull;
13 | import androidx.cardview.widget.CardView;
14 | import androidx.recyclerview.widget.RecyclerView;
15 |
16 | import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
17 | import com.firebase.ui.firestore.FirestoreRecyclerOptions;
18 | import com.google.android.gms.tasks.OnFailureListener;
19 | import com.google.android.gms.tasks.OnSuccessListener;
20 | import com.google.android.gms.tasks.Task;
21 | import com.google.firebase.firestore.CollectionReference;
22 | import com.google.firebase.firestore.DocumentReference;
23 | import com.google.firebase.firestore.DocumentSnapshot;
24 | import com.google.firebase.firestore.FirebaseFirestore;
25 | import com.google.firebase.firestore.GeoPoint;
26 |
27 | import java.sql.Timestamp;
28 | import java.util.HashMap;
29 | import java.util.Map;
30 |
31 | public class ContributionsFoodAdapter extends FirestoreRecyclerAdapter {
32 |
33 | Context context;
34 |
35 | public ContributionsFoodAdapter(@NonNull FirestoreRecyclerOptions options) {
36 | super(options);
37 | }
38 |
39 | @NonNull
40 | @Override
41 | public FoodViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
42 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.contributionscard_item, parent, false);
43 | return new FoodViewHolder(v);
44 | }
45 |
46 | public void rightSwiped(int position){
47 | deleteItem(position);
48 | }
49 |
50 | public void leftSwiped(int position){
51 | if(getSnapshots().getSnapshot(position).getBoolean("Status")){
52 | changeStatus(position);
53 | }else {
54 | deleteItem(position);
55 | }
56 | }
57 |
58 | public void deleteItem(int position){
59 | getSnapshots().getSnapshot(position).getReference().delete();
60 | }
61 |
62 | public void changeStatus(int position){
63 | getSnapshots().getSnapshot(position).getReference().update("Status", false);
64 | }
65 |
66 | public boolean getStatus(int position){
67 | return getSnapshots().getSnapshot(position).getBoolean("Status");
68 | }
69 |
70 | @Override
71 | protected void onBindViewHolder(@NonNull ContributionsFoodAdapter.FoodViewHolder holder, int position, @NonNull FoodItem model) {
72 |
73 | holder.Date.setText(model.TimeStamp.toDate().toLocaleString());
74 | holder.FoodName.setText(String.valueOf(model.FoodName));
75 | holder.FoodCount.setText(String.valueOf(model.FoodCount));
76 |
77 | if(!model.Status) {
78 | holder.cardView.setCardBackgroundColor(Color.parseColor("#EEFC5E"));
79 | }
80 | }
81 |
82 | class FoodViewHolder extends RecyclerView.ViewHolder {
83 |
84 | TextView Date, FoodName, FoodCount;
85 | CardView cardView;
86 | public FoodViewHolder(@NonNull View itemView) {
87 | super(itemView);
88 | FoodName = itemView.findViewById(R.id.contributionsItemName);
89 | FoodCount = itemView.findViewById(R.id.contributionsItemCount);
90 | Date = itemView.findViewById(R.id.contributionsItemDate);
91 | cardView = itemView.findViewById(R.id.contributionsItemCard);
92 |
93 | }
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/ContributionsShelterAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 | import android.widget.Toast;
10 |
11 | import androidx.annotation.NonNull;
12 | import androidx.cardview.widget.CardView;
13 | import androidx.recyclerview.widget.RecyclerView;
14 |
15 | import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
16 | import com.firebase.ui.firestore.FirestoreRecyclerOptions;
17 |
18 | public class ContributionsShelterAdapter extends FirestoreRecyclerAdapter {
19 |
20 | Context context;
21 |
22 | public ContributionsShelterAdapter(@NonNull FirestoreRecyclerOptions options) {
23 | super(options);
24 | }
25 |
26 | @NonNull
27 | @Override
28 | public ContributionsShelterAdapter.ShelterViewHolder onCreateViewHolder (@NonNull ViewGroup parent, int viewType){
29 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.contributionscard_item, parent, false);
30 | return new ContributionsShelterAdapter.ShelterViewHolder(v);
31 | }
32 |
33 | public void rightSwiped(int position){
34 | deleteItem(position);
35 | }
36 |
37 | public void leftSwiped(int position){
38 | if(getSnapshots().getSnapshot(position).getBoolean("Status")){
39 | changeStatus(position);
40 | }else {
41 | deleteItem(position);
42 | }
43 | }
44 |
45 | public void deleteItem(int position){
46 | getSnapshots().getSnapshot(position).getReference().delete();
47 | }
48 |
49 | public void changeStatus(int position){
50 | getSnapshots().getSnapshot(position).getReference().update("Status", false);
51 | }
52 |
53 | // @Override
54 | // public void onDataChanged () {
55 | // super.onDataChanged();
56 | // if (getItemCount() == 0)
57 | // Toast.makeText(context, "There are no Food items", Toast.LENGTH_SHORT).show();
58 | // }
59 |
60 | @Override
61 | protected void onBindViewHolder (@NonNull ContributionsShelterAdapter.ShelterViewHolder holder,
62 | int position, @NonNull ShelterItem model){
63 |
64 | holder.Date.setText(String.valueOf(model.TimeStamp.toDate().toLocaleString()));
65 | holder.ShelterDesc.setText(String.valueOf(model.ShelterDescription));
66 | holder.ShelterCount.setText(String.valueOf(model.ShelterAvailability));
67 |
68 | if(!model.Status)
69 | holder.cardView.setCardBackgroundColor(Color.parseColor("#EEFC5E"));
70 |
71 | }
72 |
73 |
74 | class ShelterViewHolder extends RecyclerView.ViewHolder {
75 |
76 | TextView Date, ShelterDesc, ShelterCount;
77 | CardView cardView;
78 |
79 | public ShelterViewHolder(@NonNull View itemView) {
80 | super(itemView);
81 | ShelterDesc = itemView.findViewById(R.id.contributionsItemName);
82 | ShelterCount = itemView.findViewById(R.id.contributionsItemCount);
83 | Date = itemView.findViewById(R.id.contributionsItemDate);
84 | cardView = itemView.findViewById(R.id.contributionsItemCard);
85 |
86 | }
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/DonateItem.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.os.Bundle;
6 |
7 | public class DonateItem extends AppCompatActivity {
8 |
9 | @Override
10 | protected void onCreate(Bundle savedInstanceState) {
11 | super.onCreate(savedInstanceState);
12 | setContentView(R.layout.activity_donate_item);
13 | }
14 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/FoodAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 | import android.app.AlertDialog;
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.Button;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 | import android.widget.Toast;
11 | import androidx.annotation.NonNull;
12 | import androidx.cardview.widget.CardView;
13 | import androidx.recyclerview.widget.RecyclerView;
14 | import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
15 | import com.firebase.ui.firestore.FirestoreRecyclerOptions;
16 | import com.google.firebase.firestore.DocumentSnapshot;
17 |
18 | public class FoodAdapter extends FirestoreRecyclerAdapter {
19 |
20 | // private onFoodItemClickListener listener;
21 | private onFoodItemMessageButtonClickListener messageButtonClickListener;
22 | private onFoodItemCallButtonClickListener callButtonClickListener;
23 | private onFoodItemTrackButtonClickListener trackButtonClickListener;
24 | Context context;
25 |
26 | public FoodAdapter(@NonNull FirestoreRecyclerOptions options) {
27 | super(options);
28 | }
29 |
30 | @NonNull
31 | @Override
32 | public FoodAdapter.FoodViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
33 |
34 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.foodcard_item, parent, false);
35 | return new FoodViewHolder(v);
36 | }
37 |
38 | @Override
39 | public void onDataChanged() {
40 | super.onDataChanged();
41 | if(getItemCount() == 0){
42 |
43 | }
44 | }
45 |
46 | @Override
47 | protected void onBindViewHolder(@NonNull FoodViewHolder holder, int position, @NonNull FoodItem model) {
48 |
49 | holder.DonorName.setText(String.valueOf(model.DonorName));
50 | holder.DonorNumber.setText(String.valueOf(model.DonorNumber));
51 | holder.FoodName.setText(String.valueOf(model.FoodName));
52 | holder.FoodCount.setText(String.valueOf(model.FoodCount));
53 | if(model.getVerification()){
54 | holder.donor_verification.setVisibility(View.VISIBLE);
55 | }
56 |
57 | }
58 |
59 | class FoodViewHolder extends RecyclerView.ViewHolder {
60 |
61 | TextView DonorName, DonorNumber, FoodName, FoodCount;
62 | Button send_message, call_donor, track_location;
63 | ImageView donor_verification;
64 | CardView cardView;
65 | public FoodViewHolder(@NonNull View itemView) {
66 | super(itemView);
67 | DonorName = itemView.findViewById(R.id.foodDonorName);
68 | DonorNumber = itemView.findViewById(R.id.foodDonorNumber);
69 | FoodName = itemView.findViewById(R.id.foodItemName);
70 | FoodCount = itemView.findViewById(R.id.foodItemCount);
71 | cardView = itemView.findViewById(R.id.foodItemCard);
72 | donor_verification = itemView.findViewById(R.id.donor_verification);
73 | send_message = itemView.findViewById(R.id.message_donor);
74 | call_donor = itemView.findViewById(R.id.call_donor);
75 | track_location = itemView.findViewById(R.id.track_map);
76 |
77 | send_message.setOnClickListener(new View.OnClickListener() {
78 | @Override
79 | public void onClick(View v) {
80 | int position = getAdapterPosition();
81 | if (position != RecyclerView.NO_POSITION && messageButtonClickListener != null) {
82 | messageButtonClickListener.onMessageButtonClick(getSnapshots().getSnapshot(position), position);
83 | }
84 | }
85 | });
86 |
87 | call_donor.setOnClickListener(new View.OnClickListener() {
88 | @Override
89 | public void onClick(View v) {
90 | int position = getAdapterPosition();
91 | if (position != RecyclerView.NO_POSITION && callButtonClickListener != null) {
92 | callButtonClickListener.onCallButtonClick(getSnapshots().getSnapshot(position), position);
93 | }
94 | }
95 | });
96 |
97 | track_location.setOnClickListener(new View.OnClickListener() {
98 | @Override
99 | public void onClick(View v) {
100 | int position = getAdapterPosition();
101 | if (position != RecyclerView.NO_POSITION && trackButtonClickListener != null) {
102 | trackButtonClickListener.onTrackButtonClick(getSnapshots().getSnapshot(position), position);
103 | }
104 | }
105 | });
106 |
107 | // itemView.setOnClickListener(new View.OnClickListener() {
108 | // @Override
109 | // public void onClick(View v) {
110 | // int position = getAdapterPosition();
111 | // if (position != RecyclerView.NO_POSITION && listener != null) {
112 | // listener.onFoodItemClick(getSnapshots().getSnapshot(position), position);
113 | // }
114 | // }
115 | // });
116 |
117 | }
118 | }
119 |
120 | public interface onFoodItemMessageButtonClickListener {
121 | void onMessageButtonClick(DocumentSnapshot documentSnapshot, int position);
122 | }
123 |
124 | public void setOnMessageButtonClickListener(onFoodItemMessageButtonClickListener listener){
125 | this.messageButtonClickListener = listener;
126 | }
127 |
128 | public interface onFoodItemCallButtonClickListener {
129 | void onCallButtonClick(DocumentSnapshot documentSnapshot, int position);
130 | }
131 |
132 | public void setOnCallButtonClickListener(onFoodItemCallButtonClickListener listener){
133 | this.callButtonClickListener = listener;
134 | }
135 |
136 | public interface onFoodItemTrackButtonClickListener {
137 | void onTrackButtonClick(DocumentSnapshot documentSnapshot, int position);
138 | }
139 |
140 | public void setOnTrackButtonClickListener(onFoodItemTrackButtonClickListener listener){
141 | this.trackButtonClickListener = listener;
142 | }
143 |
144 |
145 | // public interface onFoodItemClickListener{
146 | // void onFoodItemClick(DocumentSnapshot documentSnapshot, int position);
147 | // }
148 | //
149 | // public void setOnFoodItemClickListener(onFoodItemClickListener listener){
150 | // this.listener = listener;
151 | // }
152 |
153 | }
154 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/FoodItem.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import com.google.firebase.Timestamp;
4 | import com.google.firebase.firestore.GeoPoint;
5 |
6 | public class FoodItem {
7 | String DonorID, DonorName, DonorNumber, FoodName, FoodCount;
8 | Boolean Status, Verification;
9 | String Hash;
10 | Timestamp TimeStamp;
11 | GeoPoint Location;
12 |
13 |
14 | public Boolean getStatus() {
15 | return Status;
16 | }
17 |
18 | public void setStatus(Boolean status) {
19 | Status = status;
20 | }
21 |
22 | public FoodItem(String donorID, String donorName, String donorNumber, String foodName, String foodCount, String hash, Boolean status, Boolean verification ,Timestamp timestamp, GeoPoint location) {
23 | DonorID = donorID;
24 | DonorName = donorName;
25 | DonorNumber = donorNumber;
26 | FoodName = foodName;
27 | FoodCount = foodCount;
28 | Status = status;
29 | Verification = verification;
30 | TimeStamp = timestamp;
31 | Location = location;
32 | Hash = hash;
33 | }
34 |
35 | public String getHash() {
36 | return Hash;
37 | }
38 |
39 | public void setHash(String hash) {
40 | Hash = hash;
41 | }
42 |
43 | public Boolean getVerification() {
44 | return Verification;
45 | }
46 |
47 | public void setVerification(Boolean verification) {
48 | Verification = verification;
49 | }
50 |
51 | public GeoPoint getLocation() {
52 | return Location;
53 | }
54 |
55 | public void setLocation(GeoPoint location) {
56 | Location = location;
57 | }
58 |
59 | public com.google.firebase.Timestamp getTimestamp() {
60 | return TimeStamp;
61 | }
62 |
63 | public void setTimestamp(com.google.firebase.Timestamp timestamp) {
64 | TimeStamp = timestamp;
65 | }
66 |
67 | public FoodItem() {
68 | }
69 |
70 |
71 | public String getDonorID() {
72 | return DonorID;
73 | }
74 |
75 | public void setDonorID(String donorID) {
76 | DonorID = donorID;
77 | }
78 |
79 |
80 | public String getDonorName() {
81 | return DonorName;
82 | }
83 |
84 | public void setDonorName(String donorName) {
85 | DonorName = donorName;
86 | }
87 |
88 | public String getDonorNumber() {
89 | return DonorNumber;
90 | }
91 |
92 | public void setDonorNumber(String donorNumber) {
93 | DonorNumber = donorNumber;
94 | }
95 |
96 | public String getFoodName() {
97 | return FoodName;
98 | }
99 |
100 | public void setFoodName(String foodName) {
101 | FoodName = foodName;
102 | }
103 |
104 | public String getFoodCount() {
105 | return FoodCount;
106 | }
107 |
108 | public void setFoodCount(String foodCount) {
109 | FoodCount = foodCount;
110 | }
111 |
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/Geohash.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | public class Geohash {
7 |
8 | private static final String base32 = "0123456789bcdefghjkmnpqrstuvwxyz";
9 |
10 | public static String encode(double lat, double lon, int precision) {
11 | StringBuilder geohash = new StringBuilder();
12 |
13 | double latMin = -90, latMax = 90;
14 | double lonMin = -180, lonMax = 180;
15 | boolean evenBit = true;
16 | int idx = 0, bit = 0;
17 |
18 | while (geohash.length() < precision) {
19 | if (evenBit) {
20 | double lonMid = (lonMin + lonMax) / 2;
21 | if (lon >= lonMid) {
22 | idx = idx * 2 + 1;
23 | lonMin = lonMid;
24 | } else {
25 | idx = idx * 2;
26 | lonMax = lonMid;
27 | }
28 | } else {
29 | double latMid = (latMin + latMax) / 2;
30 | if (lat >= latMid) {
31 | idx = idx * 2 + 1;
32 | latMin = latMid;
33 | } else {
34 | idx = idx * 2;
35 | latMax = latMid;
36 | }
37 | }
38 | evenBit = !evenBit;
39 |
40 | if (++bit == 5) {
41 | geohash.append(base32.charAt(idx));
42 | bit = 0;
43 | idx = 0;
44 | }
45 | }
46 |
47 | return geohash.toString();
48 | }
49 |
50 | public static Map decode(String geohash) {
51 | double latMin = -90, latMax = 90;
52 | double lonMin = -180, lonMax = 180;
53 | boolean evenBit = true;
54 |
55 | for (int i = 0; i < geohash.length(); i++) {
56 | int idx = base32.indexOf(geohash.charAt(i));
57 | for (int n = 4; n >= 0; n--) {
58 | int bitN = (idx >> n) & 1;
59 | if (evenBit) {
60 | double lonMid = (lonMin + lonMax) / 2;
61 | if (bitN == 1) {
62 | lonMin = lonMid;
63 | } else {
64 | lonMax = lonMid;
65 | }
66 | } else {
67 | double latMid = (latMin + latMax) / 2;
68 | if (bitN == 1) {
69 | latMin = latMid;
70 | } else {
71 | latMax = latMid;
72 | }
73 | }
74 | evenBit = !evenBit;
75 | }
76 | }
77 |
78 | double lat = (latMin + latMax) / 2;
79 | double lon = (lonMin + lonMax) / 2;
80 |
81 | Map location = new HashMap<>();
82 | location.put("lat", lat);
83 | location.put("lon", lon);
84 | return location;
85 | }
86 |
87 | public static String adjacent(String geohash, String direction) {
88 | geohash = geohash.toLowerCase();
89 | direction = direction.toLowerCase();
90 |
91 | if (geohash.isEmpty())
92 | throw new IllegalArgumentException("Invalid geohash");
93 | if (!"nsew".contains(direction))
94 | throw new IllegalArgumentException("Invalid direction");
95 |
96 | Map neighbour = new HashMap<>();
97 | neighbour.put("n", new String[]{"p0r21436x8zb9dcf5h7kjnmqesgutwvy", "bc01fg45238967deuvhjyznpkmstqrwx"});
98 | neighbour.put("s", new String[]{"14365h7k9dcfesgujnmqp0r2twvyx8zb", "238967debc01fg45kmstqrwxuvhjyznp"});
99 | neighbour.put("e", new String[]{"bc01fg45238967deuvhjyznpkmstqrwx", "p0r21436x8zb9dcf5h7kjnmqesgutwvy"});
100 | neighbour.put("w", new String[]{"238967debc01fg45kmstqrwxuvhjyznp", "14365h7k9dcfesgujnmqp0r2twvyx8zb"});
101 |
102 | Map border = new HashMap<>();
103 | border.put("n", new String[]{"prxz", "bcfguvyz"});
104 | border.put("s", new String[]{"028b", "0145hjnp"});
105 | border.put("e", new String[]{"bcfguvyz", "prxz"});
106 | border.put("w", new String[]{"0145hjnp", "028b"});
107 |
108 | int type = geohash.length() % 2;
109 | String lastCh = geohash.substring(geohash.length() - 1);
110 | String parent = geohash.substring(0, geohash.length() - 1);
111 |
112 | if (border.get(direction)[type].contains(lastCh) && !parent.isEmpty()) {
113 | parent = adjacent(parent, direction);
114 | }
115 |
116 | return parent + base32.charAt(neighbour.get(direction)[type].indexOf(lastCh));
117 | }
118 |
119 | public static Map neighbours(String geohash) {
120 | Map neighbours = new HashMap<>();
121 | neighbours.put("n", adjacent(geohash, "n"));
122 | neighbours.put("ne", adjacent(adjacent(geohash, "n"), "e"));
123 | neighbours.put("e", adjacent(geohash, "e"));
124 | neighbours.put("se", adjacent(adjacent(geohash, "s"), "e"));
125 | neighbours.put("s", adjacent(geohash, "s"));
126 | neighbours.put("sw", adjacent(adjacent(geohash, "s"), "w"));
127 | neighbours.put("w", adjacent(geohash, "w"));
128 | neighbours.put("nw", adjacent(adjacent(geohash, "n"), "w"));
129 | return neighbours;
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 | import androidx.annotation.NonNull;
3 | import androidx.appcompat.app.AppCompatActivity;
4 | import androidx.core.app.ActivityCompat;
5 |
6 | import android.content.Intent;
7 | import android.content.pm.PackageManager;
8 | import android.os.Bundle;
9 | import android.widget.Toast;
10 | import com.google.android.gms.tasks.OnSuccessListener;
11 | import com.google.firebase.auth.FirebaseAuth;
12 | import com.google.firebase.auth.FirebaseUser;
13 | import com.google.firebase.database.DataSnapshot;
14 | import com.google.firebase.database.DatabaseReference;
15 | import com.google.firebase.database.FirebaseDatabase;
16 |
17 | public class MainActivity extends AppCompatActivity {
18 |
19 | FirebaseUser user;
20 | DatabaseReference UserDB;
21 | FirebaseAuth mAuth;
22 |
23 | @Override
24 | protected void onStart() {
25 | super.onStart();
26 |
27 | if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED) {
28 | askPermission();
29 | }
30 |
31 | }
32 |
33 | private void askPermission() {
34 | ActivityCompat.requestPermissions(MainActivity.this, new String[] {android.Manifest.permission.ACCESS_FINE_LOCATION}, 100);
35 | }
36 |
37 | @Override
38 | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
39 | if (requestCode == 100){
40 | if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
41 | Toast.makeText(this, "Permission Granted", Toast.LENGTH_SHORT).show();;
42 | }else{
43 | Toast.makeText(this, "Require Permission", Toast.LENGTH_SHORT).show();
44 | mAuth.signOut();
45 | Intent intent_login = new Intent(getApplicationContext(), Login.class);
46 | startActivity(intent_login);
47 | finish();
48 | }
49 | }
50 | super.onRequestPermissionsResult(requestCode, permissions, grantResults);
51 | }
52 |
53 | @Override
54 | protected void onCreate(Bundle savedInstanceState) {
55 | super.onCreate(savedInstanceState);
56 |
57 | mAuth = FirebaseAuth.getInstance();
58 | UserDB = FirebaseDatabase.getInstance("https://share-it-6d179-default-rtdb.asia-southeast1.firebasedatabase.app/").getReference("Users");
59 | user = mAuth.getCurrentUser();
60 |
61 | if(user == null){
62 | Intent intent_login = new Intent(getApplicationContext(), Login.class);
63 | startActivity(intent_login);
64 | finish();
65 | }else {
66 | String UserID = user.getUid();
67 | UserDB.child(UserID).get().addOnSuccessListener(new OnSuccessListener() {
68 | @Override
69 | public void onSuccess(DataSnapshot dataSnapshot) {
70 | if (user.getEmail() != String.valueOf(dataSnapshot.child("email").getValue())){
71 | UserDB.child(UserID).child("email").setValue(user.getEmail());
72 | }
73 | String usertype = String.valueOf(dataSnapshot.child("usertype").getValue());
74 | if(usertype.equals("Donor")){
75 | Intent intent_donor = new Intent(getApplicationContext(), Donor_Side.class);
76 | startActivity(intent_donor);
77 | finish();
78 | } else if (usertype.equals("Receiver")) {
79 | Intent intent_receiver = new Intent(getApplicationContext(), Receiver_Side.class);
80 | startActivity(intent_receiver);
81 | finish();
82 | }
83 | else {
84 | mAuth.signOut();
85 | Intent intent_login = new Intent(getApplicationContext(), Login.class);
86 | startActivity(intent_login);
87 | finish();
88 | Toast.makeText(MainActivity.this, "Error fetching user details\nPlease try again", Toast.LENGTH_SHORT).show();
89 | }
90 | }
91 | });
92 | }
93 |
94 | }
95 |
96 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/ShelterAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.Button;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 | import android.widget.Toast;
11 |
12 | import androidx.annotation.NonNull;
13 | import androidx.cardview.widget.CardView;
14 | import androidx.recyclerview.widget.RecyclerView;
15 |
16 | import com.firebase.ui.firestore.FirestoreRecyclerAdapter;
17 | import com.firebase.ui.firestore.FirestoreRecyclerOptions;
18 | import com.google.firebase.firestore.DocumentSnapshot;
19 |
20 | public class ShelterAdapter extends FirestoreRecyclerAdapter {
21 |
22 | // private ShelterAdapter.onShelterItemClickListener listener;
23 |
24 | Context context;
25 | private onShelterItemMessageButtonClickListener messageButtonClickListener;
26 | private onShelterItemCallButtonClickListener callButtonClickListener;
27 | private onShelterItemTrackButtonClickListener trackButtonClickListener;
28 |
29 | public ShelterAdapter(@NonNull FirestoreRecyclerOptions options) {
30 | super(options);
31 | }
32 |
33 | @NonNull
34 | @Override
35 | public ShelterAdapter.ShelterViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
36 |
37 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.sheltercard_item, parent, false);
38 | return new ShelterAdapter.ShelterViewHolder(v);
39 | }
40 |
41 | @Override
42 | public void onDataChanged() {
43 | super.onDataChanged();
44 | if(getItemCount() == 0){
45 |
46 | }
47 | // Toast.makeText(context, "There are no Food items", Toast.LENGTH_SHORT).show();
48 | }
49 |
50 | @Override
51 | protected void onBindViewHolder(@NonNull ShelterAdapter.ShelterViewHolder holder, int position, @NonNull ShelterItem model) {
52 |
53 | holder.DonorName.setText(String.valueOf(model.DonorName));
54 | holder.DonorNumber.setText(String.valueOf(model.DonorNumber));
55 | holder.ShelterDesc.setText(String.valueOf(model.ShelterDescription));
56 | holder.ShelterAvailability.setText(String.valueOf(model.ShelterAvailability));
57 | if(model.getVerification()){
58 | holder.donor_verification.setVisibility(View.VISIBLE);
59 | }
60 |
61 | }
62 |
63 | class ShelterViewHolder extends RecyclerView.ViewHolder {
64 |
65 | TextView DonorName, DonorNumber, ShelterDesc, ShelterAvailability;
66 | CardView cardView;
67 | Button send_message, call_donor, track_location;
68 | ImageView donor_verification;
69 | public ShelterViewHolder(@NonNull View itemView) {
70 | super(itemView);
71 | DonorName = itemView.findViewById(R.id.shelterDonorName);
72 | DonorNumber = itemView.findViewById(R.id.shelterDonorNumber);
73 | ShelterDesc = itemView.findViewById(R.id.shelterItemDesc);
74 | ShelterAvailability = itemView.findViewById(R.id.shelterItemCount);
75 | cardView = itemView.findViewById(R.id.shelterItemCard);
76 | donor_verification = itemView.findViewById(R.id.donor_verification);
77 | send_message = itemView.findViewById(R.id.message_donor);
78 | call_donor = itemView.findViewById(R.id.call_donor);
79 | track_location = itemView.findViewById(R.id.track_map);
80 |
81 | send_message.setOnClickListener(new View.OnClickListener() {
82 | @Override
83 | public void onClick(View v) {
84 | int position = getAdapterPosition();
85 | if (position != RecyclerView.NO_POSITION && messageButtonClickListener != null) {
86 | messageButtonClickListener.onMessageButtonClick(getSnapshots().getSnapshot(position), position);
87 | }
88 | }
89 | });
90 |
91 | call_donor.setOnClickListener(new View.OnClickListener() {
92 | @Override
93 | public void onClick(View v) {
94 | int position = getAdapterPosition();
95 | if (position != RecyclerView.NO_POSITION && callButtonClickListener != null) {
96 | callButtonClickListener.onCallButtonClick(getSnapshots().getSnapshot(position), position);
97 | }
98 | }
99 | });
100 |
101 | track_location.setOnClickListener(new View.OnClickListener() {
102 | @Override
103 | public void onClick(View v) {
104 | int position = getAdapterPosition();
105 | if (position != RecyclerView.NO_POSITION && trackButtonClickListener != null) {
106 | trackButtonClickListener.onTrackButtonClick(getSnapshots().getSnapshot(position), position);
107 | }
108 | }
109 | });
110 |
111 |
112 |
113 | // itemView.setOnClickListener(new View.OnClickListener() {
114 | // @Override
115 | // public void onClick(View v) {
116 | // int position = getAdapterPosition();
117 | // if (position != RecyclerView.NO_POSITION && listener != null) {
118 | // listener.onShelterItemClick(getSnapshots().getSnapshot(position), position);
119 | // }
120 | // }
121 | // });
122 |
123 | }
124 | }
125 |
126 | public interface onShelterItemMessageButtonClickListener {
127 | void onMessageButtonClick(DocumentSnapshot documentSnapshot, int position);
128 | }
129 | public void setOnMessageButtonClickListener(onShelterItemMessageButtonClickListener listener){
130 | this.messageButtonClickListener = listener;
131 | }
132 |
133 | public interface onShelterItemCallButtonClickListener {
134 | void onCallButtonClick(DocumentSnapshot documentSnapshot, int position);
135 | }
136 |
137 | public void setOnCallButtonClickListener(onShelterItemCallButtonClickListener listener){
138 | this.callButtonClickListener = listener;
139 | }
140 |
141 | public interface onShelterItemTrackButtonClickListener {
142 | void onTrackButtonClick(DocumentSnapshot documentSnapshot, int position);
143 | }
144 |
145 | public void setOnTrackButtonClickListener(onShelterItemTrackButtonClickListener listener){
146 | this.trackButtonClickListener = listener;
147 | }
148 |
149 | // public interface onShelterItemClickListener{
150 | // // void onFoodItemClick(DocumentSnapshot documentSnapshot, int position);
151 | // void onShelterItemClick(DocumentSnapshot documentSnapshot, int position);
152 | // }
153 | //
154 | // public void setOnShelterItemClickListener(ShelterAdapter.onShelterItemClickListener listener){
155 | // this.listener = listener;
156 | // }
157 |
158 | }
159 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/ShelterItem.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import com.google.firebase.Timestamp;
4 | import com.google.firebase.firestore.GeoPoint;
5 |
6 | public class ShelterItem {
7 |
8 | String DonorID, DonorName, DonorNumber, ShelterDescription, ShelterAvailability;
9 | Boolean Status, Verification;
10 | Timestamp TimeStamp;
11 | GeoPoint Location;
12 |
13 | public ShelterItem(String donorID, String donorName, String donorNumber, String shelterDescription, String shelterAvailability, Timestamp timestamp, Boolean status, Boolean verification,GeoPoint location) {
14 | DonorID = donorID;
15 | DonorName = donorName;
16 | DonorNumber = donorNumber;
17 | ShelterDescription = shelterDescription;
18 | ShelterAvailability = shelterAvailability;
19 | Location = location;
20 | Status = status;
21 | Verification = verification;
22 | TimeStamp = timestamp;
23 | }
24 |
25 | public Boolean getVerification() {
26 | return Verification;
27 | }
28 |
29 | public void setVerification(Boolean verification) {
30 | Verification = verification;
31 | }
32 |
33 |
34 | public GeoPoint getLocation() {
35 | return Location;
36 | }
37 |
38 | public void setLocation(GeoPoint location) {
39 | Location = location;
40 | }
41 |
42 | public Boolean getStatus() {
43 | return Status;
44 | }
45 |
46 | public void setStatus(Boolean status) {
47 | Status = status;
48 | }
49 |
50 | public ShelterItem() {
51 | }
52 |
53 |
54 | public String getDonorID() {
55 | return DonorID;
56 | }
57 |
58 | public void setDonorID(String donorID) {
59 | DonorID = donorID;
60 | }
61 |
62 | public String getDonorName() {
63 | return DonorName;
64 | }
65 |
66 | public void setDonorName(String donorName) {
67 | DonorName = donorName;
68 | }
69 |
70 | public String getDonorNumber() {
71 | return DonorNumber;
72 | }
73 |
74 | public void setDonorNumber(String donorNumber) {
75 | DonorNumber = donorNumber;
76 | }
77 |
78 | public String getShelterDescription() {
79 | return ShelterDescription;
80 | }
81 |
82 | public void setShelterDescription(String shelterDescription) {
83 | ShelterDescription = shelterDescription;
84 | }
85 |
86 | public String getShelterAvailability() {
87 | return ShelterAvailability;
88 | }
89 |
90 | public void setShelterAvailability(String shelterAvailability) {
91 | ShelterAvailability = shelterAvailability;
92 | }
93 |
94 | public com.google.firebase.Timestamp getTimestamp() {
95 | return TimeStamp;
96 | }
97 |
98 | public void setTimestamp(com.google.firebase.Timestamp timestamp) {
99 | TimeStamp = timestamp;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/Spinner.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import androidx.appcompat.app.AppCompatActivity;
4 |
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.widget.AdapterView;
9 | import android.widget.ArrayAdapter;
10 | import android.widget.Toast;
11 |
12 | public class Spinner extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_spinner);
18 | android.widget.Spinner spinner = findViewById(R.id.user_spinner);
19 | ArrayAdapter adapter = ArrayAdapter.createFromResource(this,R.array.donation_type, android.R.layout.simple_spinner_item);
20 |
21 | adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
22 | spinner.setAdapter(adapter);
23 |
24 | spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
25 | @Override
26 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
27 | // Get the selected user type
28 | String donationType = parent.getItemAtPosition(position).toString();
29 |
30 | switch (donationType) {
31 | case "":
32 | break;
33 | case "Clothes":
34 | Intent intent_clothes = new Intent(getApplicationContext(), donation_cloth.class);
35 | startActivity(intent_clothes);
36 | Toast.makeText(parent.getContext(),donationType,Toast.LENGTH_SHORT).show();
37 | finish();
38 | break;
39 | case "Food":
40 | Intent intent_food = new Intent(getApplicationContext(), sendFood.class);
41 | startActivity(intent_food);
42 | Toast.makeText(parent.getContext(),donationType,Toast.LENGTH_SHORT).show();
43 | finish();
44 | break;
45 | case "Shelter":
46 | Intent intent_shelter = new Intent(getApplicationContext(), donation_shelter.class);
47 | startActivity(intent_shelter);
48 | Toast.makeText(parent.getContext(),donationType,Toast.LENGTH_SHORT).show();
49 | finish();
50 | break;
51 | }
52 |
53 | }
54 |
55 | @Override
56 | public void onNothingSelected(AdapterView> adapterView) {
57 |
58 |
59 | }
60 | });}}
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/User.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | public class User {
4 |
5 | private String name, phone, email, usertype, userId;
6 | private Boolean verification;
7 |
8 | public User() {
9 | }
10 |
11 | public User(String name, String phone, String email, String usertype, String userId, Boolean verification) {
12 | this.name = name;
13 | this.phone = phone;
14 | this.email = email;
15 | this.usertype = usertype;
16 | this.userId = userId;
17 | this.verification = verification;
18 | }
19 |
20 | public Boolean getVerification() {
21 | return verification;
22 | }
23 |
24 | public void setVerification(Boolean verification) {
25 | this.verification = verification;
26 | }
27 |
28 | public String getName() {
29 | return name;
30 | }
31 |
32 | public void setName(String name) {
33 | this.name = name;
34 | }
35 |
36 | public void setPhone(String phone) {
37 | this.phone = phone;
38 | }
39 |
40 | public void setEmail(String email) {
41 | this.email = email;
42 | }
43 |
44 | public void setUsertype(String usertype) {
45 | this.usertype = usertype;
46 | }
47 |
48 | public void setUserId(String userId) {
49 | this.userId = userId;
50 | }
51 |
52 | public String getUsertype() {
53 | return usertype;
54 | }
55 |
56 | public String getPhone() {
57 | return phone;
58 | }
59 |
60 | public String getEmail() {
61 | return email;
62 | }
63 |
64 | public String getUserId() {
65 | return userId;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/WrapContentLinearLayoutManager.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 |
7 | import androidx.recyclerview.widget.LinearLayoutManager;
8 | import androidx.recyclerview.widget.RecyclerView;
9 |
10 | public class WrapContentLinearLayoutManager extends LinearLayoutManager {
11 | public WrapContentLinearLayoutManager(Context context) {
12 | super(context);
13 | }
14 |
15 | public WrapContentLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
16 | super(context, orientation, reverseLayout);
17 | }
18 |
19 | public WrapContentLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
20 | super(context, attrs, defStyleAttr, defStyleRes);
21 | }
22 |
23 | @Override
24 | public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
25 | try {
26 | super.onLayoutChildren(recycler, state);
27 | } catch (IndexOutOfBoundsException e) {
28 | Log.e("TAG", "meet a IOOBE in RecyclerView");
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/change_user_email.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | import android.content.Intent;
7 | import android.os.Bundle;
8 | import android.text.TextUtils;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.ProgressBar;
12 | import android.widget.Toast;
13 |
14 | import com.google.android.gms.tasks.OnFailureListener;
15 | import com.google.android.gms.tasks.OnSuccessListener;
16 | import com.google.android.gms.tasks.SuccessContinuation;
17 | import com.google.android.material.textfield.TextInputEditText;
18 | import com.google.firebase.auth.FirebaseAuth;
19 | import com.google.firebase.auth.FirebaseUser;
20 |
21 | public class change_user_email extends AppCompatActivity {
22 |
23 | TextInputEditText edt_email;
24 | Button btn_save;
25 | ProgressBar progressBar;
26 | FirebaseAuth mAuth;
27 | FirebaseUser user;
28 |
29 | @Override
30 | protected void onStart() {
31 | super.onStart();
32 | mAuth = FirebaseAuth.getInstance();
33 | user = mAuth.getCurrentUser();
34 | }
35 |
36 | @Override
37 | protected void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | setContentView(R.layout.activity_change_user_email);
40 |
41 | edt_email = findViewById(R.id.change_email);
42 | btn_save = findViewById(R.id.change_email_btn);
43 | progressBar = findViewById(R.id.change_progressbar);
44 |
45 | btn_save.setOnClickListener(new View.OnClickListener() {
46 | @Override
47 | public void onClick(View v) {
48 | String email = edt_email.getText().toString();
49 | progressBar.setVisibility(View.VISIBLE);
50 | btn_save.setVisibility(View.INVISIBLE);
51 | if (TextUtils.isEmpty(email)) {
52 | edt_email.setError("PLease enter email");
53 | progressBar.setVisibility(View.INVISIBLE);
54 | btn_save.setVisibility(View.VISIBLE);
55 | return;
56 | } else if (!email.matches("^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$")) {
57 | Toast.makeText(change_user_email.this, "Please enter your email properly", Toast.LENGTH_SHORT).show();
58 | progressBar.setVisibility(View.INVISIBLE);
59 | btn_save.setVisibility(View.VISIBLE);
60 | return;
61 | }
62 |
63 | user.verifyBeforeUpdateEmail(String.valueOf(edt_email.getText())).addOnSuccessListener(new OnSuccessListener() {
64 | @Override
65 | public void onSuccess(Void unused) {
66 | progressBar.setVisibility(View.INVISIBLE);
67 | btn_save.setVisibility(View.VISIBLE);
68 | Toast.makeText(change_user_email.this, "Please verify using the link sent to new email to update", Toast.LENGTH_SHORT).show();
69 | Intent main = new Intent(getApplicationContext(),MainActivity.class);
70 | startActivity(main);
71 | finish();
72 | }
73 | }).addOnFailureListener(new OnFailureListener() {
74 | @Override
75 | public void onFailure(@NonNull Exception e) {
76 | progressBar.setVisibility(View.INVISIBLE);
77 | btn_save.setVisibility(View.VISIBLE);
78 | Toast.makeText(change_user_email.this, "Please check if the email is correct", Toast.LENGTH_SHORT).show();
79 | }
80 | });
81 |
82 | }
83 | });
84 |
85 | }
86 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/shareit/change_user_password.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | import android.content.Intent;
7 | import android.os.Bundle;
8 | import android.text.TextUtils;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.ProgressBar;
12 | import android.widget.Toast;
13 |
14 | import com.google.android.gms.tasks.OnFailureListener;
15 | import com.google.android.gms.tasks.OnSuccessListener;
16 | import com.google.android.material.textfield.TextInputEditText;
17 | import com.google.firebase.auth.AuthCredential;
18 | import com.google.firebase.auth.EmailAuthProvider;
19 | import com.google.firebase.auth.FirebaseAuth;
20 | import com.google.firebase.auth.FirebaseUser;
21 |
22 | public class change_user_password extends AppCompatActivity {
23 |
24 | TextInputEditText edt_old_pass, edt_new_pass, edt_renew_pass;
25 | String old_pass, new_pass, renew_pass;
26 | Button btn_save;
27 | ProgressBar progressBar;
28 | FirebaseAuth mAuth;
29 | FirebaseUser user;
30 |
31 | @Override
32 | protected void onStart() {
33 | super.onStart();
34 | mAuth = FirebaseAuth.getInstance();
35 | user = mAuth.getCurrentUser();
36 | }
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_change_user_password);
42 |
43 | edt_old_pass = findViewById(R.id.change_prev_password);
44 | edt_new_pass = findViewById(R.id.change_new_password);
45 | edt_renew_pass = findViewById(R.id.change_renew_password);
46 | btn_save = findViewById(R.id.password_change_btn);
47 | progressBar = findViewById(R.id.change_progressbar);
48 |
49 | btn_save.setOnClickListener(new View.OnClickListener() {
50 | @Override
51 | public void onClick(View v) {
52 | progressBar.setVisibility(View.VISIBLE);
53 | btn_save.setVisibility(View.INVISIBLE);
54 | old_pass = edt_old_pass.getText().toString();
55 | new_pass = edt_new_pass.getText().toString();
56 | renew_pass = edt_renew_pass.getText().toString();
57 |
58 | if(TextUtils.isEmpty(old_pass)){
59 | edt_old_pass.setError("Please Enter Old Password");
60 | progressBar.setVisibility(View.INVISIBLE);
61 | btn_save.setVisibility(View.VISIBLE);
62 | return;
63 | } else if (!old_pass.matches("^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{8,}$")) {
64 | Toast.makeText(change_user_password.this, "Please enter old password correctly", Toast.LENGTH_SHORT).show();
65 | progressBar.setVisibility(View.INVISIBLE);
66 | btn_save.setVisibility(View.VISIBLE);
67 | return;
68 | } else if (TextUtils.isEmpty(new_pass)) {
69 | edt_new_pass.setError("Please enter new password");
70 | progressBar.setVisibility(View.INVISIBLE);
71 | btn_save.setVisibility(View.VISIBLE);
72 | return;
73 | } else if (!new_pass.matches("^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{8,}$")) {
74 | Toast.makeText(change_user_password.this, "New password must have minimum eight characters, at least one letter, one number and one special character", Toast.LENGTH_SHORT).show();
75 | progressBar.setVisibility(View.INVISIBLE);
76 | btn_save.setVisibility(View.VISIBLE);
77 | return;
78 | } else if (TextUtils.isEmpty(renew_pass)) {
79 | edt_renew_pass.setError("Field cant be empty");
80 | progressBar.setVisibility(View.INVISIBLE);
81 | btn_save.setVisibility(View.VISIBLE);
82 | return;
83 | } else if (!TextUtils.equals(new_pass, renew_pass)) {
84 | Toast.makeText(change_user_password.this, "New Password and Confirm Password should be same", Toast.LENGTH_SHORT).show();
85 | progressBar.setVisibility(View.INVISIBLE);
86 | btn_save.setVisibility(View.VISIBLE);
87 | return;
88 | }else {
89 | reset_password(old_pass, new_pass);
90 | }
91 |
92 | }
93 | });
94 |
95 | }
96 |
97 | private void reset_password(String old_pass, String new_pass) {
98 |
99 | AuthCredential authCredential = EmailAuthProvider.getCredential(user.getEmail(), old_pass);
100 | user.reauthenticate(authCredential).addOnSuccessListener(new OnSuccessListener() {
101 | @Override
102 | public void onSuccess(Void unused) {
103 | progressBar.setVisibility(View.INVISIBLE);
104 | btn_save.setVisibility(View.VISIBLE);
105 | user.updatePassword(new_pass).addOnSuccessListener(new OnSuccessListener() {
106 | @Override
107 | public void onSuccess(Void unused) {
108 | Toast.makeText(change_user_password.this, "Password reset successfully ", Toast.LENGTH_SHORT).show();
109 | Intent main = new Intent(getApplicationContext(),MainActivity.class);
110 | startActivity(main);
111 | finish();
112 | }
113 | }).addOnFailureListener(new OnFailureListener() {
114 | @Override
115 | public void onFailure(@NonNull Exception e) {
116 | Toast.makeText(change_user_password.this, "There was some technical difficulty while reseting your password", Toast.LENGTH_SHORT).show();
117 | mAuth.sendPasswordResetEmail(user.getEmail()).addOnSuccessListener(new OnSuccessListener() {
118 | @Override
119 | public void onSuccess(Void unused) {
120 | Toast.makeText(change_user_password.this, "Sending password reset link to your registered email", Toast.LENGTH_SHORT).show();
121 | }
122 | });
123 | }
124 | });
125 | }
126 | }).addOnFailureListener(new OnFailureListener() {
127 | @Override
128 | public void onFailure(@NonNull Exception e) {
129 | progressBar.setVisibility(View.INVISIBLE);
130 | btn_save.setVisibility(View.VISIBLE);
131 | Toast.makeText(change_user_password.this, "Old password could not be verified, resending password reset link", Toast.LENGTH_SHORT).show();
132 | mAuth.sendPasswordResetEmail(user.getEmail()).addOnSuccessListener(new OnSuccessListener() {
133 | @Override
134 | public void onSuccess(Void unused) {
135 | Toast.makeText(change_user_password.this, "Old password could not be verified, sending password reset link", Toast.LENGTH_SHORT).show();
136 | }
137 | }).addOnFailureListener(new OnFailureListener() {
138 | @Override
139 | public void onFailure(@NonNull Exception e) {
140 | Toast.makeText(change_user_password.this, "Old password could not be verified, please try again.", Toast.LENGTH_SHORT).show();
141 | }
142 | });
143 | }
144 | });
145 |
146 | }
147 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/mainbg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable-v24/mainbg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/peep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable-v24/peep.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/peep2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable-v24/peep2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background_box_blue.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
8 |
9 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background_box_purple.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
8 |
9 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background_button_purple.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_add_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_archive_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_autorenew_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_call_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_close_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_delete_sweep_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_email_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_local_phone_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_logout_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_map_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_menu_open_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_message_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_password_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_person_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_save_alt_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_verified_24.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/black_verified_mark.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cafe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/cafe.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cloth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/cloth.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/clothes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/clothes.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/contribution.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/contribution.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/diet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/diet.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/donate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/donate.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_bdr.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/header_bkg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/house.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/house.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/log_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/log_out.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/mail_sent_amico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/mail_sent_amico.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/messages_rafiki.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/messages_rafiki.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/personal_settings_rafiki.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/personal_settings_rafiki.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/push_notifications_pana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/push_notifications_pana.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/received.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/received.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/reset_password_pana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/reset_password_pana.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shelter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/drawable/shelter.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_change_user_details.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
27 |
30 |
31 |
38 |
39 |
40 |
41 |
49 |
50 |
56 |
57 |
58 |
59 |
63 |
64 |
73 |
74 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_change_user_email.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
27 |
31 |
32 |
39 |
40 |
41 |
42 |
46 |
47 |
56 |
57 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_change_user_password.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
27 |
30 |
31 |
38 |
39 |
40 |
41 |
44 |
45 |
52 |
53 |
54 |
55 |
59 |
60 |
67 |
68 |
69 |
70 |
74 |
75 |
84 |
85 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_change_user_phone.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
27 |
28 |
39 |
40 |
53 |
54 |
62 |
63 |
71 |
72 |
85 |
86 |
87 |
88 |
89 |
93 |
94 |
95 |
105 |
106 |
107 |
113 |
114 |
115 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_donate_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_donation_cloth.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
14 |
15 |
16 |
17 |
23 |
24 |
25 |
28 |
29 |
36 |
37 |
38 |
39 |
43 |
44 |
51 |
52 |
53 |
54 |
59 |
60 |
68 |
69 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_donation_shelter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
15 |
21 |
22 |
23 |
26 |
27 |
35 |
36 |
37 |
38 |
42 |
43 |
50 |
51 |
52 |
53 |
58 |
59 |
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_donor_side.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
18 |
19 |
20 |
21 |
31 |
32 |
39 |
40 |
52 |
53 |
59 |
63 |
69 |
70 |
71 |
72 |
84 |
85 |
91 |
95 |
101 |
102 |
103 |
104 |
116 |
117 |
123 |
127 |
133 |
134 |
135 |
136 |
148 |
149 |
155 |
159 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
177 |
178 |
179 |
180 |
181 |
182 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
21 |
22 |
26 |
27 |
35 |
36 |
37 |
38 |
42 |
43 |
50 |
51 |
52 |
53 |
57 |
58 |
64 |
65 |
74 |
75 |
76 |
77 |
78 |
85 |
86 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
22 |
23 |
26 |
27 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
90 |
91 |
99 |
100 |
101 |
102 |
106 |
107 |
115 |
116 |
117 |
118 |
122 |
123 |
129 |
130 |
139 |
140 |
141 |
142 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_send_food.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
19 |
20 |
23 |
24 |
31 |
32 |
33 |
34 |
38 |
39 |
46 |
47 |
48 |
49 |
54 |
55 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_spinner.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
14 |
15 |
21 |
29 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_user_details_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
27 |
30 |
31 |
38 |
39 |
40 |
41 |
48 |
49 |
55 |
56 |
57 |
58 |
62 |
63 |
72 |
73 |
74 |
75 |
82 |
83 |
87 |
88 |
97 |
98 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_view_clothes.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_view_contributions.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
17 |
18 |
23 |
24 |
30 |
31 |
35 |
36 |
37 |
38 |
43 |
44 |
50 |
51 |
55 |
56 |
57 |
58 |
63 |
64 |
70 |
71 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
92 |
93 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_view_food.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_view_shelters.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/clothcard_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
26 |
27 |
32 |
33 |
39 |
40 |
41 |
42 |
47 |
48 |
53 |
54 |
60 |
61 |
68 |
69 |
70 |
71 |
76 |
77 |
82 |
83 |
89 |
90 |
91 |
92 |
97 |
98 |
103 |
104 |
110 |
111 |
112 |
113 |
118 |
119 |
127 |
128 |
135 |
136 |
143 |
144 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/contributionscard_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
38 |
39 |
40 |
41 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
59 |
60 |
61 |
62 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/foodcard_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
26 |
27 |
32 |
33 |
39 |
40 |
41 |
42 |
47 |
48 |
53 |
54 |
60 |
61 |
68 |
69 |
70 |
71 |
76 |
77 |
82 |
83 |
89 |
90 |
91 |
92 |
97 |
98 |
103 |
104 |
110 |
111 |
112 |
113 |
118 |
119 |
127 |
128 |
135 |
136 |
143 |
144 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
23 |
29 |
30 |
34 |
35 |
41 |
42 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
63 |
64 |
72 |
73 |
74 |
75 |
82 |
83 |
91 |
92 |
93 |
94 |
101 |
102 |
110 |
111 |
112 |
113 |
120 |
121 |
129 |
130 |
131 |
132 |
139 |
140 |
148 |
149 |
150 |
151 |
156 |
157 |
164 |
165 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/progress_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
18 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/sheltercard_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
26 |
27 |
32 |
33 |
39 |
40 |
41 |
42 |
47 |
48 |
53 |
54 |
60 |
61 |
68 |
69 |
70 |
71 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
89 |
90 |
91 |
92 |
97 |
98 |
103 |
104 |
110 |
111 |
112 |
113 |
118 |
119 |
127 |
128 |
135 |
136 |
143 |
144 |
145 |
146 |
147 |
148 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/userclass.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/new_donation_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/view_cloth_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/view_contribution_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/view_food_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/view_shelter_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #b7e2f3
8 | #FF018786
9 | #FF000000
10 | #FFFFFFFF
11 | #EEFC5E
12 | #ED2939
13 | #3CB043
14 | #000000
15 | #777474
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/headings_array.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | - Food
7 | - Clothes
8 | - Shelter
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | NestAid
3 | Login
4 | Enter Email
5 | Enter Password
6 | Register User
7 | Register
8 | Login Now
9 | Register Now
10 | Enter Name
11 | Enter Phone Number
12 |
13 | Hello blank fragment
14 | Confirm Password
15 | User Details
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/shareit/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.shareit;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | maven { url 'https://jitpack.io' }
4 | }
5 | dependencies {
6 | classpath 'com.google.gms:google-services:4.3.15'
7 | }
8 | }// Top-level build file where you can add configuration options common to all sub-projects/modules.
9 | plugins {
10 | id 'com.android.application' version '8.1.0' apply false
11 | id 'com.android.library' version '8.1.0' apply false
12 | }
--------------------------------------------------------------------------------
/firebase.json:
--------------------------------------------------------------------------------
1 | {
2 | "functions": [
3 | {
4 | "source": "functions",
5 | "codebase": "default",
6 | "ignore": [
7 | "node_modules",
8 | ".git",
9 | "firebase-debug.log",
10 | "firebase-debug.*.log"
11 | ],
12 | "predeploy": [
13 | "npm --prefix \"$RESOURCE_DIR\" run lint"
14 | ]
15 | }
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/functions/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | es6: true,
4 | node: true,
5 | },
6 | parserOptions: {
7 | "ecmaVersion": 2018,
8 | },
9 | extends: [
10 | "eslint:recommended",
11 | "google",
12 | ],
13 | rules: {
14 | "no-restricted-globals": ["error", "name", "length"],
15 | "prefer-arrow-callback": "error",
16 | "quotes": ["error", "double", {"allowTemplateLiterals": true}],
17 | },
18 | overrides: [
19 | {
20 | files: ["**/*.spec.*"],
21 | env: {
22 | mocha: true,
23 | },
24 | rules: {},
25 | },
26 | ],
27 | globals: {},
28 | };
29 |
--------------------------------------------------------------------------------
/functions/index.js:
--------------------------------------------------------------------------------
1 | const functions = require("firebase-functions");
2 | const admin = require("firebase-admin");
3 | const {firestore} = require("firebase-admin");
4 | admin.initializeApp();
5 |
6 | exports.removeExpiredDocuments = functions.pubsub.schedule("every 30 minutes")
7 | .onRun(async (context) => {
8 | console.log("Cron-Job");
9 | const db = admin.firestore();
10 | const now = firestore.Timestamp.now();
11 | const ts = firestore.Timestamp.fromMillis(now.toMillis() - 7200000);
12 | // 24 hours in milliseconds = 86400000
13 |
14 | const snap = await db.collection("Foods").where("MilliSec", "<", ts)
15 | .get();
16 | const promises = [];
17 | snap.forEach((snap) => {
18 | promises.push(snap.ref.delete());
19 | });
20 | return Promise.all(promises);
21 | });
22 |
23 | // // Create and deploy your first functions
24 | // // https://firebase.google.com/docs/functions/get-started
25 | //
26 | // exports.helloWorld = functions.https.onRequest((request, response) => {
27 | // functions.logger.info("Hello logs!", {structuredData: true});
28 | // response.send("Hello from Firebase!");
29 | // });
30 |
--------------------------------------------------------------------------------
/functions/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "functions",
3 | "description": "Cloud Functions for Firebase",
4 | "scripts": {
5 | "lint": "eslint .",
6 | "serve": "firebase emulators:start --only functions",
7 | "shell": "firebase functions:shell",
8 | "start": "npm run shell",
9 | "deploy": "firebase deploy --only functions",
10 | "logs": "firebase functions:log"
11 | },
12 | "engines": {
13 | "node": "16"
14 | },
15 | "main": "index.js",
16 | "dependencies": {
17 | "firebase-admin": "^11.5.0",
18 | "firebase-functions": "^4.2.0"
19 | },
20 | "devDependencies": {
21 | "eslint": "^8.15.0",
22 | "eslint-config-google": "^0.14.0",
23 | "firebase-functions-test": "^3.0.0"
24 | },
25 | "private": true
26 | }
27 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Enables namespacing of each library's R class so that its R class includes only the
19 | # resources declared in the library itself and none from the library's dependencies,
20 | # thereby reducing the size of the R class for that library
21 | android.nonTransitiveRClass=true
22 | android.defaults.buildfeatures.buildconfig=true
23 | android.nonFinalResIds=false
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chirag38-unity/NestAid/46659a435f8f3daf8f4eb27b0c07d4049eacdd31/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Mar 31 18:29:14 IST 2023
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | gradlePluginPortal()
6 | }
7 | }
8 | dependencyResolutionManagement {
9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | }
15 | rootProject.name = "ShareIT"
16 | include ':app'
17 |
--------------------------------------------------------------------------------
/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ShareIT
3 | Login
4 | Enter Email
5 | Enter Password
6 | Register User
7 | Register
8 | Login Now
9 | Register Now
10 | Enter Name
11 | Enter Phone Number
12 |
13 | Hello blank fragment
14 |
--------------------------------------------------------------------------------