mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-09 09:39:51 +00:00
last selected comment section option and default
This commit is contained in:
parent
d42f104884
commit
cf3587f504
6 changed files with 31 additions and 6 deletions
|
@ -489,7 +489,7 @@ class Settings : FragmentedStorageFileJson() {
|
||||||
|
|
||||||
@FormField(R.string.default_comment_section, FieldForm.DROPDOWN, -1, 0)
|
@FormField(R.string.default_comment_section, FieldForm.DROPDOWN, -1, 0)
|
||||||
@DropdownFieldOptionsId(R.array.comment_sections)
|
@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)
|
@FormField(R.string.default_recommendations, FieldForm.TOGGLE, R.string.default_recommendations_description, 0)
|
||||||
var recommendationsDefault: Boolean = false;
|
var recommendationsDefault: Boolean = false;
|
||||||
|
|
|
@ -104,6 +104,7 @@ import com.futo.platformplayer.states.StateApp
|
||||||
import com.futo.platformplayer.states.StateDeveloper
|
import com.futo.platformplayer.states.StateDeveloper
|
||||||
import com.futo.platformplayer.states.StateDownloads
|
import com.futo.platformplayer.states.StateDownloads
|
||||||
import com.futo.platformplayer.states.StateHistory
|
import com.futo.platformplayer.states.StateHistory
|
||||||
|
import com.futo.platformplayer.states.StateMeta
|
||||||
import com.futo.platformplayer.states.StatePlatform
|
import com.futo.platformplayer.states.StatePlatform
|
||||||
import com.futo.platformplayer.states.StatePlayer
|
import com.futo.platformplayer.states.StatePlayer
|
||||||
import com.futo.platformplayer.states.StatePlaylists
|
import com.futo.platformplayer.states.StatePlaylists
|
||||||
|
@ -444,7 +445,8 @@ class VideoDetailView : ConstraintLayout {
|
||||||
|
|
||||||
if (StatePolycentric.instance.enabled) {
|
if (StatePolycentric.instance.enabled) {
|
||||||
_buttonPolycentric.setOnClickListener {
|
_buttonPolycentric.setOnClickListener {
|
||||||
setTabIndex(0)
|
setTabIndex(0);
|
||||||
|
StateMeta.instance.setLastCommentSection(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_buttonPolycentric.visibility = View.GONE
|
_buttonPolycentric.visibility = View.GONE
|
||||||
|
@ -456,6 +458,7 @@ class VideoDetailView : ConstraintLayout {
|
||||||
|
|
||||||
_buttonPlatform.setOnClickListener {
|
_buttonPlatform.setOnClickListener {
|
||||||
setTabIndex(1)
|
setTabIndex(1)
|
||||||
|
StateMeta.instance.setLastCommentSection(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
val layoutTop: LinearLayout = findViewById(R.id.layout_top);
|
val layoutTop: LinearLayout = findViewById(R.id.layout_top);
|
||||||
|
@ -1297,8 +1300,11 @@ class VideoDetailView : ConstraintLayout {
|
||||||
if (Settings.instance.comments.recommendationsDefault) {
|
if (Settings.instance.comments.recommendationsDefault) {
|
||||||
setTabIndex(2)
|
setTabIndex(2)
|
||||||
} else {
|
} else {
|
||||||
val commentType = !Settings.instance.other.polycentricEnabled || Settings.instance.comments.defaultCommentSection == 1
|
when(Settings.instance.comments.defaultCommentSection) {
|
||||||
setTabIndex(if (commentType) 1 else 0, true)
|
0 -> if(Settings.instance.other.polycentricEnabled) setTabIndex(0) else setTabIndex(1);
|
||||||
|
1 -> setTabIndex(1);
|
||||||
|
2 -> setTabIndex(StateMeta.instance.getLastCommentSection())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,29 @@ package com.futo.platformplayer.states
|
||||||
|
|
||||||
import com.futo.platformplayer.stores.FragmentedStorage
|
import com.futo.platformplayer.stores.FragmentedStorage
|
||||||
import com.futo.platformplayer.stores.StringHashSetStorage
|
import com.futo.platformplayer.stores.StringHashSetStorage
|
||||||
|
import com.futo.platformplayer.stores.StringStorage
|
||||||
|
|
||||||
class StateMeta {
|
class StateMeta {
|
||||||
val hiddenVideos = FragmentedStorage.get<StringHashSetStorage>("hiddenVideos");
|
val hiddenVideos = FragmentedStorage.get<StringHashSetStorage>("hiddenVideos");
|
||||||
val hiddenCreators = FragmentedStorage.get<StringHashSetStorage>("hiddenCreators");
|
val hiddenCreators = FragmentedStorage.get<StringHashSetStorage>("hiddenCreators");
|
||||||
|
|
||||||
|
val lastCommentSection = FragmentedStorage.get<StringStorage>("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 {
|
fun isVideoHidden(videoUrl: String) : Boolean {
|
||||||
return hiddenVideos.contains(videoUrl);
|
return hiddenVideos.contains(videoUrl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -916,6 +916,7 @@
|
||||||
<string-array name="comment_sections">
|
<string-array name="comment_sections">
|
||||||
<item>Polycentric</item>
|
<item>Polycentric</item>
|
||||||
<item>Platform</item>
|
<item>Platform</item>
|
||||||
|
<item>Last Selected</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string-array name="audio_languages">
|
<string-array name="audio_languages">
|
||||||
<item>English</item>
|
<item>English</item>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0c11c566918647fb6d3d010deeeb8312c94d3437
|
Subproject commit fe6c3bdf3b454046987341327289086e9fb357e0
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3b1301572d3960a1fee8b2e5083aae9d52c13d14
|
Subproject commit c0a601817d0840151fbca8fdfd8a41cab8ca9339
|
Loading…
Add table
Add a link
Reference in a new issue