├── FEED ├── .gitignore ├── .idea │ ├── codeStyles │ │ └── Project.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ └── runConfigurations.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── google-services.json │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── feed │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── feed │ │ │ │ ├── Cache.java │ │ │ │ ├── Child.java │ │ │ │ ├── DisplayActivity.java │ │ │ │ ├── DonateActivity.java │ │ │ │ ├── FirstActivity.java │ │ │ │ ├── GeoLocation.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── RecieveActivity.java │ │ │ │ ├── RegisterActivity.java │ │ │ │ └── SecondActivity.java │ │ └── res │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ ├── background.xml │ │ │ ├── background_login.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── logo.jpg │ │ │ ├── myfooddonation.JPG │ │ │ ├── new_login.jpg │ │ │ ├── password.png │ │ │ ├── pexels.jpeg │ │ │ ├── receiver.JPG │ │ │ └── username.png │ │ │ ├── layout-v26 │ │ │ └── activity_donate.xml │ │ │ ├── layout │ │ │ ├── activity_display.xml │ │ │ ├── activity_donate.xml │ │ │ ├── activity_first.xml │ │ │ ├── activity_main.xml │ │ │ ├── activity_recieve.xml │ │ │ ├── activity_second.xml │ │ │ └── register_activity.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── feed │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── README.md └── ScreenShots ├── WhatsApp Image 2019-11-19 at 22.20.59 (1).jpeg ├── WhatsApp Image 2019-11-19 at 22.20.59 (2).jpeg ├── WhatsApp Image 2019-11-19 at 22.20.59 (3).jpeg ├── WhatsApp Image 2019-11-19 at 22.20.59 (4).jpeg ├── WhatsApp Image 2019-11-19 at 22.20.59 (5).jpeg ├── WhatsApp Image 2019-11-19 at 22.20.59 (6).jpeg ├── WhatsApp Image 2019-11-19 at 22.20.59 (7).jpeg └── WhatsApp Image 2019-11-19 at 22.20.59.jpeg /FEED/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | -------------------------------------------------------------------------------- /FEED/.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /FEED/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /FEED/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /FEED/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 41 | 42 | 43 | 44 | 45 | 46 | 48 | -------------------------------------------------------------------------------- /FEED/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /FEED/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /FEED/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.google.gms.google-services' 3 | 4 | android { 5 | compileSdkVersion 29 6 | buildToolsVersion "29.0.1" 7 | defaultConfig { 8 | applicationId "com.example.feed" 9 | minSdkVersion 16 10 | targetSdkVersion 29 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 14 | multiDexEnabled true 15 | } 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | implementation fileTree(dir: 'libs', include: ['*.jar']) 26 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 27 | implementation 'com.google.android.material:material:1.0.0' 28 | implementation 'com.google.firebase:firebase-auth:16.0.5' 29 | implementation 'com.google.firebase:firebase-database:16.0.4' 30 | implementation 'androidx.appcompat:appcompat:1.0.2' 31 | testImplementation 'junit:junit:4.12' 32 | androidTestImplementation 'androidx.test:runner:1.2.0' 33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 34 | implementation 'com.google.android.gms:play-services:12.0.1' 35 | implementation 'com.android.support:multidex:1.0.3' 36 | implementation 'com.firebase:firebase-client-android:2.5.2' 37 | 38 | } 39 | -------------------------------------------------------------------------------- /FEED/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "285973563297", 4 | "firebase_url": "https://feed-85067.firebaseio.com", 5 | "project_id": "feed-85067", 6 | "storage_bucket": "feed-85067.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:285973563297:android:358b2162e412172c", 12 | "android_client_info": { 13 | "package_name": "com.example.feed" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "285973563297-2qbasvk9pmpio6fc4i0jhecffdmjq9as.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "com.example.feed", 22 | "certificate_hash": "5fd6a182f435fd3c54f0d925baadbfeac9c57d51" 23 | } 24 | }, 25 | { 26 | "client_id": "285973563297-pchfhr60ldqts39qnae6g1qebej9jpds.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyChThneeVQZ3H2E6FgAfYgrzU77LX5SYho" 33 | } 34 | ], 35 | "services": { 36 | "appinvite_service": { 37 | "other_platform_oauth_client": [ 38 | { 39 | "client_id": "285973563297-pchfhr60ldqts39qnae6g1qebej9jpds.apps.googleusercontent.com", 40 | "client_type": 3 41 | } 42 | ] 43 | } 44 | } 45 | } 46 | ], 47 | "configuration_version": "1" 48 | } -------------------------------------------------------------------------------- /FEED/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 22 | -------------------------------------------------------------------------------- /FEED/app/src/androidTest/java/com/example/feed/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 2 | 3 | import android.content.Context; 4 | import androidx.test.InstrumentationRegistry; 5 | import androidx.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.example.feed", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /FEED/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/Cache.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 2 | 3 | public class Cache { 4 | 5 | private Long maxid; 6 | private String userName; 7 | private String foodName; 8 | private String quantity; 9 | private String number; 10 | private Double x,y; 11 | 12 | public Long getMaxid() { 13 | return maxid; 14 | } 15 | 16 | public void setMaxid(Long maxid) { 17 | this.maxid = maxid; 18 | } 19 | 20 | public Double getX() { 21 | return x; 22 | } 23 | 24 | public void setX(Double x) { 25 | this.x = x; 26 | } 27 | 28 | public Double getY() { 29 | return y; 30 | } 31 | 32 | public void setY(Double y) { 33 | this.y = y; 34 | } 35 | 36 | public String getUserName() { 37 | return userName; 38 | } 39 | 40 | public void setUserName(String userName) { 41 | this.userName = userName; 42 | } 43 | 44 | public String getFoodName() { 45 | return foodName; 46 | } 47 | 48 | public void setFoodName(String foodName) { 49 | this.foodName = foodName; 50 | } 51 | 52 | public String getQuantity() { 53 | return quantity; 54 | } 55 | 56 | public void setQuantity(String quantity) { 57 | this.quantity = quantity; 58 | } 59 | 60 | public String getNumber() { 61 | return number; 62 | } 63 | 64 | public void setNumber(String number) { 65 | this.number = number; 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/Child.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 2 | 3 | public class Child { 4 | 5 | private String userName; 6 | private String foodName; 7 | private String quantity; 8 | private String number; 9 | private Double x,y; 10 | 11 | public String getUserName() { 12 | return userName; 13 | } 14 | 15 | public void setUserName(String userName) { 16 | this.userName = userName; 17 | } 18 | 19 | public String getFoodName() { 20 | return foodName; 21 | } 22 | 23 | public void setFoodName(String foodName) { 24 | this.foodName = foodName; 25 | } 26 | 27 | public String getQuantity() { 28 | return quantity; 29 | } 30 | 31 | public void setQuantity(String quantity) { 32 | this.quantity = quantity; 33 | } 34 | 35 | public String getNumber() { 36 | return number; 37 | } 38 | 39 | public void setNumber(String number) { 40 | this.number = number; 41 | } 42 | 43 | public Double getX() { 44 | return x; 45 | } 46 | 47 | public void setX(Double x) { 48 | this.x = x; 49 | } 50 | 51 | public Double getY() { 52 | return y; 53 | } 54 | 55 | public void setY(Double y) { 56 | this.y = y; 57 | } 58 | } -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/DisplayActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.content.Intent; 6 | import android.net.Uri; 7 | import android.os.Bundle; 8 | import android.view.View; 9 | import android.widget.Button; 10 | import android.widget.EditText; 11 | 12 | public class DisplayActivity extends AppCompatActivity { 13 | 14 | private EditText uname, fname, quantity, number; 15 | private Button btn; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | setContentView(R.layout.activity_display); 21 | 22 | 23 | 24 | uname = (EditText) findViewById(R.id.etname); 25 | fname = (EditText) findViewById(R.id.etfoodname); 26 | quantity = (EditText) findViewById(R.id.etquantity); 27 | number = (EditText) findViewById(R.id.etnum); 28 | 29 | Intent i = getIntent(); 30 | 31 | String name = i.getStringExtra("name"); 32 | String food = i.getStringExtra("food"); 33 | String quant = i.getStringExtra("quant"); 34 | String num = i.getStringExtra("num"); 35 | Double x =i.getDoubleExtra("lat",0); 36 | Double y =i.getDoubleExtra("lng",0); 37 | 38 | uname.setText("Donor Name- "+name); 39 | fname.setText("Food Name- "+food); 40 | quantity.setText("Food Quantity- "+quant); 41 | number.setText("Donor Number- "+num); 42 | 43 | uname.setEnabled(false); 44 | fname.setEnabled(false); 45 | quantity.setEnabled(false); 46 | number.setEnabled(false); 47 | 48 | final String address = "geo:"+String.valueOf(x)+","+String.valueOf(y); 49 | 50 | btn = (Button) findViewById(R.id.btnloc); 51 | 52 | btn.setOnClickListener(new View.OnClickListener() { 53 | @Override 54 | public void onClick(View view) { 55 | 56 | Uri gmmIntentUri = Uri.parse(address); 57 | Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); 58 | mapIntent.setPackage("com.google.android.apps.maps"); 59 | if (mapIntent.resolveActivity(getPackageManager()) != null) { 60 | startActivity(mapIntent); 61 | } 62 | 63 | // Intent intent = new Intent(); 64 | // intent.setAction(Intent.ACTION_VIEW); 65 | // intent.setData(Uri.parse(address)); 66 | // startActivity(intent); 67 | 68 | } 69 | }); 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/DonateActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.annotation.RequiresApi; 5 | import androidx.appcompat.app.AppCompatActivity; 6 | import androidx.core.app.ActivityCompat; 7 | import androidx.core.content.ContextCompat; 8 | 9 | import android.Manifest; 10 | import android.app.Activity; 11 | import android.content.Intent; 12 | import android.content.pm.PackageManager; 13 | import android.location.Location; 14 | import android.os.Build; 15 | import android.os.Bundle; 16 | import android.text.TextUtils; 17 | import android.view.View; 18 | import android.widget.Button; 19 | import android.widget.EditText; 20 | import android.widget.Toast; 21 | 22 | import com.google.firebase.database.DataSnapshot; 23 | import com.google.firebase.database.DatabaseError; 24 | import com.google.firebase.database.DatabaseReference; 25 | import com.google.firebase.database.FirebaseDatabase; 26 | import com.google.firebase.database.ValueEventListener; 27 | 28 | 29 | public class DonateActivity extends AppCompatActivity { 30 | 31 | 32 | private EditText uname, fname, quantity, number; 33 | private DatabaseReference reff; 34 | private Child member; 35 | private long maxid = 0; 36 | private Double lat,lng; 37 | 38 | 39 | @RequiresApi(api = Build.VERSION_CODES.M) 40 | protected void onCreate(Bundle savedInstanceState) { 41 | super.onCreate(savedInstanceState); 42 | setContentView(R.layout.activity_donate); 43 | 44 | if (!(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { 45 | ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, 123); 46 | } 47 | 48 | uname = (EditText) findViewById(R.id.etname); 49 | fname = (EditText) findViewById(R.id.etfoodname); 50 | quantity = (EditText) findViewById(R.id.etquantity); 51 | number = (EditText) findViewById(R.id.etnum); 52 | 53 | Button btn = (Button) findViewById(R.id.btnsubmit); 54 | 55 | member = new Child(); 56 | 57 | reff = FirebaseDatabase.getInstance().getReference().child("Child"); 58 | 59 | reff.addValueEventListener(new ValueEventListener() { 60 | @Override 61 | public void onDataChange(@NonNull DataSnapshot dataSnapshot) { 62 | if (dataSnapshot.exists()) { 63 | maxid = dataSnapshot.getChildrenCount(); 64 | } 65 | } 66 | 67 | @Override 68 | public void onCancelled(@NonNull DatabaseError databaseError) { 69 | 70 | } 71 | }); 72 | 73 | btn.setOnClickListener(new View.OnClickListener() { 74 | @Override 75 | public void onClick(View view) { 76 | String un, fn, qt, nm; 77 | 78 | un = uname.getText().toString().trim(); 79 | fn = fname.getText().toString().trim(); 80 | qt = quantity.getText().toString().trim(); 81 | nm = number.getText().toString().trim(); 82 | 83 | if (TextUtils.isEmpty(un) || TextUtils.isEmpty(fn) || TextUtils.isEmpty(qt) || TextUtils.isEmpty(nm)) { 84 | Toast.makeText(DonateActivity.this, "Fields must not be empty", Toast.LENGTH_SHORT).show(); 85 | } else { 86 | 87 | 88 | GeoLocation geoLocation = new GeoLocation(getApplicationContext()); 89 | 90 | Location l = geoLocation.getLocation(); 91 | 92 | if (l != null) { 93 | lat = l.getLatitude(); 94 | lng = l.getLongitude(); 95 | 96 | 97 | 98 | member.setUserName(un); 99 | member.setFoodName(fn); 100 | member.setQuantity(qt); 101 | member.setNumber(nm); 102 | member.setX(lat); 103 | member.setY(lng); 104 | 105 | reff.child(String.valueOf(maxid + 1)).setValue(member); 106 | 107 | Toast.makeText(DonateActivity.this, "Donated", Toast.LENGTH_SHORT).show(); 108 | 109 | Intent intent = new Intent(DonateActivity.this, SecondActivity.class); 110 | startActivity(intent); 111 | finish(); 112 | } 113 | } 114 | } 115 | }); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/FirstActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 2 | 3 | import androidx.annotation.NonNull; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | import androidx.core.app.ActivityCompat; 6 | import androidx.core.content.ContextCompat; 7 | 8 | import android.Manifest; 9 | import android.content.Intent; 10 | import android.content.pm.PackageManager; 11 | import android.os.Bundle; 12 | import android.text.TextUtils; 13 | import android.util.Log; 14 | import android.widget.Button; 15 | 16 | import android.view.View; 17 | import android.view.View.OnClickListener; 18 | import android.widget.EditText; 19 | import android.widget.Toast; 20 | 21 | import com.google.android.gms.tasks.OnCompleteListener; 22 | import com.google.android.gms.tasks.Task; 23 | import com.google.firebase.auth.AuthResult; 24 | import com.google.firebase.auth.FirebaseAuth; 25 | import com.google.firebase.auth.FirebaseUser; 26 | 27 | 28 | public class FirstActivity extends AppCompatActivity { 29 | 30 | private static final String TAG = "FirstActivity"; 31 | private FirebaseAuth mAuth; 32 | private EditText ETemail; 33 | private EditText ETpassword; 34 | long maxid=0; 35 | 36 | @Override 37 | protected void onCreate(Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | setContentView(R.layout.activity_first); 40 | 41 | if (!(ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { 42 | ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, 123); 43 | } 44 | 45 | mAuth = FirebaseAuth.getInstance(); 46 | 47 | ETemail = (EditText)findViewById(R.id.editText); 48 | ETpassword = (EditText)findViewById(R.id.editText2); 49 | 50 | final Button signIn = (Button) findViewById(R.id.sign_in); 51 | signIn.setOnClickListener(new OnClickListener() { 52 | @Override 53 | public void onClick(View view) { 54 | signInIntoApp(); 55 | } 56 | }); 57 | 58 | Button signUp = (Button) findViewById(R.id.sign_up); 59 | signUp.setOnClickListener(new OnClickListener() { 60 | @Override 61 | public void onClick(View view){ 62 | Intent intent = new Intent(FirstActivity.this, RegisterActivity.class); 63 | startActivity(intent); 64 | } 65 | }); 66 | 67 | } 68 | 69 | private void signInIntoApp(){ 70 | String email = ETemail.getText().toString().trim(); 71 | String password = ETpassword.getText().toString().trim(); 72 | 73 | if(TextUtils.isEmpty(email)){ 74 | Toast.makeText(this," Invalid Email ",Toast.LENGTH_SHORT).show(); 75 | return; 76 | } 77 | 78 | if(TextUtils.isEmpty(password)){ 79 | Toast.makeText(this," Invalid Password ",Toast.LENGTH_SHORT).show(); 80 | return; 81 | } 82 | 83 | mAuth.signInWithEmailAndPassword(email, password) 84 | .addOnCompleteListener(this, new OnCompleteListener() { 85 | @Override 86 | public void onComplete(@NonNull Task task) { 87 | if (task.isSuccessful()) { 88 | // Sign in success, update UI with the signed-in user's information 89 | Log.d(TAG, "signInWithEmail:success"); 90 | FirebaseUser user = mAuth.getCurrentUser(); 91 | 92 | Intent intent = new Intent(FirstActivity.this, SecondActivity.class); 93 | startActivity(intent); 94 | } else { 95 | // If sign in fails, display a message to the user. 96 | Log.w(TAG, "signInWithEmail:failure", task.getException()); 97 | Toast.makeText(FirstActivity.this," Authentication failed.", 98 | Toast.LENGTH_SHORT).show(); 99 | } 100 | 101 | // ... 102 | } 103 | }); 104 | } 105 | 106 | @Override 107 | public void onStart() { 108 | super.onStart(); 109 | // Check if user is signed in (non-null) and update UI accordingly. 110 | FirebaseUser currentUser = mAuth.getCurrentUser(); 111 | //updateUI(currentUser); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/GeoLocation.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 2 | 3 | import android.Manifest; 4 | import android.content.Context; 5 | import android.content.pm.PackageManager; 6 | import android.location.Location; 7 | import android.location.LocationListener; 8 | import android.location.LocationManager; 9 | import android.os.Bundle; 10 | import android.widget.Toast; 11 | 12 | import androidx.core.content.ContextCompat; 13 | 14 | class GeoLocation implements LocationListener { 15 | 16 | Context context; 17 | 18 | public GeoLocation(Context c) { 19 | this.context = c; 20 | } 21 | 22 | public Location getLocation() { 23 | 24 | LocationManager lm = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); 25 | assert lm != null; 26 | boolean onGPS = lm.isProviderEnabled(LocationManager.GPS_PROVIDER); 27 | if (onGPS) { 28 | 29 | if (ContextCompat.checkSelfPermission(context,Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED ){ 30 | return null; 31 | } 32 | 33 | lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 6000, 10, this); 34 | 35 | Location l = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); 36 | 37 | return l; 38 | } 39 | else{ 40 | Toast.makeText(context,"Enable GPS",Toast.LENGTH_SHORT).show(); 41 | } 42 | return null; 43 | } 44 | 45 | @Override 46 | public void onLocationChanged(Location location) { 47 | 48 | } 49 | 50 | @Override 51 | public void onStatusChanged(String s, int i, Bundle bundle) { 52 | 53 | } 54 | 55 | @Override 56 | public void onProviderEnabled(String s) { 57 | 58 | } 59 | 60 | @Override 61 | public void onProviderDisabled(String s) { 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 2 | 3 | import androidx.appcompat.app.AppCompatActivity; 4 | 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.os.Handler; 8 | 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | 17 | new Handler().postDelayed(new Runnable() { 18 | @Override 19 | public void run() { 20 | Intent intent = new Intent(MainActivity.this, FirstActivity.class); 21 | startActivity(intent); 22 | finish(); 23 | } 24 | },2000); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/RecieveActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 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.ListView; 11 | import android.widget.Toast; 12 | 13 | 14 | import com.google.firebase.database.DataSnapshot; 15 | import com.google.firebase.database.DatabaseError; 16 | import com.google.firebase.database.DatabaseReference; 17 | import com.google.firebase.database.FirebaseDatabase; 18 | import com.google.firebase.database.ValueEventListener; 19 | import java.util.ArrayList; 20 | 21 | 22 | public class RecieveActivity extends AppCompatActivity { 23 | 24 | private DatabaseReference reff; 25 | private ListView mListView; 26 | private ArrayAdapter adapter; 27 | private ArrayList arrayList; 28 | private long N=0; 29 | 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_recieve); 34 | 35 | Toast.makeText(RecieveActivity.this,"Please Wait.....",Toast.LENGTH_SHORT).show(); 36 | 37 | mListView = (ListView) findViewById(R.id.listview); 38 | 39 | 40 | reff = FirebaseDatabase.getInstance().getReference().child("Child"); 41 | arrayList = new ArrayList(); 42 | 43 | 44 | reff.addListenerForSingleValueEvent(new ValueEventListener() { 45 | @Override 46 | public void onDataChange(final DataSnapshot dataSnapshot) { 47 | arrayList.clear(); 48 | N=dataSnapshot.getChildrenCount(); 49 | for( int i = 1 ; i <= N ; i++ ){ 50 | arrayList.add(dataSnapshot.child(String.valueOf(i)).child("foodName").getValue(String.class)); 51 | } 52 | 53 | adapter = new ArrayAdapter(RecieveActivity.this, android.R.layout.simple_expandable_list_item_1,arrayList); 54 | mListView.setAdapter(adapter); 55 | 56 | mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 57 | @Override 58 | public void onItemClick(AdapterView adapterView, View view, int i, long l) { 59 | Cache c = new Cache(); 60 | 61 | i++; 62 | 63 | c.setUserName(dataSnapshot.child(String.valueOf(i)).child("userName").getValue(String.class)); 64 | c.setFoodName(dataSnapshot.child(String.valueOf(i)).child("foodName").getValue(String.class)); 65 | c.setQuantity(dataSnapshot.child(String.valueOf(i)).child("quantity").getValue(String.class)); 66 | c.setNumber(dataSnapshot.child(String.valueOf(i)).child("number").getValue(String.class)); 67 | c.setX(dataSnapshot.child(String.valueOf(i)).child("x").getValue(Double.class)); 68 | c.setY(dataSnapshot.child(String.valueOf(i)).child("y").getValue(Double.class)); 69 | 70 | 71 | Intent intent = new Intent(RecieveActivity.this,DisplayActivity.class); 72 | 73 | intent.putExtra("name",c.getUserName()); 74 | intent.putExtra("food",c.getFoodName()); 75 | intent.putExtra("quant",c.getQuantity()); 76 | intent.putExtra("num",c.getNumber()); 77 | intent.putExtra("lat",c.getX()); 78 | intent.putExtra("lng",c.getY()); 79 | 80 | startActivity(intent); 81 | 82 | } 83 | }); 84 | 85 | } 86 | 87 | @Override 88 | public void onCancelled(DatabaseError databaseError) { 89 | 90 | } 91 | }); 92 | 93 | 94 | 95 | } 96 | 97 | } 98 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/RegisterActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 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.util.Log; 10 | import android.view.View; 11 | import android.widget.Button; 12 | import android.widget.EditText; 13 | import android.widget.Toast; 14 | 15 | import com.google.android.gms.tasks.OnCompleteListener; 16 | import com.google.android.gms.tasks.Task; 17 | import com.google.firebase.auth.AuthResult; 18 | import com.google.firebase.auth.FirebaseAuth; 19 | import com.google.firebase.auth.FirebaseUser; 20 | 21 | 22 | public class RegisterActivity extends AppCompatActivity { 23 | 24 | private static final String TAG = ">"; 25 | private EditText ETemail; 26 | private EditText ETpassword; 27 | private FirebaseAuth mAuth; 28 | 29 | protected void registerUser(){ 30 | String email = ETemail.getText().toString().trim(); 31 | String password = ETpassword.getText().toString().trim(); 32 | 33 | if(TextUtils.isEmpty(email)){ 34 | Toast.makeText(this," Invalid Email ",Toast.LENGTH_SHORT).show(); 35 | return; 36 | } 37 | 38 | if(TextUtils.isEmpty(password)){ 39 | Toast.makeText(this," Invalid Password ",Toast.LENGTH_SHORT).show(); 40 | return; 41 | } 42 | 43 | mAuth.signInWithEmailAndPassword(email, password) 44 | .addOnCompleteListener(this, new OnCompleteListener() { 45 | @Override 46 | public void onComplete(@NonNull Task task) { 47 | if (task.isSuccessful()) { 48 | // Sign in success, update UI with the signed-in user's information 49 | Log.d(TAG, "signInWithEmail:success"); 50 | FirebaseUser user = mAuth.getCurrentUser(); 51 | 52 | Toast.makeText(RegisterActivity.this," User already exists, Logging in... ", Toast.LENGTH_SHORT).show(); 53 | 54 | Intent intent = new Intent(RegisterActivity.this, SecondActivity.class); 55 | startActivity(intent); 56 | finish(); 57 | 58 | } else { 59 | createUser(); 60 | } 61 | 62 | // ... 63 | } 64 | }); 65 | 66 | 67 | 68 | } 69 | 70 | protected void createUser(){ 71 | 72 | String email = ETemail.getText().toString().trim(); 73 | String password = ETpassword.getText().toString().trim(); 74 | 75 | mAuth.createUserWithEmailAndPassword(email, password) 76 | .addOnCompleteListener(this, new OnCompleteListener() { 77 | @Override 78 | public void onComplete(@NonNull Task task) { 79 | if (task.isSuccessful()) { 80 | // Sign in success, update UI with the signed-in user's information 81 | Log.d(TAG, "createUserWithEmail:success"); 82 | FirebaseUser user = mAuth.getCurrentUser(); 83 | Toast.makeText(RegisterActivity.this,"Logging in... ", Toast.LENGTH_SHORT).show(); 84 | Intent intent = new Intent(RegisterActivity.this, SecondActivity.class); 85 | startActivity(intent); 86 | finish(); 87 | } else { 88 | // If sign in fails, display a message to the user. 89 | Log.w(TAG, "createUserWithEmail:failure", task.getException()); 90 | Toast.makeText(RegisterActivity.this, "Email already exists.", 91 | Toast.LENGTH_SHORT).show(); 92 | // updateUI(null); 93 | } 94 | 95 | // ... 96 | } 97 | }); 98 | } 99 | 100 | @Override 101 | protected void onCreate(Bundle savedInstanceState) { 102 | super.onCreate(savedInstanceState); 103 | setContentView(R.layout.register_activity); 104 | 105 | // Initialize Firebase Auth 106 | mAuth = FirebaseAuth.getInstance(); 107 | 108 | ETemail = (EditText)findViewById(R.id.email); 109 | ETpassword = (EditText)findViewById(R.id.password); 110 | 111 | 112 | Button register = (Button) findViewById(R.id.register); 113 | register.setOnClickListener(new View.OnClickListener() { 114 | @Override 115 | public void onClick(View view) { 116 | registerUser(); 117 | } 118 | }); 119 | } 120 | 121 | @Override 122 | public void onStart() { 123 | super.onStart(); 124 | // Check if user is signed in (non-null) and update UI accordingly. 125 | FirebaseUser currentUser = mAuth.getCurrentUser(); 126 | //updateUI(currentUser); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /FEED/app/src/main/java/com/example/feed/SecondActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.feed; 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.Button; 9 | 10 | public class SecondActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_second); 16 | 17 | Button donate = (Button) findViewById(R.id.donate); 18 | donate.setOnClickListener(new View.OnClickListener() { 19 | @Override 20 | public void onClick(View view) { 21 | Intent intent = new Intent(SecondActivity.this,DonateActivity.class); 22 | startActivity(intent); 23 | } 24 | }); 25 | 26 | Button recieve = (Button) findViewById(R.id.recieve); 27 | recieve.setOnClickListener(new View.OnClickListener() { 28 | @Override 29 | public void onClick(View view) { 30 | Intent intent = new Intent(SecondActivity.this,RecieveActivity.class); 31 | startActivity(intent); 32 | } 33 | }); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 9 | 10 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/background_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 9 | 10 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nizam19/Feed-Android/1032115c217cbf7bd92060a3d7793e27d9f2b16a/FEED/app/src/main/res/drawable/logo.jpg -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/myfooddonation.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nizam19/Feed-Android/1032115c217cbf7bd92060a3d7793e27d9f2b16a/FEED/app/src/main/res/drawable/myfooddonation.JPG -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/new_login.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nizam19/Feed-Android/1032115c217cbf7bd92060a3d7793e27d9f2b16a/FEED/app/src/main/res/drawable/new_login.jpg -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nizam19/Feed-Android/1032115c217cbf7bd92060a3d7793e27d9f2b16a/FEED/app/src/main/res/drawable/password.png -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/pexels.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nizam19/Feed-Android/1032115c217cbf7bd92060a3d7793e27d9f2b16a/FEED/app/src/main/res/drawable/pexels.jpeg -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/receiver.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nizam19/Feed-Android/1032115c217cbf7bd92060a3d7793e27d9f2b16a/FEED/app/src/main/res/drawable/receiver.JPG -------------------------------------------------------------------------------- /FEED/app/src/main/res/drawable/username.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nizam19/Feed-Android/1032115c217cbf7bd92060a3d7793e27d9f2b16a/FEED/app/src/main/res/drawable/username.png -------------------------------------------------------------------------------- /FEED/app/src/main/res/layout-v26/activity_donate.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 25 | 26 | 44 | 45 | 61 | 62 | 78 | 79 |