-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Use the brand new material switches for preferences #6475
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
Conversation
Sounds like there are two dependencies that require different versions of |
Not sure what the only failing bot https://github.com/AntennaPod/AntennaPod/actions/runs/4903561149/jobs/8756083040?pr=6475#step:4:1625 complains about. |
This line gives more specific information I think: https://github.com/AntennaPod/AntennaPod/actions/runs/4903561149/jobs/8756083040#step:4:1638 |
I think upgrading the dependency added a new check in some part of the code that is unrelated to your change. So in order to upgrade the dependency, that other part needs to be looked into as well. |
@keunes @ByteHamster First of all, thanks for being helpful 😊
Thanks to your help I've found it the lint in question androidx/androidx#171 which happened to be enabled by material library upgrade and is unrelated to my changes is just giving a false alarm for our case. My understanding is the lint is supposed to disallow use of setOnDismissListener inside in a DialogFragment but in here we are using the setOnDismissListener for a nested non-fragment dialog which isn't related to the parent fragment dialog. So in order to impose least possible change to make this work without adding a SuppressLint, I've just proxied the setOnDismissListener through a new method in the builder, called setDialogOnDismissListener to circumvent the lint. Thanks 😊 |
8cd38ea
to
f1d1622
Compare
The last commit (Proxy setOnDismissListener to circumvent false alarm lint) feels quite hacky, not making it obvious why the method is needed. I would instead just suppress the lint check for that line. |
This reverts commit 7a35494.
It initially was to circumvent the lint but turned out the lint now understands this is a false alarm.
Reverted.
It wasn't possible to SuppressLint that specific line and it needed to apply it to the whole block which I guess isn't ideal so I turned it to into a method, |
There is an alternative solution to this, |
I think it is fine in this case, because it's just an implied resource cycle (name sounds like a parent style because it is shorter). But it seems to be quite easy to work around: <style name="Preference.SwitchPreferenceCompat">
<item name="widgetLayout">@layout/preference_switch</item>
<item name="android:layout">@layout/preference_material</item>
<item name="allowDividerAbove">false</item>
<item name="allowDividerBelow">true</item>
<item name="iconSpaceReserved">@bool/config_materialPreferenceIconSpaceReserved</item>
</style> |
No longer needs to edit each.
That forces to use |
Please let me know if you don't like the approach so I can revert to yours. Thanks 😊 |
Thanks! Will be released in AntennaPod 3.1 :) (sorry for the delay, I'm currently on vacation) |
Thanks @ebraminio! If you're interested; we'll be having the community meeting on (exceptionally) on the third Saturday of the month: 17 June 18:00 CEST. You're most welcome to join (to discuss anything AntennaPod, meet us, etc.) Meeting details on our website. |
That should be very interesting and it will be an honor, thanks for the invitation 😊 |
@ebraminio Hi there, funny enough that I found this issue referencing my article which references your post on StackOverflow. That aside, am I right that your way to remove that |
@cyb3rko Interestingly enough a friend referenced your article unaware of that you already referenced my answer and completed it 😊 I think avoiding Also now that I've linked my project, feel free to have a look at its the app and maybe considering its translation as I'm asked about a German translation of the app but never found anyone who could do it unlike other languages but if there is no interest that wouldn't be any issue at all. The app has local focus but has may interesting parts that can interest such as its astronomy utilities and compass and offline global map and doesn't even get an internet access in its AndroidManifest.xml so can be considered as safe for one time testing I guess (just to note, it will show planets direction in its compass if location is set in its setting). Thanks 😊 |
@ebraminio Your app sounds interesting and I see you have big success with it. But unfortunately I'm pretty busy right now and I spend my left free time for some personal projects. Keep going! |
I wanted to make the app to use new Material switches introduced in Material 1.7.0 and use my solution https://stackoverflow.com/a/73782598 but apparently upgrading Material to 1.7.0 isn't that easy and gives me this error,
so before going further wanted to see if anyone wants this at all which if not I can just close, then if you like the approach or want me to introduce a new class for the switch instead editing each, and do you know how the lifecycle library issue can be resolved? Thanks!
(the new switch looks like this rather than the current old fashioned one)