Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/MusicStateSpec.java
Andreas Shimokawa f812fb1b1f Improvements to MusicPlayback receiver
- Also send duration if "duration" extra is present
- If "playing" and "postion" extras are present send a music state update

treat previous state and current state as equal if position delta is <=2 seconds
(Neccessary for some players which update every second - the pebble however counts by itself)
2016-06-11 23:37:03 +02:00

35 lines
976 B
Java

package nodomain.freeyourgadget.gadgetbridge.model;
/**
* Created by steffen on 07.06.16.
*/
public class MusicStateSpec {
public static final int STATE_PLAYING = 0;
public static final int STATE_PAUSED = 1;
public static final int STATE_STOPPED = 2;
public static final int STATE_UNKNOWN = 3;
public byte state;
public int position;
public int playRate;
public byte shuffle;
public byte repeat;
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof MusicStateSpec)) {
return false;
}
MusicStateSpec stateSpec = (MusicStateSpec) obj;
return this.state == stateSpec.state &&
Math.abs(this.position - stateSpec.position)<=2 &&
this.playRate == stateSpec.playRate &&
this.shuffle == stateSpec.shuffle &&
this.repeat == stateSpec.repeat;
}
}