mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2024-11-23 17:16:02 -06:00
Fix opening twitter link from about on android 11 (#1460)
This commit is contained in:
parent
d139c22782
commit
d87283eb31
@ -1,6 +1,7 @@
|
|||||||
package io.github.wulkanowy.utils
|
package io.github.wulkanowy.utils
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
@ -58,8 +59,11 @@ fun Context.getCompatBitmap(@DrawableRes drawableRes: Int, @ColorRes colorRes: I
|
|||||||
|
|
||||||
fun Context.openInternetBrowser(uri: String, onActivityNotFound: (uri: String) -> Unit = {}) {
|
fun Context.openInternetBrowser(uri: String, onActivityNotFound: (uri: String) -> Unit = {}) {
|
||||||
Intent.parseUri(uri, 0).let {
|
Intent.parseUri(uri, 0).let {
|
||||||
if (it.resolveActivity(packageManager) != null) startActivity(it)
|
try {
|
||||||
else onActivityNotFound(uri)
|
startActivity(it)
|
||||||
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
onActivityNotFound(uri)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user