From 81107df53f5cde6e85c01118d912c7fc49027cce Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sun, 13 Jun 2021 21:35:34 +0200 Subject: [PATCH 1/3] Added comments disabled functionallity --- .../fragments/list/comments/CommentsFragment.java | 14 ++++++++++++++ app/src/main/res/layout/fragment_comments.xml | 11 +++++++++++ app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 4 files changed, 27 insertions(+) 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 5d2cc4fdf..1a9a85f8c 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 @@ -6,6 +6,7 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -24,6 +25,8 @@ import io.reactivex.rxjava3.disposables.CompositeDisposable; public class CommentsFragment extends BaseListInfoFragment { private final CompositeDisposable disposables = new CompositeDisposable(); + private TextView commentsDisabledView; + public static CommentsFragment getInstance(final int serviceId, final String url, final String name) { final CommentsFragment instance = new CommentsFragment(); @@ -35,6 +38,13 @@ public class CommentsFragment extends BaseListInfoFragment { super(UserAction.REQUESTED_COMMENTS); } + @Override + protected void initViews(final View rootView, final Bundle savedInstanceState) { + super.initViews(rootView, savedInstanceState); + + commentsDisabledView = rootView.findViewById(R.id.comments_disabled); + } + /*////////////////////////////////////////////////////////////////////////// // LifeCycle //////////////////////////////////////////////////////////////////////////*/ @@ -73,6 +83,10 @@ public class CommentsFragment extends BaseListInfoFragment { @Override public void handleResult(@NonNull final CommentsInfo result) { super.handleResult(result); + + commentsDisabledView.setVisibility( + result.isCommentsDisabled() ? View.VISIBLE : View.GONE); + 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 3c9a1785f..9de932b20 100644 --- a/app/src/main/res/layout/fragment_comments.xml +++ b/app/src/main/res/layout/fragment_comments.xml @@ -49,6 +49,17 @@ + + Ausschalten, um Kommentare auszublenden Automatische Wiedergabe Keine Kommentare + Kommentare sind deaktiviert Kommentare konnten nicht geladen werden Schließen Wiedergabe fortsetzen diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index acef587d1..f75380101 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -336,6 +336,7 @@ %s videos No comments + Comments are disabled Start Pause From 75a8edf20feb3c39d9621adc1ca4293a265e01e7 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sun, 13 Jun 2021 22:04:57 +0200 Subject: [PATCH 2/3] Added corresponding required code changes from Extractor branch --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index b903eafca..4b6890eac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -186,7 +186,7 @@ dependencies { // name and the commit hash with the commit hash of the (pushed) commit you want to test // This works thanks to JitPack: https://jitpack.io/ implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751' - implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.6' + implementation 'com.github.TeamNewPipe:NewPipeExtractor:c38a06e8dcd9c206a52b622704b138b78d633274' /** Checkstyle **/ checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" 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 3/3] 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" /> - -