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) {
if(!this::exoPlayer.isInitialized) return
when (event) {
PlayerEventType.Play.value -> exoPlayer.play()
PlayerEventType.Pause.value -> exoPlayer.pause()

View file

@ -844,12 +844,12 @@ class ResultFragment : Fragment() {
if (d is LoadResponse) {
updateVisStatus(2)
result_vpn.text = when (api.vpnStatus) {
result_vpn?.text = when (api.vpnStatus) {
VPNStatus.MightBeNeeded -> getString(R.string.vpn_might_be_needed)
VPNStatus.Torrent -> getString(R.string.vpn_torrent)
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"
@ -859,7 +859,7 @@ class ResultFragment : Fragment() {
currentPoster = d.posterUrl
currentIsMovie = !d.isEpisodeBased()
result_openinbrower.setOnClickListener {
result_openinbrower?.setOnClickListener {
val i = Intent(ACTION_VIEW)
i.data = Uri.parse(d.url)
try {
@ -869,7 +869,7 @@ class ResultFragment : Fragment() {
}
}
result_share.setOnClickListener {
result_share?.setOnClickListener {
val i = Intent(ACTION_SEND)
i.type = "text/plain"
i.putExtra(EXTRA_SUBJECT, d.name)

View file

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

View file

@ -124,6 +124,7 @@ object VideoDownloadManager {
val totalBytes: Long,
val relativePath: String,
val displayName: String,
val extraData : String? = null,
)
data class DownloadedFileInfoResult(