diff --git a/app/src/main/java/com/futo/platformplayer/Settings.kt b/app/src/main/java/com/futo/platformplayer/Settings.kt index 132a74074..e03b9d08a 100644 --- a/app/src/main/java/com/futo/platformplayer/Settings.kt +++ b/app/src/main/java/com/futo/platformplayer/Settings.kt @@ -640,6 +640,14 @@ class Settings : FragmentedStorageFileJson() { @FormField(R.string.default_recommendations, FieldForm.TOGGLE, R.string.default_recommendations_description, 0) var recommendationsDefault: Boolean = false; + @AdvancedField + @FormField(R.string.hide_polycentric_comments, FieldForm.TOGGLE, R.string.hide_polycentric_comments_description, 0) + var hidePolycentricComments: Boolean = false; + + @AdvancedField + @FormField(R.string.hide_platform_comments, FieldForm.TOGGLE, R.string.hide_platform_comments_description, 0) + var hidePlatformComments: Boolean = false; + @AdvancedField @FormField(R.string.hide_recommendations, FieldForm.TOGGLE, R.string.hide_recommendations_description, 0) var hideRecommendations: Boolean = false; @@ -1065,6 +1073,18 @@ class Settings : FragmentedStorageFileJson() { @FormField(R.string.watch_later_add_start, FieldForm.TOGGLE, R.string.watch_later_add_start_description, 4) var watchLaterAddStart: Boolean = true; + @AdvancedField + @FormField(R.string.hide_polycentric_likes, FieldForm.TOGGLE, R.string.hide_polycentric_likes_description, 0) + var hidePolycentricLikes: Boolean = false; + + @AdvancedField + @FormField(R.string.hide_platform_likes, FieldForm.TOGGLE, R.string.hide_platform_likes_description, 0) + var hidePlatformLikes: Boolean = false; + + @AdvancedField + @FormField(R.string.hide_chat, FieldForm.TOGGLE, R.string.hide_chat_description, 0) + var hideChat: Boolean = false; + @FormField(R.string.enable_polycentric, FieldForm.TOGGLE, R.string.can_be_disabled_when_you_are_experiencing_issues, 5) var polycentricEnabled: Boolean = true; diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt index 76435cf0e..03855e024 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/main/VideoDetailView.kt @@ -1036,7 +1036,7 @@ class VideoDetailView : ConstraintLayout { } else null }, - if(video?.isLive ?: false) + if(!Settings.instance.other.hideChat && video?.isLive ?: false) RoundButton(context, R.drawable.ic_chat, context.getString(R.string.live_chat), TAG_LIVECHAT) { video?.let { try { @@ -1047,7 +1047,7 @@ class VideoDetailView : ConstraintLayout { } } _slideUpOverlay?.hide(); - } else if(video is JSVideoDetails && (video as JSVideoDetails).hasVODEvents()) + } else if(!Settings.instance.other.hideChat && video is JSVideoDetails && (video as JSVideoDetails).hasVODEvents()) RoundButton(context, R.drawable.ic_chat, context.getString(R.string.vod_chat), TAG_VODCHAT) { video?.let { try { @@ -1645,10 +1645,29 @@ class VideoDetailView : ConstraintLayout { if (Settings.instance.comments.recommendationsDefault && !Settings.instance.comments.hideRecommendations) { setTabIndex(2, true) } else { - when (Settings.instance.comments.defaultCommentSection) { - 0 -> if (Settings.instance.other.polycentricEnabled) setTabIndex(0, true) else setTabIndex(1, true) - 1 -> setTabIndex(1, true) - 2 -> setTabIndex(StateMeta.instance.getLastCommentSection(), true) + val index = when (Settings.instance.comments.defaultCommentSection) { + 2 -> StateMeta.instance.getLastCommentSection() + else -> Settings.instance.comments.defaultCommentSection + } + when (index) { + 0 -> { + if (Settings.instance.other.polycentricEnabled && !Settings.instance.comments.hidePolycentricComments) { + setTabIndex(0, true) + } else { + if (Settings.instance.comments.hidePlatformComments) { + setTabIndex(null, true) + } else { + setTabIndex(1, true) + } + } + } + 1 -> { + if (Settings.instance.comments.hidePlatformComments) { + setTabIndex(null, true) + } else { + setTabIndex(1, true) + } + } } } } @@ -1714,7 +1733,7 @@ class VideoDetailView : ConstraintLayout { _rating.visibility = View.GONE; - if (StatePolycentric.instance.enabled && !(video is LocalVideoDetails)) { + if (StatePolycentric.instance.enabled && !(video is LocalVideoDetails) && !Settings.instance.other.hidePolycentricLikes) { fragment.lifecycleScope.launch(Dispatchers.IO) { try { val queryReferencesResponse = ApiMethods.getQueryReferences( @@ -1781,34 +1800,40 @@ class VideoDetailView : ConstraintLayout { } } - when (video.rating) { - is RatingLikeDislikes -> { - val r = video.rating as RatingLikeDislikes; - _layoutRating.visibility = View.VISIBLE; + if (Settings.instance.other.hidePlatformLikes) { + _layoutRating.visibility = View.GONE; + _imageLikeIcon.visibility = View.GONE; + _imageDislikeIcon.visibility = View.GONE; + } else { + when (video.rating) { + is RatingLikeDislikes -> { + val r = video.rating as RatingLikeDislikes; + _layoutRating.visibility = View.VISIBLE; - _textLikes.visibility = View.VISIBLE; - _imageLikeIcon.visibility = View.VISIBLE; - _textLikes.text = r.likes.toHumanNumber(); + _textLikes.visibility = View.VISIBLE; + _imageLikeIcon.visibility = View.VISIBLE; + _textLikes.text = r.likes.toHumanNumber(); - _imageDislikeIcon.visibility = View.VISIBLE; - _textDislikes.visibility = View.VISIBLE; - _textDislikes.text = r.dislikes.toHumanNumber(); - } + _imageDislikeIcon.visibility = View.VISIBLE; + _textDislikes.visibility = View.VISIBLE; + _textDislikes.text = r.dislikes.toHumanNumber(); + } - is RatingLikes -> { - val r = video.rating as RatingLikes; - _layoutRating.visibility = View.VISIBLE; + is RatingLikes -> { + val r = video.rating as RatingLikes; + _layoutRating.visibility = View.VISIBLE; - _textLikes.visibility = View.VISIBLE; - _imageLikeIcon.visibility = View.VISIBLE; - _textLikes.text = r.likes.toHumanNumber(); + _textLikes.visibility = View.VISIBLE; + _imageLikeIcon.visibility = View.VISIBLE; + _textLikes.text = r.likes.toHumanNumber(); - _imageDislikeIcon.visibility = View.GONE; - _textDislikes.visibility = View.GONE; - } + _imageDislikeIcon.visibility = View.GONE; + _textDislikes.visibility = View.GONE; + } - else -> { - _layoutRating.visibility = View.GONE; + else -> { + _layoutRating.visibility = View.GONE; + } } } @@ -1860,17 +1885,19 @@ class VideoDetailView : ConstraintLayout { _liveChat?.stop(); _liveChat = null; var gotLive = false; - if (video.isLive && video.live != null) { - loadLiveChat(video); - gotLive = true; - } - if (video.isLive && video.live == null && !video.video.videoSources.any()) { - startLiveTry(video); - gotLive = true; - } - if(!gotLive && video is JSVideoDetails && video.hasVODEvents()) { - Logger.i(TAG, "Loading VOD chat"); - loadVODChat(video); + if (!Settings.instance.other.hideChat) { + if (video.isLive && video.live != null) { + loadLiveChat(video); + gotLive = true; + } + if (video.isLive && video.live == null && !video.video.videoSources.any()) { + startLiveTry(video); + gotLive = true; + } + if (!gotLive && video is JSVideoDetails && video.hasVODEvents()) { + Logger.i(TAG, "Loading VOD chat"); + loadVODChat(video); + } } _player.updateNextPrevious(); @@ -1887,8 +1914,6 @@ class VideoDetailView : ConstraintLayout { _buttonSubscribe.visibility = View.VISIBLE _buttonMore.visibility = View.VISIBLE _buttonPins.visibility = View.VISIBLE - _layoutRating.visibility = View.VISIBLE - _rating.visibility = View.VISIBLE; _layoutChangeBottomSection.visibility = View.VISIBLE } @@ -3043,6 +3068,12 @@ class VideoDetailView : ConstraintLayout { return } + val polycentricCommentsHidden = Settings.instance.comments.hidePolycentricComments || !Settings.instance.other.polycentricEnabled + _buttonPolycentric.visibility = if (polycentricCommentsHidden) View.GONE else View.VISIBLE + + val platformCommentsHidden = Settings.instance.comments.hidePlatformComments + _buttonPlatform.visibility = if (platformCommentsHidden) View.GONE else View.VISIBLE + val recommendationsHidden = Settings.instance.comments.hideRecommendations _buttonRecommended.visibility = if (recommendationsHidden) View.GONE else View.VISIBLE @@ -3633,4 +3664,4 @@ class VideoDetailView : ConstraintLayout { private val _buttonPinStore = FragmentedStorage.get("videoPinnedButtons"); private var _lastOfflinePlaybackToastTime: Long = 0 } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/special/CommentsModalBottomSheet.kt b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/special/CommentsModalBottomSheet.kt index c74a72180..6734e5751 100644 --- a/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/special/CommentsModalBottomSheet.kt +++ b/app/src/main/java/com/futo/platformplayer/fragment/mainactivity/special/CommentsModalBottomSheet.kt @@ -205,10 +205,29 @@ class CommentsModalBottomSheet : BottomSheetDialogFragment() { if (Settings.instance.comments.recommendationsDefault && !Settings.instance.comments.hideRecommendations) { setTabIndex(2, true) } else { - when (Settings.instance.comments.defaultCommentSection) { - 0 -> if (Settings.instance.other.polycentricEnabled) setTabIndex(0, true) else setTabIndex(1, true) - 1 -> setTabIndex(1, true) - 2 -> setTabIndex(StateMeta.instance.getLastCommentSection(), true) + val index = when (Settings.instance.comments.defaultCommentSection) { + 2 -> StateMeta.instance.getLastCommentSection() + else -> Settings.instance.comments.defaultCommentSection + } + when (index) { + 0 -> { + if (Settings.instance.other.polycentricEnabled && !Settings.instance.comments.hidePolycentricComments) { + setTabIndex(0, true) + } else { + if (Settings.instance.comments.hidePlatformComments) { + setTabIndex(null, true) + } else { + setTabIndex(1, true) + } + } + } + 1 -> { + if (Settings.instance.comments.hidePlatformComments) { + setTabIndex(null, true) + } else { + setTabIndex(1, true) + } + } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 962bef48b..e46d82d0d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -497,6 +497,12 @@ Allow adding duplicate videos to playlists Add new videos to the beginning of Watch Later When adding videos to Watch Later add them to the beginning of the list instead of the end + Hide Polycentric likes + Fully hide Polycentric rating + Hide platform likes + Fully hide platform rating + Hide chat + Fully hide the chat button and popup Already in watch later Enable Polycentric Enable Polycentric Local Caching @@ -519,6 +525,10 @@ Prefer Original Audio Use original audio instead of preferred language when it is known Default Comment Section + Hide Polycentric Comments + Fully hide the Polycentric comments tab. + Hide Platform Comments + Fully hide the platform comments tab. Hide Recommendations Fully hide the recommendations tab. Recommendations as Default