1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 19:06:53 +01:00

Work around music controls being disabled since last commit on Amazfit Cor (we do not get a music app started event before we haven't sent music information - weird)

This commit is contained in:
Andreas Shimokawa 2020-06-22 18:35:22 +02:00
parent 6b20f62e0f
commit 5d58a2f583
2 changed files with 10 additions and 1 deletions

View File

@ -842,7 +842,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
sendMusicStateToDevice(bufferMusicSpec, bufferMusicStateSpec);
}
private void sendMusicStateToDevice(MusicSpec musicSpec, MusicStateSpec musicStateSpec) {
protected void sendMusicStateToDevice(MusicSpec musicSpec, MusicStateSpec musicStateSpec) {
if (characteristicChunked == null) {
return;
}

View File

@ -35,6 +35,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor.AmazfitCorFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitcor.AmazfitCorService;
import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport;
@ -85,6 +86,14 @@ public class AmazfitCorSupport extends AmazfitBipSupport {
return this;
}
@Override
public void onSetMusicState(MusicStateSpec stateSpec) {
if (stateSpec != null && !stateSpec.equals(bufferMusicStateSpec)) {
sendMusicStateToDevice(null, stateSpec);
bufferMusicStateSpec = stateSpec;
}
}
@Override
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
return new AmazfitCorFWHelper(uri, context);