added notification with N style (and add android O channel notification )#791
added notification with N style (and add android O channel notification )#791MARTINI1 wants to merge 9 commits intofarkam135:masterfrom
Conversation
|
The linearlayout -> relativelayout change is probably going to make it less performant, not more. Probably for the layouts with three nested linearlayouts, definitely for the one without that level of nesting. |
|
Thanks MARTINI1! As a side note, there's just one problem with this PR and others you made before: you need to try to make more atomic changes (and smaller when possible). |
|
@harkin relativelayout is more effective, and they say it here:
and here:
I wanted to fix the strange trick of making negative margins and implementing the nougat style to the notification this last forced me to edit the layouts and since it was as I have transformed them to relativelayout for a better, cleaner solution and avoiding doing so many linearlayout |
|
That's a general rule, performances depends on every case. Anyway with layouts so small there's no much difference nowadays that smartphones are so powerful. Regarding this, you should make 2 PRs: This make code revisions much more readable! |
|
@thearaks yes, tested in VM kitkat and oreo, and my mobile with nougat (watch the captures please xD ) about lot of code, you are right, what I did not find how to make a smart change apart I had (and I have) a bug or something missing, that when I put the setStyle tells me that I did not find reference to that when I copied it from the official documentation (and I worked before but was mixed with another PR and doing so clean I was not going :() if you have any suggestion tell me please, I will be very grateful because I am not completely satisfied |
|
@MARTINI1 I'm not sure I'd put much stock in a blog post from 2009 tbh, a lot has changed since the donut/eclair days. Those layouts aren't 'excessively deep' and the last link to stackoverflow is the most important I think. Relativelayouts always, unconditionally, causing a second measure pass is normally slower than when you get from the linearlayouts (there's only one using a weight there that I see). If the change makes it easier to do the new notification styles, great! Re lots of code, both notifications being created in code look very similar, and it happens twice. Maybe a method could be refactored out there that generates the similar notifications? For the XML, looks like many states share similar views, maybe some commonalities could be extracted and included into these layouts (not sure this is worth it TBH)? |
|
Aside the duplicate code in GoIVNotificationManager that could easily be fixed (and is unnecessary, since the support library handles the platform difference anyway. But we need support library version 26 and also we should update out target API level to 26), Also, in general, the new proposed layouts are less readable than the previous version. (I'll post an updated version of this PR to show how the same changes can be implemented more cleanly) Ufortunately, this PR is a little too "dirt". IMHO I wouldn't merge this at the moment. |
Android 4.4 kitkat

Android 7 nougat

Android 8 oreo

**
I have been forced to change the layout to relative only in the compact notificiations since by the change to the N style they appeared wrong in android >=7 and with the done change already appear correctly (as in the screenshots)