forked from recloudstream/cloudstream
resume progress for movies
This commit is contained in:
parent
aa146c7b98
commit
c9cd73e07f
2 changed files with 51 additions and 35 deletions
|
@ -1077,8 +1077,9 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
|
||||||
observe(viewModel.episodes) { episodeList ->
|
observe(viewModel.episodes) { episodeList ->
|
||||||
lateFixDownloadButton(episodeList.size <= 1) // movies can have multible parts but still be *movies* this will fix this
|
lateFixDownloadButton(episodeList.size <= 1) // movies can have multible parts but still be *movies* this will fix this
|
||||||
var isSeriesVisible = false
|
var isSeriesVisible = false
|
||||||
|
var isProgressVisible = false
|
||||||
DataStoreHelper.getLastWatched(currentId)?.let { resume ->
|
DataStoreHelper.getLastWatched(currentId)?.let { resume ->
|
||||||
if (currentIsMovie == false && episodeList.size >= 3) {
|
if (currentIsMovie == false) {
|
||||||
isSeriesVisible = true
|
isSeriesVisible = true
|
||||||
|
|
||||||
result_resume_series_button?.setOnClickListener {
|
result_resume_series_button?.setOnClickListener {
|
||||||
|
@ -1092,20 +1093,33 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
|
||||||
"${getString(R.string.episode)} ${resume.episode}"
|
"${getString(R.string.episode)} ${resume.episode}"
|
||||||
else
|
else
|
||||||
" \"${getString(R.string.season_short)}${resume.season}:${getString(R.string.episode_short)}${resume.episode}\""
|
" \"${getString(R.string.season_short)}${resume.season}:${getString(R.string.episode_short)}${resume.episode}\""
|
||||||
|
}
|
||||||
|
|
||||||
getViewPos(resume.episodeId)?.let { viewPos ->
|
getViewPos(resume.episodeId)?.let { viewPos ->
|
||||||
|
if(viewPos.position > 30_000L || currentIsMovie == false) { // first 30s will not show for movies
|
||||||
result_resume_series_progress?.apply {
|
result_resume_series_progress?.apply {
|
||||||
max = (viewPos.duration / 1000).toInt()
|
max = (viewPos.duration / 1000).toInt()
|
||||||
progress = (viewPos.position / 1000).toInt()
|
progress = (viewPos.position / 1000).toInt()
|
||||||
}
|
}
|
||||||
result_resume_series_progress_text?.text =
|
result_resume_series_progress_text?.text =
|
||||||
getString(R.string.resume_time_left).format((viewPos.duration - viewPos.position) / (60_000))
|
getString(R.string.resume_time_left).format((viewPos.duration - viewPos.position) / (60_000))
|
||||||
|
isProgressVisible = true
|
||||||
|
} else {
|
||||||
|
isProgressVisible = false
|
||||||
|
isSeriesVisible = false
|
||||||
|
}
|
||||||
} ?: run {
|
} ?: run {
|
||||||
|
isProgressVisible = false
|
||||||
isSeriesVisible = false
|
isSeriesVisible = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
result_series_parent?.isVisible = isSeriesVisible
|
result_series_parent?.isVisible = isSeriesVisible
|
||||||
|
result_resume_progress_holder?.isVisible = isProgressVisible
|
||||||
|
context?.getString(if (isProgressVisible) R.string.resume else R.string.play_movie_button)
|
||||||
|
?.let {
|
||||||
|
result_play_movie?.text = it
|
||||||
|
}
|
||||||
|
|
||||||
when (startAction) {
|
when (startAction) {
|
||||||
START_ACTION_RESUME_LATEST -> {
|
START_ACTION_RESUME_LATEST -> {
|
||||||
|
@ -1354,10 +1368,10 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
|
||||||
|
|
||||||
result_poster_holder?.visibility = VISIBLE
|
result_poster_holder?.visibility = VISIBLE
|
||||||
|
|
||||||
result_play_movie?.text =
|
/*result_play_movie?.text =
|
||||||
if (d.type == TvType.Torrent) getString(R.string.play_torrent_button) else getString(
|
if (d.type == TvType.Torrent) getString(R.string.play_torrent_button) else getString(
|
||||||
R.string.play_movie_button
|
R.string.play_movie_button
|
||||||
)
|
)*/
|
||||||
//result_plot_header?.text =
|
//result_plot_header?.text =
|
||||||
// if (d.type == TvType.Torrent) getString(R.string.torrent_plot) else getString(R.string.result_plot)
|
// if (d.type == TvType.Torrent) getString(R.string.torrent_plot) else getString(R.string.result_plot)
|
||||||
if (!d.plot.isNullOrEmpty()) {
|
if (!d.plot.isNullOrEmpty()) {
|
||||||
|
|
|
@ -667,8 +667,11 @@
|
||||||
tools:text="S1E1 Episode 1"
|
tools:text="S1E1 Episode 1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:id="@+id/result_resume_progress_holder"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
@ -700,7 +703,6 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
tools:ignore="RtlSymmetry" />
|
tools:ignore="RtlSymmetry" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
|
||||||
<!--<TextView
|
<!--<TextView
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:drawableLeft="@drawable/ic_baseline_play_arrow_24"
|
android:drawableLeft="@drawable/ic_baseline_play_arrow_24"
|
||||||
|
|
Loading…
Reference in a new issue