mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
small fixes
This commit is contained in:
parent
3ab3986e22
commit
d4014084cd
4 changed files with 59 additions and 49 deletions
|
@ -903,6 +903,7 @@ class PlayerFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handlePlayerEvent(event: Int) {
|
private fun handlePlayerEvent(event: Int) {
|
||||||
|
if(!this::exoPlayer.isInitialized) return
|
||||||
when (event) {
|
when (event) {
|
||||||
PlayerEventType.Play.value -> exoPlayer.play()
|
PlayerEventType.Play.value -> exoPlayer.play()
|
||||||
PlayerEventType.Pause.value -> exoPlayer.pause()
|
PlayerEventType.Pause.value -> exoPlayer.pause()
|
||||||
|
|
|
@ -844,12 +844,12 @@ class ResultFragment : Fragment() {
|
||||||
if (d is LoadResponse) {
|
if (d is LoadResponse) {
|
||||||
updateVisStatus(2)
|
updateVisStatus(2)
|
||||||
|
|
||||||
result_vpn.text = when (api.vpnStatus) {
|
result_vpn?.text = when (api.vpnStatus) {
|
||||||
VPNStatus.MightBeNeeded -> getString(R.string.vpn_might_be_needed)
|
VPNStatus.MightBeNeeded -> getString(R.string.vpn_might_be_needed)
|
||||||
VPNStatus.Torrent -> getString(R.string.vpn_torrent)
|
VPNStatus.Torrent -> getString(R.string.vpn_torrent)
|
||||||
else -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
result_vpn.visibility = if (api.vpnStatus == VPNStatus.None) GONE else VISIBLE
|
result_vpn?.visibility = if (api.vpnStatus == VPNStatus.None) GONE else VISIBLE
|
||||||
|
|
||||||
result_bookmark_button.text = "Watching"
|
result_bookmark_button.text = "Watching"
|
||||||
|
|
||||||
|
@ -859,7 +859,7 @@ class ResultFragment : Fragment() {
|
||||||
currentPoster = d.posterUrl
|
currentPoster = d.posterUrl
|
||||||
currentIsMovie = !d.isEpisodeBased()
|
currentIsMovie = !d.isEpisodeBased()
|
||||||
|
|
||||||
result_openinbrower.setOnClickListener {
|
result_openinbrower?.setOnClickListener {
|
||||||
val i = Intent(ACTION_VIEW)
|
val i = Intent(ACTION_VIEW)
|
||||||
i.data = Uri.parse(d.url)
|
i.data = Uri.parse(d.url)
|
||||||
try {
|
try {
|
||||||
|
@ -869,7 +869,7 @@ class ResultFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result_share.setOnClickListener {
|
result_share?.setOnClickListener {
|
||||||
val i = Intent(ACTION_SEND)
|
val i = Intent(ACTION_SEND)
|
||||||
i.type = "text/plain"
|
i.type = "text/plain"
|
||||||
i.putExtra(EXTRA_SUBJECT, d.name)
|
i.putExtra(EXTRA_SUBJECT, d.name)
|
||||||
|
|
|
@ -169,25 +169,29 @@ class InAppUpdater {
|
||||||
registerReceiver(
|
registerReceiver(
|
||||||
object : BroadcastReceiver() {
|
object : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
val downloadId = intent?.getLongExtra(
|
try {
|
||||||
DownloadManager.EXTRA_DOWNLOAD_ID, id
|
val downloadId = intent?.getLongExtra(
|
||||||
) ?: id
|
DownloadManager.EXTRA_DOWNLOAD_ID, id
|
||||||
|
) ?: id
|
||||||
|
|
||||||
val query = DownloadManager.Query()
|
val query = DownloadManager.Query()
|
||||||
query.setFilterById(downloadId)
|
query.setFilterById(downloadId)
|
||||||
val c = downloadManager.query(query)
|
val c = downloadManager.query(query)
|
||||||
|
|
||||||
if (c.moveToFirst()) {
|
if (c.moveToFirst()) {
|
||||||
val columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS)
|
val columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS)
|
||||||
if (DownloadManager.STATUS_SUCCESSFUL == c
|
if (DownloadManager.STATUS_SUCCESSFUL == c
|
||||||
.getInt(columnIndex)
|
.getInt(columnIndex)
|
||||||
) {
|
) {
|
||||||
c.getColumnIndex(DownloadManager.COLUMN_MEDIAPROVIDER_URI)
|
c.getColumnIndex(DownloadManager.COLUMN_MEDIAPROVIDER_URI)
|
||||||
val uri = Uri.parse(
|
val uri = Uri.parse(
|
||||||
c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI))
|
c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI))
|
||||||
)
|
)
|
||||||
openApk(localContext, uri)
|
openApk(localContext, uri)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e : Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
|
}, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
|
||||||
|
@ -220,45 +224,49 @@ class InAppUpdater {
|
||||||
val update = getAppUpdate()
|
val update = getAppUpdate()
|
||||||
if (update.shouldUpdate && update.updateURL != null) {
|
if (update.shouldUpdate && update.updateURL != null) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
val currentVersion = packageName?.let {
|
try {
|
||||||
packageManager.getPackageInfo(
|
val currentVersion = packageName?.let {
|
||||||
it,
|
packageManager.getPackageInfo(
|
||||||
0
|
it,
|
||||||
)
|
0
|
||||||
}
|
)
|
||||||
|
}
|
||||||
|
|
||||||
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
val builder: AlertDialog.Builder = AlertDialog.Builder(this)
|
||||||
builder.setTitle("New update found!\n${currentVersion?.versionName} -> ${update.updateVersion}")
|
builder.setTitle("New update found!\n${currentVersion?.versionName} -> ${update.updateVersion}")
|
||||||
builder.setMessage("${update.changelog}")
|
builder.setMessage("${update.changelog}")
|
||||||
|
|
||||||
val context = this
|
val context = this
|
||||||
builder.apply {
|
builder.apply {
|
||||||
setPositiveButton("Update") { _, _ ->
|
setPositiveButton("Update") { _, _ ->
|
||||||
showToast(context, "Download started", Toast.LENGTH_LONG)
|
showToast(context, "Download started", Toast.LENGTH_LONG)
|
||||||
thread {
|
thread {
|
||||||
val downloadStatus =
|
val downloadStatus =
|
||||||
normalSafeApiCall { context.downloadUpdate(update.updateURL) } ?: false
|
normalSafeApiCall { context.downloadUpdate(update.updateURL) } ?: false
|
||||||
if (!downloadStatus) {
|
if (!downloadStatus) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
showToast(
|
showToast(
|
||||||
context,
|
context,
|
||||||
"Download Failed",
|
"Download Failed",
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
setNegativeButton("Cancel") { _, _ -> }
|
setNegativeButton("Cancel") { _, _ -> }
|
||||||
|
|
||||||
if (checkAutoUpdate) {
|
if (checkAutoUpdate) {
|
||||||
setNeutralButton("Don't show again") { _, _ ->
|
setNeutralButton("Don't show again") { _, _ ->
|
||||||
settingsManager.edit().putBoolean("auto_update", false).apply()
|
settingsManager.edit().putBoolean("auto_update", false).apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
builder.show()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
builder.show()
|
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,7 @@ object VideoDownloadManager {
|
||||||
val totalBytes: Long,
|
val totalBytes: Long,
|
||||||
val relativePath: String,
|
val relativePath: String,
|
||||||
val displayName: String,
|
val displayName: String,
|
||||||
|
val extraData : String? = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class DownloadedFileInfoResult(
|
data class DownloadedFileInfoResult(
|
||||||
|
|
Loading…
Reference in a new issue