fix open crash

This commit is contained in:
Bnyro 2022-07-15 10:16:31 +02:00
parent d2b0f34757
commit 3f6da4102e
3 changed files with 8 additions and 3 deletions

View File

@ -892,7 +892,7 @@ class PlayerFragment : Fragment() {
} }
if (response.hls != null) { if (response.hls != null) {
binding.relPlayerVlc.setOnClickListener { binding.relPlayerOpen.setOnClickListener {
// start an intent with video as mimetype using the hls stream // start an intent with video as mimetype using the hls stream
val uri: Uri = Uri.parse(response.hls) val uri: Uri = Uri.parse(response.hls)
val intent = Intent() val intent = Intent()
@ -904,7 +904,11 @@ class PlayerFragment : Fragment() {
intent.putExtra("artist", uploader) intent.putExtra("artist", uploader)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
try {
startActivity(intent) startActivity(intent)
} catch (e: Exception) {
Toast.makeText(context, R.string.no_player_found, Toast.LENGTH_SHORT).show()
}
} }
} }
if (relatedStreamsEnabled) { if (relatedStreamsEnabled) {

View File

@ -185,7 +185,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/relPlayer_vlc" android:id="@+id/relPlayer_open"
style="@style/PlayerActionsLayout"> style="@style/PlayerActionsLayout">
<ImageView <ImageView

View File

@ -241,4 +241,5 @@
<string name="autoRotatePlayer_summary">Automatically switch to player fullscreen when the device gets turned.</string> <string name="autoRotatePlayer_summary">Automatically switch to player fullscreen when the device gets turned.</string>
<string name="pure_theme">Pure theme</string> <string name="pure_theme">Pure theme</string>
<string name="pure_theme_summary">Pure white/black theme</string> <string name="pure_theme_summary">Pure white/black theme</string>
<string name="no_player_found">No external player found. Please make sure you have one installed.</string>
</resources> </resources>