Merge remote-tracking branch 'origin/master'

# 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_3_0.xml
#	.idea/libraries/support_v4_23_3_0.xml
#	.idea/libraries/support_vector_drawable_23_3_0.xml
#	app/src/main/res/values/strings.xml
This commit is contained in:
Matan Bar Yosef 2016-07-03 16:07:27 +03:00
commit aef9568ba6
18 changed files with 330 additions and 200 deletions

View file

@ -5,7 +5,7 @@
<GradleProjectSettings> <GradleProjectSettings>
<option name="distributionType" value="LOCAL" /> <option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.10" /> <option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.10" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View file

@ -1,13 +1,11 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="animated-vector-drawable-23.3.0"> <library name="animated-vector-drawable-23.3.0">
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.3.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/23.3.0/jars/classes.jar!/" /> <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> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$USER_HOME$/Library/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://$USER_HOME$/AppData/Local/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!/" /> <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> </SOURCES>
</library> </library>

View file

@ -4,13 +4,11 @@
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.3.0/annotations.zip!/" /> <root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.3.0/annotations.zip!/" />
</ANNOTATIONS> </ANNOTATIONS>
<CLASSES> <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!/" /> <root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.3.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.3.0/res" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/23.3.0/appcompat-v7-23.3.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/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!/" /> <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> </SOURCES>
</library> </library>

View file

@ -4,13 +4,11 @@
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.3.0/annotations.zip!/" /> <root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.3.0/annotations.zip!/" />
</ANNOTATIONS> </ANNOTATIONS>
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.3.0/res" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/design/23.3.0/jars/classes.jar!/" /> <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> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/design/23.3.0/design-23.3.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/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!/" /> <root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/design/23.3.0/design-23.3.0-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>

View file

@ -4,13 +4,11 @@
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.3.0/annotations.zip!/" /> <root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.3.0/annotations.zip!/" />
</ANNOTATIONS> </ANNOTATIONS>
<CLASSES> <CLASSES>
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.3.0/jars/classes.jar!/" />
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/recyclerview-v7/23.3.0/res" /> <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> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/recyclerview-v7/23.3.0/recyclerview-v7-23.3.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/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!/" /> <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> </SOURCES>
</library> </library>

View file

@ -1,12 +1,10 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="support-annotations-23.3.0"> <library name="support-annotations-23.3.0">
<CLASSES> <CLASSES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.3.0/support-annotations-23.3.0.jar!/" /> <root url="jar:///opt/android-sdk/extras/android/m2repository/com/android/support/support-annotations/23.3.0/support-annotations-23.3.0.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-annotations/23.3.0/support-annotations-23.3.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/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!/" /> <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> </SOURCES>
</library> </library>

View file

@ -5,13 +5,11 @@
</ANNOTATIONS> </ANNOTATIONS>
<CLASSES> <CLASSES>
<root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.3.0/res" /> <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!/" /> <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!/" />
<root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.3.0/jars/classes.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.3.0/support-v4-23.3.0-sources.jar!/" />
<root url="jar://$USER_HOME$/AppData/Local/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!/" /> <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> </SOURCES>
</library> </library>

View file

@ -6,8 +6,6 @@
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES> <SOURCES>
<root url="jar://$USER_HOME$/Library/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://$USER_HOME$/AppData/Local/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!/" /> <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> </SOURCES>
</library> </library>

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View file

