# Conflicts:
#	.idea/libraries/animated_vector_drawable_23_3_0.xml
#	.idea/libraries/appcompat_v7_23_3_0.xml
#	.idea/libraries/design_23_3_0.xml
#	.idea/libraries/recyclerview_v7_23_3_0.xml
#	.idea/libraries/support_annotations_23_4_0.xml
#	.idea/libraries/support_v4_23_3_0.xml
#	.idea/libraries/support_vector_drawable_23_3_0.xml
#	app/src/main/AndroidManifest.xml
#	app/src/main/res/values/strings.xml
This commit is contained in:
Aran Zaiger 2016-07-06 20:30:57 +03:00
parent 219368175f
commit 2ca5d59ee2
14 changed files with 127 additions and 197 deletions

View file

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="animated-vector-drawable-23.3.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.3.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.3.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Android/Sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/23.3.0/animated-vector-drawable-23.3.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/animated-vector-drawable/23.3.0/animated-vector-drawable-23.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,16 +0,0 @@
<component name="libraryTable">
<library name="appcompat-v7-23.3.0">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.3.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.3.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.3.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.3.0/appcompat-v7-23.3.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.3.0/appcompat-v7-23.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,16 +0,0 @@
<component name="libraryTable">
<library name="design-23.3.0">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.3.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.3.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.3.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Android/Sdk/extras/android/m2repository/com/android/support/design/23.3.0/design-23.3.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/design/23.3.0/design-23.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,16 +0,0 @@
<component name="libraryTable">
<library name="recyclerview-v7-23.3.0">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.3.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.3.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.3.0/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Android/Sdk/extras/android/m2repository/com/android/support/recyclerview-v7/23.3.0/recyclerview-v7-23.3.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/recyclerview-v7/23.3.0/recyclerview-v7-23.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,12 +0,0 @@
<component name="libraryTable">
<library name="support-annotations-23.3.0">
<CLASSES>
<root url="jar://$USER_HOME$/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/23.3.0/support-annotations-23.3.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Android/Sdk/extras/android/m2repository/com/android/support/support-annotations/23.3.0/support-annotations-23.3.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-annotations/23.3.0/support-annotations-23.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,17 +0,0 @@
<component name="libraryTable">
<library name="support-v4-23.3.0">
<ANNOTATIONS>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.3.0/annotations.zip!/" />
</ANNOTATIONS>
<CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.3.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.3.0/jars/classes.jar!/" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.3.0/jars/libs/internal_impl-23.3.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Android/Sdk/extras/android/m2repository/com/android/support/support-v4/23.3.0/support-v4-23.3.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-v4/23.3.0/support-v4-23.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="support-vector-drawable-23.3.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.3.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/23.3.0/res" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/Android/Sdk/extras/android/m2repository/com/android/support/support-vector-drawable/23.3.0/support-vector-drawable-23.3.0-sources.jar!/" />
<root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-vector-drawable/23.3.0/support-vector-drawable-23.3.0-sources.jar!/" />
</SOURCES>
</library>
</component>

View file

