added content setting to disable comments

This commit is contained in:
Ritvik Saraf 2018-10-02 20:56:14 +05:30
parent 2e9a860aaa
commit b8865e925d
4 changed files with 14 additions and 7 deletions

View File

@ -216,7 +216,7 @@ public class VideoDetailFragment
.getBoolean(getString(R.string.show_next_video_key), true); .getBoolean(getString(R.string.show_next_video_key), true);
showComments = PreferenceManager.getDefaultSharedPreferences(activity) showComments = PreferenceManager.getDefaultSharedPreferences(activity)
.getBoolean(getString(R.string.show_comments), true); .getBoolean(getString(R.string.show_comments_key), true);
PreferenceManager.getDefaultSharedPreferences(activity) PreferenceManager.getDefaultSharedPreferences(activity)
.registerOnSharedPreferenceChangeListener(this); .registerOnSharedPreferenceChangeListener(this);
@ -305,7 +305,7 @@ public class VideoDetailFragment
updateFlags |= RESOLUTIONS_MENU_UPDATE_FLAG; updateFlags |= RESOLUTIONS_MENU_UPDATE_FLAG;
} else if (key.equals(getString(R.string.show_play_with_kodi_key))) { } else if (key.equals(getString(R.string.show_play_with_kodi_key))) {
updateFlags |= TOOLBAR_ITEMS_UPDATE_FLAG; 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); showComments = sharedPreferences.getBoolean(key, true);
updateFlags |= COMMENTS_UPDATE_FLAG; updateFlags |= COMMENTS_UPDATE_FLAG;
} }
@ -815,11 +815,14 @@ public class VideoDetailFragment
} }
if(showRelatedStreams){ if(showRelatedStreams){
//temp empty fragment. will be updated in handleResult
pageAdapter.addFragment(new Fragment(), RELATED_TAB_TAG); pageAdapter.addFragment(new Fragment(), RELATED_TAB_TAG);
} }
if(pageAdapter.getCount() < 2){ if(pageAdapter.getCount() < 2){
tabLayout.setVisibility(View.GONE); 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); 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);
}
} }

View File

@ -135,7 +135,7 @@
<string name="show_search_suggestions_key" translatable="false">show_search_suggestions</string> <string name="show_search_suggestions_key" translatable="false">show_search_suggestions</string>
<string name="show_play_with_kodi_key" translatable="false">show_play_with_kodi</string> <string name="show_play_with_kodi_key" translatable="false">show_play_with_kodi</string>
<string name="show_next_video_key" translatable="false">show_next_video</string> <string name="show_next_video_key" translatable="false">show_next_video</string>
<string name="show_comments" translatable="false">show_comments</string> <string name="show_comments_key" translatable="false">show_comments</string>
<string name="show_hold_to_append_key" translatable="false">show_hold_to_append</string> <string name="show_hold_to_append_key" translatable="false">show_hold_to_append</string>
<string name="default_language_value">en</string> <string name="default_language_value">en</string>
<string name="default_country_value">GB</string> <string name="default_country_value">GB</string>

View File

@ -76,6 +76,8 @@
<string name="use_inexact_seek_summary">Inexact seek allows the player to seek to positions faster with reduced precision</string> <string name="use_inexact_seek_summary">Inexact seek allows the player to seek to positions faster with reduced precision</string>
<string name="download_thumbnail_title">Load thumbnails</string> <string name="download_thumbnail_title">Load thumbnails</string>
<string name="download_thumbnail_summary">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.</string> <string name="download_thumbnail_summary">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.</string>
<string name="show_comments_title">Show comments</string>
<string name="show_comments_summary">Disable to stop showing comments</string>
<string name="thumbnail_cache_wipe_complete_notice">Image cache wiped</string> <string name="thumbnail_cache_wipe_complete_notice">Image cache wiped</string>
<string name="metadata_cache_wipe_title">Wipe cached metadata</string> <string name="metadata_cache_wipe_title">Wipe cached metadata</string>
<string name="metadata_cache_wipe_summary">Remove all cached webpage data</string> <string name="metadata_cache_wipe_summary">Remove all cached webpage data</string>

View File

@ -43,6 +43,12 @@
android:title="@string/download_thumbnail_title" android:title="@string/download_thumbnail_title"
android:summary="@string/download_thumbnail_summary"/> android:summary="@string/download_thumbnail_summary"/>
<SwitchPreference
android:defaultValue="true"
android:key="@string/show_comments_key"
android:title="@string/show_comments_title"
android:summary="@string/show_comments_summary"/>
<Preference <Preference
android:summary="@string/import_data_summary" android:summary="@string/import_data_summary"
android:key="@string/import_data" android:key="@string/import_data"