no comments

This commit is contained in:
Ritvik Saraf 2018-09-24 14:53:43 +05:30
parent d694c5f511
commit 515be677a9
4 changed files with 45 additions and 4 deletions

View File

@ -54,7 +54,6 @@ import org.schabi.newpipe.ReCaptchaActivity;
import org.schabi.newpipe.download.DownloadDialog; import org.schabi.newpipe.download.DownloadDialog;
import org.schabi.newpipe.extractor.InfoItem; import org.schabi.newpipe.extractor.InfoItem;
import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.comments.CommentsInfo; import org.schabi.newpipe.extractor.comments.CommentsInfo;
import org.schabi.newpipe.extractor.comments.CommentsInfoItem; import org.schabi.newpipe.extractor.comments.CommentsInfoItem;
@ -200,6 +199,7 @@ public class VideoDetailFragment
private ImageButton relatedStreamExpandButton; private ImageButton relatedStreamExpandButton;
private LinearLayout commentsRootLayout; private LinearLayout commentsRootLayout;
private View commentsEmptyStateView;
private LinearLayout commentsView; private LinearLayout commentsView;
private ImageButton commentsExpandButton; private ImageButton commentsExpandButton;
private Disposable commentsDisposable; private Disposable commentsDisposable;
@ -571,6 +571,7 @@ public class VideoDetailFragment
relatedStreamExpandButton = rootView.findViewById(R.id.detail_related_streams_expand); relatedStreamExpandButton = rootView.findViewById(R.id.detail_related_streams_expand);
commentsRootLayout = rootView.findViewById(R.id.detail_comments_root_layout); 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); commentsView = rootView.findViewById(R.id.detail_comments_view);
commentsExpandButton = rootView.findViewById(R.id.detail_comments_expand); commentsExpandButton = rootView.findViewById(R.id.detail_comments_expand);
@ -750,9 +751,13 @@ public class VideoDetailFragment
} }
private void initComments(CommentsInfo info) { 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<CommentsInfoItem> initialComments = info.getRelatedItems(); List<CommentsInfoItem> initialComments = info.getRelatedItems();
if (null != info && initialComments != null if (null != info && initialComments != null

View File

@ -45,7 +45,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/empty_view_no_videos" android:text="@string/empty_view_no_comments"
android:textSize="24sp"/> android:textSize="24sp"/>
</LinearLayout> </LinearLayout>

View File

@ -477,6 +477,35 @@
android:layout_marginTop="14dp" android:layout_marginTop="14dp"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/comments_empty_state_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical"
android:paddingTop="65dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:fontFamily="monospace"
android:text="(╯°-°)╯"
android:textSize="35sp"
tools:ignore="HardcodedText,UnusedAttribute"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/empty_view_no_comments"
android:textSize="18sp"/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/detail_comments_view" android:id="@+id/detail_comments_view"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -227,6 +227,7 @@
<string name="user_report">User report</string> <string name="user_report">User report</string>
<string name="search_no_results">No results</string> <string name="search_no_results">No results</string>
<string name="empty_view_no_videos" translatable="false">@string/no_videos</string> <string name="empty_view_no_videos" translatable="false">@string/no_videos</string>
<string name="empty_view_no_comments" translatable="false">@string/no_comments</string>
<string name="empty_subscription_feed_subtitle">Nothing Here But Crickets</string> <string name="empty_subscription_feed_subtitle">Nothing Here But Crickets</string>
<string name="detail_drag_description">Drag to reorder</string> <string name="detail_drag_description">Drag to reorder</string>
@ -264,6 +265,12 @@
<item quantity="other">%s videos</item> <item quantity="other">%s videos</item>
</plurals> </plurals>
<string name="no_comments">No comments</string>
<plurals name="comments">
<item quantity="one">%s comment</item>
<item quantity="other">%s comments</item>
</plurals>
<!-- Missions --> <!-- Missions -->
<string name="start">Start</string> <string name="start">Start</string>
<string name="pause">Pause</string> <string name="pause">Pause</string>