-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add a homescreen widget #144
base: master
Are you sure you want to change the base?
Conversation
101e1f8
to
2c94781
Compare
8301183
to
d9b576d
Compare
d9b576d
to
ac09a01
Compare
First impression - this works crazy awesome! |
android/app/src/main/kotlin/com/nt4f04und/sweyer/MusicPlayerAppWidget.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/kotlin/com/nt4f04und/sweyer/MusicPlayerAppWidget.kt
Show resolved
Hide resolved
android/app/src/main/kotlin/com/nt4f04und/sweyer/MusicPlayerAppWidget.kt
Show resolved
Hide resolved
android/app/src/main/kotlin/com/nt4f04und/sweyer/MusicPlayerAppWidget.kt
Show resolved
Hide resolved
android/app/src/main/res/drawable-nodpi/music_player_widget_preview.png
Outdated
Show resolved
Hide resolved
As a side note - we probably would like to show title and artist in the widget, but I'm in favor of doing this in a separate PR |
Co-authored-by: nt4f04uNd <nt4f04uNd@gmail.com>
<resources> | ||
<dimen name="musicPlayerWidgetButtonSize">48dp</dimen> | ||
<dimen name="appWidgetRadius">16dp</dimen> | ||
<dimen name="appWidgetInnerRadius">8dp</dimen> |
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.
Why do they differ?
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.
Can you also help me understand what do these radiuses practically mean?
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.
This is part of the rounded corner implementation, see the docs.
The appWidgetRadius
refers to the corner radius of the background element of the widget (in our case it's the album art), and the appWidgetInnerRadius
is the corner radius of any foreground element in the widget (in our case it's the button bar).
Prior to Android 31 there was no guideline about these, but on 31 and up they are given by the launcher via @android:dimen/system_app_widget_background_radius
and @android:dimen/system_app_widget_inner_radius
, and the description of system_app_widget_inner_radius
says:
This is exactly 8 dp less than the background radius, to align nicely when using an 8 dp padding.
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 renamed appWidgetRadius
to appWidgetBackgroundRadius
which hopefully makes it a bit clearer.
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.
Thanks
Maybe we should write this explanation down in the comments
android/app/src/main/res/drawable/music_player_widget_button_bar_background.xml
Outdated
Show resolved
Hide resolved
While I was testing the buld from this PR, one time after changing a song and then immediately minimizing the app to the home page, where there was a widget visible, I got the "The app is not responding notification" from the system. It was also the default art. I didn't get it anymore since, but maybe it's something to dig into. Maybe it was reported to firebase, I didn't check |
I suppose that's the error I got
It's almost an exact duplicate of the other one that we have
|
I personally am not a fan of having any text in the widget, but we can definiert provide a second widget with more information, or maybe even allow to configure it when creating the widget. |
06c3309
to
7a1dee0
Compare
android/app/src/main/kotlin/com/nt4f04und/sweyer/MusicPlayerAppWidget.kt
Outdated
Show resolved
Hide resolved
android/app/src/main/kotlin/com/nt4f04und/sweyer/MusicPlayerAppWidget.kt
Show resolved
Hide resolved
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.
In the code it says @drawable/round_play_arrow
But the image has changed to the pause icon
Is this intended?
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.
Also the diff from this commit 7a1dee0 didn't seem to change the radius of the button bar
I would have expected this to align with the outer radius with your changes
Yeah, sounds nice |
Depends on #130.
Adds a adaptable homescreen widget. Closes #111.
Pictures