Change web search intent logic (#62)
This commit is contained in:
@@ -10,6 +10,9 @@
|
|||||||
<intent>
|
<intent>
|
||||||
<action android:name="android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL" />
|
<action android:name="android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL" />
|
||||||
</intent>
|
</intent>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.WEB_SEARCH" />
|
||||||
|
</intent>
|
||||||
</queries>
|
</queries>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package it.vfsfitvnm.vimusic.ui.views
|
|||||||
|
|
||||||
import android.app.SearchManager
|
import android.app.SearchManager
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.compose.animation.AnimatedContentScope
|
import androidx.compose.animation.AnimatedContentScope
|
||||||
import androidx.compose.animation.ExperimentalAnimationApi
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
import androidx.compose.animation.animateColorAsState
|
import androidx.compose.animation.animateColorAsState
|
||||||
@@ -218,13 +219,16 @@ fun PlayerBottomSheet(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onSearchOnline = {
|
onSearchOnline = {
|
||||||
player?.mediaMetadata?.let {
|
val mediaMetadata = player?.mediaMetadata ?: return@LyricsView
|
||||||
context.startActivity(Intent(Intent.ACTION_WEB_SEARCH).apply {
|
|
||||||
putExtra(
|
val intent = Intent(Intent.ACTION_WEB_SEARCH).apply {
|
||||||
SearchManager.QUERY,
|
putExtra(SearchManager.QUERY, "${mediaMetadata.title} ${mediaMetadata.artist} lyrics")
|
||||||
"${it.title} ${it.artist} lyrics"
|
}
|
||||||
)
|
|
||||||
})
|
if (intent.resolveActivity(context.packageManager) != null) {
|
||||||
|
context.startActivity(intent)
|
||||||
|
} else {
|
||||||
|
Toast.makeText(context, "No browser app found!", Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLyricsUpdate = { lyrics ->
|
onLyricsUpdate = { lyrics ->
|
||||||
|
|||||||
Reference in New Issue
Block a user