cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fardjad <...@git.apache.org>
Subject [GitHub] cordova-cli pull request: android-parser: Add launch-mode preferen...
Date Wed, 23 Apr 2014 21:02:00 GMT
Github user fardjad commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/164#discussion_r11923593
  
    --- Diff: src/metadata/android_parser.js ---
    @@ -97,6 +108,29 @@ module.exports.prototype = {
                 }
             }
     
    +        // Set launchMode in AndroidManifest
    +        var launchModePref = this.findLaunchModePreference(config);
    +        if (launchModePref) {
    +            var act = manifest.getroot().find('./application/activity');
    +            switch (launchModePref) {
    +                case 'standard':
    +                    act.attrib["android:launchMode"] = 'standard';
    +                    break;
    +                case 'singleTop':
    +                    act.attrib["android:launchMode"] = 'singleTop';
    +                    break;
    +                case 'singleTask':
    +                    act.attrib["android:launchMode"] = 'singleTask';
    +                    break;
    +                case 'singleInstance':
    +                    act.attrib["android:launchMode"] = 'singleInstance';
    +                    break;
    +                case 'default':
    +                    delete act.attrib["android:launchMode"];
    --- End diff --
    
    No, there's no `android:launchMode` default preference defined in application template.
According to [<Activity> documentation] **launchMode** defaults to standard if not specified.
What this default case does is that it removes previously set `android:launchMode` attribute
when user specifies an invalid value for `launch-mode` in **config.xml**. It is essentially
the same as setting it's value to **standard**.
    
    That case shouldn't happen when `launch-mode` is not specified or is one of the allowed
values.
    
    The code is similar to `findOrientationPreference` which was already there. I just wanted
to use the same coding style.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message