diff --git a/.idea/libraries/android_android_23.xml b/.idea/libraries/android_android_23.xml
deleted file mode 100644
index a279d4a..0000000
--- a/.idea/libraries/android_android_23.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
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/animated_vector_drawable_23_4_0.xml b/.idea/libraries/animated_vector_drawable_23_4_0.xml
index 99f4e11..f3749a7 100644
--- a/.idea/libraries/animated_vector_drawable_23_4_0.xml
+++ b/.idea/libraries/animated_vector_drawable_23_4_0.xml
@@ -1,12 +1,12 @@
-
+
-
+
\ 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/appcompat_v7_23_4_0.xml b/.idea/libraries/appcompat_v7_23_4_0.xml
index ddf5d98..c9db6e3 100644
--- a/.idea/libraries/appcompat_v7_23_4_0.xml
+++ b/.idea/libraries/appcompat_v7_23_4_0.xml
@@ -1,15 +1,12 @@
-
-
-
-
+
-
+
\ 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/design_23_4_0.xml b/.idea/libraries/design_23_4_0.xml
index e6ce58c..2b72087 100644
--- a/.idea/libraries/design_23_4_0.xml
+++ b/.idea/libraries/design_23_4_0.xml
@@ -1,15 +1,12 @@
-
-
-
-
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_auth_9_2_0.xml b/.idea/libraries/firebase_auth_9_2_0.xml
index 7185ab6..f4f9543 100644
--- a/.idea/libraries/firebase_auth_9_2_0.xml
+++ b/.idea/libraries/firebase_auth_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/firebase_common_9_2_0.xml b/.idea/libraries/firebase_common_9_2_0.xml
index 317d346..2aa6d7c 100644
--- a/.idea/libraries/firebase_common_9_2_0.xml
+++ b/.idea/libraries/firebase_common_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/firebase_messaging_9_2_0.xml b/.idea/libraries/firebase_messaging_9_2_0.xml
index f28a963..036d0ad 100644
--- a/.idea/libraries/firebase_messaging_9_2_0.xml
+++ b/.idea/libraries/firebase_messaging_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/mediarouter_v7_23_0_0.xml b/.idea/libraries/mediarouter_v7_23_0_0.xml
index 5f69718..2e8eb2f 100644
--- a/.idea/libraries/mediarouter_v7_23_0_0.xml
+++ b/.idea/libraries/mediarouter_v7_23_0_0.xml
@@ -1,16 +1,13 @@
-
-
-
+
-
-
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_ads_lite_9_2_0.xml b/.idea/libraries/play_services_ads_lite_9_2_0.xml
index 8674fb1..ccc96e0 100644
--- a/.idea/libraries/play_services_ads_lite_9_2_0.xml
+++ b/.idea/libraries/play_services_ads_lite_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_analytics_9_2_0.xml b/.idea/libraries/play_services_analytics_9_2_0.xml
index 2b08c1c..c6e4b62 100644
--- a/.idea/libraries/play_services_analytics_9_2_0.xml
+++ b/.idea/libraries/play_services_analytics_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_appinvite_9_2_0.xml b/.idea/libraries/play_services_appinvite_9_2_0.xml
index 6b9e8d2..57aca98 100644
--- a/.idea/libraries/play_services_appinvite_9_2_0.xml
+++ b/.idea/libraries/play_services_appinvite_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_base_9_2_0.xml b/.idea/libraries/play_services_base_9_2_0.xml
index a1981fd..8ec9e71 100644
--- a/.idea/libraries/play_services_base_9_2_0.xml
+++ b/.idea/libraries/play_services_base_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_basement_9_2_0.xml b/.idea/libraries/play_services_basement_9_2_0.xml
index 0aec068..d4ac257 100644
--- a/.idea/libraries/play_services_basement_9_2_0.xml
+++ b/.idea/libraries/play_services_basement_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_cast_9_2_0.xml b/.idea/libraries/play_services_cast_9_2_0.xml
index 984c4b1..db48fce 100644
--- a/.idea/libraries/play_services_cast_9_2_0.xml
+++ b/.idea/libraries/play_services_cast_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_clearcut_9_2_0.xml b/.idea/libraries/play_services_clearcut_9_2_0.xml
index 491f374..fde64de 100644
--- a/.idea/libraries/play_services_clearcut_9_2_0.xml
+++ b/.idea/libraries/play_services_clearcut_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_contextmanager_9_2_0.xml b/.idea/libraries/play_services_contextmanager_9_2_0.xml
index f1795a0..0c01383 100644
--- a/.idea/libraries/play_services_contextmanager_9_2_0.xml
+++ b/.idea/libraries/play_services_contextmanager_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_drive_9_2_0.xml b/.idea/libraries/play_services_drive_9_2_0.xml
index d4461f8..98828c3 100644
--- a/.idea/libraries/play_services_drive_9_2_0.xml
+++ b/.idea/libraries/play_services_drive_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_fitness_9_2_0.xml b/.idea/libraries/play_services_fitness_9_2_0.xml
index e78f832..2c270ce 100644
--- a/.idea/libraries/play_services_fitness_9_2_0.xml
+++ b/.idea/libraries/play_services_fitness_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_gcm_9_2_0.xml b/.idea/libraries/play_services_gcm_9_2_0.xml
index 842e61c..5662aa1 100644
--- a/.idea/libraries/play_services_gcm_9_2_0.xml
+++ b/.idea/libraries/play_services_gcm_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_identity_9_2_0.xml b/.idea/libraries/play_services_identity_9_2_0.xml
index 7443980..ad29331 100644
--- a/.idea/libraries/play_services_identity_9_2_0.xml
+++ b/.idea/libraries/play_services_identity_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_panorama_9_2_0.xml b/.idea/libraries/play_services_panorama_9_2_0.xml
index ed921cc..9a61b57 100644
--- a/.idea/libraries/play_services_panorama_9_2_0.xml
+++ b/.idea/libraries/play_services_panorama_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_safetynet_9_2_0.xml b/.idea/libraries/play_services_safetynet_9_2_0.xml
index 9c5b023..8685efc 100644
--- a/.idea/libraries/play_services_safetynet_9_2_0.xml
+++ b/.idea/libraries/play_services_safetynet_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/libraries/play_services_tagmanager_9_2_0.xml b/.idea/libraries/play_services_tagmanager_9_2_0.xml
index 705e858..59cfde9 100644
--- a/.idea/libraries/play_services_tagmanager_9_2_0.xml
+++ b/.idea/libraries/play_services_tagmanager_9_2_0.xml
@@ -1,8 +1,8 @@
-
+
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/recyclerview_v7_23_4_0.xml b/.idea/libraries/recyclerview_v7_23_4_0.xml
index e06fd5f..c911745 100644
--- a/.idea/libraries/recyclerview_v7_23_4_0.xml
+++ b/.idea/libraries/recyclerview_v7_23_4_0.xml
@@ -1,15 +1,12 @@
-
-
-
-
+
\ 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_annotations_23_4_0.xml b/.idea/libraries/support_annotations_23_4_0.xml
index 87c058c..f678226 100644
--- a/.idea/libraries/support_annotations_23_4_0.xml
+++ b/.idea/libraries/support_annotations_23_4_0.xml
@@ -1,11 +1,11 @@
-
+
-
+
\ 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_v4_23_4_0.xml b/.idea/libraries/support_v4_23_4_0.xml
index bf0eefe..96fd1a8 100644
--- a/.idea/libraries/support_v4_23_4_0.xml
+++ b/.idea/libraries/support_v4_23_4_0.xml
@@ -1,16 +1,13 @@
-
-
-
-
+
-
+
\ 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/.idea/libraries/support_vector_drawable_23_4_0.xml b/.idea/libraries/support_vector_drawable_23_4_0.xml
index 5d80f68..32cf50b 100644
--- a/.idea/libraries/support_vector_drawable_23_4_0.xml
+++ b/.idea/libraries/support_vector_drawable_23_4_0.xml
@@ -1,12 +1,12 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/libraries/volley_1_0_0.xml b/.idea/libraries/volley_1_0_0.xml
index 81a83dd..8e317b7 100644
--- a/.idea/libraries/volley_1_0_0.xml
+++ b/.idea/libraries/volley_1_0_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 5d19981..1a3eaff 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -37,7 +37,7 @@
-
+
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 aac76e6..68d785a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -31,15 +31,32 @@
+ android:noHistory="true"
+ android:screenOrientation="portrait"/>
-
+ android:screenOrientation="portrait"/>
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GmapFragment.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GmapFragment.java
new file mode 100644
index 0000000..34966f0
--- /dev/null
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GmapFragment.java
@@ -0,0 +1,165 @@
+package com.android_app.matan.ara.sagi.thesocialnotework;
+
+import android.content.Context;
+import android.location.Location;
+import android.net.Uri;
+import android.os.Bundle;
+//import android.app.Fragment;
+import android.support.v4.app.Fragment;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.volley.Response;
+import com.google.android.gms.maps.CameraUpdateFactory;
+import com.google.android.gms.maps.GoogleMap;
+import com.google.android.gms.maps.MapFragment;
+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 org.json.JSONArray;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+
+public class GmapFragment extends Fragment implements OnMapReadyCallback {
+ // TODO: Rename parameter arguments, choose names that match
+ // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+ private static final String ARG_PARAM1 = "param1";
+ private static final String ARG_PARAM2 = "param2";
+ private static final String TAG = "[TSN / GmapFragment]";
+ private GoogleMap mMap;
+ private GPSUtils gpsUtils;
+ private MainActivity mainActivity;
+
+ // TODO: Rename and change types of parameters
+ private String mParam1;
+ private String mParam2;
+
+
+ public GmapFragment() {
+ // Required empty public constructor
+ }
+
+ /**
+ * Use this factory method to create a new instance of
+ * this fragment using the provided parameters.
+ *
+ * @param param1 Parameter 1.
+ * @param param2 Parameter 2.
+ * @return A new instance of fragment GmapFragment.
+ */
+ // TODO: Rename and change types and number of parameters
+ public static GmapFragment newInstance(String param1, String param2) {
+ GmapFragment fragment = new GmapFragment();
+ Bundle args = new Bundle();
+ args.putString(ARG_PARAM1, param1);
+ args.putString(ARG_PARAM2, param2);
+ fragment.setArguments(args);
+ return fragment;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ if (getArguments() != null) {
+ mParam1 = getArguments().getString(ARG_PARAM1);
+ mParam2 = getArguments().getString(ARG_PARAM2);
+ }
+ mainActivity = (MainActivity)getActivity();
+
+ gpsUtils = mainActivity.getGPSUtils();
+
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ return inflater.inflate(R.layout.fragment_gmap, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ SupportMapFragment frag = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.mapFragment);
+ frag.getMapAsync(this);
+ }
+
+
+ @Override
+ public void onAttach(Context context) {
+ super.onAttach(context);
+ }
+
+ @Override
+ public void onDetach() {
+ super.onDetach();
+ }
+
+ @Override
+ public void onMapReady(GoogleMap googleMap) {
+
+ mMap = googleMap;
+
+ VolleyUtilSingleton.getInstance(getActivity()).get(mainActivity.BASE_URL + "/note/all?uid=" +mainActivity.getUserId() , getNotesSuccessListener, mainActivity.genericErrorListener);
+
+ LatLng userLocation = new LatLng(gpsUtils.getLatitude(), gpsUtils.getLongitude());
+ mMap.addMarker(new MarkerOptions().position(userLocation).title("I Am Here!"));
+ mMap.moveCamera(CameraUpdateFactory.newLatLng(userLocation));
+
+ }
+
+ //response listener for getting all user notes
+ Response.Listener getNotesSuccessListener = new Response.Listener() {
+ @Override
+ public void onResponse(JSONObject response) {
+ Log.d(TAG, "getNotesSuccessListener: " + response.toString());
+ List listOfNotes = new ArrayList<>();
+
+ try {
+ //need to get all notes and add to listOfNotes
+ JSONArray noteObjectsArray = response.getJSONArray("notes");
+ Date time = new Date();
+ for (int i = 0; i < noteObjectsArray.length(); i++) {
+ JSONObject noteObject = noteObjectsArray.getJSONObject(i);
+ time.setTime(noteObject.getLong("created_at"));
+
+ listOfNotes.add(mainActivity.getNoteFromJsonObj(noteObject, time));
+ }
+ addNotesToMap(listOfNotes);
+// noteList.setAdapter(noteListAdapter);
+ } catch (Exception e) {
+ Log.e(TAG, "newNoteSuccess:" + e.getMessage());
+ }
+ }
+ };
+
+ private void addNotesToMap(List listOfNotes) {
+ for(Note note : listOfNotes){
+ String title = note.getTitle();
+ float lat = note.getLat();
+ float lng = note.getLon();
+ mMap.addMarker(new MarkerOptions().position(new LatLng(lat,lng)).title(title));
+ }
+ }
+
+
+ /**
+ * This interface must be implemented by activities that contain this
+ * fragment to allow an interaction in this fragment to be communicated
+ * to the activity and potentially other fragments contained in that
+ * activity.
+ *
+ * See the Android Training lesson Communicating with Other Fragments for more information.
+ */
+
+}
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 6ef19cb..dfdc2d2 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,6 +17,17 @@ 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 {
public static final String LOCAL_DATA_TSN = "TSN_DATA_STORE";
@@ -25,6 +36,10 @@ public class MainActivity extends AppCompatActivity
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,27 +47,33 @@ 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();
+
+
+
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
+
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
+
//get Bundle data (Userid)
Bundle b = getIntent().getExtras();
userId = b.getString("user_id");
//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);
ft.commit();
Log.d(TAG, "Changed");
-
gpsUtils = new GPSUtils(this);
gpsUtils.getLocation();
}
@@ -92,15 +113,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) {
@@ -111,6 +143,7 @@ public class MainActivity extends AppCompatActivity
drawer.closeDrawer(GravityCompat.START);
return true;
}
+
public GPSUtils getGPSUtils() {
return this.gpsUtils;
}
@@ -138,6 +171,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