Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
13062f7
Migrate ManageTilesView to Material 3 and refactor for state hoisting.
oungsi2000 Jun 19, 2026
42bc0bf
Add ManageTilesView screenshot tests
oungsi2000 Jun 19, 2026
0ac8be8
Refactor ManageTilesView to use a state object and sub-composables
oungsi2000 Jun 19, 2026
6ffa26c
Remove unused import in ManageTilesView
oungsi2000 Jun 19, 2026
f404e7d
Restore Server Discovery tablet screenshot references
oungsi2000 Jun 19, 2026
1337c97
Merge branch 'main' into refactor-manage-tiles-view
oungsi2000 Jun 20, 2026
aa5ad24
Update ManageTilesView layout and icon selection UI
oungsi2000 Jun 24, 2026
32b736f
Rename ManageTilesView to ManageTiles and move to ui package
oungsi2000 Jun 28, 2026
f3be433
Add "multiple servers" test case to ManageTiles screenshot tests
oungsi2000 Jun 28, 2026
fdd3f1d
Use HADimens for spacing in ManageTilesView
oungsi2000 Jun 28, 2026
fb40613
Add UI tests for ManageTiles
oungsi2000 Jun 28, 2026
9fc67f6
Refactor ManageTiles layout to simplify hierarchy and remove redundan…
oungsi2000 Jun 28, 2026
a017d11
Refactor ManageTiles view into sub-composables
oungsi2000 Jun 28, 2026
b85f45a
Update ManageTiles reset icon UI to use HAIconButton
oungsi2000 Jun 28, 2026
71acbb2
Refactor ManageTilesViewModel to use StateFlow and a unified state ob…
oungsi2000 Jun 28, 2026
b7c109a
Refactor ManageTiles selection to use tile IDs
oungsi2000 Jun 28, 2026
36d00f8
Clean up ManageTiles code and remove unused imports
oungsi2000 Jun 28, 2026
c74d8ca
Update ManageTilesScreenshotTest structure
oungsi2000 Jun 28, 2026
b9af4c6
Merge branch 'main' into refactor-manage-tiles-view
oungsi2000 Jun 28, 2026
4a386c8
Refactor tile info snackbar to use strings in ManageTilesViewModel
oungsi2000 Jun 29, 2026
02a95fd
Update ManageTiles tests to support submit state and server dropdowns
oungsi2000 Jun 29, 2026
7afc3ad
Refactor ManageTilesViewModel: state, snackbar, dispatchers, visibility
oungsi2000 Jun 30, 2026
18d44f6
Refactor ManageTiles composable: inline dropdowns, ColumnScope extens…
oungsi2000 Jun 30, 2026
70d4eb7
Remove dialog state and icon selection from ManageTilesFragment
oungsi2000 Jun 30, 2026
ad1daf9
Update tests and fragment for review round 2 changes
oungsi2000 Jun 30, 2026
72e5fa5
Refactor Quick Settings tile management state and snackbar event hand…
oungsi2000 Jun 30, 2026
7d06a1a
Refactor ManageTiles UI components and layout
oungsi2000 Jun 30, 2026
ec7f493
Update ManageTiles screenshot test references
oungsi2000 Jun 30, 2026
1c1658b
Update ManageTilesViewModelTest to use TileInfoSnackbarEvent
oungsi2000 Jun 30, 2026
cad9ce3
Refactor ManageTiles persistence logic and snackbar event handling
oungsi2000 Jul 3, 2026
e86ef4f
Refactor ManageTiles: state simplification, UI refinements, and snack…
oungsi2000 Jul 3, 2026
a0395f2
Update IconDialog to Material 3 and refactor tile setup strings
oungsi2000 Jul 3, 2026
89f008c
Update ManageTiles screenshot tests and state structure
oungsi2000 Jul 3, 2026
c70e70a
Refactor ManageTilesViewModel to load entity data on-demand
oungsi2000 Jul 3, 2026
196ddf8
Refactor IconDialog to use Material 2 and HomeAssistantAppTheme
oungsi2000 Jul 3, 2026
66fd9db
Remove window insets padding from SnackbarHost in ManageTilesScreen
oungsi2000 Jul 3, 2026
ea985c1
Refactor ManageTiles tile addition logic
oungsi2000 Jul 3, 2026
112057e
Remove unused windowInsetsPadding import in ManageTilesScreen
oungsi2000 Jul 3, 2026
a35c118
Update TileDao return type and ManageTiles layout constraints
oungsi2000 Jul 3, 2026
1661061
Update reference screenshots for ManageTiles and ServerDiscovery tests
oungsi2000 Jul 3, 2026
39e264a
Update Server Discovery tablet screenshot test references
oungsi2000 Jul 3, 2026
489da9f
Refactor ManageTilesScreen UI and styling
oungsi2000 Jul 10, 2026
149b212
Refactor ManageTiles state management and resolve race of entity loading
oungsi2000 Jul 10, 2026
355cd41
Update ManageTiles tests and state for concurrency and UI consistency
oungsi2000 Jul 10, 2026
ad0681d
Adjust R imports
TimoPtr Jul 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,24 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.ComposeView
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import com.mikepenz.iconics.typeface.IIcon
import dagger.hilt.android.AndroidEntryPoint
import io.homeassistant.companion.android.common.R as commonR
import io.homeassistant.companion.android.common.compose.theme.HATheme
import io.homeassistant.companion.android.settings.addHelpMenuProvider
import io.homeassistant.companion.android.settings.qs.views.ManageTilesView
import io.homeassistant.companion.android.util.compose.HomeAssistantAppTheme
import io.homeassistant.companion.android.util.icondialog.IconDialog
import timber.log.Timber
import io.homeassistant.companion.android.settings.qs.ui.ManageTilesScreen

