diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..39fb081
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+.externalNativeBuild
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..96cc43e
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..7ac24c7
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..8cdb7eb
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..e455c7c
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.gitignore b/app/.gitignore
new file mode 100755
index 0000000..796b96d
--- /dev/null
+++ b/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100755
index 0000000..97d0298
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,46 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 25
+ buildToolsVersion "25.0.2"
+ defaultConfig {
+ applicationId "com.example.datarsd1.mdbsocials_2"
+ minSdkVersion 15
+ targetSdkVersion 25
+ versionCode 1
+ versionName "1.0"
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+ compile 'com.android.support:appcompat-v7:25.1.1'
+ compile 'com.google.firebase:firebase-auth:9.6.1'
+ compile 'com.google.firebase:firebase-database:9.6.1'
+ compile 'com.google.firebase:firebase-storage:9.6.1'
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
+ compile 'com.google.android.gms:play-services-auth:9.6.1'
+ compile 'com.google.android.gms:play-services-gcm:9.6.1'
+ compile 'com.android.support:recyclerview-v7:25.1.1'
+ compile 'com.android.support:cardview-v7:25.1.1'
+ compile 'com.android.support:support-v4:25.1.1'
+ compile 'com.github.bumptech.glide:glide:3.7.0'
+ compile 'com.android.support:palette-v7:25.1.1'
+ compile 'com.android.support:design:25.1.1'
+}
+
+
+
+
+apply plugin: 'com.google.gms.google-services'
\ No newline at end of file
diff --git a/app/google-services.json b/app/google-services.json
new file mode 100755
index 0000000..febf3e7
--- /dev/null
+++ b/app/google-services.json
@@ -0,0 +1,55 @@
+{
+ "project_info": {
+ "project_number": "958355265554",
+ "firebase_url": "https://mdbsocials-2.firebaseio.com",
+ "project_id": "mdbsocials-2",
+ "storage_bucket": "mdbsocials-2.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:958355265554:android:cfaa8e4aac594fa7",
+ "android_client_info": {
+ "package_name": "com.example.datarsd1.mdbsocials_2"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "958355265554-9rpqldndbvfnlm0jlrchfgcut9d87k14.apps.googleusercontent.com",
+ "client_type": 1,
+ "android_info": {
+ "package_name": "com.example.datarsd1.mdbsocials_2",
+ "certificate_hash": "c0769d44fad38d3f70d2e1943ac41688c92dd43b"
+ }
+ },
+ {
+ "client_id": "958355265554-rnc9pfabbfs69l3ohn6m7430ieh0meh4.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyA4hwDtXVryud26rBOs-kmJtCNhVeuU2v0"
+ }
+ ],
+ "services": {
+ "analytics_service": {
+ "status": 1
+ },
+ "appinvite_service": {
+ "status": 2,
+ "other_platform_oauth_client": [
+ {
+ "client_id": "958355265554-rnc9pfabbfs69l3ohn6m7430ieh0meh4.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ]
+ },
+ "ads_service": {
+ "status": 2
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
new file mode 100755
index 0000000..4c601d5
--- /dev/null
+++ b/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /Users/datarsd1/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/app/src/androidTest/java/com/example/datarsd1/mdbsocials_2/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/datarsd1/mdbsocials_2/ExampleInstrumentedTest.java
new file mode 100755
index 0000000..4a1df12
--- /dev/null
+++ b/app/src/androidTest/java/com/example/datarsd1/mdbsocials_2/ExampleInstrumentedTest.java
@@ -0,0 +1,26 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see Testing documentation
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+ @Test
+ public void useAppContext() throws Exception {
+ // Context of the app under test.
+ Context appContext = InstrumentationRegistry.getTargetContext();
+
+ assertEquals("com.example.datarsd1.mdbsocials_2", appContext.getPackageName());
+ }
+}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
new file mode 100755
index 0000000..43b7dc5
--- /dev/null
+++ b/app/src/main/AndroidManifest.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/AddSocial.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/AddSocial.java
new file mode 100755
index 0000000..f45cd24
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/AddSocial.java
@@ -0,0 +1,124 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.ContentValues;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.net.Uri;
+import android.provider.MediaStore;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.Toast;
+
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.storage.FirebaseStorage;
+import com.google.firebase.storage.StorageReference;
+
+public class AddSocial extends AppCompatActivity implements View.OnClickListener{
+
+ private EditText newTitleText, newDateText, newDescText;
+ private FirebaseAuth mAuth;
+ private String firebasePathLocation;
+ private DatabaseReference mDatabase;
+ private ImageView preview;
+
+ private Button addEventButton, uploadImageButton;
+
+ private Uri eventimageuri;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_add_social);
+
+ newTitleText = (EditText)findViewById(R.id.newEventTitle);
+ newDateText = (EditText)findViewById(R.id.newEventDate);
+ newDescText = (EditText)findViewById(R.id.newEventDesc);
+
+ mDatabase = FirebaseDatabase.getInstance().getReference();
+ final String id = mDatabase.child("Socials").push().getKey();
+ mAuth = FirebaseAuth.getInstance();
+
+ preview = (ImageView)findViewById(R.id.eventImagePreview);
+
+ addEventButton = (Button)findViewById(R.id.newEventCreate);
+ uploadImageButton = (Button)findViewById(R.id.newEventImage);
+ addEventButton.setOnClickListener(this);
+ uploadImageButton.setOnClickListener(this);
+ }
+
+ public void onClick(View v)
+ {
+ switch(v.getId())
+ {
+ case R.id.newEventCreate:
+ Log.d("new evt clicked", "button onclick working");
+ if (eventimageuri==null|| newTitleText.getText()==null || newDateText.getText()==null || newDescText.getText()==null ||
+ newTitleText.getText().toString().length()==0 || newDateText.getText().toString().length()==0 || newDescText.getText().toString().length()==0)
+ {
+ Toast.makeText(getApplicationContext(),"Please Enter All Fields Properly",Toast.LENGTH_LONG).show();
+ }else
+ {
+ final DatabaseReference ref = FirebaseDatabase.getInstance().getReference();
+ final String key = ref.child("Socials").push().getKey();
+ StorageReference storageRef = FirebaseStorage.getInstance().getReferenceFromUrl("gs://mdbsocials-2.appspot.com");
+ StorageReference riversRef = storageRef.child("eventPics/" + key + ".jpg");
+
+ String name = newTitleText.getText().toString();
+ String date = newDateText.getText().toString();
+ String desc = newDescText.getText().toString();
+ String host = mAuth.getCurrentUser().getEmail();
+
+ FirebaseUtils.writeEventToDB(mDatabase, riversRef, eventimageuri, key, name, date, desc, host, mAuth);
+ startActivity(new Intent(getApplicationContext(),UserFeedActivity.class));
+ }
+ break;
+ case R.id.newEventImage:
+ AlertDialog alertDialog = new AlertDialog.Builder(AddSocial.this).create();
+ alertDialog.setTitle("Image Upload Options");
+ alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "Take a Photo", new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int which)
+ {
+ dialog.dismiss();
+ Intent takePictureIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
+
+ ContentValues values = new ContentValues();
+ values.put(MediaStore.Images.Media.TITLE, "Image");
+ Uri tempuri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
+ takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, tempuri);
+ startActivityForResult(takePictureIntent, 0);
+ }
+ });
+ alertDialog.setButton(AlertDialog.BUTTON_POSITIVE, "Upload from Gallery", new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+ intent.setType("image/*");
+ startActivityForResult(intent, 1); }
+ });
+ alertDialog.show();
+ Button glitchy = alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
+ glitchy.setEnabled(false);
+ break;
+ }
+ }
+
+ protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent)
+ {
+ super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
+ if (resultCode == RESULT_OK && requestCode == 1) {
+ eventimageuri = imageReturnedIntent.getData();
+ preview.setImageURI(eventimageuri);
+ }
+ }
+}
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/DownloadImageTask.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/DownloadImageTask.java
new file mode 100755
index 0000000..09e86aa
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/DownloadImageTask.java
@@ -0,0 +1,87 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.app.Activity;
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.AsyncTask;
+import android.util.Log;
+import android.widget.ImageView;
+
+import com.bumptech.glide.Glide;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.concurrent.ExecutionException;
+
+import static android.R.attr.bitmap;
+
+/**
+ * Created by Adhiraj Datar on 3/2/2017.
+ */
+
+public class DownloadImageTask extends AsyncTask {
+ private ImageView container;
+ private ProgressDialog mDialog;
+ private Context context;
+ private Activity act;
+ private Bitmap bitmap;
+
+ public DownloadImageTask(Activity act, Context context, ImageView mActivity) {
+ super();
+ this.container = mActivity;
+ this.act = act;
+ this.context = context;
+ mDialog = new ProgressDialog(act);
+ bitmap = null;
+ }
+
+ protected void onPreExecute() {
+ container.setImageBitmap(null);
+ mDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ mDialog.setCancelable(true);
+ mDialog.setMessage("Loading...");
+ mDialog.setProgress(0);
+ mDialog.show();
+ }
+
+ protected Bitmap doInBackground(String... urls) {
+ for (String s: urls)
+ {
+ try{
+ bitmap = Glide.with(context)
+ .load(s)
+ .asBitmap()
+ .into(100,100)
+ .get();
+ } catch (final ExecutionException e) {
+ Log.e("h", e.getMessage());
+ } catch (final InterruptedException e) {
+ Log.e("a", e.getMessage());
+ } catch (final NullPointerException e) {
+ //
+ }
+ if (isCancelled()) break;
+ }
+ return bitmap;
+ }
+ protected void onProgressUpdate(Integer... progress) {
+ mDialog.show();
+ mDialog.setProgress(progress[0]);
+ }
+
+ protected void onPostExecute(Bitmap result) {
+ if (result != null) {
+ container.setImageBitmap(result);
+ }
+ else {
+
+ }
+
+ mDialog.dismiss();
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/EventDetailsActivity.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/EventDetailsActivity.java
new file mode 100755
index 0000000..9795177
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/EventDetailsActivity.java
@@ -0,0 +1,199 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.support.design.widget.FloatingActionButton;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.ImageView;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.bumptech.glide.Glide;
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
+import com.google.firebase.storage.FirebaseStorage;
+import com.google.firebase.storage.StorageReference;
+
+import java.sql.Array;
+import java.util.ArrayList;
+
+public class EventDetailsActivity extends AppCompatActivity implements View.OnClickListener{
+
+ TextView name, host, date, desc;
+ ImageView wallpaper, hostimg;
+ FirebaseAuth mAuth;
+ DatabaseReference mDatabaseRef;
+ StorageReference mStorageRef;
+ Button interestButton;
+ FloatingActionButton eventadd;
+
+ ArrayList interestedNames, interestedEmails, interestedIds;
+
+ String user;
+
+ int initialNumInterested;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_event_details);
+
+ user = FirebaseAuth.getInstance().getCurrentUser().getUid();
+
+ mAuth = FirebaseAuth.getInstance();
+ mDatabaseRef = FirebaseDatabase.getInstance().getReference();
+ mStorageRef = FirebaseStorage.getInstance().getReference();
+
+ interestedNames = new ArrayList<>();
+ interestedEmails = new ArrayList<>();
+ interestedIds = new ArrayList<>();
+
+ wallpaper = (ImageView)findViewById(R.id.profilewallpaper);
+ hostimg = (ImageView)findViewById(R.id.profileimage);
+
+ name = (TextView)findViewById(R.id.eventNameDisplay);
+ name.setText(getIntent().getExtras().getString("title"));
+
+ host = (TextView)findViewById(R.id.eventHostDisplay);
+ host.setText("By: " + getIntent().getExtras().getString("host"));
+
+ date = (TextView)findViewById(R.id.eventDateDisplay);
+ date.setText("Date: " + getIntent().getExtras().getString("date"));
+
+ desc = (TextView)findViewById(R.id.eventDescDisplay);
+ desc.setText(getIntent().getExtras().getString("desc"));
+
+ initialNumInterested = getIntent().getExtras().getInt("numInterested");
+
+ StorageReference evtImgRef = mStorageRef.child(getIntent().getExtras().getString("firebasePath"));
+ evtImgRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
+ @Override
+ public void onSuccess(Uri uri)
+ {
+ new DownloadImageTask(EventDetailsActivity.this, getApplicationContext(), wallpaper).execute(uri.toString());
+ }
+ });
+
+ final StorageReference hostImgRef = mStorageRef.child("profiles/"+getIntent().getExtras().getString("hostuid")+".jpg");
+ hostImgRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
+ @Override
+ public void onSuccess(Uri uri)
+ {
+ new DownloadImageTask(EventDetailsActivity.this, getApplicationContext(), hostimg).execute(uri.toString());
+ }
+ });
+
+ interestButton = (Button)findViewById(R.id.eventInterestedButton);
+ interestButton.setText("Interested: "+getIntent().getExtras().getInt("numInterested"));
+ interestButton.setOnClickListener(this);
+
+ eventadd = (FloatingActionButton) findViewById(R.id.addInterestButton);
+ eventadd.setOnClickListener(this);
+
+
+ }
+
+ public void onClick(View v)
+ {
+ switch(v.getId())
+ {
+ case R.id.eventInterestedButton:
+ Intent intent = new Intent(getApplicationContext(), InterestedActivity.class);
+ if (initialNumInterested == 0)
+ {
+ Toast.makeText(getApplicationContext(),"Nobody is interested in this",Toast.LENGTH_LONG).show();
+
+ }else {
+ intent.putExtra("key", getIntent().getExtras().getString("id"));
+ startActivity(intent);
+ }
+ break;
+ case R.id.addInterestButton:
+ addInterest();
+ eventadd.setEnabled(false);
+ final DatabaseReference ref = FirebaseDatabase.getInstance().getReference("/Socials/"+getIntent().getExtras().getString("id"));
+ break;
+ }
+ }
+
+ public void addInterest()
+ {
+ final String email = FirebaseAuth.getInstance().getCurrentUser().getEmail();
+ final DatabaseReference ref = FirebaseDatabase.getInstance().getReference("/Socials/"+getIntent().getExtras().getString("id"));
+ ref.addListenerForSingleValueEvent(new ValueEventListener() {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot) {
+ ref.child("interested").child("" + dataSnapshot.child("numInterested").getValue(Integer.class)).setValue(email);
+ ref.child("interestedUIDs").child("" + dataSnapshot.child("numInterested").getValue(Integer.class)).setValue(mAuth.getCurrentUser().getUid());
+ interestButton.setText("Interested: "+((int)(dataSnapshot.child("numInterested").getValue(Integer.class) + 1)));
+ ref.child("numInterested").setValue((int)(dataSnapshot.child("numInterested").getValue(Integer.class) + 1));
+
+ initialNumInterested+=1;
+ }
+ @Override
+ public void onCancelled(DatabaseError databaseError) {}
+ });
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.logoutMenuButton:
+ UserUtils fb = new UserUtils(mAuth);
+ fb.signOut();
+ startActivity(new Intent(this, MainActivity.class));
+ break;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ toggleInterestButton();
+ }
+
+ protected void onResume()
+ {
+ super.onResume();
+ toggleInterestButton();
+ }
+
+ public void toggleInterestButton()
+ {
+ final DatabaseReference ref = FirebaseDatabase.getInstance().getReference("/Socials/"+getIntent().getExtras().getString("id"));
+ ref.addListenerForSingleValueEvent(new ValueEventListener() {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot) {
+ ArrayList interestedPeopleIDs = (ArrayList) dataSnapshot.child("interestedUIDs").getValue();
+ if (interestedPeopleIDs != null && interestedPeopleIDs.contains(mAuth.getCurrentUser().getUid()))
+ {
+ eventadd.setEnabled(false);
+ }
+ }
+ @Override
+ public void onCancelled(DatabaseError databaseError) {
+
+ }
+ });
+ }
+
+}
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/FirebaseUtils.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/FirebaseUtils.java
new file mode 100755
index 0000000..7afe4ee
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/FirebaseUtils.java
@@ -0,0 +1,75 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.net.Uri;
+
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.storage.FirebaseStorage;
+import com.google.firebase.storage.StorageReference;
+import com.google.firebase.storage.UploadTask;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by Adhiraj Datar on 3/2/2017.
+ */
+
+public class FirebaseUtils
+{
+
+ public static void writeUserToDB(FirebaseAuth mAuth, DatabaseReference mDatabase, Uri profileImage, String name, String email, String password)
+ {
+ String key = mAuth.getCurrentUser().getUid();
+ Map post = new HashMap<>();
+
+ String profilePicLocation = "profiles/" + key + ".jpg";
+ StorageReference storageRef = FirebaseStorage.getInstance().getReferenceFromUrl("gs://mdbsocials-2.appspot.com").child(profilePicLocation);
+ storageRef.putFile(profileImage);
+
+ post.put("uid", key);
+ post.put("name", name);
+ post.put("email", email);
+ post.put("password",password);
+
+ mDatabase.child("Users").push().setValue(post);
+ }
+
+ public static void writeEventToDB(final DatabaseReference mDatabase, StorageReference riversRef, final Uri eventimageuri, final String key, final String name, final String date, final String desc, final String host, final FirebaseAuth mAuth)
+ {
+ riversRef.putFile(eventimageuri).addOnSuccessListener(new OnSuccessListener() {
+ @Override
+ public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
+ ArrayList interested = new ArrayList();
+ Integer numInterested = 0;
+ Map post = new HashMap();
+ post.put("name", name);
+ post.put("host", host);
+ post.put("date", date);
+ post.put("desc", desc);
+ post.put("hostuid",mAuth.getCurrentUser().getUid());
+ post.put("interestedList", interested);
+ post.put("firebasepath", "eventPics/"+key+".jpg");
+ post.put("id",key);
+ post.put("numInterested", numInterested);
+ if (name.length()==0 || host==null || host.length()==0 || date.length()==0 || desc.length()==0 || key==null || key.length()==0)
+ {
+
+ }else
+ {
+ mDatabase.child("Socials").child(key).setValue(post);
+ }
+ }
+ });
+ }
+
+}
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/InterestedActivity.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/InterestedActivity.java
new file mode 100755
index 0000000..5b053ea
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/InterestedActivity.java
@@ -0,0 +1,115 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.Menu;
+import android.view.MenuItem;
+
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.ChildEventListener;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+
+import java.util.ArrayList;
+
+public class InterestedActivity extends AppCompatActivity {
+ FirebaseAuth mAuth;
+ RecyclerView interestedPeopleRVDisplay;
+ InterestedAdapter interestedPeopleRVAdapter;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_interested);
+
+ mAuth = FirebaseAuth.getInstance();
+
+ interestedPeopleRVDisplay = (RecyclerView) findViewById(R.id.usersinterestedrecycler);
+ interestedPeopleRVDisplay.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+
+ Intent intent = getIntent();
+ interestedPeopleRVAdapter = new InterestedAdapter(InterestedActivity.this, getApplicationContext(), new ArrayList());
+
+ interestedPeopleRVDisplay.setAdapter(interestedPeopleRVAdapter);
+ final String firebasekey = intent.getStringExtra("key");
+
+ final ArrayList interestedPeople = new ArrayList<>();
+ final ArrayList interestedUIDs = new ArrayList<>();
+
+ DatabaseReference ref = FirebaseDatabase.getInstance().getReference("/Socials");
+
+ ref.addChildEventListener(new ChildEventListener() {
+
+ @Override
+ public void onChildAdded(DataSnapshot dataSnapshot, String s) {
+ if (dataSnapshot.getKey().equals(firebasekey)) {
+ ArrayList x = (ArrayList) dataSnapshot.child("interested").getValue();
+ ArrayList uids = (ArrayList) dataSnapshot.child("interestedUIDs").getValue();
+
+ for (int i = 0; i < x.size(); i++)
+ {
+ interestedPeople.add(x.get(i));
+ interestedUIDs.add(uids.get(i));
+ }
+
+ ArrayList interestedMDBros = new ArrayList<>();
+
+
+ for (int i = 0; i < interestedPeople.size(); i++) {
+ interestedMDBros.add(new User("profiles/"+interestedUIDs.get(i)+".jpg",interestedPeople.get(i)));
+ }
+
+ interestedPeopleRVAdapter.updateList(interestedMDBros);
+ interestedPeopleRVAdapter.notifyDataSetChanged();
+ }
+ }
+
+ @Override
+ public void onChildChanged(DataSnapshot dataSnapshot, String s) {
+
+ }
+
+ @Override
+ public void onChildRemoved(DataSnapshot dataSnapshot) {
+
+ }
+
+ @Override
+ public void onChildMoved(DataSnapshot dataSnapshot, String s) {
+
+ }
+
+ @Override
+ public void onCancelled(DatabaseError databaseError) {
+
+ }
+ });
+
+
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.logoutMenuButton:
+ UserUtils fb = new UserUtils(mAuth);
+ fb.signOut();
+ startActivity(new Intent(this, MainActivity.class));
+ break;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+}
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/InterestedAdapter.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/InterestedAdapter.java
new file mode 100755
index 0000000..61cc0a1
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/InterestedAdapter.java
@@ -0,0 +1,82 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.app.Activity;
+import android.content.Context;
+import android.net.Uri;
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.bumptech.glide.Glide;
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.firebase.storage.FirebaseStorage;
+import com.google.firebase.storage.StorageReference;
+
+import java.util.ArrayList;
+
+/**
+ * Created by Adhiraj Datar on 3/2/2017.
+ */
+
+public class InterestedAdapter extends RecyclerView.Adapter
+{
+ Context context;
+ public static ArrayList mdbros;
+ Activity activity;
+
+ public InterestedAdapter(Activity activity, Context context, ArrayList interestedpeople)
+ {
+ this.context = context;
+ this.activity = activity;
+ this.mdbros = interestedpeople;
+ }
+
+ public InterestedAdapter.CustomViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
+ {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_view_user, parent, false);
+ return new CustomViewHolder(view);
+ }
+
+ public void onBindViewHolder(final InterestedAdapter.CustomViewHolder holder, int position)
+ {
+ User curr = mdbros.get(position);
+ holder.interestedPersonEmail.setText(curr.email);
+
+ StorageReference mStorageRef = FirebaseStorage.getInstance().getReferenceFromUrl("gs://mdbsocials-2.appspot.com");
+ StorageReference interestedImageRef = mStorageRef.child(curr.img);
+ interestedImageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
+ @Override
+ public void onSuccess(Uri uri)
+ {
+ new DownloadImageTask(activity, context, holder.interestedPersonImage).execute(uri.toString());
+ }
+ });
+ }
+
+ public int getItemCount()
+ {
+ return mdbros.size();
+ }
+
+ public void updateList(ArrayList i)
+ {
+ mdbros = i;
+ }
+
+ public class CustomViewHolder extends RecyclerView.ViewHolder
+ {
+ TextView interestedPersonEmail;
+ ImageView interestedPersonImage;
+
+ public CustomViewHolder(View view) {
+ super(view);
+
+ interestedPersonEmail = (TextView) view.findViewById(R.id.userProfileEmail);
+ interestedPersonImage = (ImageView) view.findViewById(R.id.userProfileImage);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/MainActivity.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/MainActivity.java
new file mode 100755
index 0000000..eaca25e
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/MainActivity.java
@@ -0,0 +1,104 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v7.app.AppCompatActivity;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.auth.FirebaseUser;
+
+/**
+ * Main Activity of MDBSocials app
+ * inflates main activity layout, sets listeners and enables Authorization features
+ * Main Sign in Page/ Sign up page. Not seen if user is already logged in
+ * sends intents to: UserFeedActivity and SignupActivity
+ */
+
+public class MainActivity extends AppCompatActivity implements View.OnClickListener{
+
+ Button loginButton, signUpButton;
+ EditText usernameInput, passwordInput;
+
+ private FirebaseAuth mAuth;
+ private FirebaseAuth.AuthStateListener mAuthListener;
+
+ @Override
+ /**
+ * onCreate method for main activity of MDBSocials app
+ * inflates main activity layout, sets listeners and enables Authorization features
+ * sends intents to: UserFeedActivity and SignupActivity
+ */
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ usernameInput = (EditText)findViewById(R.id.emailInput);
+ passwordInput = (EditText)findViewById(R.id.passwordInput);
+ loginButton = (Button)findViewById(R.id.loginButton);
+ signUpButton = (Button)findViewById(R.id.signUpButton);
+
+ loginButton.setOnClickListener(this);
+ signUpButton.setOnClickListener(this);
+
+ mAuth = FirebaseAuth.getInstance();
+ mAuthListener = new FirebaseAuth.AuthStateListener() {
+ @Override
+ public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
+ FirebaseUser user = firebaseAuth.getCurrentUser();
+ if (user != null) {
+ startActivity(new Intent(MainActivity.this, UserFeedActivity.class));
+ }else
+ {
+
+ }
+ }
+ };
+ }
+
+ /**
+ * onClick method for main activity of MDBSocials app
+ * handles click events for sign up and sign in buttons
+ * sends intents to: SingupActivity and UserFeedActivity
+ */
+ public void onClick(View v)
+ {
+ switch (v.getId()) {
+ case R.id.loginButton:
+ signIn();
+ break;
+ case R.id.signUpButton:
+ startActivity(new Intent(MainActivity.this, SignupActivity.class));
+ break;
+ }
+ }
+
+ /**
+ * signIn method for main activity of MDBSocials app
+ * calls on UserUtils helper class to handle user authorization
+ * sends intents to: UserFeedActivity and SignupActivity
+ */
+ public void signIn()
+ {
+ UserUtils authManager = new UserUtils(mAuth);
+ authManager.signIn(this, usernameInput.getText().toString(), passwordInput.getText().toString());
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ mAuth.addAuthStateListener(mAuthListener);
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ if (mAuthListener != null) {
+ mAuth.removeAuthStateListener(mAuthListener);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/SignupActivity.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/SignupActivity.java
new file mode 100755
index 0000000..e76a734
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/SignupActivity.java
@@ -0,0 +1,130 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.Intent;
+import android.net.Uri;
+import android.support.annotation.NonNull;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.Toast;
+
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.auth.AuthResult;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.auth.FirebaseUser;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.storage.FirebaseStorage;
+import com.google.firebase.storage.StorageReference;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Signup Activity of MDBSocials app
+ * inflates signup activity layout, sets listeners and enables Authorization features
+ * Main Sign up page. Not seen if user is already logged in
+ * sends intents to: UserFeedActivity
+ */
+
+public class SignupActivity extends AppCompatActivity implements View.OnClickListener {
+
+ private Button addProfilePicButton, addUserButton;
+ private EditText usernameInput, passwordInput, nameInput;
+
+ private FirebaseAuth mAuth;
+ private FirebaseAuth.AuthStateListener mAuthListener;
+
+ private Uri profileImage;
+ private String profilePicLocation;
+ private DatabaseReference mDatabase;
+
+ final int GET_PROFILE_IMAGE = 1;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_signup);
+
+ addProfilePicButton = (Button)findViewById(R.id.addProfilePhotoButton);
+ addUserButton = (Button)findViewById(R.id.signUpButton);
+
+ usernameInput = (EditText) findViewById(R.id.signUpEmailInput);
+ passwordInput = (EditText) findViewById(R.id.signUpPasswordInput);
+ nameInput = (EditText) findViewById(R.id.signUpNameInput);
+
+ mAuth = FirebaseAuth.getInstance();
+ mDatabase = FirebaseDatabase.getInstance().getReference();
+
+ addProfilePicButton.setOnClickListener(this);
+ addUserButton.setOnClickListener(this);
+
+ mAuthListener = new FirebaseAuth.AuthStateListener() {
+ @Override
+ public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
+ FirebaseUser user = firebaseAuth.getCurrentUser();
+ if (user != null) {
+ startActivity(new Intent(SignupActivity.this, UserFeedActivity.class));
+ }else
+ {
+
+ }
+ }
+ };
+ }
+
+ public void onClick(View v)
+ {
+ switch (v.getId())
+ {
+ case R.id.addProfilePhotoButton:
+ Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
+ intent.setType("image/*");
+ startActivityForResult(intent, GET_PROFILE_IMAGE);
+ break;
+ case R.id.signUpButton:
+ signUp();
+ break;
+ }
+ }
+
+ public void signUp()
+ {
+ final String userName, userPassword, userEmail;
+ userName = nameInput.getText().toString();
+ userEmail = usernameInput.getText().toString();
+ userPassword = passwordInput.getText().toString();
+
+ UserUtils signUpUtil = new UserUtils(mAuth);
+ signUpUtil.signUp(getApplicationContext(), mDatabase, profileImage, userPassword, userEmail, userName);
+ }
+
+ protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent)
+ {
+ super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
+ if (resultCode == RESULT_OK && requestCode==1)
+ {
+ profileImage = imageReturnedIntent.getData();
+ ((ImageView)findViewById(R.id.profilePicPreview)).setImageURI(profileImage);
+ }
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ mAuth.addAuthStateListener(mAuthListener);
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ if (mAuthListener != null) {
+ mAuth.removeAuthStateListener(mAuthListener);
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/Social.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/Social.java
new file mode 100755
index 0000000..0c07692
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/Social.java
@@ -0,0 +1,28 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import java.util.ArrayList;
+
+/**
+ * Created by Adhiraj Datar on 3/2/2017.
+ */
+
+public class Social {
+
+ String title, host, description, date, firebaseLocation, id, hostuid;
+ ArrayList interested, interestedUIDs;
+ Integer numInterested;
+
+ public Social(String t, String h, String desc, String d, String fbl, String id, Integer numInterested, String hostuid, ArrayList interested, ArrayList interestedUIDs) {
+ this.title = t;
+ this.host = h;
+ this.description = desc;
+ this.date = d;
+ this.firebaseLocation = fbl;
+ this.id = id;
+ this.interested = interested;
+ this.interestedUIDs = interestedUIDs;
+ this.numInterested = numInterested;
+ this.hostuid = hostuid;
+ }
+
+}
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/User.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/User.java
new file mode 100755
index 0000000..94202e8
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/User.java
@@ -0,0 +1,19 @@
+package com.example.datarsd1.mdbsocials_2;
+
+/**
+ * Created by Adhiraj Datar on 3/2/2017.
+ */
+public class User
+{
+
+ String img;
+ String email;
+
+ public User(String img, String email)
+ {
+ this.img = img;
+ this.email = email;
+ }
+
+}
+
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserFeedActivity.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserFeedActivity.java
new file mode 100755
index 0000000..ca66ff6
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserFeedActivity.java
@@ -0,0 +1,113 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.Intent;
+import android.support.design.widget.FloatingActionButton;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class UserFeedActivity extends AppCompatActivity implements View.OnClickListener{
+
+ private FirebaseAuth mAuth;
+ UserFeedAdapter adapter;
+ RecyclerView eventsListView;
+ DatabaseReference mDatabase;
+ FloatingActionButton fab;
+
+ ArrayList socials = new ArrayList();
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_user_feed);
+
+ mAuth = FirebaseAuth.getInstance();
+ mDatabase = FirebaseDatabase.getInstance().getReference();
+
+ eventsListView = (RecyclerView) findViewById(R.id.eventsFeedRecyclerView);
+ eventsListView.setLayoutManager(new LinearLayoutManager(this));
+
+ adapter = new UserFeedAdapter(UserFeedActivity.this, getApplicationContext(), socials);
+ eventsListView.setAdapter(adapter);
+
+ fab = (FloatingActionButton)findViewById(R.id.addEventButton);
+ fab.setOnClickListener(this);
+
+ mDatabase.child("Socials").addValueEventListener(new ValueEventListener() {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot) {
+ socials = new ArrayList();
+ for (DataSnapshot d: dataSnapshot.getChildren())
+ {
+ HashMap evt = (HashMap) d.getValue();
+ String id = (String) evt.get("id");
+ String firebasePathLocation = (String) evt.get("firebasepath");
+ String name = (String) evt.get("name");
+ String host = (String) evt.get("host");
+ String date = (String) evt.get("date");
+ String desc = (String) evt.get("desc");
+ String hostuid = (String) evt.get("hostuid");
+ Integer numInterested = ((Long)evt.get("numInterested")).intValue();
+ ArrayList interested = (ArrayList) evt.get("interestedList");
+ ArrayList interestedUIDs = (ArrayList) evt.get("interestedUIDs");
+ if(interested == null)
+ {
+ interested = new ArrayList();
+ }else if(interestedUIDs == null)
+ {
+ interestedUIDs = new ArrayList();
+ }
+ Social social = new Social(name, host, desc, date, firebasePathLocation, id, numInterested, hostuid, interested, interestedUIDs);
+ socials.add(social);
+ }
+ adapter.setSocialsList(socials);
+ adapter.notifyDataSetChanged();
+ }
+ @Override
+ public void onCancelled(DatabaseError databaseError) { }
+ });
+ }
+
+ public void onClick(View v)
+ {
+ switch(v.getId())
+ {
+ case R.id.addEventButton:
+ Intent intent = new Intent(getApplicationContext(),AddSocial.class);
+ startActivity(intent);
+ break;
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.main_menu, menu);
+ return super.onCreateOptionsMenu(menu);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.logoutMenuButton:
+ UserUtils fb = new UserUtils(mAuth);
+ fb.signOut();
+ startActivity(new Intent(this, MainActivity.class));
+ break;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserFeedAdapter.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserFeedAdapter.java
new file mode 100755
index 0000000..27ee160
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserFeedAdapter.java
@@ -0,0 +1,150 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.support.v7.widget.RecyclerView;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.bumptech.glide.Glide;
+import com.google.android.gms.tasks.OnSuccessListener;
+import com.google.firebase.database.DataSnapshot;
+import com.google.firebase.database.DatabaseError;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.database.FirebaseDatabase;
+import com.google.firebase.database.ValueEventListener;
+import com.google.firebase.storage.FirebaseStorage;
+import com.google.firebase.storage.StorageReference;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+
+
+public class UserFeedAdapter extends RecyclerView.Adapter
+{
+
+ private Context context;
+ private Activity activity;
+ private DatabaseReference mDatabase = FirebaseDatabase.getInstance().getReference();;
+
+ private ArrayList socialList = new ArrayList<>();
+
+ public UserFeedAdapter(Activity activity, Context context, ArrayList socials) {
+ this.context = context;
+ this.activity = activity;
+ this.socialList = socials;
+ }
+
+ public void setSocialsList(ArrayList schedule)
+ {
+ socialList = schedule;
+ }
+
+ @Override
+ public int getItemCount() {
+ return socialList.size();
+ }
+
+ @Override
+ public CustomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_event_view, parent, false);
+ return new CustomViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(final CustomViewHolder holder, int position)
+ {
+ Social s = socialList.get(getItemCount()-position-1);
+ holder.hostNameView.setText(s.host);
+ holder.eventNameView.setText(s.title);
+
+ if(s.interested == null)
+ {
+ s.interested = new ArrayList<>();
+ }
+
+ holder.numInterestedView.setText("Interested: "+s.numInterested);
+
+ StorageReference storageRef = FirebaseStorage.getInstance().getReference().child(socialList.get(position).firebaseLocation);
+ storageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener()
+ {
+ @Override
+ public void onSuccess(Uri uri)
+ {
+ new DownloadImageTask(activity, context, holder.eventImageView).execute(uri.toString());
+ }
+
+ });
+ }
+
+ class CustomViewHolder extends RecyclerView.ViewHolder
+ {
+ TextView eventNameView, hostNameView, numInterestedView;
+ ImageView eventImageView;
+ ArrayList interestedNames, interestedEmails;
+
+ public CustomViewHolder(View v)
+ {
+ super(v);
+ this.eventNameView = (TextView) v.findViewById(R.id.eventTitle);
+ this.eventImageView = (ImageView) v.findViewById(R.id.eventImage);
+ this.hostNameView = (TextView) v.findViewById(R.id.eventHost);
+ this.numInterestedView = (TextView) v.findViewById(R.id.eventInterested);
+
+ interestedNames = new ArrayList();
+ interestedEmails = new ArrayList();
+
+ v.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ final Social s = socialList.get(getAdapterPosition());
+ Intent intent = new Intent(context, EventDetailsActivity.class);
+
+ ValueEventListener postListener = new ValueEventListener() {
+ @Override
+ public void onDataChange(DataSnapshot dataSnapshot) {
+ ArrayList interested = s.interested;
+ for (DataSnapshot d: dataSnapshot.getChildren()) {
+ HashMap evt = (HashMap) d.getValue();
+ if (interested.contains(evt.get("uid"))) {
+ interestedNames.add((String) evt.get("name"));
+ interestedNames.add((String) evt.get("email"));
+ }
+ }
+ }
+ @Override
+ public void onCancelled(DatabaseError databaseError) {
+ Log.e("Error", "Something went wrong");
+ }
+ };
+ mDatabase.child("Users").addValueEventListener(postListener);
+
+ intent.putExtra("title", s.title);
+ intent.putExtra("host", s.host);
+ intent.putExtra("desc", s.description);
+ intent.putExtra("date", s.date);
+ intent.putExtra("interestedList", s.interested.size());
+ intent.putExtra("firebasePath", s.firebaseLocation);
+ intent.putExtra("id",s.id);
+ intent.putExtra("hostuid",s.hostuid);
+ intent.putExtra("numInterested", s.numInterested);
+ intent.putExtra("interestedUIDs", s.interestedUIDs);
+ intent.putStringArrayListExtra("interestedName", interestedNames);
+ intent.putStringArrayListExtra("interestedEmail", interestedEmails);
+ intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(intent);
+ }
+ });
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserUtils.java b/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserUtils.java
new file mode 100755
index 0000000..e17ef74
--- /dev/null
+++ b/app/src/main/java/com/example/datarsd1/mdbsocials_2/UserUtils.java
@@ -0,0 +1,82 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.support.annotation.NonNull;
+import android.util.Log;
+import android.widget.CheckBox;
+import android.widget.Toast;
+
+import com.google.android.gms.tasks.OnCompleteListener;
+import com.google.android.gms.tasks.Task;
+import com.google.firebase.auth.AuthResult;
+import com.google.firebase.auth.FirebaseAuth;
+import com.google.firebase.database.DatabaseReference;
+import com.google.firebase.storage.FirebaseStorage;
+import com.google.firebase.storage.StorageReference;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by datarsd1 on 3/1/17.
+ */
+
+public class UserUtils
+{
+
+ private FirebaseAuth mAuth;
+
+ public UserUtils(FirebaseAuth mAuth)
+ {
+ this.mAuth = mAuth;
+ }
+
+ public void signIn(final Context context, String userEmail, String userPassword)
+ {
+ if (userPassword == null || userEmail == null || userEmail.length() == 0 || userPassword.length() == 0)
+ {
+ Toast.makeText(context, "You didn't Enter Anything", Toast.LENGTH_SHORT).show();
+ }else
+ {
+ mAuth.signInWithEmailAndPassword(userEmail, userPassword).addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ if (!task.isSuccessful()) {
+ Toast.makeText(context, "Sign in Failed.", Toast.LENGTH_SHORT).show();
+ }
+ }
+ });
+ }
+ }
+
+ public void signUp(final Context context, final DatabaseReference mDatabase, final Uri profileImage, final String userPassword, final String userEmail, final String userName)
+ {
+ if (profileImage == null || userPassword == null || userEmail == null || userEmail.length() == 0 || userPassword.length() == 0 || userName.length()==0)
+ {
+ Toast.makeText(context, "You didn't Enter Anything", Toast.LENGTH_SHORT).show();
+ }else
+ {
+ mAuth.createUserWithEmailAndPassword(userEmail, userPassword).addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ if (task.isSuccessful())
+ {
+ FirebaseUtils.writeUserToDB(mAuth, mDatabase, profileImage, userName, userEmail, userPassword);
+ }else
+ {
+ Toast.makeText(context, "Sign Up Failed. Make sure you entered a valid email and a STRONG password (uppercase, symbols, 10+ chars)",
+ Toast.LENGTH_LONG).show();
+ }
+ }
+ });
+ }
+ }
+
+ public void signOut()
+ {
+ mAuth.signOut();
+ }
+
+}
diff --git a/app/src/main/res/drawable/buttonshape.xml b/app/src/main/res/drawable/buttonshape.xml
new file mode 100755
index 0000000..94c4e2d
--- /dev/null
+++ b/app/src/main/res/drawable/buttonshape.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/cardviewshape.xml b/app/src/main/res/drawable/cardviewshape.xml
new file mode 100755
index 0000000..4755870
--- /dev/null
+++ b/app/src/main/res/drawable/cardviewshape.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/circle.xml b/app/src/main/res/drawable/circle.xml
new file mode 100755
index 0000000..25a070e
--- /dev/null
+++ b/app/src/main/res/drawable/circle.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/logout.png b/app/src/main/res/drawable/logout.png
new file mode 100755
index 0000000..6d07c2f
Binary files /dev/null and b/app/src/main/res/drawable/logout.png differ
diff --git a/app/src/main/res/drawable/mdblogo.png b/app/src/main/res/drawable/mdblogo.png
new file mode 100755
index 0000000..566ae01
Binary files /dev/null and b/app/src/main/res/drawable/mdblogo.png differ
diff --git a/app/src/main/res/drawable/passwordtext.xml b/app/src/main/res/drawable/passwordtext.xml
new file mode 100755
index 0000000..09a755b
--- /dev/null
+++ b/app/src/main/res/drawable/passwordtext.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/plusicon.png b/app/src/main/res/drawable/plusicon.png
new file mode 100755
index 0000000..bd171be
Binary files /dev/null and b/app/src/main/res/drawable/plusicon.png differ
diff --git a/app/src/main/res/drawable/titletextfield.xml b/app/src/main/res/drawable/titletextfield.xml
new file mode 100755
index 0000000..e73b6dc
--- /dev/null
+++ b/app/src/main/res/drawable/titletextfield.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/usernametext.xml b/app/src/main/res/drawable/usernametext.xml
new file mode 100755
index 0000000..49f9969
--- /dev/null
+++ b/app/src/main/res/drawable/usernametext.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/wallpaper.jpg b/app/src/main/res/drawable/wallpaper.jpg
new file mode 100755
index 0000000..703d3d7
Binary files /dev/null and b/app/src/main/res/drawable/wallpaper.jpg differ
diff --git a/app/src/main/res/drawable/wallpaper2.png b/app/src/main/res/drawable/wallpaper2.png
new file mode 100755
index 0000000..a02719a
Binary files /dev/null and b/app/src/main/res/drawable/wallpaper2.png differ
diff --git a/app/src/main/res/layout/activity_add_social.xml b/app/src/main/res/layout/activity_add_social.xml
new file mode 100755
index 0000000..f8a6b96
--- /dev/null
+++ b/app/src/main/res/layout/activity_add_social.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_event_details.xml b/app/src/main/res/layout/activity_event_details.xml
new file mode 100755
index 0000000..21c35c8
--- /dev/null
+++ b/app/src/main/res/layout/activity_event_details.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_interested.xml b/app/src/main/res/layout/activity_interested.xml
new file mode 100755
index 0000000..90ffeaa
--- /dev/null
+++ b/app/src/main/res/layout/activity_interested.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
new file mode 100755
index 0000000..563bf5e
--- /dev/null
+++ b/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_signup.xml b/app/src/main/res/layout/activity_signup.xml
new file mode 100755
index 0000000..8de6e72
--- /dev/null
+++ b/app/src/main/res/layout/activity_signup.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_user_feed.xml b/app/src/main/res/layout/activity_user_feed.xml
new file mode 100755
index 0000000..cd67615
--- /dev/null
+++ b/app/src/main/res/layout/activity_user_feed.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/row_event_view.xml b/app/src/main/res/layout/row_event_view.xml
new file mode 100755
index 0000000..0e50384
--- /dev/null
+++ b/app/src/main/res/layout/row_event_view.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/row_view_user.xml b/app/src/main/res/layout/row_view_user.xml
new file mode 100755
index 0000000..9fdff88
--- /dev/null
+++ b/app/src/main/res/layout/row_view_user.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/main_menu.xml b/app/src/main/res/menu/main_menu.xml
new file mode 100755
index 0000000..aacccb5
--- /dev/null
+++ b/app/src/main/res/menu/main_menu.xml
@@ -0,0 +1,10 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100755
index 0000000..cde69bc
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100755
index 0000000..c133a0c
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100755
index 0000000..bfa42f0
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100755
index 0000000..324e72c
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100755
index 0000000..aee44e1
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100755
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/ViewStyles.xml b/app/src/main/res/values/ViewStyles.xml
new file mode 100755
index 0000000..cffc62c
--- /dev/null
+++ b/app/src/main/res/values/ViewStyles.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100755
index 0000000..3ab3e9c
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100755
index 0000000..47c8224
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
new file mode 100755
index 0000000..15e9322
--- /dev/null
+++ b/app/src/main/res/values/strings.xml
@@ -0,0 +1,13 @@
+
+ MDBSocials
+ Sign Up
+ Log In
+ Sign up for Socials!
+ Sign in to Socials!
+ Email
+ Name
+ Password
+
+
+
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100755
index 0000000..5885930
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/app/src/test/java/com/example/datarsd1/mdbsocials_2/ExampleUnitTest.java b/app/src/test/java/com/example/datarsd1/mdbsocials_2/ExampleUnitTest.java
new file mode 100755
index 0000000..8818451
--- /dev/null
+++ b/app/src/test/java/com/example/datarsd1/mdbsocials_2/ExampleUnitTest.java
@@ -0,0 +1,17 @@
+package com.example.datarsd1.mdbsocials_2;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see Testing documentation
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
new file mode 100755
index 0000000..006413d
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,24 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.2.3'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ classpath 'com.google.gms:google-services:3.0.0'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
new file mode 100755
index 0000000..aac7c9b
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,17 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx1536m
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100755
index 0000000..13372ae
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100755
index 0000000..04e285f
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Dec 28 10:00:20 PST 2015
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..9d82f78
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100755
index 0000000..aec9973
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/settings.gradle b/settings.gradle
new file mode 100755
index 0000000..e7b4def
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':app'