diff --git a/.idea/libraries/animated_vector_drawable_23_3_0.xml b/.idea/libraries/animated_vector_drawable_23_3_0.xml
deleted file mode 100644
index b3f679b..0000000
--- a/.idea/libraries/animated_vector_drawable_23_3_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/appcompat_v7_23_3_0.xml b/.idea/libraries/appcompat_v7_23_3_0.xml
deleted file mode 100644
index da50caa..0000000
--- a/.idea/libraries/appcompat_v7_23_3_0.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/design_23_3_0.xml b/.idea/libraries/design_23_3_0.xml
deleted file mode 100644
index 26dbcf3..0000000
--- a/.idea/libraries/design_23_3_0.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/recyclerview_v7_23_3_0.xml b/.idea/libraries/recyclerview_v7_23_3_0.xml
deleted file mode 100644
index b353d5e..0000000
--- a/.idea/libraries/recyclerview_v7_23_3_0.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/support_annotations_23_3_0.xml b/.idea/libraries/support_annotations_23_3_0.xml
deleted file mode 100644
index fd1ab9e..0000000
--- a/.idea/libraries/support_annotations_23_3_0.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_23_3_0.xml b/.idea/libraries/support_v4_23_3_0.xml
deleted file mode 100644
index 98d1b53..0000000
--- a/.idea/libraries/support_v4_23_3_0.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/support_vector_drawable_23_3_0.xml b/.idea/libraries/support_vector_drawable_23_3_0.xml
deleted file mode 100644
index 2d70087..0000000
--- a/.idea/libraries/support_vector_drawable_23_3_0.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index b0751b4..6750108 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -22,8 +22,9 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
- compile 'com.android.support:appcompat-v7:23.3.0'
- compile 'com.android.support:design:23.3.0'
+ compile 'com.android.support:appcompat-v7:23.4.0'
+ compile 'com.android.support:design:23.4.0'
compile 'com.android.volley:volley:1.0.0'
- compile 'com.android.support:support-v4:23.3.0'
+ compile 'com.android.support:support-v4:23.4.0'
+ compile 'com.google.android.gms:play-services:9.2.0'
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 330e51d..ff7708a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,7 +2,6 @@
-
@@ -21,23 +20,39 @@
android:theme="@style/AppTheme">
+ android:noHistory="true"
+ android:theme="@style/AppTheme.NoActionBar">
-
-
+
-
+ android:theme="@style/AppTheme.NoActionBar" />
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MainActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MainActivity.java
index 7761f25..5242ac1 100644
--- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MainActivity.java
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MainActivity.java
@@ -17,14 +17,29 @@ import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
+import com.android.volley.Response;
+import com.android.volley.VolleyError;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
- protected final String TAG = "[TSN / MainActivity]";
+ protected static final String TAG = "[TSN / MainActivity]";
protected String userId;
private GPSUtils gpsUtils;
private boolean locationPermission;
public static ProgressDialog progress;
+ private GmapFragment gmapFragment;
+ private PersonalFragment personalFragment;
+ public static final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
+
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -32,6 +47,8 @@ public class MainActivity extends AppCompatActivity
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
+ gmapFragment = new GmapFragment();
+ personalFragment = new PersonalFragment();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@@ -58,7 +75,7 @@ public class MainActivity extends AppCompatActivity
//Change Layout
Log.d(TAG, "Changing Fragment to Personal Activity");
- PersonalFragment personalFragment = new PersonalFragment();
+// PersonalFragment personalFragment = new PersonalFragment();
personalFragment.setArguments(b);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, personalFragment);
@@ -104,15 +121,26 @@ public class MainActivity extends AppCompatActivity
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
- // Handle navigation view item clicks here.
+ FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
+ Bundle b = new Bundle();
+
int id = item.getItemId();
if (id == R.id.nav_explore) {
// Handle the camera action
} else if (id == R.id.nav_map) {
-
+//
+ Log.d(TAG,"Before going to map");
+// gmapFragment.("note_list", (ArrayList) listOfNotes);
+// gmapFragment.put("user_lat", gpsUtils.getLatitude());
+// gmapFragment.putExtra("user_lng", gpsUtils.getLongitude());
+ ft.replace(R.id.fragment_container, gmapFragment);
+ ft.commit();
} else if (id == R.id.nav_personal) {
+ Log.d(TAG,"Before going to personal");
+ ft.replace(R.id.fragment_container, personalFragment);
+ ft.commit();
} else if (id == R.id.nav_settings) {
} else if (id == R.id.nav_logout) {
@@ -122,7 +150,9 @@ public class MainActivity extends AppCompatActivity
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
- }public GPSUtils getGPSUtils() {
+ }
+
+ public GPSUtils getGPSUtils() {
return this.gpsUtils;
}
@@ -149,6 +179,48 @@ public class MainActivity extends AppCompatActivity
}
}
+ // //Generic response ErrorListener
+ Response.ErrorListener genericErrorListener = new Response.ErrorListener() {
+ @Override
+ public void onErrorResponse(VolleyError error) {
+ Log.d(TAG, "genericErrorListener");
+ error.printStackTrace();
+ }
+ };
+ public Note getNoteFromJsonObj(JSONObject noteObject, Date time) throws JSONException {
+// List listOfNotes = new ArrayList<>();
+
+ Note note = new Note(
+ noteObject.getString("id"),
+ Float.parseFloat(noteObject.getJSONObject("location").getString("lat")),
+ Float.parseFloat(noteObject.getJSONObject("location").getString("lng")),
+ noteObject.getJSONObject("location").getString("address"),
+ noteObject.getString("title"),
+ noteObject.getString("body"),
+ time.toString(),
+ noteObject.getBoolean("is_public"),
+ noteObject.getInt("likes"),
+ jsonArrayToStringArray(noteObject.getJSONArray("tags"))
+ );
+ return note;
+// listOfNotes.add(addNote);
+
+ }
+
+ public ArrayList jsonArrayToStringArray(JSONArray jArray) {
+ ArrayList stringArray = new ArrayList();
+ for (int i = 0, count = jArray.length(); i < count; i++) {
+ try {
+ JSONObject jsonObject = jArray.getJSONObject(i);
+ stringArray.add(jsonObject.toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+ }
+ return stringArray;
+ }
+
+ public String getUserId(){return userId;}
}
diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MapsActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MapsActivity.java
deleted file mode 100644
index 9841f90..0000000
--- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MapsActivity.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.android_app.matan.ara.sagi.thesocialnotework;
-
-import android.content.Intent;
-import android.support.v4.app.FragmentActivity;
-import android.os.Bundle;
-import android.util.Log;
-import android.widget.Toast;
-
-//import com.google.android.gms.maps.CameraUpdateFactory;
-//import com.google.android.gms.maps.GoogleMap;
-//import com.google.android.gms.maps.OnMapReadyCallback;
-//import com.google.android.gms.maps.SupportMapFragment;
-//import com.google.android.gms.maps.model.LatLng;
-//import com.google.android.gms.maps.model.MarkerOptions;
-
-import java.util.ArrayList;
-//
-//public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
-////
-//// private GoogleMap mMap;
-//// private ArrayList listOfNotes;
-//// private float userLat, userLng;
-//
-// @Override
-// protected void onCreate(Bundle savedInstanceState) {
-// super.onCreate(savedInstanceState);
-// setContentView(R.layout.activity_maps);
-// // Obtain the SupportMapFragment and get notified when the map is ready to be used.
-// SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
-// .findFragmentById(R.id.map);
-// mapFragment.getMapAsync(this);
-//
-// Log.d("Tag","in maps create");
-// listOfNotes = getIntent().getParcelableArrayListExtra("note_list");
-// userLat = getIntent().getFloatExtra("user_lat", -34);
-// userLng = getIntent().getFloatExtra("user_lng", 151);
-// Toast.makeText(this, listOfNotes.get(1).title, Toast.LENGTH_LONG).show();
-// }
-//
-//
-// /**
-// * Manipulates the map once available.
-// * This callback is triggered when the map is ready to be used.
-// * This is where we can add markers or lines, add listeners or move the camera. In this case,
-// * we just add a marker near Sydney, Australia.
-// * If Google Play services is not installed on the device, the user will be prompted to install
-// * it inside the SupportMapFragment. This method will only be triggered once the user has
-// * installed Google Play services and returned to the app.
-// */
-// @Override
-// public void onMapReady(GoogleMap googleMap) {
-// mMap = googleMap;
-//
-// LatLng userLocation = new LatLng(userLat,userLng);
-// LatLng noteLocation = null;
-//
-// for (Note note :listOfNotes){
-// noteLocation = new LatLng(note.getLat(),note.getLon());
-// mMap.addMarker(new MarkerOptions().position(noteLocation).title(note.getTitle()));
-// }
-// // Add a marker in Sydney and move the camera
-//// LatLng sydney = new LatLng(-34, 151);
-//// mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
-// mMap.addMarker(new MarkerOptions().position(userLocation).title("I Am Here!"));
-//
-// mMap.moveCamera(CameraUpdateFactory.newLatLng(userLocation));
-// }
-//}
diff --git a/app/src/main/res/layout/activity_maps.xml b/app/src/main/res/layout/activity_maps.xml
deleted file mode 100644
index 4cb5c87..0000000
--- a/app/src/main/res/layout/activity_maps.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/app/src/main/res/layout/fragment_gmap.xml b/app/src/main/res/layout/fragment_gmap.xml
new file mode 100644
index 0000000..c0a1fc9
--- /dev/null
+++ b/app/src/main/res/layout/fragment_gmap.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 600e848..8ee5a08 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -37,5 +37,6 @@
Hello blank fragment
Password should be at least 4 chars long
+ Map