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

Use more runwithplugin

parent 8b5734db
......@@ -81,14 +81,7 @@ public class MprisActivity extends AppCompatActivity {
private void connectToPlugin(final String targetPlayerName) {
BackgroundService.RunCommand(this, service -> {
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;
}
BackgroundService.RunWithPlugin(this, deviceId, MprisPlugin.class, mpris -> {
targetPlayer = mpris.getPlayerStatus(targetPlayerName);
addSytemvolumeFragment();
......@@ -172,7 +165,6 @@ public class MprisActivity extends AppCompatActivity {
});
});
}
private void addSytemvolumeFragment() {
......
......@@ -49,9 +49,6 @@ public class ShareBroadcastReceiver extends BroadcastReceiver {
long jobId = intent.getLongExtra(SharePlugin.CANCEL_SHARE_BACKGROUND_JOB_ID_EXTRA, -1);
String deviceId = intent.getStringExtra(SharePlugin.CANCEL_SHARE_DEVICE_ID_EXTRA);
BackgroundService.RunCommand(context, service -> {
SharePlugin plugin = service.getDevice(deviceId).getPlugin(SharePlugin.class);
plugin.cancelJob(jobId);
});
BackgroundService.RunWithPlugin(context, deviceId, SharePlugin.class, plugin -> plugin.cancelJob(jobId));
}
}
Markdown is supported
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