@@ -22,6 +22,7 @@ import android.appwidget.AppWidgetManager
2222import android.content.ComponentName
2323import android.content.Context
2424import android.content.Intent
25+ import androidx.browser.customtabs.CustomTabsIntent
2526import android.content.SharedPreferences
2627import android.content.pm.PackageManager
2728import android.os.Bundle
@@ -121,13 +122,11 @@ class MainActivity : AppCompatActivity() {
121122 tvVersion.text = getString(R .string.changelog_version, versionName)
122123
123124 findViewById<View >(R .id.tv_github_link).setOnClickListener {
124- val intent = Intent (Intent .ACTION_VIEW , android.net.Uri .parse(" https://github.com/LeanBitLab/Lwidget" ))
125- startActivity(intent)
125+ CustomTabsIntent .Builder ().build().launchUrl(this @MainActivity, android.net.Uri .parse(" https://github.com/LeanBitLab/Lwidget" ))
126126 }
127127
128128 findViewById<View >(R .id.tv_privacy_policy).setOnClickListener {
129- val intent = Intent (Intent .ACTION_VIEW , android.net.Uri .parse(" https://github.com/LeanBitLab/Lwidget/wiki/Privacy-Policy" ))
130- startActivity(intent)
129+ CustomTabsIntent .Builder ().build().launchUrl(this @MainActivity, android.net.Uri .parse(" https://github.com/LeanBitLab/Lwidget/wiki/Privacy-Policy" ))
131130 }
132131
133132
@@ -283,7 +282,7 @@ class MainActivity : AppCompatActivity() {
283282 startActivity(Intent (Intent .ACTION_VIEW , android.net.Uri .parse(" market://details?id=org.breezyweather" )))
284283 } catch (e: Exception ) {
285284 try {
286- startActivity( Intent ( Intent . ACTION_VIEW , android.net.Uri .parse(" https://f-droid.org/packages/org.breezyweather/" ) ))
285+ CustomTabsIntent . Builder ().build().launchUrl( this @MainActivity , android.net.Uri .parse(" https://f-droid.org/packages/org.breezyweather/" ))
287286 } catch (e2: Exception ) {}
288287 }
289288 } else if (weatherMissing) {
@@ -953,7 +952,7 @@ class MainActivity : AppCompatActivity() {
953952 com.google.android.material.snackbar.Snackbar .LENGTH_LONG
954953 ).setAction(" Install" ) {
955954 try {
956- startActivity( Intent ( Intent . ACTION_VIEW , android.net.Uri .parse(" https://github.com/breezy-weather/breezy-weather/releases" ) ))
955+ CustomTabsIntent . Builder ().build().launchUrl( this @MainActivity , android.net.Uri .parse(" https://github.com/breezy-weather/breezy-weather/releases" ))
957956 } catch (e: Exception ) {}
958957 }.show()
959958 return @setOnCheckedChangeListener
@@ -1219,7 +1218,7 @@ class MainActivity : AppCompatActivity() {
12191218 try {
12201219 startActivity(Intent (Intent .ACTION_VIEW , android.net.Uri .parse(" market://details?id=org.tasks" )))
12211220 } catch (e: Exception ) {
1222- startActivity( Intent ( Intent . ACTION_VIEW , android.net.Uri .parse(" https://play.google.com/store/apps/details?id=org.tasks" ) ))
1221+ CustomTabsIntent . Builder ().build().launchUrl( this @MainActivity , android.net.Uri .parse(" https://play.google.com/store/apps/details?id=org.tasks" ))
12231222 }
12241223 }.show()
12251224 return @setOnCheckedChangeListener
0 commit comments