Skip to content

Conversation

@pphu
Copy link

@pphu pphu commented Sep 25, 2022

This adds support for 1x2 history widget size by using Java Calendar's NARROW_FORMAT when getting narrow. From discussion #1513
1x2 widget example

I've been removed from Android development for many years but from what I can tell, Android 13 has better support for widget size. However since the min SDK is Android 9, I'm using the width < 80 to determine if the widget size is less than 2 cells wide. The default widget size is currently at 80 and that rounds to 2 cells wide. It's a little too magical for my taste but if anyone has a suggestion, please let me know.

@hiqua
Copy link
Collaborator

hiqua commented Nov 25, 2022

Android 13 has better support for widget size. However since the min SDK is Android 9, I'm using the width < 80 to determine if the widget size is less than 2 cells wide.

If that's the case, can you branch on the Android version depending on that, such that the magic only happens for Android 12 and lesser? This way we can remove the magic eventually, once we upgrade the SDK.

@iSoron
Copy link
Owner

iSoron commented Dec 20, 2022

Thanks for the PR, @pphu. The implementation looks good to me, but I think we need unit tests for narrowWeekdayName and a view test for HistoryChart (under the new size). See HistoryCardViewTest.kt for a view test example and TEST.md for instructions on running view tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants