From 515be677a918b45181b9e6bc956de668a3956432 Mon Sep 17 00:00:00 2001 From: Ritvik Saraf <13ritvik@gmail.com> Date: Mon, 24 Sep 2018 14:53:43 +0530 Subject: [PATCH] no comments --- .../fragments/detail/VideoDetailFragment.java | 11 +++++-- app/src/main/res/layout/fragment_comments.xml | 2 +- .../main/res/layout/fragment_video_detail.xml | 29 +++++++++++++++++++ app/src/main/res/values/strings.xml | 7 +++++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 64d785bcb..09e9b38d7 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -54,7 +54,6 @@ import org.schabi.newpipe.ReCaptchaActivity; import org.schabi.newpipe.download.DownloadDialog; import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.NewPipe; -import org.schabi.newpipe.extractor.ServiceList; import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.comments.CommentsInfo; import org.schabi.newpipe.extractor.comments.CommentsInfoItem; @@ -200,6 +199,7 @@ public class VideoDetailFragment private ImageButton relatedStreamExpandButton; private LinearLayout commentsRootLayout; + private View commentsEmptyStateView; private LinearLayout commentsView; private ImageButton commentsExpandButton; private Disposable commentsDisposable; @@ -571,6 +571,7 @@ public class VideoDetailFragment relatedStreamExpandButton = rootView.findViewById(R.id.detail_related_streams_expand); commentsRootLayout = rootView.findViewById(R.id.detail_comments_root_layout); + commentsEmptyStateView = rootView.findViewById(R.id.comments_empty_state_view); commentsView = rootView.findViewById(R.id.detail_comments_view); commentsExpandButton = rootView.findViewById(R.id.detail_comments_expand); @@ -750,9 +751,13 @@ public class VideoDetailFragment } private void initComments(CommentsInfo info) { - if(null == info) return; + clearComments(); - if (commentsView.getChildCount() > 0) commentsView.removeAllViews(); + if(null == info || null == info.getRelatedItems() || info.getRelatedItems().size() == 0){ + commentsEmptyStateView.setVisibility(View.VISIBLE); + return; + } + commentsEmptyStateView.setVisibility(View.GONE); List initialComments = info.getRelatedItems(); if (null != info && initialComments != null diff --git a/app/src/main/res/layout/fragment_comments.xml b/app/src/main/res/layout/fragment_comments.xml index 97ad5c247..83e788070 100644 --- a/app/src/main/res/layout/fragment_comments.xml +++ b/app/src/main/res/layout/fragment_comments.xml @@ -45,7 +45,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" - android:text="@string/empty_view_no_videos" + android:text="@string/empty_view_no_comments" android:textSize="24sp"/> diff --git a/app/src/main/res/layout/fragment_video_detail.xml b/app/src/main/res/layout/fragment_video_detail.xml index c59c4ac11..870043eb1 100644 --- a/app/src/main/res/layout/fragment_video_detail.xml +++ b/app/src/main/res/layout/fragment_video_detail.xml @@ -477,6 +477,35 @@ android:layout_marginTop="14dp" android:orientation="vertical"> + + + + + + + + User report No results @string/no_videos + @string/no_comments Nothing Here But Crickets Drag to reorder @@ -264,6 +265,12 @@ %s videos + No comments + + %s comment + %s comments + + Start Pause