Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.lagradost.cloudstream3.ui.NoStateAdapter
import com.lagradost.cloudstream3.ui.ViewHolderState
import com.lagradost.cloudstream3.ui.download.button.DownloadStatusTell
import com.lagradost.cloudstream3.utils.AppContextUtils.getNameFull
import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual
import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos
import com.lagradost.cloudstream3.utils.ImageLoader.loadImage
import com.lagradost.cloudstream3.utils.VideoDownloadHelper
Expand Down Expand Up @@ -151,22 +152,12 @@ class DownloadAdapter(
downloadHeaderGotoChild.isVisible = false

val posDur = getViewPos(card.data.id)
watchProgressContainer.isVisible = true
downloadHeaderEpisodeProgress.apply {
isVisible = posDur != null
posDur?.let {
val max = (it.duration / 1000).toInt()
val progress = (it.position / 1000).toInt()

if (max > 0 && progress >= (0.95 * max).toInt()) {
playIcon.setImageResource(R.drawable.ic_baseline_check_24)
isVisible = false
} else {
playIcon.setImageResource(R.drawable.netflix_play)
this.max = max
this.progress = progress
isVisible = true
}
val visualPos = it.fixVisual()
max = (visualPos.duration / 1000).toInt()
progress = (visualPos.position / 1000).toInt()
}
}

Expand Down Expand Up @@ -199,7 +190,6 @@ class DownloadAdapter(
)
}

downloadHeaderInfo.isVisible = true
downloadButton.setDefaultClickListener(card.child, downloadHeaderInfo, onItemClickEvent)
downloadButton.isVisible = !isMultiDeleteState

