Skip to content
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

Improve adding quick settings tile #2860

Merged
merged 3 commits into from
Sep 10, 2022

Conversation

jpelgrom
Copy link
Member

@jpelgrom jpelgrom commented Sep 6, 2022

Summary

This PR bundles a few improvements to the quick settings tiles setup process:

  • Instead of disabling a tile in the QS panel when it hasn't been setup, make it inactive and deeplink to the specific tile's settings when tapping it. This makes it easier to set up the tile if you haven't browsed the app settings, and also helps with the Toast message not appearing / being hidden behind the QS panel on recent Android versions.
  • When using Android 13, use the new quick settings placement API to allow adding a tile from the app's settings. If the tile was already added it will update like before.
  • Don't show the tile subtitle option on Android versions before 10, as it simply isn't available for those versions.

Screenshots

A tile that hasn't been setup will now be inactive instead of disabled (appearance depends on Android version):
An inactive tile with the Home Assistant logo, titled 'Title 1' and the subtitle 'Requires setup'

After tapping it, the settings will open for that specific tile with a message that the tile requires setup before use:

Light Dark
Tile settings, with a message 'You need to set up the tile before using it' at the bottom of the screen, light mode. Tile settings, with a message 'You need to set up the tile before using it' at the bottom of the screen, dark mode.

When using Android 13, you will now see the 'Update Tile Data' button replaced with 'Add Tile' if the tile hasn't been added to the quick settings panel yet:

Light Dark
Tile settings that show a blue button 'Add Tile' in the place of where before 'Update Tile Data' was shown, light mode. Tile settings that show a blue button 'Add Tile' in the place of where before 'Update Tile Data' was shown, dark mode.

After tapping on 'Add Tile', the system will show a dialog asking if you want to add the tile, with a basic preview:

Light Dark
A dialog on top of the app titled 'Home Assistant wants to add the following tile to Quick Settings', with a preview of the tile that was setup in the app and buttons titled 'Do not add tile' and 'Add tile', light mode. A dialog on top of the app titled 'Home Assistant wants to add the following tile to Quick Settings', with a preview of the tile that was setup in the app and buttons titled 'Do not add tile' and 'Add tile', dark mode.

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#808

Any other notes

 - Use the new option available on Android 13 to prompt the user to add a tile to the quick settings panel, if a tile wasn't already added
 - Switch Toast to Snackbar
 - Move some logic from the manage tiles view to viewmodel
 - Setting a tile subtitle is only supported on Android Q+, so don't show the field on versions before that!
 - Instead of disabling a tile if it isn't setup, if the user is logged in set it up as inactive with the default icon/label and deeplink into the app settings with a notice that it needs to be setup first. This provides a better first use experience, as the user can simply tap it to setup instead of requiring them to manually go to the settings.
Copy link
Member

@dshokouhi dshokouhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, tested debug APK and it works well.

I did spot a bug in Android 13 or at least on my device where I couldn't drag up a new tile beyond a certain point however, that happened for other apps as well like AutoNotifications which adds 40 tiles. Definitely not something introduced here but just mentioning it in case anyone else see's that issue during testing.

@JBassett JBassett merged commit bdc9094 into home-assistant:master Sep 10, 2022
@jpelgrom jpelgrom deleted the android-13-tiles branch September 10, 2022 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants