testing movies

This commit is contained in:
reduplicated 2022-09-22 00:23:26 +02:00
parent 63e4e670c0
commit 45ea1a8d8e
12 changed files with 341 additions and 212 deletions

View file

@ -201,7 +201,7 @@ dependencies {
implementation 'me.xdrop:fuzzywuzzy:1.4.0' implementation 'me.xdrop:fuzzywuzzy:1.4.0'
// aria2c downloader // aria2c downloader
implementation 'com.github.LagradOst:Aria2cButton:master-SNAPSHOT' implementation 'com.github.LagradOst:Aria2cButton:v0.0.3'
} }
task androidSourcesJar(type: Jar) { task androidSourcesJar(type: Jar) {

View file

@ -0,0 +1,42 @@
package com.lagradost.cloudstream3.ui
import android.content.Context
import android.util.AttributeSet
import android.widget.TextView
import androidx.core.view.isVisible
import com.lagradost.cloudstream3.R
import com.lagradost.fetchbutton.aria2c.DownloadStatusTell
import com.lagradost.fetchbutton.aria2c.Metadata
import com.lagradost.fetchbutton.ui.PieFetchButton
class DownloadButton(context: Context, attributeSet: AttributeSet) :
PieFetchButton(context, attributeSet) {
var progressText: TextView? = null
var mainText: TextView? = null
override fun onAttachedToWindow() {
super.onAttachedToWindow()
progressText = findViewById(R.id.result_movie_download_text_precentage)
mainText = findViewById(R.id.result_movie_download_text)
}
override fun setStatus(status: DownloadStatusTell?) {
super.setStatus(status)
val txt = when (status) {
DownloadStatusTell.Paused -> R.string.download_paused
DownloadStatusTell.Active -> R.string.downloading
DownloadStatusTell.Complete -> R.string.downloaded
else -> R.string.download
}
mainText?.setText(txt)
}
override fun updateViewOnDownload(metadata: Metadata) {
super.updateViewOnDownload(metadata)
val isVis = metadata.progressPercentage > 0
progressText?.isVisible = isVis
if (isVis)
progressText?.text = "${metadata.progressPercentage}%"
}
}

View file

@ -9,6 +9,7 @@ import androidx.cardview.widget.CardView
import androidx.core.widget.ContentLoadingProgressBar import androidx.core.widget.ContentLoadingProgressBar
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.ui.result.ResultEpisode
import com.lagradost.cloudstream3.utils.AppUtils.getNameFull import com.lagradost.cloudstream3.utils.AppUtils.getNameFull
import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual import com.lagradost.cloudstream3.utils.DataStoreHelper.fixVisual
import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos
@ -30,6 +31,7 @@ data class VisualDownloadChildCached(
) )
data class DownloadClickEvent(val action: Int, val data: EasyDownloadButton.IMinimumData) data class DownloadClickEvent(val action: Int, val data: EasyDownloadButton.IMinimumData)
data class DownloadEpisodeClickEvent(val action: Int, val data: ResultEpisode)
class DownloadChildAdapter( class DownloadChildAdapter(
var cardList: List<VisualDownloadChildCached>, var cardList: List<VisualDownloadChildCached>,

View file

@ -0,0 +1,130 @@
package com.lagradost.cloudstream3.ui.result
import android.net.Uri
import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_DOWNLOAD
import com.lagradost.cloudstream3.ui.download.DownloadEpisodeClickEvent
import com.lagradost.cloudstream3.ui.player.DownloadFileGenerator
import com.lagradost.cloudstream3.utils.ExtractorUri
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIcons
import com.lagradost.fetchbutton.aria2c.DownloadStatusTell
import com.lagradost.fetchbutton.ui.PieFetchButton
object DownloadHelper {
fun PieFetchButton.play(card: ResultEpisode) {
val files = this.getVideos()
DownloadFileGenerator(
files.map { path ->
ExtractorUri(
uri = Uri.parse(path),
id = card.id,
parentId = card.parentId,
name = context.getString(R.string.downloaded_file), //click.data.name ?: keyInfo.displayName
season = card.season,
episode = card.episode,
headerName = card.headerName,
tvType = card.tvType,
//basePath = keyInfo.basePath,
//displayName = keyInfo.displayName,
//relativePath = keyInfo.relativePath,
)
}
)
}
fun PieFetchButton.setUp(
card: ResultEpisode,
downloadClickCallback: (DownloadEpisodeClickEvent) -> Unit
) {
setPersistentId(card.id.toLong())
setOnClickListener { view ->
if (view !is PieFetchButton) return@setOnClickListener
when (view.currentStatus) {
null, DownloadStatusTell.Removed -> {
view.setStatus(DownloadStatusTell.Waiting)
downloadClickCallback.invoke(
DownloadEpisodeClickEvent(
DOWNLOAD_ACTION_DOWNLOAD,
card
)
)
}
DownloadStatusTell.Paused -> {
view.popupMenuNoIcons(
listOf(
1 to R.string.resume,
2 to R.string.play_episode,
3 to R.string.delete
)
) {
when (itemId) {
1 -> if (!view.resumeDownload()) {
downloadClickCallback.invoke(
DownloadEpisodeClickEvent(
DOWNLOAD_ACTION_DOWNLOAD,
card
)
)
}
2 -> {
play(card)
}
3 -> {
view.deleteAllFiles()
}
}
}
}
DownloadStatusTell.Complete -> {
view.popupMenuNoIcons(
listOf(
2 to R.string.play_episode,
3 to R.string.delete
)
) {
when (itemId) {
2 -> {
play(card)
}
3 -> {
view.deleteAllFiles()
}
}
}
}
DownloadStatusTell.Active -> {
view.popupMenuNoIcons(
listOf(
4 to R.string.pause,
2 to R.string.play_episode,
3 to R.string.delete
)
) {
when (itemId) {
4 -> {
view.pauseDownload()
}
2 -> {
play(card)
}
3 -> {
view.deleteAllFiles()
}
}
}
}
DownloadStatusTell.Error -> {
view.redownload()
}
DownloadStatusTell.Waiting -> {
}
else -> {}
}
}
}
}

View file

@ -14,12 +14,11 @@ import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.button.MaterialButton import com.google.android.material.button.MaterialButton
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.ui.download.DownloadButtonViewHolder import com.lagradost.cloudstream3.ui.download.DownloadButtonViewHolder
import com.lagradost.cloudstream3.ui.download.DownloadClickEvent import com.lagradost.cloudstream3.ui.download.DownloadEpisodeClickEvent
import com.lagradost.cloudstream3.ui.result.DownloadHelper.setUp
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
import com.lagradost.cloudstream3.utils.AppUtils.html import com.lagradost.cloudstream3.utils.AppUtils.html
import com.lagradost.cloudstream3.utils.UIHelper.setImage import com.lagradost.cloudstream3.utils.UIHelper.setImage
import com.lagradost.fetchbutton.aria2c.UriRequest
import com.lagradost.fetchbutton.aria2c.newUriRequest
import kotlinx.android.synthetic.main.result_episode.view.* import kotlinx.android.synthetic.main.result_episode.view.*
import kotlinx.android.synthetic.main.result_episode.view.episode_text import kotlinx.android.synthetic.main.result_episode.view.episode_text
import kotlinx.android.synthetic.main.result_episode_large.view.episode_filler import kotlinx.android.synthetic.main.result_episode_large.view.episode_filler
@ -53,7 +52,7 @@ data class EpisodeClickEvent(val action: Int, val data: ResultEpisode)
class EpisodeAdapter( class EpisodeAdapter(
private val hasDownloadSupport: Boolean, private val hasDownloadSupport: Boolean,
private val clickCallback: (EpisodeClickEvent) -> Unit, private val clickCallback: (EpisodeClickEvent) -> Unit,
private val downloadClickCallback: suspend ResultEpisode.() -> List<UriRequest>, private val downloadClickCallback: (DownloadEpisodeClickEvent) -> Unit,
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { ) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var cardList: MutableList<ResultEpisode> = mutableListOf() private var cardList: MutableList<ResultEpisode> = mutableListOf()
@ -126,7 +125,7 @@ class EpisodeAdapter(
itemView: View, itemView: View,
private val hasDownloadSupport: Boolean, private val hasDownloadSupport: Boolean,
private val clickCallback: (EpisodeClickEvent) -> Unit, private val clickCallback: (EpisodeClickEvent) -> Unit,
private val downloadClickCallback : suspend ResultEpisode.() -> List<UriRequest>, private val downloadClickCallback: (DownloadEpisodeClickEvent) -> Unit,
) : RecyclerView.ViewHolder(itemView) { ) : RecyclerView.ViewHolder(itemView) {
//override var downloadButton = EasyDownloadButton() //override var downloadButton = EasyDownloadButton()
@ -151,11 +150,8 @@ class EpisodeAdapter(
val downloadButton = parentView.result_episode_download val downloadButton = parentView.result_episode_download
downloadButton.setPersistentId(card.id.toLong())
downloadButton.isVisible = hasDownloadSupport downloadButton.isVisible = hasDownloadSupport
downloadButton.setDefaultClickListener { downloadButton.setUp(card, downloadClickCallback)
downloadClickCallback.invoke(card)
}
val name = val name =
if (card.name == null) "${episodeText.context.getString(R.string.episode)} ${card.episode}" else "${card.episode}. ${card.name}" if (card.name == null) "${episodeText.context.getString(R.string.episode)} ${card.episode}" else "${card.episode}. ${card.name}"

View file

@ -34,12 +34,8 @@ import com.lagradost.cloudstream3.TvType
import com.lagradost.cloudstream3.mvvm.* import com.lagradost.cloudstream3.mvvm.*
import com.lagradost.cloudstream3.syncproviders.providers.Kitsu import com.lagradost.cloudstream3.syncproviders.providers.Kitsu
import com.lagradost.cloudstream3.ui.WatchType import com.lagradost.cloudstream3.ui.WatchType
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_DOWNLOAD
import com.lagradost.cloudstream3.ui.download.DownloadButtonSetup.handleDownloadClick
import com.lagradost.cloudstream3.ui.download.DownloadViewModel
import com.lagradost.cloudstream3.ui.download.EasyDownloadButton
import com.lagradost.cloudstream3.ui.quicksearch.QuickSearchFragment import com.lagradost.cloudstream3.ui.quicksearch.QuickSearchFragment
import com.lagradost.cloudstream3.ui.result.ResultViewModel2.Companion.getDownloadRequest import com.lagradost.cloudstream3.ui.result.DownloadHelper.setUp
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
import com.lagradost.cloudstream3.utils.* import com.lagradost.cloudstream3.utils.*
@ -47,21 +43,19 @@ import com.lagradost.cloudstream3.utils.AppUtils.getNameFull
import com.lagradost.cloudstream3.utils.AppUtils.html import com.lagradost.cloudstream3.utils.AppUtils.html
import com.lagradost.cloudstream3.utils.AppUtils.loadCache import com.lagradost.cloudstream3.utils.AppUtils.loadCache
import com.lagradost.cloudstream3.utils.AppUtils.openBrowser import com.lagradost.cloudstream3.utils.AppUtils.openBrowser
import com.lagradost.cloudstream3.utils.Coroutines.ioWorkSafe
import com.lagradost.cloudstream3.utils.Coroutines.main
import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showBottomDialog
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import kotlinx.android.synthetic.main.download_button.*
import kotlinx.android.synthetic.main.fragment_result.* import kotlinx.android.synthetic.main.fragment_result.*
import kotlinx.android.synthetic.main.fragment_result.result_cast_items import kotlinx.android.synthetic.main.fragment_result.result_cast_items
import kotlinx.android.synthetic.main.fragment_result.result_cast_text import kotlinx.android.synthetic.main.fragment_result.result_cast_text
import kotlinx.android.synthetic.main.fragment_result.result_coming_soon import kotlinx.android.synthetic.main.fragment_result.result_coming_soon
import kotlinx.android.synthetic.main.fragment_result.result_data_holder import kotlinx.android.synthetic.main.fragment_result.result_data_holder
import kotlinx.android.synthetic.main.fragment_result.result_description import kotlinx.android.synthetic.main.fragment_result.result_description
import kotlinx.android.synthetic.main.fragment_result.result_download_movie
import kotlinx.android.synthetic.main.fragment_result.result_episode_loading import kotlinx.android.synthetic.main.fragment_result.result_episode_loading
import kotlinx.android.synthetic.main.fragment_result.result_episodes import kotlinx.android.synthetic.main.fragment_result.result_episodes
import kotlinx.android.synthetic.main.fragment_result.result_error_text import kotlinx.android.synthetic.main.fragment_result.result_error_text
@ -74,11 +68,6 @@ import kotlinx.android.synthetic.main.fragment_result.result_meta_rating
import kotlinx.android.synthetic.main.fragment_result.result_meta_site import kotlinx.android.synthetic.main.fragment_result.result_meta_site
import kotlinx.android.synthetic.main.fragment_result.result_meta_type import kotlinx.android.synthetic.main.fragment_result.result_meta_type
import kotlinx.android.synthetic.main.fragment_result.result_meta_year import kotlinx.android.synthetic.main.fragment_result.result_meta_year
import kotlinx.android.synthetic.main.fragment_result.result_movie_download_icon
import kotlinx.android.synthetic.main.fragment_result.result_movie_download_text
import kotlinx.android.synthetic.main.fragment_result.result_movie_download_text_precentage
import kotlinx.android.synthetic.main.fragment_result.result_movie_progress_downloaded
import kotlinx.android.synthetic.main.fragment_result.result_movie_progress_downloaded_holder
import kotlinx.android.synthetic.main.fragment_result.result_next_airing import kotlinx.android.synthetic.main.fragment_result.result_next_airing
import kotlinx.android.synthetic.main.fragment_result.result_next_airing_time import kotlinx.android.synthetic.main.fragment_result.result_next_airing_time
import kotlinx.android.synthetic.main.fragment_result.result_no_episodes import kotlinx.android.synthetic.main.fragment_result.result_no_episodes
@ -255,10 +244,8 @@ open class ResultFragment : ResultTrailerPlayer() {
return inflater.inflate(resultLayout, container, false) return inflater.inflate(resultLayout, container, false)
} }
private var downloadButton: EasyDownloadButton? = null
override fun onDestroyView() { override fun onDestroyView() {
updateUIListener = null updateUIListener = null
downloadButton?.dispose()
super.onDestroyView() super.onDestroyView()
} }
@ -345,7 +332,12 @@ open class ResultFragment : ResultTrailerPlayer() {
return@setOnLongClickListener true return@setOnLongClickListener true
} }
main {
result_download_movie?.setUp(ep) {
viewModel.download(it.data)
}
result_download_movie?.isVisible = true
/*main {
val file = val file =
ioWorkSafe { ioWorkSafe {
context?.let { context?.let {
@ -390,11 +382,12 @@ open class ResultFragment : ResultTrailerPlayer() {
} }
} }
result_movie_progress_downloaded_holder?.isVisible = true result_movie_progress_downloaded_holder?.isVisible = true
} }*/
} }
} }
else -> { else -> {
result_movie_progress_downloaded_holder?.isVisible = false //result_movie_progress_downloaded_holder?.isVisible = false
result_download_movie?.isVisible = false
result_play_movie?.isVisible = false result_play_movie?.isVisible = false
} }
} }
@ -459,7 +452,14 @@ open class ResultFragment : ResultTrailerPlayer() {
val storedData = getStoredData(activity ?: context ?: return) ?: return val storedData = getStoredData(activity ?: context ?: return) ?: return
//viewModel.clear() //viewModel.clear()
viewModel.load(activity, storedData.url ?: return, storedData.apiName, storedData.showFillers, storedData.dubStatus, storedData.start) viewModel.load(
activity,
storedData.url ?: return,
storedData.apiName,
storedData.showFillers,
storedData.dubStatus,
storedData.start
)
} }
} }
@ -508,8 +508,8 @@ open class ResultFragment : ResultTrailerPlayer() {
{ episodeClick -> { episodeClick ->
viewModel.handleAction(activity, episodeClick) viewModel.handleAction(activity, episodeClick)
}, },
{ { clickEvent ->
viewModel.getRequest(this)?.links ?: emptyList() viewModel.download(clickEvent.data)
//handleDownloadClick(activity, downloadClickEvent) //handleDownloadClick(activity, downloadClickEvent)
} }
) )
@ -918,7 +918,14 @@ open class ResultFragment : ResultTrailerPlayer() {
if (storedData?.url != null) { if (storedData?.url != null) {
result_reload_connectionerror.setOnClickListener { result_reload_connectionerror.setOnClickListener {
viewModel.load(activity, storedData.url, storedData.apiName, storedData.showFillers, storedData.dubStatus, storedData.start) viewModel.load(
activity,
storedData.url,
storedData.apiName,
storedData.showFillers,
storedData.dubStatus,
storedData.start
)
} }
result_reload_connection_open_in_browser?.setOnClickListener { result_reload_connection_open_in_browser?.setOnClickListener {
@ -954,7 +961,14 @@ open class ResultFragment : ResultTrailerPlayer() {
if (restart || !viewModel.hasLoaded()) { if (restart || !viewModel.hasLoaded()) {
//viewModel.clear() //viewModel.clear()
viewModel.load(activity, storedData.url, storedData.apiName, storedData.showFillers, storedData.dubStatus, storedData.start) viewModel.load(
activity,
storedData.url,
storedData.apiName,
storedData.showFillers,
storedData.dubStatus,
storedData.start
)
} }
} }
} }

View file

@ -52,9 +52,11 @@ import com.lagradost.cloudstream3.utils.DataStoreHelper.setDub
import com.lagradost.cloudstream3.utils.DataStoreHelper.setResultEpisode import com.lagradost.cloudstream3.utils.DataStoreHelper.setResultEpisode
import com.lagradost.cloudstream3.utils.DataStoreHelper.setResultSeason import com.lagradost.cloudstream3.utils.DataStoreHelper.setResultSeason
import com.lagradost.cloudstream3.utils.UIHelper.checkWrite import com.lagradost.cloudstream3.utils.UIHelper.checkWrite
import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute
import com.lagradost.cloudstream3.utils.UIHelper.navigate import com.lagradost.cloudstream3.utils.UIHelper.navigate
import com.lagradost.cloudstream3.utils.UIHelper.requestRW import com.lagradost.cloudstream3.utils.UIHelper.requestRW
import com.lagradost.cloudstream3.utils.VideoDownloadManager.getBasePath import com.lagradost.cloudstream3.utils.VideoDownloadManager.getBasePath
import com.lagradost.fetchbutton.NotificationMetaData
import com.lagradost.fetchbutton.aria2c.Aria2Starter import com.lagradost.fetchbutton.aria2c.Aria2Starter
import com.lagradost.fetchbutton.aria2c.UriRequest import com.lagradost.fetchbutton.aria2c.UriRequest
import com.lagradost.fetchbutton.aria2c.newUriRequest import com.lagradost.fetchbutton.aria2c.newUriRequest
@ -648,6 +650,29 @@ class ResultViewModel2 : ViewModel() {
System.currentTimeMillis(), System.currentTimeMillis(),
) )
) )
val notification = AcraApplication.context?.let { ctx ->
val rowTwoExtra = if (episode.name != null) " - ${episode.name}\n" else ""
val rowTwo = if (episode.season != null && episode.episode > 0) {
"${ctx.getString(R.string.season_short)}${episode.season}:${ctx.getString(R.string.episode_short)}${episode.episode}" + rowTwoExtra
} else if (episode.episode > 0) {
"${ctx.getString(R.string.episode)} ${episode.episode}" + rowTwoExtra
} else {
(episode.name ?: "") + ""
}
NotificationMetaData(
episode.id,
iconColor = ctx.colorFromAttribute(R.attr.colorPrimary),
posterUrl = currentPoster,
contentTitle = currentHeaderName,
secondRow = rowTwo,
subText = null,
linkName = currentHeaderName,
rowTwoExtra = null
)
}
val linkRequests = links.filter { link -> !link.isM3u8 }.map { link -> val linkRequests = links.filter { link -> !link.isM3u8 }.map { link ->
newUriRequest( newUriRequest(
episode.id.toLong(), link.url, episode.id.toLong(), link.url,
@ -656,7 +681,8 @@ class ResultViewModel2 : ViewModel() {
AcraApplication.context ?: return null, AcraApplication.context ?: return null,
meta meta
), ".mp4" ), ".mp4"
), folder, link.headers, USER_AGENT ), folder, link.headers, USER_AGENT,
notificationMetaData = notification
) )
} }
@ -668,13 +694,14 @@ class ResultViewModel2 : ViewModel() {
true true
) )
) )
} }.distinctBy { it.url }
.map { ExtractorSubtitleLink(it.name, it.url, "") } //.map { ExtractorSubtitleLink(it.name, it.url, "") }
.map { link -> .map { link ->
val fileName = VideoDownloadManager.getFileName( val fileName = VideoDownloadManager.getFileName(
AcraApplication.context ?: return null, AcraApplication.context ?: return null,
meta meta
) ) + ".vtt"
newUriRequest(0, link.url, fileName, folder, link.headers, USER_AGENT) newUriRequest(0, link.url, fileName, folder, link.headers, USER_AGENT)
//downloadSubtitle(context, link, fileName, folder) //downloadSubtitle(context, link, fileName, folder)
} }
@ -1066,6 +1093,19 @@ class ResultViewModel2 : ViewModel() {
handleEpisodeClickEvent(activity, click) handleEpisodeClickEvent(activity, click)
} }
private fun downloadFromRequest(req: DownloadRequest) {
Aria2Starter.download(req.links)
for (sub in req.subs.take(5)) {
Aria2Starter.download(sub)
}
}
fun download(card: ResultEpisode) = ioSafe {
getRequest(card)?.let { req ->
downloadFromRequest(req)
}
}
suspend fun getRequest(card: ResultEpisode): DownloadRequest? { suspend fun getRequest(card: ResultEpisode): DownloadRequest? {
val response = currentResponse ?: return null val response = currentResponse ?: return null
return downloadEpisode( return downloadEpisode(
@ -1202,7 +1242,7 @@ class ResultViewModel2 : ViewModel() {
listOf(result.links[index]), listOf(result.links[index]),
result.subs, result.subs,
) ?: return@ioSafe ) ?: return@ioSafe
Aria2Starter.client?.downloadFailQueue(req.links) { _, _ -> } downloadFromRequest(req)
} }
showToast( showToast(
activity, activity,

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<com.lagradost.cloudstream3.ui.DownloadButton
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/result_download_movie"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
app:aria2c_layout="@layout/download_button_layout" />

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
style="@style/BlackButton"
android:layout_width="match_parent"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:visibility="visible" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<include
layout="@layout/download_button_view"
android:layout_width="40dp"
android:layout_height="40dp" />
<TextView
android:id="@+id/result_movie_download_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:letterSpacing="0.09"
android:textAllCaps="false"
android:textColor="?attr/textColor"
android:textSize="15sp"
android:textStyle="bold"
tools:text="Downloading" />
<TextView
android:id="@+id/result_movie_download_text_precentage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:letterSpacing="0.09"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:textAllCaps="false"
android:textColor="?attr/textColor"
android:textSize="15sp"
android:textStyle="bold"
android:visibility="gone"
tools:text="68%"
tools:visibility="visible" />
</LinearLayout>
</FrameLayout>

View file

@ -570,89 +570,7 @@
android:focusable="true" android:focusable="true"
android:layout_width="match_parent" />--> android:layout_width="match_parent" />-->
<FrameLayout <include layout="@layout/download_button" />
android:id="@+id/result_movie_progress_downloaded_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/result_download_movie"
style="@style/BlackButton"
android:layout_width="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:clickable="true"
android:focusable="true"
android:nextFocusUp="@id/result_play_movie"
android:nextFocusDown="@id/result_season_button"
android:visibility="visible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/result_movie_progress_downloaded"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="end|center_vertical"
android:layout_margin="5dp"
android:background="@drawable/circle_shape_cs3"
android:indeterminate="false"
android:max="100"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:progress="30"
android:progressDrawable="@drawable/circular_progress_bar_filled_cs3"
android:visibility="visible" />
<ImageView
android:id="@+id/result_movie_download_icon"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/download"
android:src="@drawable/ic_baseline_play_arrow_24"
android:visibility="visible"
app:tint="?attr/white" />
<TextView
android:id="@+id/result_movie_download_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:letterSpacing="0.09"
android:textAllCaps="false"
android:textColor="?attr/textColor"
android:textSize="15sp"
android:textStyle="bold"
tools:text="Downloading" />
<TextView
android:id="@+id/result_movie_download_text_precentage"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:letterSpacing="0.09"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:textAllCaps="false"
android:textColor="?attr/textColor"
android:textSize="15sp"
android:textStyle="bold"
android:visibility="gone"
tools:text="68%" />
</LinearLayout>
</FrameLayout>
<!--<androidx.core.widget.ContentLoadingProgressBar <!--<androidx.core.widget.ContentLoadingProgressBar
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -418,109 +418,25 @@
</com.google.android.material.button.MaterialButton> </com.google.android.material.button.MaterialButton>
<include
<FrameLayout layout="@layout/download_button"
android:nextFocusRight="@id/result_bookmark_button"
android:id="@+id/result_movie_progress_downloaded_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_weight="1" android:layout_weight="1"
android:minWidth="250dp"> android:minWidth="250dp"
android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/result_download_movie"
style="@style/BlackButton"
android:layout_width="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
android:clickable="true"
android:focusable="true"
android:nextFocusLeft="@id/result_play_movie"
android:nextFocusUp="@id/result_cast_items"
android:nextFocusDown="@id/result_resume_series_button_play"
android:visibility="visible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/result_movie_progress_downloaded"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="end|center_vertical"
android:layout_margin="5dp"
android:background="@drawable/circle_shape_cs3"
android:indeterminate="false"
android:max="100"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:progress="30"
android:progressDrawable="@drawable/circular_progress_bar_filled_cs3"
android:visibility="visible" />
<ImageView
android:id="@+id/result_movie_download_icon"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/download"
android:src="@drawable/ic_baseline_play_arrow_24"
android:visibility="visible"
app:tint="?attr/white" />
<TextView
android:id="@+id/result_movie_download_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:letterSpacing="0.09"
android:textAllCaps="false"
android:textColor="?attr/textColor"
android:textSize="15sp"
android:textStyle="bold"
tools:text="Downloading" />
<TextView
android:id="@+id/result_movie_download_text_precentage"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:letterSpacing="0.09"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:textAllCaps="false"
android:textColor="?attr/textColor"
android:textSize="15sp"
android:textStyle="bold"
android:visibility="gone"
tools:text="68%" />
</LinearLayout>
</FrameLayout>
<com.google.android.material.button.MaterialButton
android:nextFocusLeft="@id/result_movie_progress_downloaded_holder"
android:nextFocusDown="@id/result_resume_series_button_play"
android:id="@+id/result_bookmark_button" android:id="@+id/result_bookmark_button"
style="@style/BlackButton" style="@style/BlackButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:layout_marginEnd="5dp" android:layout_marginEnd="5dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:layout_weight="1" android:layout_weight="1"
android:minWidth="250dp" android:minWidth="250dp"
android:nextFocusLeft="@id/result_download_movie"
android:nextFocusDown="@id/result_resume_series_button_play"
android:text="@string/type_none" android:text="@string/type_none"
android:visibility="visible" /> android:visibility="visible" />
</LinearLayout> </LinearLayout>

View file

@ -49,6 +49,7 @@
<item name="android:windowAllowReturnTransitionOverlap">true</item> <item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item> <item name="android:windowAllowEnterTransitionOverlap">true</item>
<!--<item name="preferenceTheme">@style/PreferencesTheme</item>--> <!--<item name="preferenceTheme">@style/PreferencesTheme</item>-->
<!-- DEF STYLE --> <!-- DEF STYLE -->
@ -65,6 +66,9 @@
<item name="white">#FFF</item> <item name="white">#FFF</item>
<item name="preferenceTheme">@style/CustomPreferenceThemeOverlay</item> <item name="preferenceTheme">@style/CustomPreferenceThemeOverlay</item>
<item name="aria2c_icon_color">?attr/white</item>
<item name="aria2c_fill_color">?attr/white</item>
<item name="aria2c_outline_color">?attr/white</item>
</style> </style>
<style name="ListViewStyle" parent="Widget.AppCompat.ListView"> <style name="ListViewStyle" parent="Widget.AppCompat.ListView">