Skip to content

Commit c8cf18a

Browse files
committed
feat: Optimized media output panel availability checks
Adjusted media output panel availability check logic based on Android version. - For Android 14 and above, assume the panel is always available. - For Android 12 and 13, check if the system UI can handle the media output dialog intent. - For Android 11 and below, check if the Settings app can handle the media output panel intent. If the panel is unavailable, hide the media control buttons. Signed-off-by: ghhccghk <2137610394@qq.com>
1 parent 93445e9 commit c8cf18a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

app/src/main/java/org/akanework/gramophone/ui/components/FullBottomSheet.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,16 @@ class FullBottomSheet
412412

413413
bottomSheetFavoriteButton.addOnCheckedChangeListener(this)
414414

415+
if (isMediaOutputPanelSupported(context)){
416+
bottomSheetMediaControl.setOnClickListener {
417+
SystemMediaControlResolver(context).intentSystemMediaDialog()
418+
}
419+
} else {
420+
bottomSheetMediaControl.visibility = GONE
421+
}
422+
423+
424+
415425
bottomSheetPlaylistButton.setOnClickListener {
416426
ViewCompat.performHapticFeedback(it, HapticFeedbackConstantsCompat.CONTEXT_CLICK)
417427
if (instance != null)

0 commit comments

Comments
 (0)