small fixes

This commit is contained in:
LagradOst 2021-09-01 15:16:49 +02:00
parent 3ab3986e22
commit d4014084cd
4 changed files with 59 additions and 49 deletions

View file

@ -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()

View file

@ -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)

View file

@ -169,6 +169,7 @@ class InAppUpdater {
registerReceiver( registerReceiver(
object : BroadcastReceiver() { object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) { override fun onReceive(context: Context?, intent: Intent?) {
try {
val downloadId = intent?.getLongExtra( val downloadId = intent?.getLongExtra(
DownloadManager.EXTRA_DOWNLOAD_ID, id DownloadManager.EXTRA_DOWNLOAD_ID, id
) ?: id ) ?: id
@ -189,6 +190,9 @@ class InAppUpdater {
openApk(localContext, uri) openApk(localContext, uri)
} }
} }
} catch (e : Exception) {
e.printStackTrace()
}
} }
}, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE) }, IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
) )
@ -220,6 +224,7 @@ class InAppUpdater {
val update = getAppUpdate() val update = getAppUpdate()
if (update.shouldUpdate && update.updateURL != null) { if (update.shouldUpdate && update.updateURL != null) {
runOnUiThread { runOnUiThread {
try {
val currentVersion = packageName?.let { val currentVersion = packageName?.let {
packageManager.getPackageInfo( packageManager.getPackageInfo(
it, it,
@ -259,6 +264,9 @@ class InAppUpdater {
} }
} }
builder.show() builder.show()
} catch (e: Exception) {
e.printStackTrace()
}
} }
return true return true
} }

View file

@ -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(