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

1.2-legacy
Kevin Hester 2021-03-31 19:45:31 +08:00
rodzic 091b18a5bb
commit 7d898481a6
2 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -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()
}
}
}

Wyświetl plik

@ -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>