From a1e05277b79c780e2392894b5731cf7f5f9c7799 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 ecc23a40a54..2b517b7fcb1 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 @@ -29,7 +29,7 @@ public class CommentsFragment extends BaseListInfoFragment { private boolean mIsVisibleToUser = false; - private TextView commentsDisabledView; + private TextView emptyStateDesc; public static CommentsFragment getInstance(final int serviceId, final String url, final String name) { @@ -42,7 +42,7 @@ public static CommentsFragment getInstance(final int serviceId, final String ur 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); } /*////////////////////////////////////////////////////////////////////////// @@ -102,8 +102,10 @@ public void showLoading() { 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); AnimationUtils.slideUp(getView(), 120, 150, 0.06f); diff --git a/app/src/main/res/layout/fragment_comments.xml b/app/src/main/res/layout/fragment_comments.xml index ca3dde55dcc..b8b27248af6 100644 --- a/app/src/main/res/layout/fragment_comments.xml +++ b/app/src/main/res/layout/fragment_comments.xml @@ -42,6 +42,7 @@ tools:ignore="HardcodedText,UnusedAttribute"/> - -