-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Refactor ManageTilesView to Material3 #7052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TimoPtr
merged 45 commits into
home-assistant:main
from
oungsi2000:refactor-manage-tiles-view
Jul 15, 2026
Merged
Changes from 6 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 42bc0bf
Add ManageTilesView screenshot tests
oungsi2000 0ac8be8
Refactor ManageTilesView to use a state object and sub-composables
oungsi2000 6ffa26c
Remove unused import in ManageTilesView
oungsi2000 f404e7d
Restore Server Discovery tablet screenshot references
oungsi2000 1337c97
Merge branch 'main' into refactor-manage-tiles-view
oungsi2000 aa5ad24
Update ManageTilesView layout and icon selection UI
oungsi2000 32b736f
Rename ManageTilesView to ManageTiles and move to ui package
oungsi2000 f3be433
Add "multiple servers" test case to ManageTiles screenshot tests
oungsi2000 fdd3f1d
Use HADimens for spacing in ManageTilesView
oungsi2000 fb40613
Add UI tests for ManageTiles
oungsi2000 9fc67f6
Refactor ManageTiles layout to simplify hierarchy and remove redundan…
oungsi2000 a017d11
Refactor ManageTiles view into sub-composables
oungsi2000 b85f45a
Update ManageTiles reset icon UI to use HAIconButton
oungsi2000 71acbb2
Refactor ManageTilesViewModel to use StateFlow and a unified state ob…
oungsi2000 b7c109a
Refactor ManageTiles selection to use tile IDs
oungsi2000 36d00f8
Clean up ManageTiles code and remove unused imports
oungsi2000 c74d8ca
Update ManageTilesScreenshotTest structure
oungsi2000 b9af4c6
Merge branch 'main' into refactor-manage-tiles-view
oungsi2000 4a386c8
Refactor tile info snackbar to use strings in ManageTilesViewModel
oungsi2000 02a95fd
Update ManageTiles tests to support submit state and server dropdowns
oungsi2000 7afc3ad
Refactor ManageTilesViewModel: state, snackbar, dispatchers, visibility
oungsi2000 18d44f6
Refactor ManageTiles composable: inline dropdowns, ColumnScope extens…
oungsi2000 70d4eb7
Remove dialog state and icon selection from ManageTilesFragment
oungsi2000 ad1daf9
Update tests and fragment for review round 2 changes
oungsi2000 72e5fa5
Refactor Quick Settings tile management state and snackbar event hand…
oungsi2000 7d06a1a
Refactor ManageTiles UI components and layout
oungsi2000 ec7f493
Update ManageTiles screenshot test references
oungsi2000 1c1658b
Update ManageTilesViewModelTest to use TileInfoSnackbarEvent
oungsi2000 cad9ce3
Refactor ManageTiles persistence logic and snackbar event handling
oungsi2000 e86ef4f
Refactor ManageTiles: state simplification, UI refinements, and snack…
oungsi2000 a0395f2
Update IconDialog to Material 3 and refactor tile setup strings
oungsi2000 89f008c
Update ManageTiles screenshot tests and state structure
oungsi2000 c70e70a
Refactor ManageTilesViewModel to load entity data on-demand
oungsi2000 196ddf8
Refactor IconDialog to use Material 2 and HomeAssistantAppTheme
oungsi2000 66fd9db
Remove window insets padding from SnackbarHost in ManageTilesScreen
oungsi2000 ea985c1
Refactor ManageTiles tile addition logic
oungsi2000 112057e
Remove unused windowInsetsPadding import in ManageTilesScreen
oungsi2000 a35c118
Update TileDao return type and ManageTiles layout constraints
oungsi2000 1661061
Update reference screenshots for ManageTiles and ServerDiscovery tests
oungsi2000 39e264a
Update Server Discovery tablet screenshot test references
oungsi2000 489da9f
Refactor ManageTilesScreen UI and styling
oungsi2000 149b212
Refactor ManageTiles state management and resolve race of entity loading
oungsi2000 355cd41
Update ManageTiles tests and state for concurrency and UI consistency
oungsi2000 ad0681d
Adjust R imports
TimoPtr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
510 changes: 355 additions & 155 deletions
510
app/src/main/kotlin/io/homeassistant/companion/android/settings/qs/views/ManageTilesView.kt
Large diffs are not rendered by default.
Oops, something went wrong.
95 changes: 95 additions & 0 deletions
95
...lin/io/homeassistant/companion/android/settings/qs/views/ManageTilesViewScreenshotTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| package io.homeassistant.companion.android.settings.qs.views | ||
|
|
||
| import androidx.compose.material3.SnackbarHostState | ||
| import androidx.compose.runtime.Composable | ||
| import androidx.compose.runtime.remember | ||
| import com.android.tools.screenshot.PreviewTest | ||
| import io.homeassistant.companion.android.common.R as commonR | ||
| import io.homeassistant.companion.android.common.compose.theme.HAThemeForPreview | ||
| import io.homeassistant.companion.android.settings.qs.TileSlot | ||
| import io.homeassistant.companion.android.util.compose.HAPreviews | ||
|
|
||
| class ManageTilesViewScreenshotTest { | ||
|
|
||
| @PreviewTest | ||
| @HAPreviews | ||
| @Composable | ||
| fun `ManageTilesView add tile`() { | ||
| HAThemeForPreview { | ||
| ManageTilesView( | ||
| snackbarHostState = remember { SnackbarHostState() }, | ||
| state = addTileState, | ||
| onTileSelected = {}, | ||
| onServerSelected = {}, | ||
| onTileLabelChange = {}, | ||
| onTileSubtitleChange = {}, | ||
| onEntitySelectedId = {}, | ||
| onEntityCleared = {}, | ||
| onShowIconDialog = {}, | ||
| onResetIcon = {}, | ||
| onShouldVibrateChange = {}, | ||
| onAuthRequiredChange = {}, | ||
| onSubmit = {}, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @PreviewTest | ||
| @HAPreviews | ||
| @Composable | ||
| fun `ManageTilesView update tile`() { | ||
|
TimoPtr marked this conversation as resolved.
Outdated
|
||
| HAThemeForPreview { | ||
| ManageTilesView( | ||
| snackbarHostState = remember { SnackbarHostState() }, | ||
| state = addTileState.copy( | ||
| selectedTile = addTileState.tileSlots[1], | ||
| tileLabel = "Living room", | ||
| tileSubtitle = "Lights", | ||
| selectedEntityId = "light.living_room", | ||
| showResetIcon = true, | ||
| shouldVibrate = true, | ||
| submitButtonLabel = commonR.string.tile_save, | ||
| submitEnabled = true, | ||
| ), | ||
| onTileSelected = {}, | ||
| onServerSelected = {}, | ||
| onTileLabelChange = {}, | ||
| onTileSubtitleChange = {}, | ||
| onEntitySelectedId = {}, | ||
| onEntityCleared = {}, | ||
| onShowIconDialog = {}, | ||
| onResetIcon = {}, | ||
| onShouldVibrateChange = {}, | ||
| onAuthRequiredChange = {}, | ||
| onSubmit = {}, | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| private companion object { | ||
| val addTileState = ManageTilesViewState( | ||
| tileSlots = listOf( | ||
| TileSlot(id = "tile_1", name = "Tile 1"), | ||
| TileSlot(id = "tile_2", name = "Tile 2"), | ||
| ), | ||
| selectedTile = TileSlot(id = "tile_1", name = "Tile 1"), | ||
| servers = emptyList(), | ||
| selectedServerId = 0, | ||
| showServerSelector = false, | ||
| tileLabel = "", | ||
| showSubtitle = true, | ||
| tileSubtitle = "", | ||
| entities = emptyList(), | ||
| selectedEntityId = "", | ||
| entityRegistry = emptyList(), | ||
| deviceRegistry = emptyList(), | ||
| areaRegistry = emptyList(), | ||
| selectedIcon = null, | ||
| showResetIcon = false, | ||
| shouldVibrate = false, | ||
| authRequired = false, | ||
| submitButtonLabel = commonR.string.tile_add, | ||
| submitEnabled = false, | ||
| ) | ||
| } | ||
| } | ||
Binary file added
BIN
+76.1 KB
.../ManageTilesViewScreenshotTest/ManageTilesView add tile_foldable_c908f502_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+63 KB
...ews/ManageTilesViewScreenshotTest/ManageTilesView add tile_phone_e05166be_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.9 KB
...TilesViewScreenshotTest/ManageTilesView add tile_phone_landscape_9e00b29d_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.2 KB
...nageTilesViewScreenshotTest/ManageTilesView add tile_small_phone_66e7bbf2_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+59.8 KB
...ws/ManageTilesViewScreenshotTest/ManageTilesView add tile_tablet_2f22c4ea_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+57.4 KB
...ilesViewScreenshotTest/ManageTilesView add tile_tablet_landscape_62cae397_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+84.4 KB
...nageTilesViewScreenshotTest/ManageTilesView update tile_foldable_c908f502_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+71.4 KB
.../ManageTilesViewScreenshotTest/ManageTilesView update tile_phone_e05166be_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+53.1 KB
...esViewScreenshotTest/ManageTilesView update tile_phone_landscape_9e00b29d_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45.4 KB
...eTilesViewScreenshotTest/ManageTilesView update tile_small_phone_66e7bbf2_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+66.9 KB
...ManageTilesViewScreenshotTest/ManageTilesView update tile_tablet_2f22c4ea_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+64 KB
...sViewScreenshotTest/ManageTilesView update tile_tablet_landscape_62cae397_0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any good reason to keep the dialog in here, move it within the ManageTiles directly.