@AndroidEntryPoint
class ManageTilesFragment : Fragment() {
val viewModel: ManageTilesViewModel by viewModels()
internal val viewModel: ManageTilesViewModel by viewModels()

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
return ComposeView(requireContext()).apply {
setContent {
HomeAssistantAppTheme {
var showingDialog by remember { mutableStateOf(false) }

if (showingDialog) {
IconDialog(
onSelect = {
onIconDialogIconsSelected(it)
showingDialog = false
},
onDismissRequest = { showingDialog = false },
)
}

ManageTilesView(
viewModel = viewModel,
onShowIconDialog = {
showingDialog = true
},
)
HATheme {
ManageTilesScreen(viewModel = viewModel)
}
}
}
Expand All @@ -59,9 +35,4 @@ class ManageTilesFragment : Fragment() {
super.onResume()
activity?.title = getString(commonR.string.tiles)
}

private fun onIconDialogIconsSelected(selectedIcon: IIcon) {
Timber.d("Selected icon: ${selectedIcon.name}")
viewModel.selectIcon(selectedIcon)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.homeassistant.companion.android.settings.qs

import androidx.compose.runtime.Stable
import com.mikepenz.iconics.typeface.IIcon
import io.homeassistant.companion.android.common.R as commonR
import io.homeassistant.companion.android.common.compose.composable.HADropdownItem
import io.homeassistant.companion.android.common.data.integration.Entity
import io.homeassistant.companion.android.common.data.servers.ServerManager
import io.homeassistant.companion.android.common.data.websocket.impl.entities.AreaRegistryResponse
import io.homeassistant.companion.android.common.data.websocket.impl.entities.DeviceRegistryResponse
import io.homeassistant.companion.android.common.data.websocket.impl.entities.EntityRegistryResponse

@Stable
internal data class ManageTilesState(
val selectedTileId: String = "",
val entities: List<Entity> = emptyList(),
val entityRegistry: List<EntityRegistryResponse> = emptyList(),
val deviceRegistry: List<DeviceRegistryResponse> = emptyList(),
val areaRegistry: List<AreaRegistryResponse> = emptyList(),
val selectedServerId: Int = ServerManager.SERVER_ID_ACTIVE,
val selectedIconId: String? = null,
val selectedIcon: IIcon? = null,
val selectedEntityId: String = "",
val tileLabel: String = "",
val tileSubtitle: String = "",
val submitButtonLabel: Int = commonR.string.tile_save,
val selectedShouldVibrate: Boolean = false,
val tileAuthRequired: Boolean = false,
val showSubtitle: Boolean = false,
val tileSlotsDropdownItems: List<HADropdownItem<String>> = emptyList(),
val serversDropdownItems: List<HADropdownItem<Int>> = emptyList(),
) {
val showServerSelector = serversDropdownItems.size > 1 ||
serversDropdownItems.none { server -> server.key == selectedServerId }

val showResetIcon = selectedIconId != null && selectedEntityId.isNotBlank()

val submitEnabled = tileLabel.isNotBlank() &&
serversDropdownItems.any { it.key == selectedServerId } &&
entities.any { it.entityId == selectedEntityId }
}
Loading
Loading