mirror of
https://github.com/home-assistant/android
synced 2024-07-22 10:54:12 +00:00
Don't reset QS tile entity when changing servers if existing on new server (#3530)
- Prevent unnecessary changes to the selected entity when changing servers, if an entity exists on both servers. It already didn't clear everything like title/icon, just the selected entity! - Still calling selectEntityId in case the icon is different
This commit is contained in:
parent
d81913b7ea
commit
6cf6c06c4c
|
@ -244,10 +244,10 @@ class ManageTilesViewModel @Inject constructor(
|
|||
}
|
||||
|
||||
fun selectServerId(serverId: Int) {
|
||||
val resetEntity = serverId != selectedServerId
|
||||
val resetEntity = serverId != selectedServerId && entities[serverId]?.none { it.entityId == selectedEntityId } == true
|
||||
selectedServerId = serverId
|
||||
loadEntities(serverId)
|
||||
if (resetEntity) selectEntityId("")
|
||||
selectEntityId(if (resetEntity) "" else selectedEntityId)
|
||||
}
|
||||
|
||||
private fun loadEntities(serverId: Int) {
|
||||
|
|
Loading…
Reference in a new issue