Expand All @@ -220,7 +210,6 @@ class DownloadAdapter(
formattedSize: String
) {
downloadButton.resetViewData()
watchProgressContainer.isVisible = false
downloadButton.isVisible = false
downloadHeaderEpisodeProgress.isVisible = false
downloadHeaderGotoChild.isVisible = !isMultiDeleteState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,26 +209,14 @@ class EpisodeAdapter(
if (item.videoWatchState == VideoWatchState.Watched) {
// This cannot be done in getDisplayPosition() as when you have not watched something
// the duration and position is 0
//episodeProgress.max = 1
//episodeProgress.progress = 1
episodePlayIcon.setImageResource(R.drawable.ic_baseline_check_24)
episodeProgress.isVisible = false
episodeProgress.max = 1
episodeProgress.progress = 1
episodeProgress.isVisible = true
} else {
val displayPos = item.getDisplayPosition()
val durationSec = (item.duration / 1000).toInt()
val progressSec = (displayPos / 1000).toInt()

if (displayPos >= item.duration && displayPos > 0) {
episodePlayIcon.setImageResource(R.drawable.ic_baseline_check_24)
episodeProgress.isVisible = false
} else {
episodePlayIcon.setImageResource(R.drawable.netflix_play)
episodeProgress.apply {
max = durationSec
progress = progressSec
isVisible = displayPos > 0L
}
}
episodeProgress.max = (item.duration / 1000).toInt()
episodeProgress.progress = (displayPos / 1000).toInt()
episodeProgress.isVisible = displayPos > 0L
}

val posterVisible = !item.poster.isNullOrBlank()
Expand Down Expand Up @@ -423,24 +411,16 @@ class EpisodeAdapter(
episodeText.isSelected = true // is needed for text repeating

if (item.videoWatchState == VideoWatchState.Watched) {
episodePlayIcon.setImageResource(R.drawable.ic_baseline_check_24)
episodeProgress.isVisible = false
// This cannot be done in getDisplayPosition() as when you have not watched something
// the duration and position is 0
episodeProgress.max = 1
episodeProgress.progress = 1
episodeProgress.isVisible = true
} else {
val displayPos = item.getDisplayPosition()
val durationSec = (item.duration / 1000).toInt()
val progressSec = (displayPos / 1000).toInt()

if (displayPos >= item.duration && displayPos > 0) {
episodePlayIcon.setImageResource(R.drawable.ic_baseline_check_24)
episodeProgress.isVisible = false
} else {
episodePlayIcon.setImageResource(R.drawable.play_button_transparent)
episodeProgress.apply {
max = durationSec
progress = progressSec
isVisible = displayPos > 0L
}
}
episodeProgress.max = (item.duration / 1000).toInt()
episodeProgress.progress = (displayPos / 1000).toInt()
episodeProgress.isVisible = displayPos > 0L
}

itemView.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import android.widget.AbsListView
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.Toast
import androidx.core.view.isGone
import androidx.core.view.isInvisible
Expand Down Expand Up @@ -607,57 +608,58 @@ open class ResultFragmentPhone : FullScreenPlayer() {
}*/

observeNullable(viewModel.resumeWatching) { resume ->
if (resume == null) {
resultBinding?.resultResumeParent?.isVisible = false
return@observeNullable
}

resultBinding?.apply {
if (resume == null) {
resultResumeParent.isVisible = false
resultPlayParent.isVisible = true
resultResumeProgressHolder.isVisible = false
return@observeNullable
}
resultResumeParent.isVisible = true

val setEpisodeText: (Button) -> Unit = { button ->
button.text = context?.getNameFull(
resume.result.name,
resume.result.episode,
resume.result.season
)
}

resume.progress?.let { progress ->
resultNextSeriesButton.isVisible = false
resultResumeSeriesTitle.apply {
isVisible = !resume.isMovie
text =
if (resume.isMovie) null else context?.getNameFull(
resume.result.name,
resume.result.episode,
resume.result.season
)
}
if (resume.isMovie) {
resultPlayParent.isGone = true
resultResumeSeriesProgressText.isVisible = true
resultResumeSeriesProgressText.setText(progress.progressLeft)
}
resultResumeSeriesProgressText.setText(progress.progressLeft)

resultResumeSeriesProgress.apply {
isVisible = true
this.max = progress.maxProgress
max = progress.maxProgress
this.progress = progress.progress
}

if (!resume.isMovie) {
setEpisodeText(resultResumeSeriesButton)
resultMovieParent.isGone = true
}

resultResumeSeriesButton.isVisible = true
resultPlayMovie.isGone = true
resultResumeProgressHolder.isVisible = true

} ?: run {
resultResumeProgressHolder.isVisible = false
if (!resume.isMovie) {
resultResumeSeriesButton.isVisible = false
setEpisodeText(resultNextSeriesButton)
resultNextSeriesButton.isVisible = true
resultNextSeriesButton.text = context?.getNameFull(
resume.result.name,
resume.result.episode,
resume.result.season
)
resultMovieParent.isGone = true
} else {
resultResumeParent.isGone = true
}

resultResumeProgressHolder.isVisible = false
resultResumeSeriesProgress.isVisible = false
resultResumeSeriesTitle.isVisible = false
resultResumeSeriesProgressText.isVisible = false
}

resultResumeSeriesButton.setOnClickListener {
resumeAction(storedData, resume)
}
resultNextSeriesButton.setOnClickListener {
resumeAction(storedData, resume)
}
resultResumeSeriesButton.setOnClickListener { resumeAction(storedData, resume) }
resultNextSeriesButton.setOnClickListener { resumeAction(storedData, resume) }
}
}

Expand Down
10 changes: 8 additions & 2 deletions app/src/main/res/drawable/play_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@
<path
android:name="path"
android:pathData="M 421.44 17.5 C 336.15 17.5 253.011 44.513 184.01 94.646 C 115.009 144.778 63.626 215.5 37.27 296.616 C 10.914 377.732 10.914 465.148 37.27 546.264 C 63.626 627.38 115.009 698.102 184.01 748.234 C 253.011 798.367 336.15 825.38 421.44 825.38 C 506.73 825.38 589.869 798.367 658.87 748.234 C 727.871 698.102 779.254 627.38 805.61 546.264 C 831.966 465.148 831.966 377.732 805.61 296.616 C 779.254 215.5 727.871 144.778 658.87 94.646 C 589.869 44.513 506.73 17.5 421.44 17.5 Z"
android:fillColor="#B3000000"
android:fillColor="#66000000"
android:strokeWidth="1"/>
<path
android:name="path_2"
android:pathData="M 598.91 419.24 L 333.91 266.24 L 333.91 572.24 L 598.91 419.24 Z"
android:fillColor="#ffffff"
android:fillColor="#f2f2f2"
android:strokeWidth="1"/>
<path
android:name="path_1"
android:pathData="M 421.44 17.5 C 336.15 17.5 253.011 44.513 184.01 94.646 C 115.009 144.778 63.626 215.5 37.27 296.616 C 10.914 377.732 10.914 465.148 37.27 546.264 C 63.626 627.38 115.009 698.102 184.01 748.234 C 253.011 798.367 336.15 825.38 421.44 825.38 C 506.73 825.38 589.869 798.367 658.87 748.234 C 727.871 698.102 779.254 627.38 805.61 546.264 C 831.966 465.148 831.966 377.732 805.61 296.616 C 779.254 215.5 727.871 144.778 658.87 94.646 C 589.869 44.513 506.73 17.5 421.44 17.5 Z"
android:strokeColor="#f2f2f2"
android:strokeWidth="25"
android:strokeMiterLimit="10"/>
</vector>
52 changes: 19 additions & 33 deletions app/src/main/res/layout/download_child_episode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,30 @@
app:cardCornerRadius="@dimen/rounded_image_radius"
app:cardElevation="0dp">

<!-- <androidx.core.widget.ContentLoadingProgressBar-->
<!-- android:id="@+id/download_child_episode_progress"-->
<!-- style="@android:style/Widget.Material.ProgressBar.Horizontal"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="5dp"-->
<!-- android:layout_gravity="bottom"-->
<!-- android:layout_marginBottom="-1.5dp"-->
<!-- android:progressBackgroundTint="?attr/colorPrimary"-->
<!-- android:progressTint="?attr/colorPrimary"-->
<!-- tools:progress="50" />-->
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/download_child_episode_progress"
style="@android:style/Widget.Material.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_gravity="bottom"
android:layout_marginBottom="-1.5dp"
android:progressBackgroundTint="?attr/colorPrimary"
android:progressTint="?attr/colorPrimary"
tools:progress="50" />

<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?android:attr/selectableItemBackgroundBorderless">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">

<FrameLayout
android:id="@+id/watch_progress_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="5dp">

<ImageView
android:id="@+id/download_child_episode_play"
style="@style/ContinueWatchingPlayUnderlayProgress"
android:layout_margin="4dp"/>

<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/download_child_episode_progress"
style="@style/ContinueWatchingCircularProgress"
android:progress="50"/>
</FrameLayout>
<ImageView
android:id="@+id/download_child_episode_play"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:contentDescription="@string/episode_play_img_des"
android:src="@drawable/ic_baseline_play_arrow_24"
android:visibility="gone" />

<LinearLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -86,7 +72,7 @@
android:textColor="?attr/grayTextColor"
tools:text="128MB / 237MB" />
</LinearLayout>
</LinearLayout>

<com.lagradost.cloudstream3.ui.download.button.PieFetchButton
android:id="@+id/download_button"
android:layout_width="@dimen/download_size"
Expand Down
37 changes: 10 additions & 27 deletions app/src/main/res/layout/download_header_episode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
app:cardBackgroundColor="?attr/boxItemBackground"
app:cardCornerRadius="@dimen/rounded_image_radius">

<!-- <androidx.core.widget.ContentLoadingProgressBar-->
<!-- android:id="@+id/download_header_episode_progress"-->
<!-- style="@android:style/Widget.Material.ProgressBar.Horizontal"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="5dp"-->
<!-- android:layout_gravity="bottom"-->
<!-- android:layout_marginBottom="-1.5dp"-->
<!-- android:progressBackgroundTint="?attr/white"-->
<!-- android:progressTint="?attr/white"-->
<!-- tools:progress="50" />-->
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/download_header_episode_progress"
style="@android:style/Widget.Material.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_gravity="bottom"
android:layout_marginBottom="-1.5dp"
android:progressBackgroundTint="?attr/colorPrimary"
android:progressTint="?attr/colorPrimary"
tools:progress="50" />

<LinearLayout
android:layout_width="match_parent"
Expand All @@ -42,23 +42,6 @@
android:contentDescription="@string/episode_poster_img_des"
android:scaleType="centerCrop"
tools:src="@drawable/example_poster" />
<FrameLayout
android:id="@+id/watch_progress_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"
tools:visibility="visible">

<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/play_icon"
style="@style/DownloadHeaderPlayUnderlayProgress"
/>
<com.google.android.material.progressindicator.CircularProgressIndicator
android:id="@+id/download_header_episode_progress"
style="@style/DownloadHeaderCircularProgress"
tools:progress="100" />
</FrameLayout>
</androidx.cardview.widget.CardView>

<LinearLayout
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_downloads.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
android:nextFocusLeft="@id/navigation_downloads"
android:tag="@string/tv_no_focus_tag"
tools:listitem="@layout/download_header_episode" />

<TextView
android:id="@+id/text_no_downloads"
android:layout_width="wrap_content"
Expand Down
Loading