@ -59,12 +59,18 @@ public class ListAdapter extends BaseAdapter {
TextView title = (TextView) v.findViewById(R.id.nvm_title_textview); TextView title = (TextView) v.findViewById(R.id.nvm_title_textview);
TextView datetime = (TextView) v.findViewById(R.id.nvm_time_textview); TextView datetime = (TextView) v.findViewById(R.id.nvm_time_textview);
TextView location = (TextView) v.findViewById(R.id.nvm_location_textview); TextView location = (TextView) v.findViewById(R.id.nvm_location_textview);
TextView likes = (TextView) v.findViewById(R.id.nvm_likes_textview);
TextView permission = (TextView) v.findViewById(R.id.nvm_permission_textview);
// NetworkImageView thumbNail = (NetworkImageView) v.findViewById(R.id.infoImageImageView); // NetworkImageView thumbNail = (NetworkImageView) v.findViewById(R.id.infoImageImageView);
// String url = mVideos.get(position).getImgURL(); // String url = mVideos.get(position).getImgURL();
// thumbNail.setImageUrl(url, VolleyUtilSingleTone.getInstance(mContext).getImageLoader()); // thumbNail.setImageUrl(url, VolleyUtilSingleTone.getInstance(mContext).getImageLoader());
title.setText(mNotes.get(position).getTitle()); Note curNote = mNotes.get(position);
datetime.setText(Html.fromHtml(mNotes.get(position).getTimestamp())); title.setText(curNote.getTitle());
location.setText(mNotes.get(position).getAddress()); datetime.setText(Html.fromHtml(curNote.getTimestamp()));
location.setText(curNote.getAddress());
likes.setText(""+curNote.getLikes());
permission.setText(curNote.isPublic() ? "Public":"Private");
// Animation animation = AnimationUtils.loadAnimation(mContext, (position > lastPosition) ? R.anim.up_from_bottom : R.anim.down_from_top); // Animation animation = AnimationUtils.loadAnimation(mContext, (position > lastPosition) ? R.anim.up_from_bottom : R.anim.down_from_top);
// v.startAnimation(animation); // v.startAnimation(animation);
lastPosition = position; lastPosition = position;

View file

@ -24,12 +24,16 @@ import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView; import android.widget.AutoCompleteTextView;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.Response; import com.android.volley.Response;
import com.android.volley.VolleyError; import com.android.volley.VolleyError;
@ -75,20 +79,17 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api"; private final String BASE_URL = "http://thesocialnotework-api.appspot.com/api";
private final String LOGIN_PATH = "/login"; private final String LOGIN_PATH = "/login";
private final String REG_PATH = "/register";
private LoginActivity self;
protected LinearLayout layout;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_login); setContentView(R.layout.activity_login);
this.self = this;
// Set up the login form. this.layout = (LinearLayout) findViewById(R.id.layout);
// mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
// populateAutoComplete();
// mUsernameView = (AutoCompleteTextView) findViewById(R.id.username);
// populateAutoComplete();
mUsernameView = (EditText) findViewById(R.id.al_username); mUsernameView = (EditText) findViewById(R.id.al_username);
mPasswordView = (EditText) findViewById(R.id.al_password); mPasswordView = (EditText) findViewById(R.id.al_password);
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() { mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@ -101,14 +102,14 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
return false; return false;
} }
}); });
Button mRegisterButton = (Button) findViewById(R.id.al_register_button); // Button mRegisterButton = (Button) findViewById(R.id.al_register_button);
mRegisterButton.setOnClickListener(new OnClickListener() { // mRegisterButton.setOnClickListener(new OnClickListener() {
@Override // @Override
public void onClick(View view) { // public void onClick(View view) {
Log.d(TAG, "Register....... this section under construction"); // Log.d(TAG, "Register....... this section under construction");
//attemptRegister(); // TODO : implement // //attemptRegister(); // TODO : implement
} // }
}); // });
Button mEmailSignInButton = (Button) findViewById(R.id.al_login_button); Button mEmailSignInButton = (Button) findViewById(R.id.al_login_button);
mEmailSignInButton.setOnClickListener(new OnClickListener() { mEmailSignInButton.setOnClickListener(new OnClickListener() {
@ -121,6 +122,10 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
mLoginFormView = findViewById(R.id.login_form); mLoginFormView = findViewById(R.id.login_form);
mProgressView = findViewById(R.id.login_progress); mProgressView = findViewById(R.id.login_progress);
// Remove Auto Focus from the Text Fields
layout.setFocusable(true);
layout.setFocusableInTouchMode(true);
} }
private void populateAutoComplete() { private void populateAutoComplete() {
@ -188,25 +193,14 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
return; return;
} }
showProgress(true); showProgress(true);
// Reset errors.
// mEmailView.setError(null);
// mUsernameView.setError(null);
mPasswordView.setError(null); mPasswordView.setError(null);
// Store values at the time of the login attempt.
// String email = mEmailView.getText().toString();
if (isParamsValid(mUsernameView.getText().toString(), mPasswordView.getText().toString())) { if (isParamsValid(mUsernameView.getText().toString(), mPasswordView.getText().toString())) {
String username = mUsernameView.getText().toString(); String username = mUsernameView.getText().toString();
String password = mPasswordView.getText().toString(); String password = mPasswordView.getText().toString();
boolean cancel = false;
View focusView = null;
// mAuthTask = new UserLoginTask(username, password); // TODO: RETRIEVE ?
// mAuthTask.execute((Void) null); // TODO: RETRIEVE ?
// http request register // http request register
JSONObject tempJson = new JSONObject(); JSONObject tempJson = new JSONObject();
@ -218,37 +212,11 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
} }
VolleyUtilSingleton.getInstance(LoginActivity.this).post(BASE_URL + LOGIN_PATH, tempJson, onLoginSuccess, onLoginError); VolleyUtilSingleton.getInstance(LoginActivity.this).post(BASE_URL + LOGIN_PATH, tempJson, onLoginSuccess, onLoginError);
// Check for a valid password, if the user entered one.
// if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
// mPasswordView.setError(getString(R.string.error_invalid_password));
// focusView = mPasswordView;
// cancel = true;
// }
// if (cancel) {
// // There was an error; don't attempt login and focus the first
// // form field with an error.
// focusView.requestFocus();
// } else {
// // Show a progress spinner, and kick off a background task to
// // perform the user login attempt.
//
// }
} else { } else {
showProgress(false); showProgress(false);
Log.d(TAG, "Invalid params - make sure username exist & password is 4 characters or more"); Log.d(TAG, "Invalid params - make sure username exist & password is 4 characters or more");
} }
// Check for a valid username
// if (TextUtils.isEmpty(username)) {
// mUsernameView.setError(getString(R.string.error_field_required));
// focusView = mUsernameView;
// cancel = true;
// } else if (!isEmailValid(username)) {
// mUsernameView.setError(getString(R.string.error_invalid_email));
// focusView = mUsernameView;
// cancel = true;
// }
} }
Response.Listener<JSONObject> onLoginSuccess = new Response.Listener<JSONObject>() { Response.Listener<JSONObject> onLoginSuccess = new Response.Listener<JSONObject>() {
@ -277,6 +245,7 @@ public class LoginActivity extends AppCompatActivity{ // implements LoaderCallba
@Override @Override
public void onErrorResponse(VolleyError error) { public void onErrorResponse(VolleyError error) {
showProgress(false); showProgress(false);
Toast.makeText(self , "Username Or Password Incorrect", Toast.LENGTH_LONG).show();
Log.d(TAG, "onLoginError: msg: " + error.getMessage()); Log.d(TAG, "onLoginError: msg: " + error.getMessage());
} }
}; };

View file

@ -1,25 +1,32 @@
package com.android_app.matan.ara.sagi.thesocialnotework; package com.android_app.matan.ara.sagi.thesocialnotework;
import java.util.ArrayList;
/** /**
* Created by JERLocal on 7/1/2016. * Created by JERLocal on 7/1/2016.
*/ */
public class Note { public class Note {
// protected int id; protected int likes;
protected ArrayList<String> tags;
protected float lat, lon; protected float lat, lon;
protected String id, address, title, body; protected String id, address, title, body, timestamp;
protected String timestamp;
protected boolean isPublic; protected boolean isPublic;
public Note(String id, float lat, float lon, String address, String title, String body, String timestamp, boolean isPublic) {
public Note(String id, float lat, float lon, String address, String title, String body, String timestamp, boolean isPublic, int likes, ArrayList<String> tags) {
this.id = id; this.id = id;
this.lat = lat; this.lat = lat;
this.lon = lon; this.lon = lon;
this.address = address; this.address = address;
this.title = title; this.title = title;
this.body = body; this.body = body;
this.timestamp = timestamp; this.timestamp = timestamp;
this.isPublic = isPublic; this.isPublic = isPublic;
this.likes = likes;
this.tags = tags;
} }
@Override @Override
@ -103,6 +110,21 @@ public class Note {
public String getLocationAndTime() { public String getLocationAndTime() {
return getTimestamp()+" at "+ getAddress(); return getTimestamp()+" at "+ getAddress();
} }
public int getLikes() {
return likes;
}
public void setLikes(int likes) {
this.likes = likes;
}
public ArrayList<String> getTags() {
return tags;
}
public void setTags(ArrayList<String> tags) {
this.tags = tags;
}
// public void save(SQLiteOpenHelper dbHelper, Context context){ // public void save(SQLiteOpenHelper dbHelper, Context context){
// SQLiteDatabase db = dbHelper.getWritableDatabase(); // SQLiteDatabase db = dbHelper.getWritableDatabase();

View file

@ -15,6 +15,7 @@ import android.widget.CompoundButton;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ListView; import android.widget.ListView;
import android.widget.Switch; import android.widget.Switch;
import android.widget.Toast;
import com.android.volley.Request; import com.android.volley.Request;
import com.android.volley.Response; import com.android.volley.Response;
@ -29,6 +30,7 @@ import org.json.JSONObject;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -72,8 +74,8 @@ public class PersonalSpaceActivity extends AppCompatActivity {
listOfNotes = new ArrayList<>(); listOfNotes = new ArrayList<>();
//add demo notes to view //TODO - remove -add demo notes to view
addDemoNotes(listOfNotes); // addDemoNotes(listOfNotes);
noteListAdapter = new ListAdapter(this, listOfNotes); noteListAdapter = new ListAdapter(this, listOfNotes);
noteList.setAdapter(noteListAdapter); noteList.setAdapter(noteListAdapter);
@ -123,6 +125,22 @@ public class PersonalSpaceActivity extends AppCompatActivity {
saveBtn.setOnClickListener(new View.OnClickListener() { saveBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { 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 //volley post
final JSONObject noteJson = new JSONObject(); final JSONObject noteJson = new JSONObject();
try { try {
@ -165,17 +183,17 @@ public class PersonalSpaceActivity extends AppCompatActivity {
//TODO remove // //TODO remove
public void addDemoNotes(List<Note> listOfNotes) { // public void addDemoNotes(List<Note> listOfNotes) {
Note n1 = new Note("1", 100, 100, "location1", "My 1st Title", "ohh i'm so sexy1", ""+System.currentTimeMillis() / 1000, true); // 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 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 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); //// 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(n1);
listOfNotes.add(n2); // listOfNotes.add(n2);
listOfNotes.add(n3); // listOfNotes.add(n3);
// listOfNotes.add(n4); //// listOfNotes.add(n4);
} // }
public void setLocationPermission(boolean locationPermission) { public void setLocationPermission(boolean locationPermission) {
@ -192,19 +210,22 @@ public class PersonalSpaceActivity extends AppCompatActivity {
Date time = new Date(); Date time = new Date();
JSONObject noteObject = response.getJSONObject("note"); JSONObject noteObject = response.getJSONObject("note");
time.setTime(noteObject.getLong("created_at")); time.setTime(noteObject.getLong("created_at"));
addNoteFromJsonObj(noteObject, time);
Note addNote = new Note( // Note addNote = new Note(
noteObject.getString("id"), // noteObject.getString("id"),
Float.parseFloat(noteObject.getJSONObject("location").getString("lat")), // Float.parseFloat(noteObject.getJSONObject("location").getString("lat")),
Float.parseFloat(noteObject.getJSONObject("location").getString("lng")), // Float.parseFloat(noteObject.getJSONObject("location").getString("lng")),
noteObject.getJSONObject("location").getString("address"), // noteObject.getJSONObject("location").getString("address"),
noteObject.getString("title"), // noteObject.getString("title"),
noteObject.getString("body"), // noteObject.getString("body"),
time.toString(), // time.toString(),
noteObject.getBoolean("is_public") // noteObject.getBoolean("is_public"),
); // noteObject.getInt("likes"),
// jsonArrayToStringArray(noteObject.getJSONArray("tags"))
listOfNotes.add(addNote); // );
//
// listOfNotes.add(addNote);
noteList.setAdapter(noteListAdapter); noteList.setAdapter(noteListAdapter);
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "newNoteSuccess:" + e.getMessage()); Log.e(TAG, "newNoteSuccess:" + e.getMessage());
@ -236,17 +257,20 @@ public class PersonalSpaceActivity extends AppCompatActivity {
JSONObject noteObject = noteObjectsArray.getJSONObject(i); JSONObject noteObject = noteObjectsArray.getJSONObject(i);
time.setTime(noteObject.getLong("created_at")); time.setTime(noteObject.getLong("created_at"));
Note addNote = new Note( addNoteFromJsonObj(noteObject, time);
noteObject.getString("id"), // Note addNote = new Note(
Float.parseFloat(noteObject.getJSONObject("location").getString("lat")), // noteObject.getString("id"),
Float.parseFloat(noteObject.getJSONObject("location").getString("lng")), // Float.parseFloat(noteObject.getJSONObject("location").getString("lat")),
noteObject.getJSONObject("location").getString("address"), // Float.parseFloat(noteObject.getJSONObject("location").getString("lng")),
noteObject.getString("title"), // noteObject.getJSONObject("location").getString("address"),
noteObject.getString("body"), // noteObject.getString("title"),
time.toString(), // noteObject.getString("body"),
noteObject.getBoolean("is_public") // time.toString(),
); // noteObject.getBoolean("is_public"),
listOfNotes.add(addNote); // noteObject.getInt("likes"),
// jsonArrayToStringArray(noteObject.getJSONArray("tags"))
// );
// listOfNotes.add(addNote);
} }
noteList.setAdapter(noteListAdapter); noteList.setAdapter(noteListAdapter);
} catch (Exception e) { } catch (Exception e) {
@ -326,4 +350,35 @@ public class PersonalSpaceActivity extends AppCompatActivity {
private 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;
}
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);
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,14 +1,21 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <?xml version="1.0" encoding="utf-8"?>
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="fill_parent"
android:gravity="center_horizontal" android:layout_height="fill_parent"
android:fitsSystemWindows="true"
android:id="@+id/login_form">
<LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin" android:layout_width="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin" android:layout_height="wrap_content"
android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="56dp"
android:paddingTop="@dimen/activity_vertical_margin" android:paddingLeft="24dp"
tools:context="com.android_app.matan.ara.sagi.thesocialnotework.LoginActivity"> android:paddingRight="24dp"
android:id="@+id/layout">
<!-- Login progress --> <!-- Login progress -->
<ProgressBar <ProgressBar
@ -19,61 +26,56 @@
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:visibility="gone" /> android:visibility="gone" />
<ScrollView <ImageView android:src="@drawable/logo"
android:id="@+id/login_form" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="72dp"
android:layout_height="match_parent"> android:layout_marginBottom="24dp"
android:layout_gravity="center_horizontal"
android:contentDescription="@string/logo" />
<LinearLayout <!-- Email Label -->
android:id="@+id/email_login_form" <android.support.design.widget.TextInputLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<EditText <EditText android:id="@+id/al_username"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/al_username" android:inputType="textEmailAddress"
android:inputType="textPersonName" android:hint="Usename" />
android:hint="@string/prompt_username" /> </android.support.design.widget.TextInputLayout>
<EditText <!-- Password Label -->
android:id="@+id/al_password" <android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">
<EditText android:id="@+id/al_password"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/prompt_password"
android:imeActionId="@+id/login"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword" android:inputType="textPassword"
android:maxLines="1" android:imeActionId="@+id/login"
android:singleLine="true" /> android:hint="Password"/>
</android.support.design.widget.TextInputLayout>
<LinearLayout <android.support.v7.widget.AppCompatButton
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<Button
android:id="@+id/al_login_button" android:id="@+id/al_login_button"
style="?android:textAppearanceSmall" android:layout_width="fill_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="24dp"
android:text="@string/action_login" android:layout_marginBottom="24dp"
android:textStyle="bold" /> android:padding="12dp"
android:text="Login"/>
<Button <TextView android:id="@+id/link_signup"
style="?android:textAppearanceSmall" android:layout_width="fill_parent"
android:id="@+id/al_register_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginBottom="24dp"
android:text="@string/action_register" android:text="No account yet? Create one for FREE"
android:textStyle="bold" /> android:gravity="center"
</LinearLayout> android:textSize="16dip"/>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</LinearLayout>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/ndf_title_textview" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/ndf_body_textview" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/ndf_time_textview" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/ndf_address_textview" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/ndf_tags_textview" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/ndf_permission_textview" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/ndf_likes_textview" />
</LinearLayout>

View file

@ -1,8 +1,22 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView
android:layout_width="0dp"
android:layout_height="70dp"
android:id="@+id/nvm_permission_textview"
android:background="@android:drawable/ic_lock_lock"
android:layout_weight="0.2"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6">
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -23,5 +37,31 @@
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:text="location" android:text="location"
android:id="@+id/nvm_location_textview" /> android:id="@+id/nvm_location_textview" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tags #1"
android:id="@+id/nvm_tags1_textview" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tags #2"
android:id="@+id/nvm_tags2_textview" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Likes"
android:id="@+id/nvm_likes_textview" />
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -18,6 +18,7 @@
<string name="title_activity_personal_space">PersonalSpaceActivity</string> <string name="title_activity_personal_space">PersonalSpaceActivity</string>
<string name="nvf_private_label">Private</string> <string name="nvf_private_label">Private</string>
<string name="nvf_public_label">Public</string> <string name="nvf_public_label">Public</string>
<string name="logo">Logo</string>
<string name="nvf_title">Title</string> <string name="nvf_title">Title</string>
<string name="nvf_content">Content</string> <string name="nvf_content">Content</string>
<string name="throw_me">Throw Me</string> <string name="throw_me">Throw Me</string>