From c27d2aadf9ce73a80a4f573fc6fd3770d81e65f9 Mon Sep 17 00:00:00 2001 From: Aran Zaiger Date: Sun, 3 Jul 2016 16:41:11 +0300 Subject: [PATCH] UI improve in Display Note --- .idea/libraries/android_android_23.xml | 9 ++ .../animated_vector_drawable_23_3_0.xml | 1 + .idea/libraries/appcompat_v7_23_3_0.xml | 1 + .idea/libraries/design_23_3_0.xml | 1 + .idea/libraries/recyclerview_v7_23_3_0.xml | 3 +- .../libraries/support_annotations_23_3_0.xml | 3 +- .idea/libraries/support_v4_23_3_0.xml | 3 +- .../support_vector_drawable_23_3_0.xml | 1 + .idea/libraries/volley_1_0_0.xml | 2 +- .idea/misc.xml | 2 +- .../PersonalSpaceActivity.java | 60 +++++++++---- app/src/main/res/layout/note_display_full.xml | 89 +++++++++++-------- 12 files changed, 116 insertions(+), 59 deletions(-) create mode 100644 .idea/libraries/android_android_23.xml 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_3_0.xml b/.idea/libraries/animated_vector_drawable_23_3_0.xml index d5460f1..1272933 100644 --- a/.idea/libraries/animated_vector_drawable_23_3_0.xml +++ b/.idea/libraries/animated_vector_drawable_23_3_0.xml @@ -6,6 +6,7 @@ + diff --git a/.idea/libraries/appcompat_v7_23_3_0.xml b/.idea/libraries/appcompat_v7_23_3_0.xml index 0dbe7ef..da3b5a3 100644 --- a/.idea/libraries/appcompat_v7_23_3_0.xml +++ b/.idea/libraries/appcompat_v7_23_3_0.xml @@ -9,6 +9,7 @@ + diff --git a/.idea/libraries/design_23_3_0.xml b/.idea/libraries/design_23_3_0.xml index 441bb88..ffd6ab6 100644 --- a/.idea/libraries/design_23_3_0.xml +++ b/.idea/libraries/design_23_3_0.xml @@ -9,6 +9,7 @@ + diff --git a/.idea/libraries/recyclerview_v7_23_3_0.xml b/.idea/libraries/recyclerview_v7_23_3_0.xml index c4ab7de..e2d2128 100644 --- a/.idea/libraries/recyclerview_v7_23_3_0.xml +++ b/.idea/libraries/recyclerview_v7_23_3_0.xml @@ -4,11 +4,12 @@ - + + diff --git a/.idea/libraries/support_annotations_23_3_0.xml b/.idea/libraries/support_annotations_23_3_0.xml index e592bd6..a2f182e 100644 --- a/.idea/libraries/support_annotations_23_3_0.xml +++ b/.idea/libraries/support_annotations_23_3_0.xml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/libraries/support_v4_23_3_0.xml b/.idea/libraries/support_v4_23_3_0.xml index a2479db..e75eec2 100644 --- a/.idea/libraries/support_v4_23_3_0.xml +++ b/.idea/libraries/support_v4_23_3_0.xml @@ -5,11 +5,12 @@ - + + diff --git a/.idea/libraries/support_vector_drawable_23_3_0.xml b/.idea/libraries/support_vector_drawable_23_3_0.xml index 7f87d23..a47f58e 100644 --- a/.idea/libraries/support_vector_drawable_23_3_0.xml +++ b/.idea/libraries/support_vector_drawable_23_3_0.xml @@ -6,6 +6,7 @@ + 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/.idea/misc.xml b/.idea/misc.xml index 1a3eaff..5d19981 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -37,7 +37,7 @@ - + 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..b38cf5c 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 @@ -10,11 +10,13 @@ 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.ListView; import android.widget.Switch; +import android.widget.TextView; import android.widget.Toast; import com.android.volley.Request; @@ -79,16 +81,57 @@ public class PersonalSpaceActivity extends AppCompatActivity { noteListAdapter = new ListAdapter(this, listOfNotes); noteList.setAdapter(noteListAdapter); -// new HeavyWorker(this).execute(); - getAllNotes(); + new HeavyWorker(this).execute(); +// getAllNotes(); //https://thesocialnotework-api.appspot.com/api/note/all?uid= addBtn.setOnClickListener(addNewNoteDialog); + // click on listView item + noteList.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + //create and configure dialog + Note note = listOfNotes.get(position); + final Dialog dialog = new Dialog(PersonalSpaceActivity.this); + dialog.setContentView(R.layout.note_display_full); + dialog.setTitle("You wrote..."); + + WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); + lp.copyFrom(dialog.getWindow().getAttributes()); + lp.width = WindowManager.LayoutParams.MATCH_PARENT; + lp.height = WindowManager.LayoutParams.MATCH_PARENT; + dialog.show(); +// dialog.getWindow().setAttributes(lp); + + + //get note_view_full layout elements + final TextView title = (TextView) dialog.findViewById(R.id.ndf_title_textview); + final TextView body = (TextView) dialog.findViewById(R.id.ndf_body_textview); + final TextView time = (TextView) dialog.findViewById(R.id.ndf_time_textview); + final TextView location = (TextView) dialog.findViewById(R.id.ndf_address_textview); + final TextView likes = (TextView) dialog.findViewById(R.id.ndf_likes_textview); + final TextView tags = (TextView) dialog.findViewById(R.id.ndf_tags_textview); + final TextView permission = (TextView) dialog.findViewById(R.id.ndf_permission_textview); + + + 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")); + + } + + }); + } + 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); @@ -183,19 +226,6 @@ public class PersonalSpaceActivity extends AppCompatActivity { -// //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; } diff --git a/app/src/main/res/layout/note_display_full.xml b/app/src/main/res/layout/note_display_full.xml index 6ffde10..f7fd781 100644 --- a/app/src/main/res/layout/note_display_full.xml +++ b/app/src/main/res/layout/note_display_full.xml @@ -1,49 +1,60 @@ - + android:layout_height="match_parent"> - - + - + - + - + - + - + - \ No newline at end of file + + + + + + + \ No newline at end of file