diff --git a/.idea/libraries/android_android_23.xml b/.idea/libraries/android_android_23.xml
new file mode 100644
index 0000000..a279d4a
--- /dev/null
+++ b/.idea/libraries/android_android_23.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..99f4e11
--- /dev/null
+++ b/.idea/libraries/animated_vector_drawable_23_4_0.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..ddf5d98
--- /dev/null
+++ b/.idea/libraries/appcompat_v7_23_4_0.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/design_23_4_0.xml b/.idea/libraries/design_23_4_0.xml
new file mode 100644
index 0000000..e6ce58c
--- /dev/null
+++ b/.idea/libraries/design_23_4_0.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_analytics_9_2_0.xml b/.idea/libraries/firebase_analytics_9_2_0.xml
new file mode 100644
index 0000000..a0c54d5
--- /dev/null
+++ b/.idea/libraries/firebase_analytics_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_analytics_impl_9_2_0.xml b/.idea/libraries/firebase_analytics_impl_9_2_0.xml
new file mode 100644
index 0000000..6e0d7e2
--- /dev/null
+++ b/.idea/libraries/firebase_analytics_impl_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..7185ab6
--- /dev/null
+++ b/.idea/libraries/firebase_auth_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_auth_common_9_2_0.xml b/.idea/libraries/firebase_auth_common_9_2_0.xml
new file mode 100644
index 0000000..86f4201
--- /dev/null
+++ b/.idea/libraries/firebase_auth_common_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_auth_module_9_2_0.xml b/.idea/libraries/firebase_auth_module_9_2_0.xml
new file mode 100644
index 0000000..a45803b
--- /dev/null
+++ b/.idea/libraries/firebase_auth_module_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_common_9_2_0.xml b/.idea/libraries/firebase_common_9_2_0.xml
new file mode 100644
index 0000000..317d346
--- /dev/null
+++ b/.idea/libraries/firebase_common_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_config_9_2_0.xml b/.idea/libraries/firebase_config_9_2_0.xml
new file mode 100644
index 0000000..d4a396e
--- /dev/null
+++ b/.idea/libraries/firebase_config_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_crash_9_2_0.xml b/.idea/libraries/firebase_crash_9_2_0.xml
new file mode 100644
index 0000000..7b7a413
--- /dev/null
+++ b/.idea/libraries/firebase_crash_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_database_9_2_0.xml b/.idea/libraries/firebase_database_9_2_0.xml
new file mode 100644
index 0000000..4cf8d04
--- /dev/null
+++ b/.idea/libraries/firebase_database_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_database_connection_9_2_0.xml b/.idea/libraries/firebase_database_connection_9_2_0.xml
new file mode 100644
index 0000000..8f2cabd
--- /dev/null
+++ b/.idea/libraries/firebase_database_connection_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_iid_9_2_0.xml b/.idea/libraries/firebase_iid_9_2_0.xml
new file mode 100644
index 0000000..f2a30ea
--- /dev/null
+++ b/.idea/libraries/firebase_iid_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_messaging_9_2_0.xml b/.idea/libraries/firebase_messaging_9_2_0.xml
new file mode 100644
index 0000000..f28a963
--- /dev/null
+++ b/.idea/libraries/firebase_messaging_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_storage_9_2_0.xml b/.idea/libraries/firebase_storage_9_2_0.xml
new file mode 100644
index 0000000..111cccc
--- /dev/null
+++ b/.idea/libraries/firebase_storage_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/firebase_storage_common_9_2_0.xml b/.idea/libraries/firebase_storage_common_9_2_0.xml
new file mode 100644
index 0000000..206dd0b
--- /dev/null
+++ b/.idea/libraries/firebase_storage_common_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/mediarouter_v7_23_0_0.xml b/.idea/libraries/mediarouter_v7_23_0_0.xml
new file mode 100644
index 0000000..5f69718
--- /dev/null
+++ b/.idea/libraries/mediarouter_v7_23_0_0.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_9_2_0.xml b/.idea/libraries/play_services_9_2_0.xml
new file mode 100644
index 0000000..7460e35
--- /dev/null
+++ b/.idea/libraries/play_services_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_ads_9_2_0.xml b/.idea/libraries/play_services_ads_9_2_0.xml
new file mode 100644
index 0000000..612f716
--- /dev/null
+++ b/.idea/libraries/play_services_ads_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..8674fb1
--- /dev/null
+++ b/.idea/libraries/play_services_ads_lite_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_analytics_9_2_0.xml b/.idea/libraries/play_services_analytics_9_2_0.xml
new file mode 100644
index 0000000..2b08c1c
--- /dev/null
+++ b/.idea/libraries/play_services_analytics_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_analytics_impl_9_2_0.xml b/.idea/libraries/play_services_analytics_impl_9_2_0.xml
new file mode 100644
index 0000000..cf0ceda
--- /dev/null
+++ b/.idea/libraries/play_services_analytics_impl_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_appindexing_9_2_0.xml b/.idea/libraries/play_services_appindexing_9_2_0.xml
new file mode 100644
index 0000000..1f748dc
--- /dev/null
+++ b/.idea/libraries/play_services_appindexing_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_appinvite_9_2_0.xml b/.idea/libraries/play_services_appinvite_9_2_0.xml
new file mode 100644
index 0000000..6b9e8d2
--- /dev/null
+++ b/.idea/libraries/play_services_appinvite_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_auth_9_2_0.xml b/.idea/libraries/play_services_auth_9_2_0.xml
new file mode 100644
index 0000000..fa81c05
--- /dev/null
+++ b/.idea/libraries/play_services_auth_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_auth_base_9_2_0.xml b/.idea/libraries/play_services_auth_base_9_2_0.xml
new file mode 100644
index 0000000..a6522a6
--- /dev/null
+++ b/.idea/libraries/play_services_auth_base_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_base_9_2_0.xml b/.idea/libraries/play_services_base_9_2_0.xml
new file mode 100644
index 0000000..a1981fd
--- /dev/null
+++ b/.idea/libraries/play_services_base_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_basement_9_2_0.xml b/.idea/libraries/play_services_basement_9_2_0.xml
new file mode 100644
index 0000000..0aec068
--- /dev/null
+++ b/.idea/libraries/play_services_basement_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_cast_9_2_0.xml b/.idea/libraries/play_services_cast_9_2_0.xml
new file mode 100644
index 0000000..984c4b1
--- /dev/null
+++ b/.idea/libraries/play_services_cast_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_cast_framework_9_2_0.xml b/.idea/libraries/play_services_cast_framework_9_2_0.xml
new file mode 100644
index 0000000..2f893d0
--- /dev/null
+++ b/.idea/libraries/play_services_cast_framework_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_clearcut_9_2_0.xml b/.idea/libraries/play_services_clearcut_9_2_0.xml
new file mode 100644
index 0000000..491f374
--- /dev/null
+++ b/.idea/libraries/play_services_clearcut_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_contextmanager_9_2_0.xml b/.idea/libraries/play_services_contextmanager_9_2_0.xml
new file mode 100644
index 0000000..f1795a0
--- /dev/null
+++ b/.idea/libraries/play_services_contextmanager_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_drive_9_2_0.xml b/.idea/libraries/play_services_drive_9_2_0.xml
new file mode 100644
index 0000000..d4461f8
--- /dev/null
+++ b/.idea/libraries/play_services_drive_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_fitness_9_2_0.xml b/.idea/libraries/play_services_fitness_9_2_0.xml
new file mode 100644
index 0000000..e78f832
--- /dev/null
+++ b/.idea/libraries/play_services_fitness_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_games_9_2_0.xml b/.idea/libraries/play_services_games_9_2_0.xml
new file mode 100644
index 0000000..6daf147
--- /dev/null
+++ b/.idea/libraries/play_services_games_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_gass_9_2_0.xml b/.idea/libraries/play_services_gass_9_2_0.xml
new file mode 100644
index 0000000..2cf9897
--- /dev/null
+++ b/.idea/libraries/play_services_gass_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_gcm_9_2_0.xml b/.idea/libraries/play_services_gcm_9_2_0.xml
new file mode 100644
index 0000000..842e61c
--- /dev/null
+++ b/.idea/libraries/play_services_gcm_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_identity_9_2_0.xml b/.idea/libraries/play_services_identity_9_2_0.xml
new file mode 100644
index 0000000..7443980
--- /dev/null
+++ b/.idea/libraries/play_services_identity_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_iid_9_2_0.xml b/.idea/libraries/play_services_iid_9_2_0.xml
new file mode 100644
index 0000000..cc01008
--- /dev/null
+++ b/.idea/libraries/play_services_iid_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_location_9_2_0.xml b/.idea/libraries/play_services_location_9_2_0.xml
new file mode 100644
index 0000000..37fb730
--- /dev/null
+++ b/.idea/libraries/play_services_location_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_maps_9_2_0.xml b/.idea/libraries/play_services_maps_9_2_0.xml
new file mode 100644
index 0000000..25cc903
--- /dev/null
+++ b/.idea/libraries/play_services_maps_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_nearby_9_2_0.xml b/.idea/libraries/play_services_nearby_9_2_0.xml
new file mode 100644
index 0000000..78acec8
--- /dev/null
+++ b/.idea/libraries/play_services_nearby_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_panorama_9_2_0.xml b/.idea/libraries/play_services_panorama_9_2_0.xml
new file mode 100644
index 0000000..ed921cc
--- /dev/null
+++ b/.idea/libraries/play_services_panorama_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_places_9_2_0.xml b/.idea/libraries/play_services_places_9_2_0.xml
new file mode 100644
index 0000000..2660453
--- /dev/null
+++ b/.idea/libraries/play_services_places_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_plus_9_2_0.xml b/.idea/libraries/play_services_plus_9_2_0.xml
new file mode 100644
index 0000000..13b2aef
--- /dev/null
+++ b/.idea/libraries/play_services_plus_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_safetynet_9_2_0.xml b/.idea/libraries/play_services_safetynet_9_2_0.xml
new file mode 100644
index 0000000..9c5b023
--- /dev/null
+++ b/.idea/libraries/play_services_safetynet_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_tagmanager_9_2_0.xml b/.idea/libraries/play_services_tagmanager_9_2_0.xml
new file mode 100644
index 0000000..705e858
--- /dev/null
+++ b/.idea/libraries/play_services_tagmanager_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_tagmanager_api_9_2_0.xml b/.idea/libraries/play_services_tagmanager_api_9_2_0.xml
new file mode 100644
index 0000000..785dae0
--- /dev/null
+++ b/.idea/libraries/play_services_tagmanager_api_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_tasks_9_2_0.xml b/.idea/libraries/play_services_tasks_9_2_0.xml
new file mode 100644
index 0000000..255cf7b
--- /dev/null
+++ b/.idea/libraries/play_services_tasks_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_vision_9_2_0.xml b/.idea/libraries/play_services_vision_9_2_0.xml
new file mode 100644
index 0000000..d05e55f
--- /dev/null
+++ b/.idea/libraries/play_services_vision_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_wallet_9_2_0.xml b/.idea/libraries/play_services_wallet_9_2_0.xml
new file mode 100644
index 0000000..3e5373d
--- /dev/null
+++ b/.idea/libraries/play_services_wallet_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/play_services_wearable_9_2_0.xml b/.idea/libraries/play_services_wearable_9_2_0.xml
new file mode 100644
index 0000000..7704163
--- /dev/null
+++ b/.idea/libraries/play_services_wearable_9_2_0.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..e06fd5f
--- /dev/null
+++ b/.idea/libraries/recyclerview_v7_23_4_0.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..87c058c
--- /dev/null
+++ b/.idea/libraries/support_annotations_23_4_0.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..bf0eefe
--- /dev/null
+++ b/.idea/libraries/support_v4_23_4_0.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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
new file mode 100644
index 0000000..5d80f68
--- /dev/null
+++ b/.idea/libraries/support_vector_drawable_23_4_0.xml
@@ -0,0 +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 8e317b7..81a83dd 100644
--- a/.idea/libraries/volley_1_0_0.xml
+++ b/.idea/libraries/volley_1_0_0.xml
@@ -1,8 +1,8 @@
-
+
diff --git a/app/src/debug/res/values/google_maps_api.xml b/app/src/debug/res/values/google_maps_api.xml
new file mode 100644
index 0000000..7b9484b
--- /dev/null
+++ b/app/src/debug/res/values/google_maps_api.xml
@@ -0,0 +1,21 @@
+
+
+
+ AIzaSyAh1zNJoLXlCF_MWXQLQyer4nADBVevIPo
+
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0843f0f..330e51d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -2,6 +2,7 @@
+
@@ -35,6 +36,8 @@
android:name=".MainActivity"
android:label="@string/title_activity_main"
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/GPSUtils.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GPSUtils.java
index 8bf155a..6188eb1 100644
--- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GPSUtils.java
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/GPSUtils.java
@@ -91,10 +91,10 @@ public class GPSUtils extends Service implements LocationListener {
if (isNetworkEnabled) {
if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ContextCompat.checkSelfPermission(mContext, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
Log.e("TAG", "No Permissions");
- ((PersonalSpaceActivity)mContext).setLocationPermission(false);
+ ((MainActivity)mContext).setLocationPermission(false);
return null;
}else{
- ((PersonalSpaceActivity)mContext).setLocationPermission(true);
+ ((MainActivity)mContext).setLocationPermission(true);
}
Log.d(TAG, "Network");
if (locationManager != null) {
diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/HeavyWorker.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/HeavyWorker.java
index 273721f..8d569dd 100644
--- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/HeavyWorker.java
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/HeavyWorker.java
@@ -30,8 +30,8 @@ public class HeavyWorker extends AsyncTask< String , Context , Void > {
protected Void doInBackground ( String ... params ) {
// Do Your WORK here
- PersonalSpaceActivity ps = (PersonalSpaceActivity)targetCtx;
- ps.getAllNotes();
+// MainActivity ps = (MainActivity) targetCtx;
+// ps.getAllNotes();
return null ;
}
diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java
index 564eb34..1a17aff 100644
--- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/LoginActivity.java
@@ -74,6 +74,9 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
private EditText mPasswordView;
private View mProgressView;
private View mLoginFormView;
+ private TextView mRegisterButton;
+ private Button mLoginButton;
+
private final String TAG = "Login Activity";
@@ -85,13 +88,19 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- //Remove title bar
- this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_login);
this.self = this;
this.layout = (LinearLayout) findViewById(R.id.layout);
mUsernameView = (EditText) findViewById(R.id.al_username);
mPasswordView = (EditText) findViewById(R.id.al_password);
+ mLoginFormView = findViewById(R.id.login_form);
+ mProgressView = findViewById(R.id.login_progress);
+ showProgress(false);
+
+ // Remove Auto Focus from the Text Fields
+ layout.setFocusable(true);
+ layout.setFocusableInTouchMode(true);
+
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
@@ -102,30 +111,29 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
return false;
}
});
-// Button mRegisterButton = (Button) findViewById(R.id.al_register_button);
-// mRegisterButton.setOnClickListener(new OnClickListener() {
-// @Override
-// public void onClick(View view) {
-// Log.d(TAG, "Register....... this section under construction");
-// //attemptRegister(); // TODO : implement
-// }
-// });
- Button mEmailSignInButton = (Button) findViewById(R.id.al_login_button);
- mEmailSignInButton.setOnClickListener(new OnClickListener() {
+ mRegisterButton = (TextView) findViewById(R.id.al_register_button);
+ mRegisterButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ Log.d(TAG, "going to Register...page");
+ Intent registerActivity = new Intent(LoginActivity.this, RegisterActivity.class);
+ startActivity(registerActivity);
+ }
+ });
+
+ mLoginButton = (Button) findViewById(R.id.al_login_button);
+ mLoginButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG, "Login.......");
+ showProgress(false);
attemptLogin();
}
});
mLoginFormView = findViewById(R.id.login_form);
mProgressView = findViewById(R.id.login_progress);
-
- // Remove Auto Focus from the Text Fields
- layout.setFocusable(true);
- layout.setFocusableInTouchMode(true);
}
private void populateAutoComplete() {
@@ -201,6 +209,8 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
String username = mUsernameView.getText().toString();
String password = mPasswordView.getText().toString();
+ boolean cancel = false;
+ View focusView = null;
// http request register
JSONObject tempJson = new JSONObject();
@@ -223,7 +233,6 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
@Override
public void onResponse(JSONObject response) {
try {
- // if(response.get("user") != null) {
if(!response.isNull("user")) {
Log.e(TAG, "onLoginSuccess => user exist"); // TODO: REMOVE console
Intent personalSpaceActivity = new Intent(LoginActivity.this, MainActivity.class);
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 8407a63..489572d 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
@@ -20,6 +20,8 @@ public class MainActivity extends AppCompatActivity
protected final String TAG = "[TSN / MainActivity]";
protected String userId;
+ private GPSUtils gpsUtils;
+ private boolean locationPermission;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -59,6 +61,9 @@ public class MainActivity extends AppCompatActivity
ft.replace(R.id.fragment_container, personalFragment);
ft.commit();
Log.d(TAG, "Changed");
+
+ gpsUtils = new GPSUtils(this);
+ gpsUtils.getLocation();
}
@Override
@@ -114,7 +119,14 @@ public class MainActivity extends AppCompatActivity
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
+ }public GPSUtils getGPSUtils() {
+ return this.gpsUtils;
+ }
+
+ public void setLocationPermission(boolean locationPermission) {
+ this.locationPermission = locationPermission;
}
+
}
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
new file mode 100644
index 0000000..9841f90
--- /dev/null
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/MapsActivity.java
@@ -0,0 +1,68 @@
+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/java/com/android_app/matan/ara/sagi/thesocialnotework/Note.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Note.java
index 4d8bfeb..2fc2e2d 100644
--- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Note.java
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/Note.java
@@ -1,11 +1,14 @@
package com.android_app.matan.ara.sagi.thesocialnotework;
+import android.os.Parcel;
+import android.os.Parcelable;
+
import java.util.ArrayList;
/**
* Created by JERLocal on 7/1/2016.
*/
-public class Note {
+public class Note implements Parcelable{
protected int likes;
protected ArrayList tags;
@@ -15,6 +18,7 @@ public class Note {
+
public Note(String id, float lat, float lon, String address, String title, String body, String timestamp, boolean isPublic, int likes, ArrayList tags) {
this.id = id;
this.lat = lat;
@@ -29,6 +33,31 @@ public class Note {
this.tags = tags;
}
+ protected Note(Parcel in) {
+ likes = in.readInt();
+ tags = in.createStringArrayList();
+ lat = in.readFloat();
+ lon = in.readFloat();
+ id = in.readString();
+ address = in.readString();
+ title = in.readString();
+ body = in.readString();
+ timestamp = in.readString();
+ isPublic = in.readByte() != 0;
+ }
+
+ public static final Creator CREATOR = new Creator() {
+ @Override
+ public Note createFromParcel(Parcel in) {
+ return new Note(in);
+ }
+
+ @Override
+ public Note[] newArray(int size) {
+ return new Note[size];
+ }
+ };
+
@Override
public String toString() {
return "Note{" +
@@ -126,6 +155,26 @@ public class Note {
this.tags = tags;
}
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(likes);
+ dest.writeList(tags);
+ dest.writeFloat(lat);
+ dest.writeFloat(lon);
+ dest.writeString(id);
+ dest.writeString(address);
+ dest.writeString(title);
+ dest.writeString(body);
+ dest.writeString(timestamp);
+ dest.writeByte((byte) (isPublic ? 1 : 0));
+ }
+
+
// public void save(SQLiteOpenHelper dbHelper, Context context){
// SQLiteDatabase db = dbHelper.getWritableDatabase();
// ContentValues values = new ContentValues();
diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java
index 0ef14f9..ebe4a60 100644
--- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalFragment.java
@@ -72,7 +72,7 @@ public class PersonalFragment extends Fragment {
this.noteList = (ListView) view.findViewById(R.id.ps_list_listview);
addBtn = (Button) view.findViewById(R.id.ps_new_note_button);
- gpsUtils = new GPSUtils(getContext());
+ gpsUtils = ((MainActivity)getActivity()).getGPSUtils();
gpsUtils.getLocation();
diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalSpaceActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalSpaceActivity.java
index 426bf28..c386bd9 100644
--- a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalSpaceActivity.java
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/PersonalSpaceActivity.java
@@ -1,384 +1,491 @@
-package com.android_app.matan.ara.sagi.thesocialnotework;
-
-import android.Manifest;
-import android.app.Dialog;
-import android.content.pm.PackageManager;
-import android.support.v4.app.ActivityCompat;
-import android.support.v4.content.ContextCompat;
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.view.WindowManager;
-import android.widget.Button;
-import android.widget.CompoundButton;
-import android.widget.EditText;
-import android.widget.ListView;
-import android.widget.Switch;
-import android.widget.Toast;
-
-import com.android.volley.Request;
-import com.android.volley.Response;
-import com.android.volley.VolleyError;
-import com.android.volley.toolbox.JsonArrayRequest;
-import com.android.volley.toolbox.JsonObjectRequest;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-
-
-//http://thesocialnotework.appspot.com/api/status | http://localhost:8080/api/note/all?uid=
-public class PersonalSpaceActivity extends AppCompatActivity {
-
- protected ListView noteList;
- protected Button addBtn;
- private final String TAG = "Personal Space Activity";
- private final int FINE_PERM = 0;
- private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
- private boolean locationPermission;
- private GPSUtils gpsUtils;
- private List listOfNotes;
- private ListAdapter noteListAdapter;
- private String userId;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_personal_space);
- Bundle b = getIntent().getExtras();
- userId = b.getString("user_id");
- Log.d(TAG,"-------------------------USER ID: "+ userId);
-
- this.locationPermission = true;
-
- //check for permission
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, FINE_PERM);
-
-
- this.noteList = (ListView) findViewById(R.id.ps_list_listview);
- addBtn = (Button) findViewById(R.id.ps_new_note_button);
- gpsUtils = new GPSUtils(this);
- gpsUtils.getLocation();
-
-
- listOfNotes = new ArrayList<>();
- //TODO - remove -add demo notes to view
-// addDemoNotes(listOfNotes);
- noteListAdapter = new ListAdapter(this, listOfNotes);
-
- noteList.setAdapter(noteListAdapter);
-// new HeavyWorker(this).execute();
- getAllNotes();
-
-//https://thesocialnotework-api.appspot.com/api/note/all?uid=
- addBtn.setOnClickListener(addNewNoteDialog);
-
-
-
- }
-
- public void getAllNotes(){
- Log.d(TAG, "url: "+BASE_URL + "/note/all?uid="+userId);
- VolleyUtilSingleton.getInstance(PersonalSpaceActivity.this).get(BASE_URL + "/note/all?uid="+userId, getNotesSuccessListener, genericErrorListener);
- }
-
- private View.OnClickListener addNewNoteDialog = new View.OnClickListener() {
- public void onClick(View v) {
-
- //create and configure dialog
- final Dialog dialog = new Dialog(PersonalSpaceActivity.this);
- dialog.setContentView(R.layout.note_view_full);
- dialog.setTitle("New Note");
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
- lp.copyFrom(dialog.getWindow().getAttributes());
- lp.width = WindowManager.LayoutParams.MATCH_PARENT;
- lp.height = WindowManager.LayoutParams.MATCH_PARENT;
- dialog.setCancelable(false);
- dialog.show();
- dialog.getWindow().setAttributes(lp);
-
-
- //get note_view_full layout elements
- final Switch permissionSwitch = (Switch) dialog.findViewById(R.id.nvf_note_permission);
- final EditText newTitle = (EditText) dialog.findViewById(R.id.nvf_note_title);
- final EditText newBody = (EditText) dialog.findViewById(R.id.nvf_note_content);
- Button saveBtn = (Button) dialog.findViewById(R.id.nvf_note_submit_btn);
- Button cancelBtn = (Button) dialog.findViewById(R.id.nvf_note_cancel_btn);
-
- cancelBtn.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- dialog.dismiss();
- }
- });
-
- saveBtn.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
-
- //title too short
- if (newTitle.getText().length() == 0)
- {
- Toast toast = Toast.makeText(PersonalSpaceActivity.this, "Title too short.", Toast.LENGTH_LONG);
- toast.show();
- return;
- }
-
- //title too long
- if (newTitle.getText().length() > 20)
- {
- Toast toast = Toast.makeText(PersonalSpaceActivity.this, "Title too long.\n Use up to 20 notes.", Toast.LENGTH_LONG);
- toast.show();
- return;
- }
- //volley post
- final JSONObject noteJson = new JSONObject();
- try {
-
- //TODO need to get owner id from login screen
- noteJson.put("owner_id", userId);
- noteJson.put("title", newTitle.getText());
- noteJson.put("lat", gpsUtils.getLatitude());
- noteJson.put("lng", gpsUtils.getLongitude());
- noteJson.put("address", gpsUtils.getAddress());
- noteJson.put("body", newBody.getText());
- noteJson.put("is_public", permissionSwitch.isChecked());
-// noteJson.put("tags",);
- Log.d(TAG, "Json: " + noteJson.toString());
-
-
- } catch (Exception e) {
- Log.d(TAG, "saveBtn: "+e.toString());
- }
-
- //send request and close dialog
- VolleyUtilSingleton.getInstance(PersonalSpaceActivity.this).post(BASE_URL + "/note/upsert", noteJson, newNoteSuccessListener, genericErrorListener);
- dialog.dismiss();
- }
- });
-
- //change text of switch according to state.
- permissionSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if (isChecked)
- permissionSwitch.setText(R.string.nvf_public_label);
- else
- permissionSwitch.setText(R.string.nvf_private_label);
- }
- });
-
-
- }
- };
-
-
-
-// //TODO remove
-// public void addDemoNotes(List listOfNotes) {
-// Note n1 = new Note("1", 100, 100, "location1", "My 1st Title", "ohh i'm so sexy1", ""+System.currentTimeMillis() / 1000, true);
-// Note n2 = new Note("2", 200, 200, "location2", "My 2st Title", "ohh i'm so sexy2", ""+System.currentTimeMillis() / 1000, true);
-// Note n3 = new Note("3", 300, 300, "hell", "My 3st Title", "ohh i'm so sexy3", ""+System.currentTimeMillis() / 1000, true);
-//// Note n4 = new Note("4", 400, 400, "hell2", "My 4st Title", "ohh i'm so sexy4", ""+System.currentTimeMillis() / 1000, true);
-// listOfNotes.add(n1);
-// listOfNotes.add(n2);
-// listOfNotes.add(n3);
-//// listOfNotes.add(n4);
-// }
-
-
- public void setLocationPermission(boolean locationPermission) {
- this.locationPermission = locationPermission;
- }
-
-
- //response listener for adding new note
- Response.Listener newNoteSuccessListener = new Response.Listener() {
- @Override
- public void onResponse(JSONObject response) {
- Log.d(TAG, "newNoteSuccess: response - " + response.toString());
- try {
- Date time = new Date();
- JSONObject noteObject = response.getJSONObject("note");
- time.setTime(noteObject.getLong("created_at"));
- addNoteFromJsonObj(noteObject, time);
-
-// Note addNote = 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"))
-// );
+//package com.android_app.matan.ara.sagi.thesocialnotework;
//
-// listOfNotes.add(addNote);
- noteList.setAdapter(noteListAdapter);
- } catch (Exception e) {
- Log.e(TAG, "newNoteSuccess:" + e.getMessage());
- }
-
- }
- };
-
-
- //response Error listener for adding new note
- Response.ErrorListener newNoteErrorListener = new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- Log.d(TAG, "newNoteError: msg: " + error.getMessage());
- }
- };
-
-
- //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());
- 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"));
-
- addNoteFromJsonObj(noteObject, time);
-// Note addNote = 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"))
-// );
-// listOfNotes.add(addNote);
- }
- noteList.setAdapter(noteListAdapter);
- } catch (Exception e) {
- Log.e(TAG, "newNoteSuccess:" + e.getMessage());
- }
-
- }
- };
-
-
- //response ErrorListener for getting all user notes
- Response.ErrorListener getNotesErrorListener = new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- Log.d(TAG,"getNotesErrorListener: "+error.getMessage());
- }
- };
-
- //Generic response ErrorListener
- Response.ErrorListener genericErrorListener = new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- Log.d(TAG,"genericErrorListener");
- error.printStackTrace();
- }
- };
-
-
- public void requestPermissions(){
- // Here, thisActivity is the current activity
- if (ContextCompat.checkSelfPermission(PersonalSpaceActivity.this,
- Manifest.permission.ACCESS_FINE_LOCATION)
- != PackageManager.PERMISSION_GRANTED) {
-
-
- ActivityCompat.requestPermissions(PersonalSpaceActivity.this,
- new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
- FINE_PERM);
-
- // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
- // app-defined int constant. The callback method gets the
- // result of the request.
-
- }
-
- if (ContextCompat.checkSelfPermission(PersonalSpaceActivity.this,
- Manifest.permission.ACCESS_FINE_LOCATION)
- != PackageManager.PERMISSION_GRANTED) {
-
-
- ActivityCompat.requestPermissions(PersonalSpaceActivity.this,
- new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
- 1);
-
- // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
- // app-defined int constant. The callback method gets the
- // result of the request.
-
- }
-
- if (ContextCompat.checkSelfPermission(PersonalSpaceActivity.this,
- Manifest.permission.ACCESS_COARSE_LOCATION)
- != PackageManager.PERMISSION_GRANTED) {
-
-
- ActivityCompat.requestPermissions(PersonalSpaceActivity.this,
- new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},
- FINE_PERM);
-
- // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
- // app-defined int constant. The callback method gets the
- // result of the request.
-
- }
-
- }
-
-
-
- private 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;
- }
-
- private void addNoteFromJsonObj(JSONObject noteObject, Date time) throws JSONException {
- Note addNote = 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"))
- );
- listOfNotes.add(addNote);
-
- }
-}
+//import android.Manifest;
+//import android.app.AlertDialog;
+//import android.app.Dialog;
+//import android.app.FragmentTransaction;
+//import android.content.DialogInterface;
+//import android.content.Intent;
+//import android.content.pm.PackageManager;
+//import android.os.Parcelable;
+//import android.support.v4.app.ActivityCompat;
+//import android.support.v4.content.ContextCompat;
+//import android.support.v7.app.AppCompatActivity;
+//import android.os.Bundle;
+//import android.util.Log;
+//import android.view.View;
+//import android.view.WindowManager;
+//import android.widget.AdapterView;
+//import android.widget.Button;
+//import android.widget.CompoundButton;
+//import android.widget.EditText;
+//import android.widget.ImageButton;
+//import android.widget.ListView;
+//import android.widget.Switch;
+//import android.widget.TextView;
+//import android.widget.Toast;
+//
+//import com.android.volley.Request;
+//import com.android.volley.Response;
+//import com.android.volley.VolleyError;
+//import com.android.volley.toolbox.JsonArrayRequest;
+//import com.android.volley.toolbox.JsonObjectRequest;
+////import com.google.android.gms.maps.MapFragment;
+//
+//import org.json.JSONArray;
+//import org.json.JSONException;
+//import org.json.JSONObject;
+//
+//import java.text.DateFormat;
+//import java.text.SimpleDateFormat;
+//import java.util.ArrayList;
+//import java.util.Calendar;
+//import java.util.Date;
+//import java.util.HashMap;
+//import java.util.List;
+//import java.util.Map;
+//import java.util.TimeZone;
+//
+//
+////TODO - change all "setOnClickListener to xml onClick
+////TODO -
+//
+////http://thesocialnotework.appspot.com/api/status | http://localhost:8080/api/note/all?uid=
+//public class PersonalSpaceActivity extends AppCompatActivity {
+//
+// protected ListView noteList;
+// protected Button addBtn, mapButton;
+// private final String TAG = "Personal Space Activity";
+// private final int FINE_PERM = 0;
+// private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
+// private boolean locationPermission;
+// private GPSUtils gpsUtils;
+// private List listOfNotes;
+// private ListAdapter noteListAdapter;
+// private String userId;
+//// private MapFragment mMapFragment;
+//
+//
+// @Override
+// protected void onCreate(Bundle savedInstanceState) {
+// super.onCreate(savedInstanceState);
+// setContentView(R.layout.activity_personal_space);
+// Bundle b = getIntent().getExtras();
+// userId = b.getString("user_id");
+// Log.d(TAG, "-------------------------USER ID: " + userId);
+//
+// this.locationPermission = true;
+//
+// //check for permission
+// ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, FINE_PERM);
+//
+//
+// this.noteList = (ListView) findViewById(R.id.ps_list_listview);
+// addBtn = (Button) findViewById(R.id.ps_new_note_button);
+// mapButton = (Button) findViewById(R.id.ps_maps_btn);
+// gpsUtils = new GPSUtils(this);
+// gpsUtils.getLocation();
+//
+//
+// listOfNotes = new ArrayList<>();
+// //TODO - remove -add demo notes to view
+//// addDemoNotes(listOfNotes);
+// noteListAdapter = new ListAdapter(this, listOfNotes);
+//
+// noteList.setAdapter(noteListAdapter);
+// new HeavyWorker(this).execute();
+//// getAllNotes();
+//
+// addBtn.setOnClickListener(addNewNoteDialog);
+//
+// mapButton.setOnClickListener(new View.OnClickListener() {
+// public void onClick(View v) {
+// Log.d(TAG, "IN TESTS!!!!!!!!!!!!!!");
+////
+// Toast.makeText(PersonalSpaceActivity.this, "SUCCESS", Toast.LENGTH_LONG).show();
+//
+// mMapFragment = MapFragment.newInstance();
+// FragmentTransaction fragmentTransaction =
+// getFragmentManager().beginTransaction();
+// fragmentTransaction.add(R.id.map, mMapFragment);
+// fragmentTransaction.commit();
+// Intent mapsActivity = new Intent(PersonalSpaceActivity.this, MapsActivity.class);
+//// Bundle loginUserBundle = new Bundle();
+// mapsActivity.putParcelableArrayListExtra("note_list", (ArrayList) listOfNotes);
+// mapsActivity.putExtra("user_lat", gpsUtils.getLatitude());
+// mapsActivity.putExtra("user_lng", gpsUtils.getLongitude());
+//// Log.d(TAG, "IN After!!!!!!!!!!!!!!");
+////
+// startActivity(mapsActivity);
+// Log.d(TAG, "FINIsh!!!");
+//
+// }
+// });
+//
+// // click on listView item
+// noteList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+// @Override
+// public void onItemClick(AdapterView> parent, View view, final int position, long id) {
+// //create and configure dialog
+// final Note note = listOfNotes.get(position);
+// final Dialog noteViewDialog = new Dialog(PersonalSpaceActivity.this);
+// noteViewDialog.setContentView(R.layout.note_display_full);
+// noteViewDialog.setTitle("You wrote...");
+//
+// WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
+// lp.copyFrom(noteViewDialog.getWindow().getAttributes());
+// lp.width = WindowManager.LayoutParams.MATCH_PARENT;
+// lp.height = WindowManager.LayoutParams.MATCH_PARENT;
+// noteViewDialog.show();
+//// dialog.getWindow().setAttributes(lp);
+//
+//
+// //get note_view_full layout elements
+// final TextView title = (TextView) noteViewDialog.findViewById(R.id.ndf_title_textview);
+// final TextView body = (TextView) noteViewDialog.findViewById(R.id.ndf_body_textview);
+// final TextView time = (TextView) noteViewDialog.findViewById(R.id.ndf_time_textview);
+// final TextView location = (TextView) noteViewDialog.findViewById(R.id.ndf_address_textview);
+// final TextView likes = (TextView) noteViewDialog.findViewById(R.id.ndf_likes_textview);
+// final TextView tags = (TextView) noteViewDialog.findViewById(R.id.ndf_tags_textview);
+// final TextView permission = (TextView) noteViewDialog.findViewById(R.id.ndf_permission_textview);
+// final ImageButton deleteBtn = (ImageButton) noteViewDialog.findViewById(R.id.ndf_delete_imagebutton);
+//
+//
+// title.setText(note.getTitle());
+// body.setText(note.getBody());
+// time.setText(note.getTimestamp());
+// location.setText("Tags: " + note.getAddress());
+// likes.setText("Likes: " + note.getLikes());
+// tags.setText(note.getTags().toString());
+// permission.setText("Permission: " + (note.isPublic() ? "Public" : "Private"));
+//
+// deleteBtn.setOnClickListener(new View.OnClickListener() {
+// public void onClick(View v) {
+// //Put up the Yes/No message box
+// AlertDialog.Builder builder = new AlertDialog.Builder(PersonalSpaceActivity.this);
+// builder
+// .setTitle("Delete Note")
+// .setMessage("Are you sure you want to delete the note?")
+// .setIcon(android.R.drawable.ic_dialog_alert)
+// .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
+// public void onClick(DialogInterface dialog, int which) {
+// //Yes button clicked, do something
+// Toast.makeText(PersonalSpaceActivity.this, "Item Deleted!",
+// Toast.LENGTH_SHORT).show();
+// //TODO send delete
+// JSONObject delNote = new JSONObject();
+// try {
+// delNote.put("uid", userId);
+// delNote.put("nid", note.getId());
+// VolleyUtilSingleton.getInstance(PersonalSpaceActivity.this).post(BASE_URL + "/note/delete", delNote, deleteNoteSuccessListener, genericErrorListener);
+// listOfNotes.remove(position);
+//
+// } catch (JSONException e) {
+// Toast.makeText(PersonalSpaceActivity.this, "Something went wrong.\n Failed to delete note...", Toast.LENGTH_LONG).show();
+// e.printStackTrace();
+// }
+// noteList.setAdapter(noteListAdapter);
+//// dialog.dismiss();
+// noteViewDialog.dismiss();
+// }
+// })
+// .setNegativeButton("No", new DialogInterface.OnClickListener() {
+// public void onClick(DialogInterface dialog, int which) {
+// //Yes button clicked, do something
+// Toast.makeText(PersonalSpaceActivity.this, "Note still here!",
+// Toast.LENGTH_SHORT).show();
+//// dialog.dismiss();
+// noteViewDialog.dismiss();
+// }
+// }) //Do nothing on no
+// .show();
+// }
+// });
+//
+// }
+// });
+//
+//
+// }
+//
+//
+// public void getAllNotes() {
+// Log.d(TAG, "url: " + BASE_URL + "/note/all?uid=" + userId);
+// VolleyUtilSingleton.getInstance(PersonalSpaceActivity.this).get(BASE_URL + "/note/all?uid=" + userId, getNotesSuccessListener, genericErrorListener);
+// }
+//
+// private View.OnClickListener addNewNoteDialog = new View.OnClickListener() {
+// public void onClick(View v) {
+//
+// //create and configure dialog
+// final Dialog dialog = new Dialog(PersonalSpaceActivity.this);
+// dialog.setContentView(R.layout.note_view_full);
+// dialog.setTitle("New Note");
+// WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
+// lp.copyFrom(dialog.getWindow().getAttributes());
+// lp.width = WindowManager.LayoutParams.MATCH_PARENT;
+// lp.height = WindowManager.LayoutParams.MATCH_PARENT;
+// dialog.setCancelable(false);
+// dialog.show();
+// dialog.getWindow().setAttributes(lp);
+//
+//
+// //get note_view_full layout elements
+// final Switch permissionSwitch = (Switch) dialog.findViewById(R.id.nvf_note_permission);
+// final EditText newTitle = (EditText) dialog.findViewById(R.id.nvf_note_title);
+// final EditText newBody = (EditText) dialog.findViewById(R.id.nvf_note_content);
+// Button saveBtn = (Button) dialog.findViewById(R.id.nvf_note_submit_btn);
+// Button cancelBtn = (Button) dialog.findViewById(R.id.nvf_note_cancel_btn);
+//
+// cancelBtn.setOnClickListener(new View.OnClickListener() {
+// public void onClick(View v) {
+// dialog.dismiss();
+// }
+// });
+//
+// saveBtn.setOnClickListener(new View.OnClickListener() {
+// public void onClick(View v) {
+//
+// //title too short
+// if (newTitle.getText().length() == 0) {
+// Toast.makeText(PersonalSpaceActivity.this, "Title too short.", Toast.LENGTH_LONG).show();
+// return;
+// }
+//
+// //title too long
+// if (newTitle.getText().length() > 20) {
+// Toast.makeText(PersonalSpaceActivity.this, "Title too long.\n Use up to 20 notes.", Toast.LENGTH_LONG).show();
+// return;
+// }
+// //volley post
+// final JSONObject noteJson = new JSONObject();
+// try {
+//
+// //TODO need to get owner id from login screen
+// noteJson.put("owner_id", userId);
+// noteJson.put("title", newTitle.getText());
+// noteJson.put("lat", gpsUtils.getLatitude());
+// noteJson.put("lng", gpsUtils.getLongitude());
+// noteJson.put("address", gpsUtils.getAddress());
+// noteJson.put("body", newBody.getText());
+// noteJson.put("is_public", permissionSwitch.isChecked());
+//// noteJson.put("tags",);
+// Log.d(TAG, "Json: " + noteJson.toString());
+//
+//
+// } catch (Exception e) {
+// Log.d(TAG, "saveBtn: " + e.toString());
+// }
+//
+// //send request and close dialog
+// VolleyUtilSingleton.getInstance(PersonalSpaceActivity.this).post(BASE_URL + "/note/upsert", noteJson, newNoteSuccessListener, genericErrorListener);
+// dialog.dismiss();
+// }
+// });
+//
+// //change text of switch according to state.
+// permissionSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+// if (isChecked)
+// permissionSwitch.setText(R.string.nvf_public_label);
+// else
+// permissionSwitch.setText(R.string.nvf_private_label);
+// }
+// });
+//
+//
+// }
+// };
+//
+//
+// public void setLocationPermission(boolean locationPermission) {
+// this.locationPermission = locationPermission;
+// }
+//
+//
+// //response listener for adding new note
+// Response.Listener newNoteSuccessListener = new Response.Listener() {
+// @Override
+// public void onResponse(JSONObject response) {
+// Log.d(TAG, "newNoteSuccess: response - " + response.toString());
+// try {
+// Date time = new Date();
+// JSONObject noteObject = response.getJSONObject("note");
+// time.setTime(noteObject.getLong("created_at"));
+// addNoteFromJsonObj(noteObject, time);
+//
+//// Note addNote = 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"))
+//// );
+////
+//// listOfNotes.add(addNote);
+// noteList.setAdapter(noteListAdapter);
+// } catch (Exception e) {
+// Log.e(TAG, "newNoteSuccess:" + e.getMessage());
+// }
+//
+// }
+// };
+//
+//
+// //response Error listener for adding new note
+// Response.ErrorListener newNoteErrorListener = new Response.ErrorListener() {
+// @Override
+// public void onErrorResponse(VolleyError error) {
+// Log.d(TAG, "newNoteError: msg: " + error.getMessage());
+// }
+// };
+//
+//
+// //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());
+// 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"));
+//
+// addNoteFromJsonObj(noteObject, time);
+// }
+// noteList.setAdapter(noteListAdapter);
+// } catch (Exception e) {
+// Log.e(TAG, "newNoteSuccess:" + e.getMessage());
+// }
+// }
+// };
+//
+// //response listener for getting all user notes
+// Response.Listener deleteNoteSuccessListener = new Response.Listener() {
+// @Override
+// public void onResponse(JSONObject response) {
+// Log.d(TAG, "deleteNoteSuccessListener: " + response.toString());
+//
+//
+// }
+// };
+//
+// //response ErrorListener for getting all user notes
+// Response.ErrorListener getNotesErrorListener = new Response.ErrorListener() {
+// @Override
+// public void onErrorResponse(VolleyError error) {
+// Log.d(TAG, "getNotesErrorListener: " + error.getMessage());
+// }
+// };
+//
+// //Generic response ErrorListener
+// Response.ErrorListener genericErrorListener = new Response.ErrorListener() {
+// @Override
+// public void onErrorResponse(VolleyError error) {
+// Log.d(TAG, "genericErrorListener");
+// error.printStackTrace();
+// }
+// };
+//
+//
+// public void requestPermissions() {
+// // Here, thisActivity is the current activity
+// if (ContextCompat.checkSelfPermission(PersonalSpaceActivity.this,
+// Manifest.permission.ACCESS_FINE_LOCATION)
+// != PackageManager.PERMISSION_GRANTED) {
+//
+//
+// ActivityCompat.requestPermissions(PersonalSpaceActivity.this,
+// new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
+// FINE_PERM);
+//
+// // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
+// // app-defined int constant. The callback method gets the
+// // result of the request.
+//
+// }
+//
+// if (ContextCompat.checkSelfPermission(PersonalSpaceActivity.this,
+// Manifest.permission.ACCESS_FINE_LOCATION)
+// != PackageManager.PERMISSION_GRANTED) {
+//
+//
+// ActivityCompat.requestPermissions(PersonalSpaceActivity.this,
+// new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
+// 1);
+//
+// // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
+// // app-defined int constant. The callback method gets the
+// // result of the request.
+//
+// }
+//
+// if (ContextCompat.checkSelfPermission(PersonalSpaceActivity.this,
+// Manifest.permission.ACCESS_COARSE_LOCATION)
+// != PackageManager.PERMISSION_GRANTED) {
+//
+//
+// ActivityCompat.requestPermissions(PersonalSpaceActivity.this,
+// new String[]{Manifest.permission.ACCESS_COARSE_LOCATION},
+// FINE_PERM);
+//
+// // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an
+// // app-defined int constant. The callback method gets the
+// // result of the request.
+//
+// }
+//
+// }
+//
+//
+// private 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;
+// }
+//
+// private void addNoteFromJsonObj(JSONObject noteObject, Date time) throws JSONException {
+// Note addNote = 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"))
+// );
+// listOfNotes.add(addNote);
+//
+// }
+//
+//// public void goToMap(View v){
+//// Log.d(TAG,"IN TESTS!!!!!!!!!!!!!!");
+////
+//// Toast.makeText(this,"SUCCESS",Toast.LENGTH_LONG).show();
+//// Intent mapsActivity = new Intent(PersonalSpaceActivity.this, MapsActivity.class);
+//// Bundle loginUserBundle = new Bundle();
+//// mapsActivity.putParcelableArrayListExtra("note_list", (ArrayList) listOfNotes);
+//// mapsActivity.putExtra("user_lat",gpsUtils.getLatitude());
+//// mapsActivity.putExtra("user_lng",gpsUtils.getLongitude());
+//// startActivity(mapsActivity);
+////
+//// }
+//}
diff --git a/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/RegisterActivity.java b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/RegisterActivity.java
new file mode 100644
index 0000000..25dce8e
--- /dev/null
+++ b/app/src/main/java/com/android_app/matan/ara/sagi/thesocialnotework/RegisterActivity.java
@@ -0,0 +1,173 @@
+package com.android_app.matan.ara.sagi.thesocialnotework;
+
+import android.content.Intent;
+import android.support.v7.app.AppCompatActivity;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+import android.widget.Toast;
+
+import com.android.volley.Response;
+import com.android.volley.VolleyError;
+
+import org.json.JSONObject;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class RegisterActivity extends AppCompatActivity implements View.OnClickListener{
+
+ private EditText mUsernameView;
+ private EditText mPasswordView;
+ private EditText mEmailView;
+ private Button registerButton;
+ private Button testBtn;
+ private RegisterActivity self;
+
+ protected RelativeLayout layout;
+ private final String TAG = "Register Activity";
+
+ private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
+ private final String REG_PATH = "/register";
+
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_register);
+
+ mUsernameView = (EditText) findViewById(R.id.ra_username);
+ mPasswordView = (EditText) findViewById(R.id.ra_password);
+ mEmailView = (EditText) findViewById(R.id.ra_email);
+
+ this.self = this;
+ this.layout = (RelativeLayout) findViewById(R.id.ra_layout);
+
+ // Remove Auto Focus from the Text Fields
+ layout.setFocusable(true);
+ layout.setFocusableInTouchMode(true);
+
+ testBtn = (Button) findViewById(R.id.btn_cancel);
+ testBtn.setOnClickListener(this);
+
+ registerButton = (Button) findViewById(R.id.ra_register_button);
+ registerButton.setOnClickListener(this);
+
+ }
+
+ private boolean isUsernameValid(String username) {
+ return !TextUtils.isEmpty(username) && username.length() > 0;
+ }
+ private boolean isPasswordValid(String password) {
+ return !TextUtils.isEmpty(password) && password.length() > 3;
+ }
+ private boolean isEmailValid(String email) {
+ if(TextUtils.isEmpty(email))
+ return false;
+// boolean isValid = false;
+
+ String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
+ CharSequence inputStr = email;
+
+ Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
+ Matcher matcher = pattern.matcher(inputStr);
+// if (matcher.matches()) {
+// isValid = true;
+// }
+// Log.d(TAG, "isValid: " + isValid);
+ return matcher.matches();
+ }
+
+ private boolean isParamsValid(String username, String password, String email) {
+ return (isUsernameValid(username) && isPasswordValid(password) && isEmailValid(email));
+ }
+
+ private void attemptRegister() {
+// showProgress(true);
+ Log.d(TAG, "in attemptRegister: Registering..");
+ if (isParamsValid(mUsernameView.getText().toString(), mPasswordView.getText().toString(), mEmailView.getText().toString())) {
+
+ Log.d(TAG, "params are valid");
+
+ String username = mUsernameView.getText().toString();
+ String password = mPasswordView.getText().toString();
+ String email = mEmailView.getText().toString();
+
+ boolean cancel = false;
+ View focusView = null;
+
+ // http request register
+ JSONObject tempJson = new JSONObject();
+ try {
+ tempJson.put("username", username);
+ tempJson.put("password", password);
+ tempJson.put("email", email);
+ } catch (Exception e) {
+ Log.d(TAG, e.toString());
+ }
+ Log.d(TAG,"JSON: "+tempJson.toString());
+
+ VolleyUtilSingleton.getInstance(RegisterActivity.this).post(BASE_URL + REG_PATH, tempJson, onRegisterSuccess, onRegisterError);
+ } else {
+// showProgress(false);
+ Log.d(TAG, "Invalid params - make sure username exist, password is 4 characters or more & email is valid");
+ Toast.makeText(this, "Make Sure tou have entered a valid email. password at least 4 chars", Toast.LENGTH_LONG).show();
+ }
+ }
+
+ Response.Listener onRegisterSuccess = new Response.Listener() {
+ @Override
+ public void onResponse(JSONObject response) {
+ Log.d(TAG,"reposne: "+ response.toString());
+ try {
+ if(response.getString("message").equals("created")) {
+
+ Log.d(TAG, "onRegisterSuccess => user created"); // TODO: REMOVE console
+ Intent loginActivity = new Intent(RegisterActivity.this, LoginActivity.class);
+
+ Toast.makeText(self, "You are now a social notework member - You May Login...", Toast.LENGTH_LONG).show();
+ startActivity(loginActivity);
+ } else {
+// showProgress(false);
+ Toast.makeText(self , "Username is already taken. maybe: " + mUsernameView.getText().toString()+"_666 ? :)", Toast.LENGTH_LONG).show();
+ Log.d(TAG, "Cannot create user, " + response.getString("message"));
+ }
+ }catch (Exception e) {
+ Log.e(TAG, "onRegisterSuccess:" + e.getMessage());
+
+ }
+ }
+ };
+
+ Response.ErrorListener onRegisterError = new Response.ErrorListener() {
+ @Override
+ public void onErrorResponse(VolleyError error) {
+// showProgress(false);
+ Toast.makeText(self , "Username is already taken. maybe: " + mUsernameView.getText().toString()+"_666 ? :)", Toast.LENGTH_LONG).show();
+ Log.d(TAG, "onRegisterError: msg: " + error.getMessage());
+ }
+ };
+
+ @Override
+ public void onClick(View view) {
+ switch(view.getId()){
+ case R.id.ra_register_button:
+ attemptRegister();
+ break;
+ case R.id.btn_cancel:
+
+ returnToLogin();
+ break;
+ }
+ }
+
+ private void returnToLogin(){
+ Intent i = new Intent(RegisterActivity.this, LoginActivity.class);
+ startActivity(i);
+ finish();
+ }
+}
diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
index 8d100f9..e39f215 100644
--- a/app/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -40,11 +40,11 @@
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
-
+
@@ -72,7 +72,7 @@
android:background="@color/colorPrimary"
android:textColor="#ffffff" />
-
diff --git a/app/src/main/res/layout/activity_personal_space.xml b/app/src/main/res/layout/activity_personal_space.xml
index 27d50fc..21995a8 100644
--- a/app/src/main/res/layout/activity_personal_space.xml
+++ b/app/src/main/res/layout/activity_personal_space.xml
@@ -26,16 +26,16 @@
+ android:onClick="goToMap"
+ android:id="@+id/ps_maps_btn"
+ android:background="@android:drawable/ic_menu_mapmode" />
+ android:layout_weight="0.2"
+ android:background="@android:drawable/ic_input_add" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/note_display_full.xml b/app/src/main/res/layout/note_display_full.xml
index 6ffde10..fc71e57 100644
--- a/app/src/main/res/layout/note_display_full.xml
+++ b/app/src/main/res/layout/note_display_full.xml
@@ -1,49 +1,67 @@
-
+ android:layout_height="match_parent">
-
-
+
-
+
-
+
-
+
-
+
-
+
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/note_view_full.xml b/app/src/main/res/layout/note_view_full.xml
index 000ac38..74768e8 100644
--- a/app/src/main/res/layout/note_view_full.xml
+++ b/app/src/main/res/layout/note_view_full.xml
@@ -62,7 +62,7 @@
android:layout_margin="15dp"
android:drawableLeft="@android:drawable/ic_menu_send"
android:background="@color/colorPrimary"
- android:textColor="@color/abc_background_cache_hint_selector_material_light"
+ android:textColor="#ffffff"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 26fe7f8..99ef513 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -7,6 +7,8 @@
Password
Login
Register
+ Register
+ No account yet? Create one for FREE
Sign in
This email address is invalid
This password is too short
@@ -21,8 +23,10 @@
Logo
Title
Content
- Throw Me
- Note Me
+ Discard
+ Save
+ Username
+ Password
MainActivity
Open navigation drawer
diff --git a/app/src/release/res/values/google_maps_api.xml b/app/src/release/res/values/google_maps_api.xml
new file mode 100644
index 0000000..fa88c61
--- /dev/null
+++ b/app/src/release/res/values/google_maps_api.xml
@@ -0,0 +1,22 @@
+
+
+
+ YOUR_KEY_HERE
+
+