Merge pull request #200 from TouchInstinct/fix/opening-browser
fix open browser
This commit is contained in:
commit
96d761a04d
|
|
@ -5,8 +5,11 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
|
||||
fun Context.safeStartActivity(intent: Intent, options: Bundle? = null, resolveFlags: Int = 0): Boolean =
|
||||
packageManager.resolveActivity(intent, resolveFlags)?.let { startActivity(intent, options) } != null
|
||||
fun Context.safeStartActivity(intent: Intent, options: Bundle? = null, resolveFlags: Int = 0) =
|
||||
try {
|
||||
startActivity(intent, options)
|
||||
} catch (e: Throwable) {
|
||||
}
|
||||
|
||||
fun Context.openBrowser(url: String) = Intent(Intent.ACTION_VIEW)
|
||||
.setData(Uri.parse(url))
|
||||
|
|
|
|||
Loading…
Reference in New Issue