mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-24 17:45:50 +01:00
Move the connected device to top in control center
What happens in reality is that devices are sorted according to their connection status first, and then by name. So even if/when we support multiple device connection, the order should remain sane. This closes #842.
This commit is contained in:
parent
7ec57fb81e
commit
e7a1e1b8c3
@ -1,5 +1,8 @@
|
||||
### Changelog
|
||||
|
||||
#### Version next
|
||||
* Move the connected device to top in control center
|
||||
|
||||
#### Version 0.24.6
|
||||
* Display the chat icon for notifications coming from Kontalk and Antox
|
||||
* Pebble: Fix for background js which try to send floats (e.g. TrekVolle)
|
||||
|
@ -163,7 +163,10 @@ public class DeviceManager {
|
||||
Collections.sort(deviceList, new Comparator<GBDevice>() {
|
||||
@Override
|
||||
public int compare(GBDevice lhs, GBDevice rhs) {
|
||||
return Collator.getInstance().compare(lhs.getName(), rhs.getName());
|
||||
if (rhs.getStateOrdinal() - lhs.getStateOrdinal() == 0) {
|
||||
return Collator.getInstance().compare(lhs.getName(), rhs.getName());
|
||||
}
|
||||
return (rhs.getStateOrdinal() - lhs.getStateOrdinal());
|
||||
}
|
||||
});
|
||||
notifyDevicesChanged();
|
||||
|
@ -252,6 +252,10 @@ public class GBDevice implements Parcelable {
|
||||
return mState;
|
||||
}
|
||||
|
||||
public int getStateOrdinal() {
|
||||
return mState.ordinal();
|
||||
}
|
||||
|
||||
public void setState(State state) {
|
||||
mState = state;
|
||||
if (state.ordinal() <= State.CONNECTED.ordinal()) {
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<changelog>
|
||||
<release version="next">
|
||||
<change>Move the connected device to top in control center</change>
|
||||
</release>
|
||||
<release version="0.24.6" versioncode="123">
|
||||
<change>Display the chat icon for notifications coming from Kontalk and Antox</change>
|
||||
<change>Pebble: Fix for background js which try to send floats (e.g. TrekVolle)</change>
|
||||
|
Loading…
Reference in New Issue
Block a user