Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/src/main/java/com/futo/platformplayer/Settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
}
}
}
}
}
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
}
}

Expand Down Expand Up @@ -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();
Expand All @@ -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
}

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -3633,4 +3664,4 @@ class VideoDetailView : ConstraintLayout {
private val _buttonPinStore = FragmentedStorage.get<StringArrayStorage>("videoPinnedButtons");
private var _lastOfflinePlaybackToastTime: Long = 0
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@
<string name="playlist_allow_dups_description">Allow adding duplicate videos to playlists</string>
<string name="watch_later_add_start">Add new videos to the beginning of Watch Later</string>
<string name="watch_later_add_start_description">When adding videos to Watch Later add them to the beginning of the list instead of the end</string>
<string name="hide_polycentric_likes">Hide Polycentric likes</string>
<string name="hide_polycentric_likes_description">Fully hide Polycentric rating</string>
<string name="hide_platform_likes">Hide platform likes</string>
<string name="hide_platform_likes_description">Fully hide platform rating</string>
<string name="hide_chat">Hide chat</string>
<string name="hide_chat_description">Fully hide the chat button and popup</string>
<string name="already_in_watch_later">Already in watch later</string>
<string name="enable_polycentric">Enable Polycentric</string>
<string name="polycentric_local_cache">Enable Polycentric Local Caching</string>
Expand All @@ -519,6 +525,10 @@
<string name="prefer_original_audio">Prefer Original Audio</string>
<string name="prefer_original_audio_description">Use original audio instead of preferred language when it is known</string>
<string name="default_comment_section">Default Comment Section</string>
<string name="hide_polycentric_comments">Hide Polycentric Comments</string>
<string name="hide_polycentric_comments_description">Fully hide the Polycentric comments tab.</string>
<string name="hide_platform_comments">Hide Platform Comments</string>
<string name="hide_platform_comments_description">Fully hide the platform comments tab.</string>
<string name="hide_recommendations">Hide Recommendations</string>
<string name="hide_recommendations_description">Fully hide the recommendations tab.</string>
<string name="default_recommendations">Recommendations as Default</string>
Expand Down