diff --git a/app/src/main/java/com/futo/platformplayer/Settings.kt b/app/src/main/java/com/futo/platformplayer/Settings.kt index b19f1b82..39bc8e9f 100644 --- a/app/src/main/java/com/futo/platformplayer/Settings.kt +++ b/app/src/main/java/com/futo/platformplayer/Settings.kt @@ -489,7 +489,7 @@ class Settings : FragmentedStorageFileJson() { @FormField(R.string.default_comment_section, FieldForm.DROPDOWN, -1, 0) @DropdownFieldOptionsId(R.array.comment_sections) - var defaultCommentSection: Int = 1; + var defaultCommentSection: Int = 2; @FormField(R.string.default_recommendations, FieldForm.TOGGLE, R.string.default_recommendations_description, 0) var recommendationsDefault: Boolean = false; 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 5bb39b1d..9b8d2192 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 @@ -104,6 +104,7 @@ import com.futo.platformplayer.states.StateApp import com.futo.platformplayer.states.StateDeveloper import com.futo.platformplayer.states.StateDownloads import com.futo.platformplayer.states.StateHistory +import com.futo.platformplayer.states.StateMeta import com.futo.platformplayer.states.StatePlatform import com.futo.platformplayer.states.StatePlayer import com.futo.platformplayer.states.StatePlaylists @@ -444,7 +445,8 @@ class VideoDetailView : ConstraintLayout { if (StatePolycentric.instance.enabled) { _buttonPolycentric.setOnClickListener { - setTabIndex(0) + setTabIndex(0); + StateMeta.instance.setLastCommentSection(0); } } else { _buttonPolycentric.visibility = View.GONE @@ -456,6 +458,7 @@ class VideoDetailView : ConstraintLayout { _buttonPlatform.setOnClickListener { setTabIndex(1) + StateMeta.instance.setLastCommentSection(1); } val layoutTop: LinearLayout = findViewById(R.id.layout_top); @@ -1297,8 +1300,11 @@ class VideoDetailView : ConstraintLayout { if (Settings.instance.comments.recommendationsDefault) { setTabIndex(2) } else { - val commentType = !Settings.instance.other.polycentricEnabled || Settings.instance.comments.defaultCommentSection == 1 - setTabIndex(if (commentType) 1 else 0, true) + when(Settings.instance.comments.defaultCommentSection) { + 0 -> if(Settings.instance.other.polycentricEnabled) setTabIndex(0) else setTabIndex(1); + 1 -> setTabIndex(1); + 2 -> setTabIndex(StateMeta.instance.getLastCommentSection()) + } } } diff --git a/app/src/main/java/com/futo/platformplayer/states/StateMeta.kt b/app/src/main/java/com/futo/platformplayer/states/StateMeta.kt index 9332599b..b20866bf 100644 --- a/app/src/main/java/com/futo/platformplayer/states/StateMeta.kt +++ b/app/src/main/java/com/futo/platformplayer/states/StateMeta.kt @@ -2,11 +2,29 @@ package com.futo.platformplayer.states import com.futo.platformplayer.stores.FragmentedStorage import com.futo.platformplayer.stores.StringHashSetStorage +import com.futo.platformplayer.stores.StringStorage class StateMeta { val hiddenVideos = FragmentedStorage.get("hiddenVideos"); val hiddenCreators = FragmentedStorage.get("hiddenCreators"); + val lastCommentSection = FragmentedStorage.get("defaultCommentSection"); + + fun getLastCommentSection(): Int{ + return when(lastCommentSection.value){ + "Polycentric" -> 0; + "Platform" -> 1; + else -> 1 + } + } + fun setLastCommentSection(value: Int) { + when(value) { + 0 -> lastCommentSection.setAndSave("Polycentric"); + 1 -> lastCommentSection.setAndSave("Platform"); + else -> lastCommentSection.setAndSave(""); + } + } + fun isVideoHidden(videoUrl: String) : Boolean { return hiddenVideos.contains(videoUrl); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 68aef7bb..e802e9a6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -916,6 +916,7 @@ Polycentric Platform + Last Selected English diff --git a/app/src/stable/assets/sources/youtube b/app/src/stable/assets/sources/youtube index 0c11c566..fe6c3bdf 160000 --- a/app/src/stable/assets/sources/youtube +++ b/app/src/stable/assets/sources/youtube @@ -1 +1 @@ -Subproject commit 0c11c566918647fb6d3d010deeeb8312c94d3437 +Subproject commit fe6c3bdf3b454046987341327289086e9fb357e0 diff --git a/app/src/unstable/assets/sources/youtube b/app/src/unstable/assets/sources/youtube index 3b130157..c0a60181 160000 --- a/app/src/unstable/assets/sources/youtube +++ b/app/src/unstable/assets/sources/youtube @@ -1 +1 @@ -Subproject commit 3b1301572d3960a1fee8b2e5083aae9d52c13d14 +Subproject commit c0a601817d0840151fbca8fdfd8a41cab8ca9339