Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/src/main/java/com/meteocool/ui/map/WebFragment.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.meteocool.ui.map

import android.Manifest
import android.content.ActivityNotFoundException
import android.content.Intent
import android.content.pm.PackageManager
import android.widget.Toast
import android.content.res.Configuration
import android.net.Uri
import android.os.Bundle
Expand Down Expand Up @@ -289,8 +291,10 @@ class WebFragment : Fragment() {
return false
}
// Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
Intent(Intent.ACTION_VIEW, Uri.parse(url)).apply {
startActivity(this)
try {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
} catch (e: ActivityNotFoundException) {
Toast.makeText(requireContext(), R.string.cant_open_link, Toast.LENGTH_SHORT).show()
}
return true
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,6 @@
<string name="intro_toggle_notifications">notifications</string>
<string name="feedback_url"><![CDATA[mailto:support@meteocool.com?subject=Android%20App%20Feedback&body=%0A%0A—%0APlease%20include%20the%20following%20information%20when%20reporting%20issues%21%0A%0AFCM-Token:]]></string>

<string name="cant_open_link">No app found to open this link</string>

</resources>