Commit graph

12 commits

Author SHA1 Message Date
Joris Pelgröm efb2390597
Add option for unlocked only quick settings tiles (#3189)
- Add option to quick settings tile to only allow interacting with it when the device is unlocked, similar to device controls on Android 13 (but phrased differently to match the system default behavior)
2022-12-30 20:34:31 -05:00
Daniel Shokouhi e7c18b870c
Add new option to vibrate when quick settings tile is clicked (#3123)
* Add new option to vibrate when quick settings tile is clicked

* Use vibration effects if the device supports it

* Review comments

* Remove question mark

* Set switch color when unchecked
2022-12-16 09:55:59 -05:00
Mads Sørensen e01246ae28
Add caching of favorites in Wear OS, resulting in prettier loading (#2982)
* Add caching of favorites, results in prettier loading

* Update wear/src/main/java/io/homeassistant/companion/android/home/MainViewModel.kt

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>

* Implement a lot suggestions from @jpelgrom
Revert previous changes to database and implement properly

* Apply suggestions from code review

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>

* Implement suggestions from @jpelgrom

* Remove null assertions from icon function

* Update wear/src/main/java/io/homeassistant/companion/android/home/views/MainView.kt

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>

* Fallback to entity ID if friendly_name is missing when creating cache,
Remove wrapper function to delete cached items

* Remove "clear cache" button

* Implement changes by @jpelgrom

Co-authored-by: Joris Pelgröm <jpelgrom@users.noreply.github.com>
2022-11-09 16:06:38 -05:00
Joris Pelgröm bdc9094845
Improve adding quick settings tile (#2860)
* Improve adding quick settings tiles

 - 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

* Only show subtitle field when supported

 - Setting a tile subtitle is only supported on Android Q+, so don't show the field on versions before that!

* Deeplink into app for tiles that aren't setup

 - 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.
2022-09-10 15:16:36 -04:00
andyboeh 6b06e0d8a8
Add authentication to widget buttons (#2798) 2022-09-05 09:50:53 -04:00
Márton Maráz 7f1677a2dd
Fix Last Notification sensor not updating when notification is repeated with the same content (#2734)
Make Sensor::lastSentState and lastSentIcon nullable, set them to null when forceUpdate = true, and make null their default value everywhere.
2022-08-03 17:58:23 -04:00
Márton Maráz 4bf88ac907
Show the charging state on the Battery Level sensor's icon (#2661)
* Show the charging state on the Battery Level sensor's icon.
A different icon will be shown for wired and wireless charging.
From now on, changing only the icon (but not the state) of a sensor will trigger sending an update to the server.
A new DB property called last_sent_icon is added, thus a DB migration is needed.

* Merge SensorDao.updateLastSendState(…) and updateLastSentIcon(…) methods to updateLastSentStateAndIcon(…)
2022-07-09 14:19:23 -04:00
leroyboerefijn 50d387a726
Entity state complication (#2574)
* Add entity state complication with hardcoded entity id

* Add config activity and save entity id in DB

* Update complications when entity state changes

* Allow all entity types for complication

* Update config layout

* remove unused file

* Upload database json

* Process review comments!

* Fix little bug

* Icon background and error catching

* Add automatic refresh and fix missed Dao inject

* Add icons for standard domains

91cd584b4b/src/common/const.ts (L66)

* Cleanup and further icon updates
2022-06-20 20:24:37 -04:00
Joris Pelgröm c98b291d30
Sync sensor enabled state with core 2022.6+ (#2547)
* Sync sensor enabled state from app to core

 - Change sensor 'registered' to indicate not registered, registered as disabled or registered as enabled
 - When a sensor is disabled, set it's status as such on core 2022.6 servers
 - In the sensor registration, use the basic sensor details in case there is no info in the database that can be used

* Clean up version check

 - Now that there is a standard function to get the version, re-use it

* Improve which sensors are synced to core

 - Update database migration to reset registration state on db upgrade to make sure the information is correct for all sensors
 - Only sync sensors that are actually available on the device
 - Fix registering all sensors on core <2022.6 on app/core version change
 - Fix unnecessary sensor updates due to location sensors which are never registered always triggering update on core >=2022.6

* Sync sensor enabled state from core to app

  - After pushing app enabled changes to core, if on core 2022.6 check if the enabled state for any of the sensors is different from what is registered in the app and try to update the sensors. This is done by reading the entire config, because otherwise we wouldn't know about sensors that have been enabled and the app already updates all sensors at the same time so no need for tracking individual updates in the sensor update response.
  - Restore getting config using webhooks, because only the webhook config contains information about entity enabled state
  - Add support for opening a specific sensor's settings page, used for the notification when trying to enable a sensor that requires granting (additional) permissions
2022-05-29 11:22:52 -04:00
Jannis Göing b9c1092302
Multiple media players per widget (#2534)
* Update Media Player Widget Preview

* Add support for multiple media players. optionally show media source label

* fix crop of media player widget preview image. avoid unnecessary api call's when finding active media player. add db migrations. add text color to media source label. set default value of showsource to false.

* remove placeholder source for source icon to fix widget preview
2022-05-29 08:57:52 -04:00
Joris Pelgröm 66c57d5768
Add theming to widgets: Dynamic color (Material You) and Transparent (#2496)
* Add transparent widgets

 - Add options to the service, entity and template widgets to have a transparent background
 - Register configuration change intent filter for widgets in order to be able to respond to day/night changes (no longer fully automatic due to setting color with int)

* Support Material You dynamic color in widgets

 - In widgets that support theming (day/night or transparent), add an option to use Material You dynamic colors
 - Dynamic colors is now the default widget style for new widgets on devices that support them

* Tweak dynamic color theming

 - Update dynamic color values to better match other themed widgets such as those from Google
 - Remove configuration changed intent receiver for widgets because it is no longer required to get colors

* Add dynamic color theming to media player widget

 - Make the media player widget themeable and add an option to use dynamic colors (transparent doesn't make sense for this layout)

* Fix camera widget background if data cannot be loaded

* Add text size option to template widgets

 - Added an option to set the text size to template widgets to better align with other widget options

* Additional Android 12 widget updates

 - When using the dynamic color theme, also use the new Android 12 widget corner radius
 - Update placeholder values in widgets to match images, and refer to dynamic color XML to provide a better preview on Android 12. Reset values when providing template to match existing behaviour when no widget is found in the database.
 - Update entity state and template widget target size to 2x1 to match preview image
 - Make sure media player album art doesn't extend past corner radius if possible

* Change theme selection to dropdown, text color alignment

 - Change theme selection to use a dropdown menu (Spinner) instead of right-aligned radio buttons on multiple lines
 - Change text color selection to left-align radio buttons
2022-05-08 13:10:58 -04:00
Joris Pelgröm ac83869cfa
Add AppDatabase v24 -> v25 auto migration (#2407)
* Add AppDatabase v24 -> v25 migration

* Export Room schema to use AutoMigration instead
2022-03-25 20:02:44 -04:00