From 4944762d7c167da620b92914350421e5fce493be Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 4 Apr 2023 18:29:16 +0200 Subject: ui: redirect to play store if no file manager on tv Signed-off-by: Jason A. Donenfeld --- ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ui/src/main/java/com/wireguard') diff --git a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt index df258ec3..1ee14ee6 100644 --- a/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt +++ b/ui/src/main/java/com/wireguard/android/activity/TvMainActivity.kt @@ -32,6 +32,7 @@ import androidx.databinding.ObservableField import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager.SpanSizeLookup +import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.wireguard.android.Application import com.wireguard.android.R import com.wireguard.android.backend.GoBackend @@ -199,7 +200,12 @@ class TvMainActivity : AppCompatActivity() { try { tunnelFileImportResultLauncher.launch("*/*") } catch (_: Throwable) { - Toast.makeText(this@TvMainActivity, getString(R.string.tv_no_file_picker), Toast.LENGTH_LONG).show() + MaterialAlertDialogBuilder(binding.root.context).setMessage(R.string.tv_no_file_picker).setCancelable(false).setPositiveButton(android.R.string.ok) { _, _ -> + try { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("market://webstoreredirect"))) + } catch (_: Throwable) { + } + }.show() } } } -- cgit v1.2.3