mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
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))
|
||||||
} ?: run {
|
isProgressVisible = true
|
||||||
|
} else {
|
||||||
|
isProgressVisible = false
|
||||||
isSeriesVisible = false
|
isSeriesVisible = false
|
||||||
}
|
}
|
||||||
|
} ?: run {
|
||||||
|
isProgressVisible = 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,39 +667,41 @@
|
||||||
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:orientation="horizontal"
|
android:paddingTop="10dp"
|
||||||
|
android:id="@+id/result_resume_progress_holder"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.core.widget.ContentLoadingProgressBar
|
||||||
|
android:layout_height="20dp"
|
||||||
|
tools:progress="50"
|
||||||
|
android:id="@+id/result_resume_series_progress"
|
||||||
|
android:indeterminate="false"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:progressBackgroundTint="?attr/colorPrimary"
|
||||||
|
android:max="100"
|
||||||
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:progress="0"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_weight="1"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<androidx.core.widget.ContentLoadingProgressBar
|
<TextView
|
||||||
android:layout_height="20dp"
|
android:id="@+id/result_resume_series_progress_text"
|
||||||
tools:progress="50"
|
android:layout_gravity="center"
|
||||||
android:id="@+id/result_resume_series_progress"
|
android:paddingStart="10dp"
|
||||||
android:indeterminate="false"
|
android:gravity="center"
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
tools:text="69m\nremaining"
|
||||||
android:progressBackgroundTint="?attr/colorPrimary"
|
android:layout_weight="0"
|
||||||
android:max="100"
|
android:textColor="?attr/grayTextColor"
|
||||||
android:layout_gravity="end|center_vertical"
|
android:layout_width="wrap_content"
|
||||||
android:progress="0"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
tools:ignore="RtlSymmetry" />
|
||||||
android:layout_weight="1"
|
|
||||||
android:visibility="visible"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/result_resume_series_progress_text"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:paddingStart="10dp"
|
|
||||||
android:gravity="center"
|
|
||||||
tools:text="69m\nremaining"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:textColor="?attr/grayTextColor"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
tools:ignore="RtlSymmetry" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!--<TextView
|
<!--<TextView
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
|
Loading…
Reference in a new issue