mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 17:08:34 +03:00
Better sorting
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
c50257653c
commit
7c8c811c6b
1 changed files with 10 additions and 2 deletions
|
@ -67,6 +67,7 @@ import com.nextcloud.talk.utils.KeyboardUtils;
|
||||||
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
import com.nextcloud.talk.utils.bundle.BundleKeys;
|
||||||
import com.nextcloud.talk.utils.database.user.UserUtils;
|
import com.nextcloud.talk.utils.database.user.UserUtils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.CompareToBuilder;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
@ -281,8 +282,15 @@ public class CallsListController extends BaseController implements SearchView.On
|
||||||
adapter.updateDataSet(callItems, true);
|
adapter.updateDataSet(callItems, true);
|
||||||
|
|
||||||
if (currentUser.hasSpreedCapabilityWithName("last-room-activity")) {
|
if (currentUser.hasSpreedCapabilityWithName("last-room-activity")) {
|
||||||
Collections.sort(callItems, (callItem, t1) ->
|
Collections.sort(callItems, (o1, o2) -> {
|
||||||
Long.compare(t1.getModel().getLastActivity(), callItem.getModel().getLastActivity()));
|
Room room1 = o1.getModel();
|
||||||
|
Room room2 = o2.getModel();
|
||||||
|
return new CompareToBuilder()
|
||||||
|
.append(room1.isPinned(), room2.isPinned())
|
||||||
|
.append(room1.getUnreadMessages(), room2.getUnreadMessages())
|
||||||
|
.append(room1.getLastActivity(), room2.getLastActivity())
|
||||||
|
.toComparison();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Collections.sort(callItems, (callItem, t1) ->
|
Collections.sort(callItems, (callItem, t1) ->
|
||||||
Long.compare(t1.getModel().getLastPing(), callItem.getModel().getLastPing()));
|
Long.compare(t1.getModel().getLastPing(), callItem.getModel().getLastPing()));
|
||||||
|
|
Loading…
Reference in a new issue