mirror of
https://gitlab.futo.org/videostreaming/grayjay.git
synced 2025-04-19 19:14:51 +00:00
chapters ui on text press
This commit is contained in:
parent
3c05521a5b
commit
b652597924
2 changed files with 29 additions and 9 deletions
|
@ -404,6 +404,10 @@ class VideoDetailView : ConstraintLayout {
|
|||
_monetization = findViewById(R.id.monetization);
|
||||
_player.attachPlayer();
|
||||
|
||||
_player.onChapterClicked.subscribe {
|
||||
showChaptersUI();
|
||||
};
|
||||
|
||||
|
||||
_buttonSubscribe.onSubscribed.subscribe {
|
||||
_slideUpOverlay = UISlideOverlays.showSubscriptionOptionsOverlay(it, _overlayContainer);
|
||||
|
@ -863,6 +867,22 @@ class VideoDetailView : ConstraintLayout {
|
|||
_cast.stopAllGestures();
|
||||
}
|
||||
|
||||
fun showChaptersUI(){
|
||||
video?.let {
|
||||
try {
|
||||
_chapters?.let {
|
||||
if(it.size == 0)
|
||||
return@let;
|
||||
_container_content_chapters.setChapters(_chapters);
|
||||
switchContentView(_container_content_chapters);
|
||||
}
|
||||
}
|
||||
catch(ex: Throwable) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateMoreButtons() {
|
||||
val isLimitedVersion = video?.url != null && StatePlatform.instance.getContentClientOrNull(video!!.url)?.let {
|
||||
if (it is JSClient)
|
||||
|
@ -879,15 +899,7 @@ class VideoDetailView : ConstraintLayout {
|
|||
_chapters?.let {
|
||||
if(it != null && it.size > 0)
|
||||
RoundButton(context, R.drawable.ic_list, "Chapters", TAG_CHAPTERS) {
|
||||
video?.let {
|
||||
try {
|
||||
_container_content_chapters.setChapters(_chapters);
|
||||
switchContentView(_container_content_chapters);
|
||||
}
|
||||
catch(ex: Throwable) {
|
||||
|
||||
}
|
||||
}
|
||||
showChaptersUI();
|
||||
}
|
||||
else null
|
||||
},
|
||||
|
|
|
@ -145,6 +145,8 @@ class FutoVideoPlayer : FutoVideoPlayerBase {
|
|||
val onVideoClicked = Event0();
|
||||
val onTimeBarChanged = Event2<Long, Long>();
|
||||
|
||||
val onChapterClicked = Event1<IChapter>();
|
||||
|
||||
@OptIn(UnstableApi::class)
|
||||
constructor(context: Context, attrs: AttributeSet? = null) : super(PLAYER_STATE_NAME, context, attrs) {
|
||||
LayoutInflater.from(context).inflate(R.layout.video_view, this, true);
|
||||
|
@ -185,6 +187,12 @@ class FutoVideoPlayer : FutoVideoPlayerBase {
|
|||
_control_duration_fullscreen = _videoControls_fullscreen.findViewById(R.id.text_duration);
|
||||
_control_pause_fullscreen = _videoControls_fullscreen.findViewById(R.id.button_pause);
|
||||
|
||||
_control_chapter.setOnClickListener {
|
||||
_currentChapter?.let {
|
||||
onChapterClicked.emit(it);
|
||||
}
|
||||
}
|
||||
|
||||
val castVisibility = if (Settings.instance.casting.enabled) View.VISIBLE else View.GONE
|
||||
_control_cast.visibility = castVisibility
|
||||
_control_cast_fullscreen.visibility = castVisibility
|
||||
|
|
Loading…
Add table
Reference in a new issue