Skip to content

Commit 5057bb5

Browse files
mayank8318iamareebjamal
authored andcommitted
fix: Improve UI of comments for feed. (fossasia#2177)
1 parent ffffeee commit 5057bb5

File tree

5 files changed

+48
-33
lines changed

5 files changed

+48
-33
lines changed

android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/CommentsDialogFragment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.fossasia.openevent.core.feed.facebook;
22

3+
import android.os.Bundle;
34
import android.support.annotation.NonNull;
45
import android.support.v4.app.DialogFragment;
5-
import android.os.Bundle;
66
import android.support.v7.widget.LinearLayoutManager;
77
import android.support.v7.widget.RecyclerView;
88
import android.view.LayoutInflater;
@@ -23,7 +23,6 @@ public class CommentsDialogFragment extends DialogFragment {
2323
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
2424
//inflate layout with recycler view
2525
View root = inflater.inflate(R.layout.list_comment, container, false);
26-
getDialog().getWindow().getAttributes().alpha = 0.8f;
2726
List<CommentItem> commentItems = this.getArguments().getParcelableArrayList(ConstantStrings.FACEBOOK_COMMENTS);
2827
RecyclerView recyclerView = root.findViewById(R.id.comment_recycler_view);
2928
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));

android/app/src/main/java/org/fossasia/openevent/core/feed/facebook/FeedAdapter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ public void onBindViewHolder(RecyclerViewHolder holder, int position) {
153153
holder.feedImageView.setVisibility(View.GONE);
154154
}
155155

156+
int comments = feedItem.getComments() != null ? feedItem.getComments().getData().size() : 0;
157+
holder.getComments.setText(context.getString(R.string.comments_value, comments));
156158
}
157159

158160
public interface OpenCommentsDialogListener {
Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,56 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
android:layout_width="match_parent"
45
android:layout_height="wrap_content"
6+
android:layout_marginBottom="@dimen/layout_margin_medium"
7+
android:layout_marginLeft="@dimen/layout_margin_medium"
8+
android:layout_marginRight="@dimen/layout_margin_medium"
9+
android:background="@color/cardview_light_background"
510
android:orientation="vertical">
611

7-
<TextView
8-
android:id="@+id/commenter"
12+
<LinearLayout
913
android:layout_width="match_parent"
1014
android:layout_height="wrap_content"
11-
android:layout_marginLeft="15dp"
12-
android:layout_marginRight="15dp"
13-
android:layout_marginTop="5dp"
14-
android:drawablePadding="8dp"
15-
android:gravity="left|center"
16-
android:text="@string/commenter"
17-
android:textColor="#222222"
18-
android:textSize="14sp"
19-
android:textStyle="bold" />
15+
android:layout_marginBottom="5dp"
16+
android:layout_marginLeft="@dimen/layout_margin_large"
17+
android:layout_marginRight="@dimen/layout_margin_large"
18+
android:orientation="horizontal">
19+
20+
<TextView
21+
android:id="@+id/commenter"
22+
android:layout_width="0dp"
23+
android:layout_height="wrap_content"
24+
android:layout_marginEnd="@dimen/layout_margin_medium"
25+
android:layout_marginRight="@dimen/layout_margin_medium"
26+
android:layout_weight="1"
27+
android:textColor="#222222"
28+
android:textSize="16sp"
29+
android:textStyle="bold"
30+
tools:text="@string/commenter" />
31+
32+
<TextView
33+
android:id="@+id/comment_time"
34+
android:layout_width="wrap_content"
35+
android:layout_height="wrap_content"
36+
android:textSize="12sp"
37+
tools:text="11 Jan 2018" />
38+
</LinearLayout>
2039

2140
<TextView
2241
android:id="@+id/comment"
2342
android:layout_width="match_parent"
2443
android:layout_height="wrap_content"
25-
android:layout_marginLeft="15dp"
26-
android:layout_marginRight="15dp"
27-
android:drawablePadding="8dp"
44+
android:layout_marginBottom="@dimen/layout_margin_medium"
45+
android:layout_marginLeft="@dimen/layout_margin_large"
46+
android:layout_marginRight="@dimen/layout_margin_large"
2847
android:textIsSelectable="true"
29-
android:textSize="14sp" />
48+
android:textSize="14sp"
49+
tools:text="@string/comment_body" />
3050

31-
<TextView
32-
android:id="@+id/comment_time"
51+
<View
3352
android:layout_width="match_parent"
34-
android:layout_height="wrap_content"
35-
android:layout_marginBottom="5dp"
36-
android:layout_marginLeft="15dp"
37-
android:layout_marginRight="15dp"
38-
android:gravity="right"
39-
android:textSize="12sp" />
40-
41-
53+
android:layout_height="1dp"
54+
android:layout_marginTop="@dimen/layout_margin_small"
55+
android:background="@color/grey" />
4256
</LinearLayout>

android/app/src/main/res/layout/list_comment.xml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
android:id="@+id/comment_list"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
android:layout_marginLeft="@dimen/layout_margin_extra_large"
7-
android:layout_marginRight="@dimen/layout_margin_extra_large"
6+
android:layout_marginLeft="@dimen/layout_margin_large"
7+
android:layout_marginRight="@dimen/layout_margin_large"
88
android:layout_marginTop="@dimen/feed_item_margin"
9-
android:background="@drawable/comment_dialog"
10-
android:orientation="vertical"
11-
android:paddingBottom="@dimen/feed_item_padding_top_bottom"
12-
android:paddingTop="@dimen/feed_item_padding_top_bottom">
9+
android:orientation="vertical">
1310

1411
<android.support.v7.widget.RecyclerView
1512
android:id="@+id/comment_recycler_view"
1613
android:layout_width="match_parent"
1714
android:layout_height="@dimen/comment_list_height"
15+
android:paddingTop="@dimen/layout_margin_medium"
1816
android:scrollbars="vertical" />
1917

2018
</LinearLayout>

android/app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@
294294
<string name="facebook_access_token" templateMergeStrategy="preserve" translatable="false">1786614831603417|DWqP48Lm77hBqCQDWVsq4lFixuo</string>
295295
<string name="no_comments">No Comments Yet :(</string>
296296
<string name="comments">comments</string>
297+
<string name="comments_value">comments (%d)</string>
297298
<string name="commenter">Commenter</string>
298299
<string name="profile_image">Profile Image</string>
299300
<string name="fields">id,full_picture,message,story,created_time,link,comments</string>
@@ -305,6 +306,7 @@
305306
<string name="speakers_bio">About me</string>
306307
<string name="social_media">Social media</string>
307308
<string name="sessions_title_card">Sessions</string>
309+
<string name="comment_body">Comment Body</string>
308310

309311
<!--Session-detail-strings-->
310312
<string name="session_track_details">Session Track :</string>

0 commit comments

Comments
 (0)