mirror of https://git.sr.ht/~oppen/ariane
fix external uri handling
This commit is contained in:
parent
bd8582aa38
commit
269612fa49
|
@ -1,8 +1,10 @@
|
|||
package oppen.ariane.ui
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.PackageManager.MATCH_ALL
|
||||
import android.media.MediaPlayer
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
|
@ -239,11 +241,12 @@ class GemActivity : AppCompatActivity() {
|
|||
|
||||
private fun externalProtocol(state: GemState.NotGeminiRequest) = runOnUiThread {
|
||||
loadingView(false)
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(state.uri.toString()))
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW)
|
||||
browserIntent.data = Uri.parse(state.uri.toString())
|
||||
|
||||
if (browserIntent.resolveActivity(packageManager) != null) {
|
||||
try {
|
||||
startActivity(browserIntent)
|
||||
} else {
|
||||
}catch (e: ActivityNotFoundException){
|
||||
showAlert("No app installed that can open ${state.uri}")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue