From 94dc614ce61186e978eff3b16217bfe56c0a2cf8 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 7 Apr 2018 18:18:46 +0200 Subject: [PATCH] Display comment images --- .../comunic/client/ui/adapters/CommentsAdapter.java | 10 ++++++++++ app/src/main/res/layout/comment_item.xml | 7 +++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 18 insertions(+) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/CommentsAdapter.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/CommentsAdapter.java index 52db03c..d7bb2be 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/CommentsAdapter.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/CommentsAdapter.java @@ -93,6 +93,16 @@ class CommentsAdapter extends ArrayAdapter { //Update comment content ((TextView) view.findViewById(R.id.comment_text)).setText(comment.getContent()); + //Update comment image (if any) + ImageView commentImage = view.findViewById(R.id.comment_image); + if(comment.getImage_url().length() < 5) + commentImage.setVisibility(View.GONE); + else { + commentImage.setVisibility(View.VISIBLE); + ImageLoadManager.remove(commentImage); + ImageLoadManager.load(context, comment.getImage_url(), commentImage); + } + //Update comment likes LikeButtonView like = view.findViewById(R.id.like_button); diff --git a/app/src/main/res/layout/comment_item.xml b/app/src/main/res/layout/comment_item.xml index baa95c2..b47fdf2 100644 --- a/app/src/main/res/layout/comment_item.xml +++ b/app/src/main/res/layout/comment_item.xml @@ -31,6 +31,13 @@ android:layout_weight="2" android:layout_height="wrap_content" tools:text="A comment content" /> + + + Edit New content for the comment An error occurred while trying to update comment content ! + Comment image