@ -22,8 +22,9 @@ android {
dependencies { dependencies {
compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12' testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0' compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.3.0' compile 'com.android.support:design:23.4.0'
compile 'com.android.volley:volley:1.0.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'
} }

View file

@ -2,7 +2,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android_app.matan.ara.sagi.thesocialnotework"> package="com.android_app.matan.ara.sagi.thesocialnotework">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
@ -21,23 +20,39 @@
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name=".SplashActivity" android:name=".SplashActivity"
android:theme="@style/AppTheme.NoActionBar" android:noHistory="true"
android:noHistory="true"> android:theme="@style/AppTheme.NoActionBar">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".LoginActivity" <activity
android:name=".LoginActivity"
android:noHistory="true" /> android:noHistory="true" />
<activity android:name=".PersonalSpaceActivity" />
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="@string/title_activity_main" android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBar"></activity> android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".RegisterActivity" <activity
android:noHistory="true"></activity> android:name=".RegisterActivity"
android:noHistory="true" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps"></activity>
</application> </application>
</manifest> </manifest>

View file

@ -17,14 +17,29 @@ import android.support.v7.widget.Toolbar;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; 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 public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener { implements NavigationView.OnNavigationItemSelectedListener {
protected final String TAG = "[TSN / MainActivity]"; protected static final String TAG = "[TSN / MainActivity]";
protected String userId; protected String userId;
private GPSUtils gpsUtils; private GPSUtils gpsUtils;
private boolean locationPermission; private boolean locationPermission;
public static ProgressDialog progress; public static ProgressDialog progress;
private GmapFragment gmapFragment;
private PersonalFragment personalFragment;
public static final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -32,6 +47,8 @@ public class MainActivity extends AppCompatActivity
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
gmapFragment = new GmapFragment();
personalFragment = new PersonalFragment();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() { fab.setOnClickListener(new View.OnClickListener() {
@ -58,7 +75,7 @@ public class MainActivity extends AppCompatActivity
//Change Layout //Change Layout
Log.d(TAG, "Changing Fragment to Personal Activity"); Log.d(TAG, "Changing Fragment to Personal Activity");
PersonalFragment personalFragment = new PersonalFragment(); // PersonalFragment personalFragment = new PersonalFragment();
personalFragment.setArguments(b); personalFragment.setArguments(b);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, personalFragment); ft.replace(R.id.fragment_container, personalFragment);
@ -104,15 +121,26 @@ public class MainActivity extends AppCompatActivity
@SuppressWarnings("StatementWithEmptyBody") @SuppressWarnings("StatementWithEmptyBody")
@Override @Override
public boolean onNavigationItemSelected(MenuItem item) { public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here. FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
Bundle b = new Bundle();
int id = item.getItemId(); int id = item.getItemId();
if (id == R.id.nav_explore) { if (id == R.id.nav_explore) {
// Handle the camera action // Handle the camera action
} else if (id == R.id.nav_map) { } else if (id == R.id.nav_map) {
//
Log.d(TAG,"Before going to map");
// gmapFragment.("note_list", (ArrayList<Note>) 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) { } 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_settings) {
} else if (id == R.id.nav_logout) { } else if (id == R.id.nav_logout) {
@ -122,7 +150,9 @@ public class MainActivity extends AppCompatActivity
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START); drawer.closeDrawer(GravityCompat.START);
return true; return true;
}public GPSUtils getGPSUtils() { }
public GPSUtils getGPSUtils() {
return this.gpsUtils; return this.gpsUtils;
} }
@ -149,6 +179,48 @@ public class MainActivity extends AppCompatActivity
} }
} }
// //Generic response ErrorListener
Response.ErrorListener genericErrorListener = new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d(TAG, "genericErrorListener");
error.printStackTrace();
}
};
public Note getNoteFromJsonObj(JSONObject noteObject, Date time) throws JSONException {
// List<Note> 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<String> jsonArrayToStringArray(JSONArray jArray) {
ArrayList<String> stringArray = new ArrayList<String>();
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;}
} }

View file

@ -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<Note> 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));
// }
//}

View file

@ -1,9 +0,0 @@
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.android_app.matan.ara.sagi.thesocialnotework.MapsActivity"
tools:layout="@layout/activity_maps" />

View file

@ -0,0 +1,21 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.android_app.matan.ara.sagi.thesocialnotework.GmapFragment">
<!-- TODO: Update blank fragment layout -->
<fragment
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mapFragment"
class="com.google.android.gms.maps.SupportMapFragment">
</fragment>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>

View file

@ -37,5 +37,6 @@
<!-- TODO: Remove or change this placeholder text --> <!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string> <string name="hello_blank_fragment">Hello blank fragment</string>
<string name="login_err_message_invalid">Password should be at least 4 chars long</string> <string name="login_err_message_invalid">Password should be at least 4 chars long</string>
<string name="title_activity_maps">Map</string>
</resources> </resources>