mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-08-10 10:09:26 +00:00
Easier search type switching on results page, fix search result click channels
This commit is contained in:
parent
fdaf41b605
commit
c26e9c281f
3 changed files with 43 additions and 2 deletions
|
@ -2,9 +2,11 @@ package com.futo.platformplayer.fragment.mainactivity.main
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.view.allViews
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.futo.platformplayer.Settings
|
||||
import com.futo.platformplayer.UIDialogs
|
||||
|
@ -23,6 +25,8 @@ import com.futo.platformplayer.models.SearchType
|
|||
import com.futo.platformplayer.states.StateMeta
|
||||
import com.futo.platformplayer.states.StatePlatform
|
||||
import com.futo.platformplayer.views.FeedStyle
|
||||
import com.futo.platformplayer.views.ToggleBar
|
||||
import com.futo.platformplayer.views.others.RadioGroupView
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
@ -114,6 +118,25 @@ class ContentSearchResultsFragment : MainFragment() {
|
|||
}
|
||||
|
||||
setPreviewsEnabled(Settings.instance.search.previewFeedItems);
|
||||
|
||||
initializeToolbar();
|
||||
}
|
||||
|
||||
fun initializeToolbar(){
|
||||
if(_toolbarContentView.allViews.any { it is RadioGroupView })
|
||||
_toolbarContentView.removeView(_toolbarContentView.allViews.find { it is RadioGroupView });
|
||||
|
||||
val radioGroup = RadioGroupView(context);
|
||||
radioGroup.onSelectedChange.subscribe {
|
||||
|
||||
if (it.size != 1)
|
||||
setSearchType(SearchType.VIDEO);
|
||||
else
|
||||
setSearchType((it[0] ?: SearchType.VIDEO) as SearchType);
|
||||
}
|
||||
radioGroup?.setOptions(listOf(Pair("Media", SearchType.VIDEO), Pair("Creators", SearchType.CREATOR), Pair("Playlists", SearchType.PLAYLIST)), listOf(_searchType), false, true)
|
||||
|
||||
_toolbarContentView.addView(radioGroup);
|
||||
}
|
||||
|
||||
override fun cleanup() {
|
||||
|
|
|
@ -45,6 +45,10 @@ open class ChannelView : LinearLayout {
|
|||
_buttonSubscribe = findViewById(R.id.button_subscribe);
|
||||
_platformIndicator = findViewById(R.id.platform_indicator);
|
||||
|
||||
//_textName.setOnClickListener { currentChannel?.let { onClick.emit(it) }; }
|
||||
//_creatorThumbnail.setOnClickListener { currentChannel?.let { onClick.emit(it) }; }
|
||||
//_textMetadata.setOnClickListener { currentChannel?.let { onClick.emit(it) }; }
|
||||
|
||||
if (_tiny) {
|
||||
_buttonSubscribe.visibility = View.GONE;
|
||||
_textMetadata.visibility = View.GONE;
|
||||
|
@ -66,8 +70,11 @@ open class ChannelView : LinearLayout {
|
|||
open fun bind(content: IPlatformContent) {
|
||||
isClickable = true;
|
||||
|
||||
if(content !is IPlatformChannelContent)
|
||||
return
|
||||
if(content !is IPlatformChannelContent) {
|
||||
currentChannel = null;
|
||||
return;
|
||||
}
|
||||
currentChannel = content;
|
||||
|
||||
_creatorThumbnail.setThumbnail(content.thumbnail, false);
|
||||
_textName.text = content.name;
|
||||
|
|
|
@ -13,6 +13,17 @@ class RadioGroupView : FlexboxLayout {
|
|||
|
||||
val selectedOptions = arrayListOf<Any?>();
|
||||
val onSelectedChange = Event1<List<Any?>>();
|
||||
constructor(context: Context) : super(context) {
|
||||
flexWrap = FlexWrap.WRAP;
|
||||
_padding_px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _padding_dp, context.resources.displayMetrics).toInt();
|
||||
|
||||
if (isInEditMode) {
|
||||
setOptions(listOf("Example 1" to 1, "Example 2" to 2, "Example 3" to 3, "Example 4" to 4, "Example 5" to 5), listOf("Example 1", "Example 2"),
|
||||
multiSelect = true,
|
||||
atLeastOne = false
|
||||
);
|
||||
}
|
||||
}
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
flexWrap = FlexWrap.WRAP;
|
||||
_padding_px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, _padding_dp, context.resources.displayMetrics).toInt();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue