home-assistant-android/wear
Márton Maráz a8a7363317
Implement support for multiple Shortcut Tiles on Wear OS (#3697)
* Extract JSONArray -> List<String> conversion to extension fun

* Refactor navigation around Shortcuts Tile settings

* Add ShortcutsTileId enum class

* Introduce multiple ShortcutTile subclasses and modify settings UI and storage to support multiple Tiles

* Check if correct ShortcutsTileId is passed as parameter to BaseShortcutTile

* Update TileUpdateRequester usages to account for multiple Tiles

* Add entity count to Shortcut Tile list in Settings

* Fix ktlint errors

* Fix more ktlint errors

* Extract string resource

* Add MULTI_INSTANCES_SUPPORTED to ShortcutsTile to be able to use any number of Tiles

* Refresh the list of Shortcut Tiles in the Settings without needing to restart the app

* Remove test logs

* Update androidx.wear.tiles:tiles to the latest version which doesn't yet require API 34 compileSdk version

* Fix crash when the preference's value is "{}"

* Fix crash when key String is "null" and converting to Int

* Rename placeholder variable name

* Add a comment explaining why to save the tiles in a getter

* Return emptyList() directly for clarity

* Remove icons from "Shortcut tile #n" entries in Settings

* Pass emptyList instead of using the non-null assertion operator to prevent NPEs in edge cases

* Refactor getTileShortcuts and getAllTileShortcuts in WearPrefsRepositoryImpl.
Make the code more readable and understandable, and reduce code duplication.

* Make it explicit that intKey is only intended to be null if stringKey == "null"

* Rename getTileShortcuts to getTileShortcutsAndSaveTileId and make it save the tileId not only when there's a null key in the map, but also when the tileId is not yet in the map. This way, actual Tiles and the tileId keys will be more in sync.

* Handle adding Shortcuts Tile immediately after updating the app to a new version which introduces support for multiple Shortcuts Tiles.

* Show message in the Settings when there are no Shortcuts tiles added yet.

* Refine message in the Settings when there are no Shortcuts tiles added yet

* WIP: ConfigShortcutsTile action

* Update comments about Wear OS versions

* Finalize ConfigShortcutsTile feature by applying @jpelgrom's suggestion to OpenShortcutTileSettingsActivity

* Only wrap the code in runCatching which is expected to throw an Exception under normal circumstances, when the pref value needs to be migrated from the old format.

* Call getTileShortcutsAndSaveTileId in OpenShortcutTileSettingsActivity

* Remove unnecessary stuff
2023-07-31 15:14:01 -04:00
..
src Implement support for multiple Shortcut Tiles on Wear OS (#3697) 2023-07-31 15:14:01 -04:00
build.gradle.kts First Steps into making Gradle Catalogs (#3724) 2023-07-29 11:11:08 -04:00
proguard-rules.pro Feature/wear publishing (#1264) 2020-12-27 22:04:37 -05:00