From 116fa027958e3ff5ad7b08eb3e8e922e9e098006 Mon Sep 17 00:00:00 2001 From: Piyush Aggarwal Date: Tue, 22 Jun 2021 08:10:21 +0530 Subject: [PATCH] mprisplugin: allow hiding per-app volume meter if not supported by remote media app --- .../Plugins/MprisPlugin/MprisNowPlayingFragment.java | 4 +++- src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisNowPlayingFragment.java b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisNowPlayingFragment.java index ece1bf3c..c86a21fc 100644 --- a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisNowPlayingFragment.java +++ b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisNowPlayingFragment.java @@ -338,7 +338,9 @@ public class MprisNowPlayingFragment extends Fragment implements VolumeKeyListen int volume = playerStatus.getVolume(); mprisControlBinding.volumeSeek.setProgress(volume); - + if(!playerStatus.isSetVolumeAllowed()) { + mprisControlBinding.volumeSeek.setEnabled(false); + } boolean isPlaying = playerStatus.isPlaying(); if (isPlaying) { mprisControlBinding.playButton.setImageResource(R.drawable.ic_pause_black); diff --git a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java index 0a43e6f8..44d288c6 100644 --- a/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/MprisPlugin/MprisPlugin.java @@ -150,7 +150,7 @@ public class MprisPlugin extends Plugin { } public boolean isSetVolumeAllowed() { - return !isSpotify(); + return !isSpotify() && (getVolume() > -1); } public long getPosition() {