Improve overview device list expand button handling

This commit is contained in:
Jonas Lochmann 2022-09-19 02:00:00 +02:00
parent d8b492e2e3
commit 93865519eb
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36

View file

@ -166,8 +166,15 @@ class OverviewFragmentModel(application: Application): AndroidViewModel(applicat
add(OverviewFragmentActionAddDevice) add(OverviewFragmentActionAddDevice)
} else { } else {
add(ShowMoreOverviewFragmentItem.ShowMoreDevices(when (itemVisibility.devices) { add(ShowMoreOverviewFragmentItem.ShowMoreDevices(when (itemVisibility.devices) {
DeviceListItemVisibility.BareMinimum -> if (deviceEntries.find { it.deviceUser?.type == UserType.Child } != null) DeviceListItemVisibility.BareMinimum -> run {
DeviceListItemVisibility.AllChildDevices else DeviceListItemVisibility.AllDevices if (
deviceEntries.any {
!it.isCurrentDevice &&
!it.isImportant &&
it.deviceUser?.type == UserType.Child
}
) DeviceListItemVisibility.AllChildDevices else DeviceListItemVisibility.AllDevices
}
DeviceListItemVisibility.AllChildDevices -> DeviceListItemVisibility.AllDevices DeviceListItemVisibility.AllChildDevices -> DeviceListItemVisibility.AllDevices
DeviceListItemVisibility.AllDevices -> DeviceListItemVisibility.AllDevices DeviceListItemVisibility.AllDevices -> DeviceListItemVisibility.AllDevices
})) }))