Switch to CustomTabs instead of launching browser
Provides a better UX Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -175,6 +175,9 @@ dependencies {
|
|||||||
//Love <3
|
//Love <3
|
||||||
implementation "com.gitlab.AuroraOSS:gplayapi:3.1.0"
|
implementation "com.gitlab.AuroraOSS:gplayapi:3.1.0"
|
||||||
|
|
||||||
|
//Browser
|
||||||
|
implementation 'androidx.browser:browser:1.5.0'
|
||||||
|
|
||||||
//Test
|
//Test
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import android.util.DisplayMetrics
|
|||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.browser.customtabs.CustomTabsIntent
|
||||||
import androidx.core.app.ActivityOptionsCompat
|
import androidx.core.app.ActivityOptionsCompat
|
||||||
import androidx.core.app.ShareCompat
|
import androidx.core.app.ShareCompat
|
||||||
import com.aurora.Constants
|
import com.aurora.Constants
|
||||||
@@ -49,12 +50,9 @@ val Context.displayMetrics: DisplayMetrics
|
|||||||
|
|
||||||
fun Context.browse(url: String) {
|
fun Context.browse(url: String) {
|
||||||
try {
|
try {
|
||||||
startActivity(
|
CustomTabsIntent.Builder()
|
||||||
Intent(
|
.build()
|
||||||
Intent.ACTION_VIEW,
|
.launchUrl(this, Uri.parse(url))
|
||||||
Uri.parse(url)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(e.message)
|
Log.e(e.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user