changes in dialog according to ownership
- owner will see permission and delete icon - other wont see permission and will see like button
This commit is contained in:
parent
db003f82d7
commit
84df7e0437
1 changed files with 20 additions and 2 deletions
|
@ -20,6 +20,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
@ -182,10 +183,18 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
|
|||
Note note = eventMarkerMap.get(marker);
|
||||
final Dialog noteViewDialog = new Dialog(getActivity());
|
||||
noteViewDialog.setContentView(R.layout.note_display_full);
|
||||
noteViewDialog.setTitle("Someone wrote...");
|
||||
|
||||
boolean isOwner = note.getOwnerId() == mainActivity.getUserId();
|
||||
if (isOwner)
|
||||
noteViewDialog.setTitle("I wrote...");
|
||||
else
|
||||
noteViewDialog.setTitle("Someone wrote...");
|
||||
|
||||
noteViewDialog.show();
|
||||
|
||||
|
||||
|
||||
|
||||
//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);
|
||||
|
@ -194,6 +203,7 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
|
|||
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 ImageView avatar = (ImageView) noteViewDialog.findViewById(R.id.note_user_avatar);
|
||||
final ImageButton deleteBtn = (ImageButton) noteViewDialog.findViewById(R.id.ndf_delete_imagebutton);
|
||||
|
||||
|
||||
|
@ -203,7 +213,15 @@ public class GmapFragment extends Fragment implements OnMapReadyCallback {
|
|||
location.setText("Tags: " + note.getAddress());
|
||||
likes.setText("Likes: " + note.getLikes());
|
||||
tags.setText(note.getTags().toString());
|
||||
permission.setText("Permission: " + (note.isPublic() ? "Public" : "Private"));
|
||||
// avatar.setImageBitmap();
|
||||
if (isOwner) {
|
||||
permission.setText("Permission: " + (note.isPublic() ? "Public" : "Private"));
|
||||
}
|
||||
else{
|
||||
deleteBtn.setBackgroundResource(R.drawable.like_icon);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// deleteBtn.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
Loading…
Reference in a new issue