Commit 2a61f431 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Use more runwithplugin

parent 8b5734db
...@@ -81,14 +81,7 @@ public class MprisActivity extends AppCompatActivity { ...@@ -81,14 +81,7 @@ public class MprisActivity extends AppCompatActivity {
private void connectToPlugin(final String targetPlayerName) { private void connectToPlugin(final String targetPlayerName) {
BackgroundService.RunCommand(this, service -> { BackgroundService.RunWithPlugin(this, deviceId, MprisPlugin.class, mpris -> {
final Device device = service.getDevice(deviceId);
final MprisPlugin mpris = device.getPlugin(MprisPlugin.class);
if (mpris == null) {
Log.e("MprisActivity", "device has no mpris plugin!");
return;
}
targetPlayer = mpris.getPlayerStatus(targetPlayerName); targetPlayer = mpris.getPlayerStatus(targetPlayerName);
addSytemvolumeFragment(); addSytemvolumeFragment();
...@@ -172,7 +165,6 @@ public class MprisActivity extends AppCompatActivity { ...@@ -172,7 +165,6 @@ public class MprisActivity extends AppCompatActivity {
}); });
}); });
} }
private void addSytemvolumeFragment() { private void addSytemvolumeFragment() {
......
...@@ -49,9 +49,6 @@ public class ShareBroadcastReceiver extends BroadcastReceiver { ...@@ -49,9 +49,6 @@ public class ShareBroadcastReceiver extends BroadcastReceiver {
long jobId = intent.getLongExtra(SharePlugin.CANCEL_SHARE_BACKGROUND_JOB_ID_EXTRA, -1); long jobId = intent.getLongExtra(SharePlugin.CANCEL_SHARE_BACKGROUND_JOB_ID_EXTRA, -1);
String deviceId = intent.getStringExtra(SharePlugin.CANCEL_SHARE_DEVICE_ID_EXTRA); String deviceId = intent.getStringExtra(SharePlugin.CANCEL_SHARE_DEVICE_ID_EXTRA);
BackgroundService.RunCommand(context, service -> { BackgroundService.RunWithPlugin(context, deviceId, SharePlugin.class, plugin -> plugin.cancelJob(jobId));
SharePlugin plugin = service.getDevice(deviceId).getPlugin(SharePlugin.class);
plugin.cancelJob(jobId);
});
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment