-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
CB-13685 android: Adaptive Icon Support #448
Conversation
I also want to point out that this PR will be required. This PR contains the updates to the ConfigParser to include |
You can ignore the node 4 Appveyor failure due to |
@dpogue I have also noticed this. There is the CI improvement PR, #442, which deprecates node 4, adds node 10 support, and other changes. When I tested my PR with the CI improvement PR, other issues appeared. If we just remove node 4 and add node 10, with no additional changes, then my PR passed. |
Codecov Report
@@ Coverage Diff @@
## master #448 +/- ##
===========================================
- Coverage 62.9% 43.84% -19.07%
===========================================
Files 15 18 +3
Lines 1650 2023 +373
Branches 308 383 +75
===========================================
- Hits 1038 887 -151
- Misses 612 1136 +524
Continue to review full report at Codecov.
|
@raphinesse I rebased with the latest master now that the #442 PR has been merged. Do you think this is ready to merge? |
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.
Just my two cents
spec/unit/prepare.spec.js
Outdated
height: undefined, | ||
background: 'res/icon/android/mdpi-background.png', | ||
foreground: undefined | ||
}]; |
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.
You have something similar to this in almost every test. Might be nice to factor this out e.g as a function that fills in missing props as undefined. This could help to slim down this 1000 lines spec.
spec/unit/prepare.spec.js
Outdated
new CordovaError('One of the following attributes are set but missing the other for the density type: mdpi. Please ensure that all require attributes are defined.') | ||
); | ||
|
||
done(); |
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.
Are these tests asynchronous? If not, we don't need this. If so, I suggest returning promises to Jasmine instead of using the done callback.
a6fe2df
to
d4cd4c6
Compare
@raphinesse Thank you for pointing out improvements to my test spec. I have updated the test and reduced the line count. I also removed the |
This PR looks good to me. I need adaptive icons for one of my own apps, so I'm eager to see this get merged soon. Without support for this, icons for apps using I noticed the main cordova-android maintainer, Joe, has announced on the mailing list that he is stepping down. So, I expect that getting this thoroughly reviewed is now more difficult. If there is anything I can do to get this over the line, please let me know. |
I will make sure this gets merged into the next major |
889efe7
to
22bb844
Compare
@raphinesse Could you have a look again and redo your review please? |
- Update default project template's icons to be adaptive. - Added backwards support for non-adaptive icon supported devices.
@janpio Unfortunately I am on a very tight schedule right now. The only thing I had reviewed were the specs. I glanced over them again and they do look much better. I still saw a few things that could be improved, but I don't have time to tackle that right now. Since it's "only the specs", I would not want to block this PR because of this. However, I can neither give my approval for the rest of this PR since I know too little of the subject at hand. |
Thanks @raphinesse! Same for me... hope someone with actual Android experience turns up. |
@janpio I rebased with the latest master. I also did the same for The downside, both I am expecting these tests may show similar side-effects. We might need to update both repo's with the temp fix... |
The changes in this PR look fine to me. I had held off on merging due to some of the questions on the cordova-common side about where the Android-specific handling code should live, especially with @erisu's proposed refactoring. |
Do I need to install anything on top of cordova to get this to work? I'm currently getting a Unquoted attribute value error |
Are you using cordova-android |
Oops thanks I'll again with the master branch |
Though the PR is merged into master, the Using |
How would one go about switching from standered npm cordova to this master branch? |
What does |
If I where to go in my command line and download cordova using node js I would type npm install -g cordova would this give me a version of cordova that would let me use adaptive icons ? |
No. |
No. |
so does adding @nightly switch it to this branch ? allowing me to create adaptive icons with cordova ? |
No. It uses the latest nightly build. Should be easier to setup than using master. Try an earlier nightly build if npm throws errors at you during installation. A full list of available versions can be found via npm. |
Has this been released yet? If not, when will it be? |
It is not released yet, it will be included in the next major version. We can't/won't commit to any particular timeline for that next major, but we are working on it. |
Platforms affected
Android
What does this PR do?
This PR adds support for Adaptive Icon.
Changes to Default Template Project
Added JavaScript Unit Testing.
config.xml for Adaptive Icons with Images
In this case, the foreground image will automatically be applied to the src attribute value. This is to support non-adaptive icon supported Android devices. If the user supplies their own src value, foreground will not be copied over.
config.xml for Adaptive Icons with Vectors
In this example, the adaptive icon supports vectors and colors for the foreground and background. If the foreground is a vector or color, the src attribute must also be defined with a PNG for Android devices that does not support adaptive icon.
config.xml for Adaptive Icons with Colors for Background
First: create colors.xml file with content
Second: update config.xml with…
The naming convention for the two new attributes,
background
andforeground
, was decided to match the element names that is used in theic_launcher.xml
for consistency. https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive#creating_adaptive_icons_in_xmlError Example: Foreground contains vector and missing src attribute.
What testing has been done on this change?
Checklist