diff --git a/app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt b/app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt index 39bd8bcf..090760df 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt @@ -8,7 +8,6 @@ import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import com.lagradost.cloudstream3.utils.Coroutines.runOnMainThread import org.acra.ReportField import org.acra.config.CoreConfiguration -import org.acra.config.toast import org.acra.data.CrashReportData import org.acra.data.StringFormat import org.acra.ktx.initAcra diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt index 368910a1..5e0fdcc6 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt @@ -3,7 +3,6 @@ package com.lagradost.cloudstream3 import android.app.Activity import android.app.PictureInPictureParams import android.content.ComponentName -import android.content.Context import android.content.Intent import android.content.pm.PackageManager import android.content.res.ColorStateList @@ -76,6 +75,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { lateinit var navOptions: NavOptions var currentToast: Toast? = null + fun showToast(act: Activity?, @StringRes message: Int, duration: Int) { if (act == null) return showToast(act, act.getString(message), duration) diff --git a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GogoanimeProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GogoanimeProvider.kt index 69ee462d..52f03d65 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GogoanimeProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/animeproviders/GogoanimeProvider.kt @@ -40,7 +40,7 @@ class GogoanimeProvider : MainAPI() { TvType.ONA ) - override fun getMainPage(): HomePageResponse? { + override fun getMainPage(): HomePageResponse { val headers = mapOf( "authority" to "ajax.gogo-load.com", "sec-ch-ua" to "\"Google Chrome\";v=\"89\", \"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"", diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt index 092db94b..c7bb5ab7 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/WcoStream.kt @@ -15,7 +15,7 @@ class WcoStream : ExtractorApi() { val html = khttp.get(url, headers = mapOf("Referer" to "https://wcostream.cc/")).text val (Id) = "/e/(.*?)?domain".toRegex().find(url)!!.destructured - val (skey) = """skey\s=\s['\"](.*?)['\"];""".toRegex().find(html)!!.destructured + val (skey) = """skey\s=\s['"](.*?)['"];""".toRegex().find(html)!!.destructured val apiLink = "$baseUrl/info/$Id?domain=wcostream.cc&skey=$skey" val referrer = "$baseUrl/e/$Id?domain=wcostream.cc" diff --git a/app/src/main/java/com/lagradost/cloudstream3/extractors/XStreamCdn.kt b/app/src/main/java/com/lagradost/cloudstream3/extractors/XStreamCdn.kt index d70781de..f92fb3ba 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/extractors/XStreamCdn.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/extractors/XStreamCdn.kt @@ -37,7 +37,7 @@ class XStreamCdn : ExtractorApi() { } } - override fun getUrl(url: String, referer: String?): List? { + override fun getUrl(url: String, referer: String?): List { val headers = mapOf( "Referer" to url, "User-Agent" to "Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0", diff --git a/app/src/main/java/com/lagradost/cloudstream3/mvvm/ArchComponentExt.kt b/app/src/main/java/com/lagradost/cloudstream3/mvvm/ArchComponentExt.kt index ba746b90..f303a0cf 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/mvvm/ArchComponentExt.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/mvvm/ArchComponentExt.kt @@ -3,7 +3,6 @@ package com.lagradost.cloudstream3.mvvm import android.util.Log import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LiveData -import androidx.lifecycle.Observer import com.bumptech.glide.load.HttpException import com.lagradost.cloudstream3.ErrorLoadingException import kotlinx.coroutines.Dispatchers @@ -12,11 +11,11 @@ import java.net.SocketTimeoutException import java.net.UnknownHostException fun LifecycleOwner.observe(liveData: LiveData, action: (t: T) -> Unit) { - liveData.observe(this, Observer { it?.let { t -> action(t) } }) + liveData.observe(this) { it?.let { t -> action(t) } } } fun LifecycleOwner.observeDirectly(liveData: LiveData, action: (t: T) -> Unit) { - liveData.observe(this, Observer { it?.let { t -> action(t) } }) + liveData.observe(this) { it?.let { t -> action(t) } } val currentValue = liveData.value if (currentValue != null) action(currentValue) @@ -64,7 +63,7 @@ suspend fun safeApiCall( Resource.Failure(true, null, null, "Please try again later.") } is HttpException -> { - Resource.Failure(false, throwable.statusCode, null, throwable.localizedMessage) + Resource.Failure(false, throwable.statusCode, null, throwable.localizedMessage ?: "") } is UnknownHostException -> { Resource.Failure(true, null, null, "Cannot connect to server, try again later.") @@ -76,7 +75,7 @@ suspend fun safeApiCall( Resource.Failure(false, null, null, "This operation is not implemented.") } else -> { - val stackTraceMsg = throwable.localizedMessage + "\n\n" + throwable.stackTrace.joinToString( + val stackTraceMsg = (throwable.localizedMessage ?: "") + "\n\n" + throwable.stackTrace.joinToString( separator = "\n" ) { "${it.fileName} ${it.lineNumber}" diff --git a/app/src/main/java/com/lagradost/cloudstream3/receivers/VideoDownloadRestartReceiver.kt b/app/src/main/java/com/lagradost/cloudstream3/receivers/VideoDownloadRestartReceiver.kt index 9a7ee826..cd39034d 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/receivers/VideoDownloadRestartReceiver.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/receivers/VideoDownloadRestartReceiver.kt @@ -3,7 +3,6 @@ package com.lagradost.cloudstream3.receivers import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.os.Build import android.util.Log diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/MiniControllerFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/MiniControllerFragment.kt index 1009b3eb..eb95335b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/MiniControllerFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/MiniControllerFragment.kt @@ -23,7 +23,7 @@ class MyMiniControllerFragment : MiniControllerFragment() { if (obtainStyledAttributes.hasValue(R.styleable.CustomCast_customCastBackgroundColor)) { currentColor = obtainStyledAttributes.getColor(R.styleable.CustomCast_customCastBackgroundColor, 0) } - + obtainStyledAttributes.recycle() super.onInflate(context, attributeSet, bundle) } diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadViewModel.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadViewModel.kt index 7d3cf3f9..d7f2bf67 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadViewModel.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadViewModel.kt @@ -7,7 +7,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.lagradost.cloudstream3.TvType import com.lagradost.cloudstream3.isMovieType import com.lagradost.cloudstream3.utils.DOWNLOAD_EPISODE_CACHE import com.lagradost.cloudstream3.utils.DOWNLOAD_HEADER_CACHE diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/download/EasyDownloadButton.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/download/EasyDownloadButton.kt index 42056773..5b8822b9 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/download/EasyDownloadButton.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/download/EasyDownloadButton.kt @@ -9,10 +9,9 @@ import android.widget.TextView import androidx.core.widget.ContentLoadingProgressBar import com.google.android.material.button.MaterialButton import com.lagradost.cloudstream3.R -import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIcons import com.lagradost.cloudstream3.utils.Coroutines import com.lagradost.cloudstream3.utils.IDisposable -import com.lagradost.cloudstream3.utils.VideoDownloadHelper +import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIcons import com.lagradost.cloudstream3.utils.VideoDownloadManager class EasyDownloadButton : IDisposable { diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeChildItemAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeChildItemAdapter.kt index 96900901..e8bda2d1 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeChildItemAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeChildItemAdapter.kt @@ -3,19 +3,11 @@ package com.lagradost.cloudstream3.ui.home import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import androidx.cardview.widget.CardView import androidx.recyclerview.widget.RecyclerView -import com.bumptech.glide.Glide -import com.bumptech.glide.load.model.GlideUrl -import com.lagradost.cloudstream3.* -import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_LOAD -import com.lagradost.cloudstream3.ui.search.SEARCH_ACTION_SHOW_METADATA +import com.lagradost.cloudstream3.R +import com.lagradost.cloudstream3.SearchResponse import com.lagradost.cloudstream3.ui.search.SearchClickCallback import com.lagradost.cloudstream3.ui.search.SearchResultBuilder -import com.lagradost.cloudstream3.utils.UIHelper.setImage -import kotlinx.android.synthetic.main.home_result_grid.view.* class HomeChildItemAdapter( var cardList: List, diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeParentItemAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeParentItemAdapter.kt index 65790c6f..acb17feb 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeParentItemAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeParentItemAdapter.kt @@ -8,7 +8,6 @@ import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import com.lagradost.cloudstream3.HomePageList import com.lagradost.cloudstream3.R -import com.lagradost.cloudstream3.SearchResponse import com.lagradost.cloudstream3.ui.search.SearchClickCallback import kotlinx.android.synthetic.main.homepage_parent.view.* diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt index e0fa989f..3979936e 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/PlayerFragment.kt @@ -853,7 +853,7 @@ class PlayerFragment : Fragment() { if (realLang.length == 2) SubtitleHelper.fromTwoLettersToLanguage(realLang) ?: realLang else realLang if (!this::exoPlayer.isInitialized) return - (exoPlayer?.trackSelector as DefaultTrackSelector?)?.let { trackSelector -> + (exoPlayer.trackSelector as DefaultTrackSelector?)?.let { trackSelector -> if (lang.isNullOrBlank()) { trackSelector.setParameters( trackSelector.buildUponParameters() @@ -1028,11 +1028,11 @@ class PlayerFragment : Fragment() { observeDirectly(viewModel.episodes) { _episodes -> episodes = _episodes if (isLoading) { - if (playerData.episodeIndex > 0 && playerData.episodeIndex < episodes.size) { + /*if (playerData.episodeIndex > 0 && playerData.episodeIndex < episodes.size) { } else { // WHAT THE FUCK DID YOU DO - } + }*/ } } @@ -1304,11 +1304,11 @@ class PlayerFragment : Fragment() { playbackPosition = if (this::exoPlayer.isInitialized) exoPlayer.currentPosition else 0 setMirrorId(sources[sourceIndex].getId()) initPlayer(getCurrentUrl()) - } else { + } /*else { if (isPlaying) { // exoPlayer.play() } - } + }*/ if (subtitleIndex != startIndexFromMap) { setPreferredSubLanguage(if (subtitleIndex <= 0) null else currentSubtitles[subtitleIndex - 1]) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/result/EpisodeAdapter.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/result/EpisodeAdapter.kt index 4ab73e12..2dffeabd 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/result/EpisodeAdapter.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/result/EpisodeAdapter.kt @@ -6,7 +6,6 @@ import android.view.View import android.view.ViewGroup import android.widget.ImageView import android.widget.TextView -import android.widget.Toast import androidx.annotation.LayoutRes import androidx.core.widget.ContentLoadingProgressBar import androidx.recyclerview.widget.RecyclerView diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchAdaptor.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchAdaptor.kt index 02e47c43..8af9f63b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchAdaptor.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchAdaptor.kt @@ -1,29 +1,17 @@ package com.lagradost.cloudstream3.ui.search -import android.app.Activity import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.FrameLayout import android.widget.ImageView -import android.widget.TextView -import androidx.cardview.widget.CardView import androidx.recyclerview.widget.RecyclerView -import com.bumptech.glide.Glide -import com.bumptech.glide.load.model.GlideUrl -import com.lagradost.cloudstream3.AnimeSearchResponse -import com.lagradost.cloudstream3.DubStatus import com.lagradost.cloudstream3.SearchResponse -import com.lagradost.cloudstream3.TvType +import com.lagradost.cloudstream3.ui.AutofitRecyclerView import com.lagradost.cloudstream3.utils.UIHelper.getGridFormatId import com.lagradost.cloudstream3.utils.UIHelper.getGridIsCompact import com.lagradost.cloudstream3.utils.UIHelper.toPx -import com.lagradost.cloudstream3.ui.AutofitRecyclerView -import com.lagradost.cloudstream3.utils.UIHelper.setImage -import kotlinx.android.synthetic.main.search_result_compact.view.backgroundCard -import kotlinx.android.synthetic.main.search_result_compact.view.imageText -import kotlinx.android.synthetic.main.search_result_compact.view.imageView -import kotlinx.android.synthetic.main.search_result_grid.view.* +import kotlinx.android.synthetic.main.search_result_compact.view.* import kotlin.math.roundToInt const val SEARCH_ACTION_LOAD = 0 diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchHelper.kt index 2a8bc5e1..f16e2095 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchHelper.kt @@ -7,7 +7,6 @@ import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_PLAY_FILE import com.lagradost.cloudstream3.ui.download.DownloadButtonSetup.handleDownloadClick import com.lagradost.cloudstream3.ui.download.DownloadClickEvent import com.lagradost.cloudstream3.ui.result.START_ACTION_LOAD_EP -import com.lagradost.cloudstream3.ui.result.START_ACTION_RESUME_LATEST import com.lagradost.cloudstream3.utils.AppUtils.loadSearchResult import com.lagradost.cloudstream3.utils.DataStoreHelper import com.lagradost.cloudstream3.utils.VideoDownloadHelper diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/AppUtils.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/AppUtils.kt index c7cd932b..b1466f37 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/AppUtils.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/AppUtils.kt @@ -12,9 +12,7 @@ import android.net.NetworkCapabilities import android.net.Uri import android.os.Build import android.provider.MediaStore -import android.view.View import androidx.appcompat.app.AppCompatActivity -import androidx.preference.PreferenceManager import com.google.android.gms.cast.framework.CastContext import com.google.android.gms.cast.framework.CastState import com.google.android.gms.common.ConnectionResult diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/CastOptionsProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/CastOptionsProvider.kt index 3ffe92b1..17ec775b 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/CastOptionsProvider.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/CastOptionsProvider.kt @@ -2,7 +2,6 @@ package com.lagradost.cloudstream3.utils import android.content.Context import com.google.android.gms.cast.CastMediaControlIntent -import com.google.android.gms.cast.LaunchOptions import com.google.android.gms.cast.framework.CastOptions import com.google.android.gms.cast.framework.OptionsProvider import com.google.android.gms.cast.framework.SessionProvider diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt index b4ba03e4..08f8865c 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/ExtractorApi.kt @@ -1,6 +1,5 @@ package com.lagradost.cloudstream3.utils -import com.lagradost.cloudstream3.SubtitleFile import com.lagradost.cloudstream3.extractors.* import com.lagradost.cloudstream3.mvvm.normalSafeApiCall diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/InAppUpdater.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/InAppUpdater.kt index 0ce428b6..12517936 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/InAppUpdater.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/InAppUpdater.kt @@ -44,13 +44,13 @@ class InAppUpdater { data class GithubObject( @JsonProperty("sha") val sha: String, // sha 256 hash - @JsonProperty("type") val type: String, // object type - @JsonProperty("url") val url: String, + @JsonProperty("type") val type: String, // object type + @JsonProperty("url") val url: String, + ) + + data class GithubTag( + @JsonProperty("object") val github_object: GithubObject, ) - - data class GithubTag( - @JsonProperty("object") val github_object: GithubObject, - ) data class Update( @JsonProperty("shouldUpdate") val shouldUpdate: Boolean, @@ -80,7 +80,7 @@ class InAppUpdater { val url = "https://api.github.com/repos/LagradOst/CloudStream-3/releases" val headers = mapOf("Accept" to "application/vnd.github.v3+json") val response = - mapper.readValue>(khttp.get(url, headers = headers).text) + mapper.readValue>(khttp.get(url, headers = headers).text) val versionRegex = Regex("""(.*?((\d)\.(\d)\.(\d)).*\.apk)""") @@ -92,26 +92,29 @@ class InAppUpdater { versionRegex.find(it.name)?.groupValues?.get(2) }).toList().lastOrNull()*/ val found = - response.filter { rel -> - !rel.prerelease - }.sortedWith(compareBy { release -> - release.assets.filter { it.content_type == "application/vnd.android.package-archive" } - .getOrNull(0)?.name?.let { it1 -> - versionRegex.find( - it1 - )?.groupValues?.get(2) - } - }).toList().lastOrNull() + response.filter { rel -> + !rel.prerelease + }.sortedWith(compareBy { release -> + release.assets.filter { it.content_type == "application/vnd.android.package-archive" } + .getOrNull(0)?.name?.let { it1 -> + versionRegex.find( + it1 + )?.groupValues?.get(2) + } + }).toList().lastOrNull() val foundAsset = found?.assets?.getOrNull(0) val currentVersion = packageName?.let { - packageManager.getPackageInfo(it, - 0) + packageManager.getPackageInfo( + it, + 0 + ) } val foundVersion = foundAsset?.name?.let { versionRegex.find(it) } - val shouldUpdate = if (found != null && foundAsset?.browser_download_url != "" && foundVersion != null) currentVersion?.versionName?.compareTo( + val shouldUpdate = + if (found != null && foundAsset?.browser_download_url != "" && foundVersion != null) currentVersion?.versionName?.compareTo( foundVersion.groupValues[2] - )!! < 0 else false + )!! < 0 else false return if (foundVersion != null) { Update(shouldUpdate, foundAsset.browser_download_url, foundVersion.groupValues[2], found.body) } else { @@ -161,6 +164,7 @@ class InAppUpdater { val localContext = this val id = downloadManager.enqueue(request) + registerReceiver( object : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { @@ -173,8 +177,7 @@ class InAppUpdater { val c = downloadManager.query(query) if (c.moveToFirst()) { - val columnIndex = c - .getColumnIndex(DownloadManager.COLUMN_STATUS) + val columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS) if (DownloadManager.STATUS_SUCCESSFUL == c .getInt(columnIndex) ) { @@ -217,8 +220,10 @@ class InAppUpdater { if (update.shouldUpdate && update.updateURL != null) { runOnUiThread { val currentVersion = packageName?.let { - packageManager.getPackageInfo(it, - 0) + packageManager.getPackageInfo( + it, + 0 + ) } val builder: AlertDialog.Builder = AlertDialog.Builder(this) @@ -233,23 +238,19 @@ class InAppUpdater { val downloadStatus = context.downloadUpdate(update.updateURL) if (!downloadStatus) { runOnUiThread { - showToast(context, + showToast( + context, "Download Failed", - Toast.LENGTH_LONG) + Toast.LENGTH_LONG + ) } - } /*else { - activity.runOnUiThread { - Toast.makeText(localContext, - "Downloaded APK", - Toast.LENGTH_LONG).show() - } - }*/ + } } } setNegativeButton("Cancel") { _, _ -> } - if(checkAutoUpdate) { + if (checkAutoUpdate) { setNeutralButton("Don't show again") { _, _ -> settingsManager.edit().putBoolean("auto_update", false).apply() } diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/JsUnpacker.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/JsUnpacker.kt index 174f1971..227d3f34 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/JsUnpacker.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/JsUnpacker.kt @@ -31,7 +31,7 @@ class JsUnpacker(packedJS: String?) { val js = packedJS try { var p = - Pattern.compile("""\}\s*\('(.*)',\s*(.*?),\s*(\d+),\s*'(.*?)'\.split\('\|'\)""", Pattern.DOTALL) + Pattern.compile("""}\s*\('(.*)',\s*(.*?),\s*(\d+),\s*'(.*?)'\.split\('\|'\)""", Pattern.DOTALL) var m = p.matcher(js) if (m.find() && m.groupCount() == 4) { val payload = m.group(1).replace("\\'", "'") diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/SingleSelectionHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/SingleSelectionHelper.kt index 09d3f3b2..c1ac4f12 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/SingleSelectionHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/SingleSelectionHelper.kt @@ -5,7 +5,6 @@ import android.content.Context import android.view.View import android.widget.* import androidx.appcompat.app.AlertDialog -import androidx.core.util.forEach import androidx.core.view.marginLeft import androidx.core.view.marginRight import androidx.core.view.marginTop diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadHelper.kt index cad52921..7cfcbc8a 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadHelper.kt @@ -1,6 +1,5 @@ package com.lagradost.cloudstream3.utils -import com.lagradost.cloudstream3.SearchResponse import com.lagradost.cloudstream3.TvType import com.lagradost.cloudstream3.ui.download.EasyDownloadButton diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt index a5db6f20..1566ddc5 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt @@ -7,7 +7,6 @@ import android.net.Uri import android.os.Build import android.os.Environment import android.provider.MediaStore -import android.webkit.MimeTypeMap import android.widget.Toast import androidx.annotation.DrawableRes import androidx.annotation.RequiresApi @@ -26,7 +25,6 @@ import com.lagradost.cloudstream3.utils.DataStore.getKey import com.lagradost.cloudstream3.utils.DataStore.removeKey import com.lagradost.cloudstream3.utils.DataStore.setKey import com.lagradost.cloudstream3.utils.UIHelper.colorFromAttribute -import com.lagradost.cloudstream3.utils.VideoDownloadManager.getExistingDownloadUriOrNullQ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.delay import kotlinx.coroutines.withContext @@ -35,7 +33,6 @@ import java.lang.Thread.sleep import java.net.URL import java.net.URLConnection import java.util.* -import kotlin.collections.ArrayList const val DOWNLOAD_CHANNEL_ID = "cloudstream3.general" const val DOWNLOAD_CHANNEL_NAME = "Downloads" @@ -91,7 +88,7 @@ object VideoDownloadManager { val referer: String } - fun VideoDownloadManager.IDownloadableMinimum.getId(): Int { + fun IDownloadableMinimum.getId(): Int { return url.hashCode() } @@ -146,9 +143,9 @@ object VideoDownloadManager { private const val ERROR_CONTENT_RESOLVER_CANT_OPEN_STREAM = -8 private const val ERROR_CONTENT_RESOLVER_NOT_FOUND = -9 - const val KEY_RESUME_PACKAGES = "download_resume" + private const val KEY_RESUME_PACKAGES = "download_resume" const val KEY_DOWNLOAD_INFO = "download_info" - const val KEY_RESUME_QUEUE_PACKAGES = "download_q_resume" + private const val KEY_RESUME_QUEUE_PACKAGES = "download_q_resume" val downloadStatus = HashMap() val downloadStatusEvent = Event>() @@ -428,7 +425,7 @@ object VideoDownloadManager { ) val folder = File(normalPath) if (folder.isDirectory) { - return folder.listFiles().map { Pair(it.name, it.toUri()) } + return folder.listFiles()?.map { Pair(it.name, it.toUri()) } } return null } @@ -934,7 +931,7 @@ object VideoDownloadManager { context.setKey(KEY_RESUME_QUEUE_PACKAGES, dQueue) } - fun isMyServiceRunning(context: Context, serviceClass: Class<*>): Boolean { + /*fun isMyServiceRunning(context: Context, serviceClass: Class<*>): Boolean { val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager? for (service in manager!!.getRunningServices(Int.MAX_VALUE)) { if (serviceClass.name == service.service.className) { @@ -942,7 +939,7 @@ object VideoDownloadManager { } } return false - } + }*/ fun downloadEpisode( context: Activity?, diff --git a/app/src/main/res/font/google_sans.xml b/app/src/main/res/font/google_sans.xml index 6851c537..6d1798e7 100644 --- a/app/src/main/res/font/google_sans.xml +++ b/app/src/main/res/font/google_sans.xml @@ -1,6 +1,6 @@ - + - +