Large diffs are not rendered by default.

@@ -87,7 +87,7 @@ public void login(View view){
headers.add(new BasicHeader("Content-Type", "application/json"));

//client.post("users.json", jsonParams, headers,new JsonResponseHandler() {

final LoginActivity loginActivity = this;
//user path
String userPath = "users/" + username + ".json";
client.get(userPath, params, headers, new JsonResponseHandler() {
@@ -103,6 +103,7 @@ public void run() {
});
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
loginActivity.finish();
}

public void onFailure() {
@@ -1,18 +1,25 @@
package zshires.com.buz;

import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.NotificationCompat;
import android.support.v7.app.ActionBarActivity;
import android.telephony.SmsManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.facebook.AppEventsLogger;
@@ -41,6 +48,7 @@

import java.util.List;


public class MainActivity extends ActionBarActivity implements OnMapReadyCallback, GoogleMap.OnMarkerClickListener, GoogleMap.OnInfoWindowClickListener {
public static MapFragment map;
public GoogleMap gmap;
@@ -50,21 +58,74 @@ public class MainActivity extends ActionBarActivity implements OnMapReadyCallbac
private static User currUser;
Circle mapCircle;

// Allows us to notify the user that something happened in the background
NotificationManager notificationManager;

// Used to track notifications
int notifID = 33;
// Used to track if notification is active in the task bar
boolean isNotificActive = false;


@Override
public void onInfoWindowClick(Marker marker) {
String title = marker.getTitle();
//find the user you clicked on in the friends list
for(User u : currUser.getFriends()){
if(u.getName().equals(title)){
//Buz! that user
sendMessage(Integer.toString(u.getPhonenumber()), "You've been Buzed by " + currUser.getName() + "!");
//TODO: this should be a notification on the receivers phone, not yours.
//The notification should take you to the map. it currently takes you to some random page
showNotification();
break;
}
}
Toast toast = Toast.makeText(getApplicationContext(), "You Buzed " + title + "!", Toast.LENGTH_SHORT);
toast.show();
}

public void showNotification() {

// Builds a notification
NotificationCompat.Builder notificBuilder = new NotificationCompat.Builder(this)
.setContentTitle("Message")
.setContentText("New Message")
.setTicker("Alert New Message")
.setSmallIcon(R.drawable.ic_launcher);

// Define that we have the intention of opening MoreInfoNotification
Intent moreInfoIntent = new Intent(this, MoreInfoNotification.class);

// Used to stack tasks across activites so we go to the proper place when back is clicked
TaskStackBuilder tStackBuilder = TaskStackBuilder.create(this);

// Add all parents of this activity to the stack
tStackBuilder.addParentStack(MoreInfoNotification.class);

// Add our new Intent to the stack
tStackBuilder.addNextIntent(moreInfoIntent);

// Define an Intent and an action to perform with it by another application
// FLAG_UPDATE_CURRENT : If the intent exists keep it but update it if needed
PendingIntent pendingIntent = tStackBuilder.getPendingIntent(0,
PendingIntent.FLAG_UPDATE_CURRENT);

// Defines the Intent to fire when the notification is clicked
notificBuilder.setContentIntent(pendingIntent);

// Gets a NotificationManager which is used to notify the user of the background event
notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

// Post the notification
notificationManager.notify(notifID, notificBuilder.build());

// Used so that we can't stop a notification that has already been stopped
isNotificActive = true;


}

public interface BackendCallback {
public void onRequestCompleted(Object result);
public void onRequestFailed(String message);
@@ -82,10 +143,10 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
currUser = new User(0,0,0,"TempUserName");
currUser.addFriend((new User(43.068762, -89.408195, 1, "A")));
currUser.addFriend((new User(43.068619, -89.408314, 2, "B")));
currUser.addFriend((new User(43.068873, -89.408581, 3, "C")));
currUser.addFriend((new User(43.068317, -89.408142, 4, "D")));
currUser.addFriend((new User(43.068762, -89.408195, 1, "Zak Shires")));
currUser.addFriend((new User(43.068619, -89.408314, 2, "Mike Fix")));
currUser.addFriend((new User(43.068873, -89.408581, 3, "Charlie")));
currUser.addFriend((new User(43.068317, -89.408142, 4, "Dave")));

/* Start Grabbing your current location */
LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
@@ -210,6 +271,22 @@ protected void onPause() {
public void onMapReady(GoogleMap map) {
map.setOnMarkerClickListener(this);
map.setOnInfoWindowClickListener(this);
map.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
@Override
public View getInfoWindow(Marker marker) {
return null;
}

@Override
public View getInfoContents(Marker marker) {
View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.info_window, null);
TextView tv = (TextView) view.findViewById(R.id.infoWindowInformation);
tv.setText("Buz " + marker.getTitle());
Typeface face = Typeface.createFromAsset(getAssets(),"fonts/Aventura-Bold.otf");
tv.setTypeface(face);
return view;
}
});
map.setMyLocationEnabled(true);
map.getUiSettings().setScrollGesturesEnabled(false);
map.getUiSettings().setZoomGesturesEnabled(false);
@@ -1,18 +1,15 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="#ffe11d">


<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:name="com.google.android.gms.maps.MapFragment"/>


</LinearLayout>
</FrameLayout>
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:id="@+id/infoWindow">

<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/infoWindowInformation"
android:textColor="#141515" />
</LinearLayout>
@@ -0,0 +1,208 @@
<?xml version="1.0" encoding="utf-8"?>
<items version="2" >

<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-maps\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="17f8750d5c0749e44dd7c54aa390d9c937803825">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-fc22f50aa80261d75b161c22157fc125bbe5eaf6.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-analytics\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="29fd6d3794b71491c2789708cd8d03c71feb8954">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-81fb670d4b93d71aa94f5619525a74c5e6ab6d6a.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-wearable\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="3033cc3a2c68dff3e5b646d6d084bdbdf7d00b25">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-0784aca34766ea02c128de4373b82c5d8794cac0.jar" />
</item>
<item
jar="C:\Users\zshires\.gradle\caches\modules-2\files-2.1\com.parse.bolts\bolts-android\1.1.2\91c20388c9a45f62b5ed8fe0502bb76ff6251fc7\bolts-android-1.1.2.jar"
jumboMode="false"
revision="21.1.2"
sha1="91c20388c9a45f62b5ed8fe0502bb76ff6251fc7">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\bolts-android-1.1.2-40979cdba1208ef491e3340ec90ce714d16d12b4.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-appindexing\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="a08d65794b844d8e7540bf9a33859bf3b2482d7f">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-2880bfdb27e31f4904f7b00ef833c27c0852d7aa.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-safetynet\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="c976518693e89ad44fbfccfc654941eaec198d08">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-49f03f490407addddf020ca95fa8e88d96c4ec1c.jar" />
</item>
<item
jar="C:\Users\zshires\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.2.4\3b7f38df6de5dd8b500e602ae8c2dd5ee446f883\httpcore-4.2.4.jar"
jumboMode="false"
revision="21.1.2"
sha1="3b7f38df6de5dd8b500e602ae8c2dd5ee446f883">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\httpcore-4.2.4-01f81900e8bd76804cac3605d2db45db9a4abda8.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-plus\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="0e8228b4bc69c6a2c8d7c18498a77e53417d2574">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-52c6acdbf085c16a04778ac3c2f1bf6fb7ad029b.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-drive\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="41b3870cbe5fa546d8095b5b89d42cb69f3dd175">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-99d834733939a56240791f0ceaab2711ec986db2.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-fitness\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="3c0b099f9de16b265ecd6122fcb603e7d0d29f90">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-aa253989ce37948b56577c7b90af13e4149bf95b.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-panorama\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="1c5a76debf0c2857ccad422c4a80ed785982f8df">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-246c3152f36a3a349fb32ffe1d429921a8808d6f.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\net.callumtaylor\asynchttpclient\1.5\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="2cd6365b9e6a4298334e6b6107b32696dfccb2db">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-654a79f02bf5be508443b67b5ca481960ecc0189.jar" />
</item>
<item
jar="C:\Users\zshires\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpmime\4.2.5\412b9914d0adec6d5716df1ada8acbc4f6f2dd37\httpmime-4.2.5.jar"
jumboMode="false"
revision="21.1.2"
sha1="412b9914d0adec6d5716df1ada8acbc4f6f2dd37">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\httpmime-4.2.5-44dae7cd32c214c7cf092c898838bcad3c91b412.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-nearby\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="ef5f051e7308febe289dc93c67c5f32785b4260a">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-61562f3a0c5e5d67cc146ba85201ecbdbe64f944.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\22.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="d84409890828e07d344a3b9b1da545dba9897b51">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-f8dd2917209bceff9970743c84753dda51263be2.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-location\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="73ccb92b70112f2e463e415ef8d7275de7da6516">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-eef030228685db3295c06b8733a05cd139f8b935.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-gcm\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="9224bc4c54ba95147c7eabd874573763c07cb6be">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-bcf61f2ecb1748248da474643cc56ac30c20353b.jar" />
</item>
<item
jar="C:\Users\zshires\.gradle\caches\modules-2\files-2.1\com.google.code.gson\gson\2.3.1\ecb6e1f8e4b0e84c4b886c2f14a1500caf309757\gson-2.3.1.jar"
jumboMode="false"
revision="21.1.2"
sha1="ecb6e1f8e4b0e84c4b886c2f14a1500caf309757">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\gson-2.3.1-4bc25401480731b5fab71ad5e3a6bb82f9ebe1f2.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-games\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="055783146ba9654a725442563be78cad303aad1f">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-7183e82967c167449a0e7e3b75ffdbac853f0c26.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.facebook.android\facebook-android-sdk\3.21.1\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="0285ad8da812e92dda76ed5d0dcba05724c7911d">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-1d7847913f4f95af054231c8da29ef493927e348.jar" />
</item>
<item
jar="C:\Users\zshires\AppData\Local\Android\sdk1\extras\android\m2repository\com\android\support\support-annotations\22.0.0\support-annotations-22.0.0.jar"
jumboMode="false"
revision="21.1.2"
sha1="685d0b2c590447e85284ed84712cb363ba04eff8">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\support-annotations-22.0.0-f01ec94dc5bb43eef13a60a8ab2f5c42231524b2.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="4c93d99d454c975536bbe3b42283eee847f03ea3">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-1d92c1aa40602f9aa7b53ca74386f7a24a9dc02b.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-wallet\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="a96b762bde4139de855735f175ec4d17dca55a6d">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-8b3739ad4c846f54aadfa3ebd6beab9cdf16fc67.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-cast\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="4cd0b093824b3228fffc21ea369b98d0b1db6566">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-4ceee79b9765a40c4f99cbb5b3c8ffca3cc68b21.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.android.support\support-v4\22.0.0\libs\internal_impl-22.0.0.jar"
jumboMode="false"
revision="21.1.2"
sha1="b5b92f469d515a13d778900f6d50c03d12f35504">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\internal_impl-22.0.0-2c55bee40895d6f868c09e876078e5116f6eca41.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-appstate\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="7ff613bf78ab057293892fdbd4169eda899c89b9">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-be16596c6eb819c65f600e0237523325f6ea742e.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-ads\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="e3d791b42eaa90416cd0b2d2e608092794a3baa4">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-2d06614096c14ddda6dd7963f2cc9841871f1269.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-identity\7.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="fb04b12526b0073c7fb1ebb70c5842d82ee95596">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-e56b19a51587cf0c9ff9b1cc38a625f4fb5cf76e.jar" />
</item>
<item
jar="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\exploded-aar\com.android.support\support-v4\22.0.0\classes.jar"
jumboMode="false"
revision="21.1.2"
sha1="4e86306289ace4aa0cfec44a05ed2b410d36989d">
<dex dex="C:\Users\zshires\Desktop\NewBuz\app\build\intermediates\pre-dexed\debug\classes-eefce17bc16beb71dfd9de5a4e51a929bb8f574f.jar" />
</item>

</items>