From 36c198fc330f4cee9b7ea6e7bf37a7ff188f66fc Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sat, 19 Jun 2021 15:03:20 +0200 Subject: [PATCH] One textview is enough for disabled comments Ref: https://github.com/TeamNewPipe/NewPipe/pull/6483#discussion_r654793920 --- .../fragments/list/comments/CommentsFragment.java | 10 ++++++---- app/src/main/res/layout/fragment_comments.xml | 12 +----------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentsFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentsFragment.java index 1a9a85f8c..3d11e90c0 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/comments/CommentsFragment.java @@ -25,7 +25,7 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable; public class CommentsFragment extends BaseListInfoFragment { private final CompositeDisposable disposables = new CompositeDisposable(); - private TextView commentsDisabledView; + private TextView emptyStateDesc; public static CommentsFragment getInstance(final int serviceId, final String url, final String name) { @@ -42,7 +42,7 @@ public class CommentsFragment extends BaseListInfoFragment { protected void initViews(final View rootView, final Bundle savedInstanceState) { super.initViews(rootView, savedInstanceState); - commentsDisabledView = rootView.findViewById(R.id.comments_disabled); + emptyStateDesc = rootView.findViewById(R.id.empty_state_desc); } /*////////////////////////////////////////////////////////////////////////// @@ -84,8 +84,10 @@ public class CommentsFragment extends BaseListInfoFragment { public void handleResult(@NonNull final CommentsInfo result) { super.handleResult(result); - commentsDisabledView.setVisibility( - result.isCommentsDisabled() ? View.VISIBLE : View.GONE); + emptyStateDesc.setText( + result.isCommentsDisabled() + ? R.string.comments_are_disabled + : R.string.no_comments); ViewUtils.slideUp(requireView(), 120, 150, 0.06f); disposables.clear(); diff --git a/app/src/main/res/layout/fragment_comments.xml b/app/src/main/res/layout/fragment_comments.xml index 9de932b20..b8e536c73 100644 --- a/app/src/main/res/layout/fragment_comments.xml +++ b/app/src/main/res/layout/fragment_comments.xml @@ -41,6 +41,7 @@ tools:ignore="HardcodedText,UnusedAttribute" /> - -