From b25c49725f9ee8b8d07c247180abcae3696592ec Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 2 May 2019 06:38:42 -0400 Subject: [PATCH] Sort hidden items on the top --- .../topjohnwu/magisk/model/entity/state/IndeterminateState.kt | 4 ++-- .../main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/model/entity/state/IndeterminateState.kt b/app/src/main/java/com/topjohnwu/magisk/model/entity/state/IndeterminateState.kt index ba381e695..43b97f12d 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/entity/state/IndeterminateState.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/state/IndeterminateState.kt @@ -1,5 +1,5 @@ package com.topjohnwu.magisk.model.entity.state enum class IndeterminateState { - INDETERMINATE, CHECKED, UNCHECKED -} \ No newline at end of file + CHECKED, INDETERMINATE, UNCHECKED +} diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt index f9d8fcf3d..2e60d5d5a 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt @@ -73,7 +73,8 @@ class HideViewModel( .filter { it.processes.isNotEmpty() } .map { HideRvItem(it, hideTargets.blockingGet()) } .toList() - .map { it.sortBy { it.item.info.name }; it } + .map { it.sortWith(compareBy( + {it.isHiddenState.value}, {it.item.info.name}, {it.packageName})); it } .doOnSuccess { allItems.update(it) } .flatMap { queryRaw() } .applyViewModel(this)