cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [4/4] android commit: Getting around to removing this old Intent code
Date Fri, 15 May 2015 21:13:32 GMT
Getting around to removing this old Intent code


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/4ea684dd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/4ea684dd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/4ea684dd

Branch: refs/heads/master
Commit: 4ea684dd7a7952d8ae30e5d381d7433515045e28
Parents: 215b7e0
Author: Joe Bowser <bowserj@apache.org>
Authored: Wed May 13 10:12:08 2015 -0700
Committer: Joe Bowser <bowserj@apache.org>
Committed: Fri May 15 14:13:18 2015 -0700

----------------------------------------------------------------------
 framework/src/org/apache/cordova/Config.java    |  2 +-
 .../org/apache/cordova/CordovaPreferences.java  | 75 --------------------
 2 files changed, 1 insertion(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4ea684dd/framework/src/org/apache/cordova/Config.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Config.java b/framework/src/org/apache/cordova/Config.java
index f261b78..048960b 100644
--- a/framework/src/org/apache/cordova/Config.java
+++ b/framework/src/org/apache/cordova/Config.java
@@ -36,8 +36,8 @@ public class Config {
     public static void init(Activity action) {
         parser = new ConfigXmlParser();
         parser.parse(action);
+        //TODO: Add feature to bring this back.  Some preferences should be overridden by
intents, but not all
         parser.getPreferences().setPreferencesBundle(action.getIntent().getExtras());
-        parser.getPreferences().copyIntoIntentExtras(action);
     }
 
     // Intended to be used for testing only; creates an empty configuration.

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4ea684dd/framework/src/org/apache/cordova/CordovaPreferences.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaPreferences.java b/framework/src/org/apache/cordova/CordovaPreferences.java
index 2d13c86..b4f6b81 100644
--- a/framework/src/org/apache/cordova/CordovaPreferences.java
+++ b/framework/src/org/apache/cordova/CordovaPreferences.java
@@ -83,13 +83,6 @@ public class CordovaPreferences {
         if (value != null) {
             // Use Integer.decode() can't handle it if the highest bit is set.
             return (int)(long)Long.decode(value);
-        } else if (preferencesBundleExtras != null) {
-            Object bundleValue = preferencesBundleExtras.get(name);
-            if (bundleValue instanceof String) {
-                return Integer.valueOf((String)bundleValue);
-            }
-            // Gives a nice warning if type is wrong.
-            return preferencesBundleExtras.getInt(name, defaultValue);
         }
         return defaultValue;
     }
@@ -99,13 +92,6 @@ public class CordovaPreferences {
         String value = prefs.get(name);
         if (value != null) {
             return Double.valueOf(value);
-        } else if (preferencesBundleExtras != null) {
-            Object bundleValue = preferencesBundleExtras.get(name);
-            if (bundleValue instanceof String) {
-                return Double.valueOf((String)bundleValue);
-            }
-            // Gives a nice warning if type is wrong.
-            return preferencesBundleExtras.getDouble(name, defaultValue);
         }
         return defaultValue;
     }
@@ -115,69 +101,8 @@ public class CordovaPreferences {
         String value = prefs.get(name);
         if (value != null) {
             return value;
-        } else if (preferencesBundleExtras != null && !"errorurl".equals(name)) {
-            Object bundleValue = preferencesBundleExtras.get(name);
-            if (bundleValue != null) {
-                return bundleValue.toString();
-            }
         }
         return defaultValue;
     }
 
-    // Plugins should not rely on values within the intent since this does not work
-    // for apps with multiple webviews. Instead, they should retrieve prefs from the
-    // Config object associated with their webview.
-    public void copyIntoIntentExtras(Activity action) {
-        for (String name : prefs.keySet()) {
-            String value = prefs.get(name);
-            if (value == null) {
-                continue;
-            }
-            if (name.equals("loglevel")) {
-                LOG.setLogLevel(value);
-            } else if (name.equals("splashscreen")) {
-                // Note: We should probably pass in the classname for the variable splash
on splashscreen!
-                int resource = action.getResources().getIdentifier(value, "drawable", action.getClass().getPackage().getName());
-                if(resource == 0) {
-                    resource = action.getResources().getIdentifier(value, "drawable", action.getPackageName());
-                }
-                action.getIntent().putExtra(name, resource);
-            }
-            else if(name.equals("backgroundcolor")) {
-                int asInt = (int)(long)Long.decode(value);
-                action.getIntent().putExtra(name, asInt);
-            }
-            else if(name.equals("loadurltimeoutvalue")) {
-                int asInt = Integer.decode(value);
-                action.getIntent().putExtra(name, asInt);
-            }
-            else if(name.equals("splashscreendelay")) {
-                int asInt = Integer.decode(value);
-                action.getIntent().putExtra(name, asInt);
-            }
-            else if(name.equals("keeprunning"))
-            {
-                boolean asBool = Boolean.parseBoolean(value);
-                action.getIntent().putExtra(name, asBool);
-            }
-            else if(name.equals("inappbrowserstorageenabled"))
-            {
-                boolean asBool = Boolean.parseBoolean(value);
-                action.getIntent().putExtra(name, asBool);
-            }
-            else if(name.equals("disallowoverscroll"))
-            {
-                boolean asBool = Boolean.parseBoolean(value);
-                action.getIntent().putExtra(name, asBool);
-            }
-            else
-            {
-                action.getIntent().putExtra(name, value);
-            }
-        }
-        // In the normal case, the intent extras are null until the first call to putExtra().
-        if (preferencesBundleExtras == null) {
-            preferencesBundleExtras = action.getIntent().getExtras();
-        }
-    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message