From b8865e925d498cb9c728c083e8719732c54afc6b Mon Sep 17 00:00:00 2001 From: Ritvik Saraf <13ritvik@gmail.com> Date: Tue, 2 Oct 2018 20:56:14 +0530 Subject: [PATCH] added content setting to disable comments --- .../newpipe/fragments/detail/VideoDetailFragment.java | 11 +++++------ app/src/main/res/values/settings_keys.xml | 2 +- app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/content_settings.xml | 6 ++++++ 4 files changed, 14 insertions(+), 7 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 ded6be349..67f86a905 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 @@ -216,7 +216,7 @@ public class VideoDetailFragment .getBoolean(getString(R.string.show_next_video_key), true); showComments = PreferenceManager.getDefaultSharedPreferences(activity) - .getBoolean(getString(R.string.show_comments), true); + .getBoolean(getString(R.string.show_comments_key), true); PreferenceManager.getDefaultSharedPreferences(activity) .registerOnSharedPreferenceChangeListener(this); @@ -305,7 +305,7 @@ public class VideoDetailFragment updateFlags |= RESOLUTIONS_MENU_UPDATE_FLAG; } else if (key.equals(getString(R.string.show_play_with_kodi_key))) { updateFlags |= TOOLBAR_ITEMS_UPDATE_FLAG; - } else if (key.equals(R.string.show_comments)) { + } else if (key.equals(getString(R.string.show_comments_key))) { showComments = sharedPreferences.getBoolean(key, true); updateFlags |= COMMENTS_UPDATE_FLAG; } @@ -815,11 +815,14 @@ public class VideoDetailFragment } if(showRelatedStreams){ + //temp empty fragment. will be updated in handleResult pageAdapter.addFragment(new Fragment(), RELATED_TAB_TAG); } if(pageAdapter.getCount() < 2){ tabLayout.setVisibility(View.GONE); + }else{ + tabLayout.setVisibility(View.VISIBLE); } } @@ -1247,8 +1250,4 @@ public class VideoDetailFragment showError(getString(R.string.blocked_by_gema), false, R.drawable.gruese_die_gema); } - - public void onCommentsError(Throwable exception) { - showSnackBarError(exception, UserAction.REQUESTED_COMMENTS, NewPipe.getNameOfService(serviceId), url, R.string.error_unable_to_load_comments); - } } \ No newline at end of file diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index b110a6aa3..1a56e2d40 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -135,7 +135,7 @@ show_search_suggestions show_play_with_kodi show_next_video - show_comments + show_comments show_hold_to_append en GB diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3dbbc29cf..bd00ddce1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -76,6 +76,8 @@ Inexact seek allows the player to seek to positions faster with reduced precision Load thumbnails Disable to stop all thumbnails from loading and save on data and memory usage. Changing this will clear both in-memory and on-disk image cache. + Show comments + Disable to stop showing comments Image cache wiped Wipe cached metadata Remove all cached webpage data diff --git a/app/src/main/res/xml/content_settings.xml b/app/src/main/res/xml/content_settings.xml index fcf42b130..d641a1574 100644 --- a/app/src/main/res/xml/content_settings.xml +++ b/app/src/main/res/xml/content_settings.xml @@ -43,6 +43,12 @@ android:title="@string/download_thumbnail_title" android:summary="@string/download_thumbnail_summary"/> + +