fix autobug for devices that don't have URL sharing support

This commit is contained in:
Kevin Hester
2021-03-31 19:45:31 +08:00
parent 091b18a5bb
commit 7d898481a6
2 changed files with 13 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package com.geeksville.mesh.ui
import android.content.ActivityNotFoundException
import android.content.Intent
import android.graphics.ColorMatrix
import android.graphics.ColorMatrixColorFilter
@@ -143,8 +144,17 @@ class ChannelFragment : ScreenFragment("Channel"), Logging {
type = "text/plain"
}
val shareIntent = Intent.createChooser(sendIntent, null)
requireActivity().startActivity(shareIntent)
try {
val shareIntent = Intent.createChooser(sendIntent, null)
requireActivity().startActivity(shareIntent)
}
catch(ex: ActivityNotFoundException) {
Snackbar.make(
binding.shareButton,
R.string.no_app_found,
Snackbar.LENGTH_SHORT
).show()
}
}
}

View File

@@ -102,4 +102,5 @@
<string name="are_you_shure_change_default">Are you sure you want to change to the default channel?</string>
<string name="reset_to_defaults">Reset to defaults</string>
<string name="apply">Apply</string>
<string name="no_app_found">No application found to send URLs</string>
</resources>