cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [33/56] [abbrv] [partial] start of lazy loading: axe all vendored-in libs
Date Wed, 12 Jun 2013 17:15:49 GMT
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/09ee1837/lib/cordova-android/framework/src/org/apache/cordova/GPSListener.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/GPSListener.java b/lib/cordova-android/framework/src/org/apache/cordova/GPSListener.java
deleted file mode 100755
index daaf7ee..0000000
--- a/lib/cordova-android/framework/src/org/apache/cordova/GPSListener.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-
-package org.apache.cordova;
-
-import android.location.LocationManager;
-
-/**
- * This class handles requests for GPS location services.
- *
- */
-public class GPSListener extends CordovaLocationListener {
-    public GPSListener(LocationManager locationManager, GeoBroker m) {
-        super(locationManager, m, "[Cordova GPSListener]");
-    }
-
-
-    /**
-     * Start requesting location updates.
-     *
-     * @param interval
-     */
-    @Override
-    protected void start() {
-        if (!this.running) {
-            if (this.locationManager.getProvider(LocationManager.GPS_PROVIDER) != null) {
-                this.running = true;
-                this.locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, this);
-            } else {
-                this.fail(CordovaLocationListener.POSITION_UNAVAILABLE, "GPS provider is not available.");
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/09ee1837/lib/cordova-android/framework/src/org/apache/cordova/GeoBroker.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/GeoBroker.java b/lib/cordova-android/framework/src/org/apache/cordova/GeoBroker.java
deleted file mode 100644
index 4a07b73..0000000
--- a/lib/cordova-android/framework/src/org/apache/cordova/GeoBroker.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-package org.apache.cordova;
-
-import org.apache.cordova.api.CallbackContext;
-import org.apache.cordova.api.CordovaPlugin;
-import org.apache.cordova.api.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.content.Context;
-import android.location.Location;
-import android.location.LocationManager;
-
-/*
- * This class is the interface to the Geolocation.  It's bound to the geo object.
- *
- * This class only starts and stops various GeoListeners, which consist of a GPS and a Network Listener
- */
-
-public class GeoBroker extends CordovaPlugin {
-    private GPSListener gpsListener;
-    private NetworkListener networkListener;
-    private LocationManager locationManager;    
-
-    /**
-     * Constructor.
-     */
-    public GeoBroker() {
-    }
-
-    /**
-     * Executes the request and returns PluginResult.
-     *
-     * @param action 		The action to execute.
-     * @param args 		JSONArry of arguments for the plugin.
-     * @param callbackContext	The callback id used when calling back into JavaScript.
-     * @return 			True if the action was valid, or false if not.
-     */
-    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
-        if (this.locationManager == null) {
-            this.locationManager = (LocationManager) this.cordova.getActivity().getSystemService(Context.LOCATION_SERVICE);
-            this.networkListener = new NetworkListener(this.locationManager, this);
-            this.gpsListener = new GPSListener(this.locationManager, this);
-        }
-
-        if ( locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ||
-                locationManager.isProviderEnabled( LocationManager.NETWORK_PROVIDER )) {
-
-            if (action.equals("getLocation")) {
-                boolean enableHighAccuracy = args.getBoolean(0);
-                int maximumAge = args.getInt(1);
-                Location last = this.locationManager.getLastKnownLocation((enableHighAccuracy ? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER));
-                // Check if we can use lastKnownLocation to get a quick reading and use less battery
-                if (last != null && (System.currentTimeMillis() - last.getTime()) <= maximumAge) {
-                    PluginResult result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(last));
-                    callbackContext.sendPluginResult(result);
-                } else {
-                    this.getCurrentLocation(callbackContext, enableHighAccuracy, args.optInt(2, 60000));
-                }
-            }
-            else if (action.equals("addWatch")) {
-                String id = args.getString(0);
-                boolean enableHighAccuracy = args.getBoolean(1);
-                this.addWatch(id, callbackContext, enableHighAccuracy);
-            }
-            else if (action.equals("clearWatch")) {
-                String id = args.getString(0);
-                this.clearWatch(id);
-            }
-            else {
-                return false;
-            }
-        } else {
-            PluginResult.Status status = PluginResult.Status.NO_RESULT;
-            String message = "Location API is not available for this device.";
-            PluginResult result = new PluginResult(status, message);
-            callbackContext.sendPluginResult(result);
-        }
-        return true;
-    }
-
-    private void clearWatch(String id) {
-        this.gpsListener.clearWatch(id);
-        this.networkListener.clearWatch(id);
-    }
-
-    private void getCurrentLocation(CallbackContext callbackContext, boolean enableHighAccuracy, int timeout) {
-        if (enableHighAccuracy) {
-            this.gpsListener.addCallback(callbackContext, timeout);
-        } else {
-            this.networkListener.addCallback(callbackContext, timeout);
-        }
-    }
-
-    private void addWatch(String timerId, CallbackContext callbackContext, boolean enableHighAccuracy) {
-        if (enableHighAccuracy) {
-            this.gpsListener.addWatch(timerId, callbackContext);
-        } else {
-            this.networkListener.addWatch(timerId, callbackContext);
-        }
-    }
-
-    /**
-     * Called when the activity is to be shut down.
-     * Stop listener.
-     */
-    public void onDestroy() {
-        if (this.networkListener != null) {
-            this.networkListener.destroy();
-            this.networkListener = null;
-        }
-        if (this.gpsListener != null) {
-            this.gpsListener.destroy();
-            this.gpsListener = null;
-        }
-    }
-
-    /**
-     * Called when the view navigates.
-     * Stop the listeners.
-     */
-    public void onReset() {
-        this.onDestroy();
-    }
-
-    public JSONObject returnLocationJSON(Location loc) {
-        JSONObject o = new JSONObject();
-
-        try {
-            o.put("latitude", loc.getLatitude());
-            o.put("longitude", loc.getLongitude());
-            o.put("altitude", (loc.hasAltitude() ? loc.getAltitude() : null));
-            o.put("accuracy", loc.getAccuracy());
-            o.put("heading", (loc.hasBearing() ? (loc.hasSpeed() ? loc.getBearing() : null) : null));
-            o.put("velocity", loc.getSpeed());
-            o.put("timestamp", loc.getTime());
-        } catch (JSONException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        return o;
-    }
-
-    public void win(Location loc, CallbackContext callbackContext, boolean keepCallback) {
-    	PluginResult result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(loc));
-    	result.setKeepCallback(keepCallback);
-        callbackContext.sendPluginResult(result);
-    }
-
-    /**
-     * Location failed.  Send error back to JavaScript.
-     * 
-     * @param code			The error code
-     * @param msg			The error message
-     * @throws JSONException 
-     */
-    public void fail(int code, String msg, CallbackContext callbackContext, boolean keepCallback) {
-        JSONObject obj = new JSONObject();
-        String backup = null;
-        try {
-            obj.put("code", code);
-            obj.put("message", msg);
-        } catch (JSONException e) {
-            obj = null;
-            backup = "{'code':" + code + ",'message':'" + msg.replaceAll("'", "\'") + "'}";
-        }
-        PluginResult result;
-        if (obj != null) {
-            result = new PluginResult(PluginResult.Status.ERROR, obj);
-        } else {
-            result = new PluginResult(PluginResult.Status.ERROR, backup);
-        }
-
-        result.setKeepCallback(keepCallback);
-        callbackContext.sendPluginResult(result);
-    }
-
-    public boolean isGlobalListener(CordovaLocationListener listener)
-    {
-    	if (gpsListener != null && networkListener != null)
-    	{
-    		return gpsListener.equals(listener) || networkListener.equals(listener);
-    	}
-    	else
-    		return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/09ee1837/lib/cordova-android/framework/src/org/apache/cordova/Globalization.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/Globalization.java b/lib/cordova-android/framework/src/org/apache/cordova/Globalization.java
deleted file mode 100644
index 5c75e10..0000000
--- a/lib/cordova-android/framework/src/org/apache/cordova/Globalization.java
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-
-package org.apache.cordova;
-
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Currency;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.apache.cordova.api.CallbackContext;
-import org.apache.cordova.api.CordovaPlugin;
-import org.apache.cordova.api.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.annotation.TargetApi;
-import android.text.format.Time;
-
-/**
- *
- */
-public class Globalization extends CordovaPlugin  {
-    //GlobalizationCommand Plugin Actions
-    public static final String GETLOCALENAME = "getLocaleName";
-    public static final String DATETOSTRING = "dateToString";
-    public static final String STRINGTODATE = "stringToDate";
-    public static final String GETDATEPATTERN = "getDatePattern";
-    public static final String GETDATENAMES = "getDateNames";
-    public static final String ISDAYLIGHTSAVINGSTIME = "isDayLightSavingsTime";
-    public static final String GETFIRSTDAYOFWEEK = "getFirstDayOfWeek";
-    public static final String NUMBERTOSTRING = "numberToString";
-    public static final String STRINGTONUMBER = "stringToNumber";
-    public static final String GETNUMBERPATTERN = "getNumberPattern";
-    public static final String GETCURRENCYPATTERN = "getCurrencyPattern";
-    public static final String GETPREFERREDLANGUAGE = "getPreferredLanguage";
-
-    //GlobalizationCommand Option Parameters
-    public static final String OPTIONS = "options";
-    public static final String FORMATLENGTH = "formatLength";
-    //public static final String SHORT = "short"; //default for dateToString format
-    public static final String MEDIUM = "medium";
-    public static final String LONG = "long";
-    public static final String FULL = "full";
-    public static final String SELECTOR = "selector";
-    //public static final String DATEANDTIME = "date and time"; //default for dateToString
-    public static final String DATE = "date";
-    public static final String TIME = "time";
-    public static final String DATESTRING = "dateString";
-    public static final String TYPE = "type";
-    public static final String ITEM = "item";
-    public static final String NARROW = "narrow";
-    public static final String WIDE = "wide";
-    public static final String MONTHS = "months";
-    public static final String DAYS = "days";
-    //public static final String DECMIAL = "wide"; //default for numberToString
-    public static final String NUMBER = "number";
-    public static final String NUMBERSTRING = "numberString";
-    public static final String PERCENT = "percent";
-    public static final String CURRENCY = "currency";
-    public static final String CURRENCYCODE = "currencyCode";
-
-    @Override
-    public boolean execute(String action, JSONArray data, CallbackContext callbackContext) {
-        JSONObject obj = new JSONObject();
-
-        try{
-            if (action.equals(GETLOCALENAME)){
-                obj = getLocaleName();
-            }else if (action.equals(GETPREFERREDLANGUAGE)){
-                obj = getPreferredLanguage();
-            } else if (action.equalsIgnoreCase(DATETOSTRING)) {
-                obj = getDateToString(data);
-            }else if(action.equalsIgnoreCase(STRINGTODATE)){
-                obj = getStringtoDate(data);
-            }else if(action.equalsIgnoreCase(GETDATEPATTERN)){
-                obj = getDatePattern(data);
-            }else if(action.equalsIgnoreCase(GETDATENAMES)){
-                if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.GINGERBREAD) {
-                    throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-                } else {
-                    obj = getDateNames(data);
-                }
-            }else if(action.equalsIgnoreCase(ISDAYLIGHTSAVINGSTIME)){
-                obj = getIsDayLightSavingsTime(data);
-            }else if(action.equalsIgnoreCase(GETFIRSTDAYOFWEEK)){
-                obj = getFirstDayOfWeek(data);
-            }else if(action.equalsIgnoreCase(NUMBERTOSTRING)){
-                obj = getNumberToString(data);
-            }else if(action.equalsIgnoreCase(STRINGTONUMBER)){
-                obj = getStringToNumber(data);
-            }else if(action.equalsIgnoreCase(GETNUMBERPATTERN)){
-                obj = getNumberPattern(data);
-            }else if(action.equalsIgnoreCase(GETCURRENCYPATTERN)){
-                obj = getCurrencyPattern(data);
-            }else {
-                return false;
-            }
-
-            callbackContext.success(obj);
-        }catch (GlobalizationError ge){
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, ge.toJson()));
-        }catch (Exception e){
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
-        }
-        return true;
-    }
-    /*
-     * @Description: Returns the string identifier for the client's current locale setting
-     *
-     * @Return: JSONObject
-     *          Object.value {String}: The locale identifier
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-     */
-    private JSONObject getLocaleName() throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            obj.put("value",Locale.getDefault().toString());//get the locale from the Android Device
-            return obj;
-        }catch(Exception e){
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-    /*
-     * @Description: Returns the string identifier for the client's current language
-     *
-     * @Return: JSONObject
-     *          Object.value {String}: The language identifier
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-     */
-    private JSONObject getPreferredLanguage() throws GlobalizationError {
-        JSONObject obj = new JSONObject();
-        try {
-            obj.put("value", Locale.getDefault().getDisplayLanguage().toString());
-            return obj;
-        } catch (Exception e) {
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-    /*
-     * @Description: Returns a date formatted as a string according to the client's user preferences and
-     * calendar using the time zone of the client.
-     *
-     * @Return: JSONObject
-     *          Object.value {String}: The localized date string
-     *
-     * @throws: GlobalizationError.FORMATTING_ERROR
-     */
-    private JSONObject getDateToString(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            Date date = new Date((Long)options.getJSONObject(0).get(DATE));
-
-            //get formatting pattern from android device (Will only have device specific formatting for short form of date) or options supplied
-            JSONObject datePattern = getDatePattern(options);
-            SimpleDateFormat fmt = new SimpleDateFormat(datePattern.getString("pattern"));
-
-            //return formatted date
-            return obj.put("value",fmt.format(date));
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.FORMATTING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Parses a date formatted as a string according to the client's user
-     * preferences and calendar using the time zone of the client and returns
-     * the corresponding date object
-     * @Return: JSONObject
-     *          Object.year {Number}: The four digit year
-     *          Object.month {Number}: The month from (0 - 11)
-     *          Object.day {Number}: The day from (1 - 31)
-     *          Object.hour {Number}: The hour from (0 - 23)
-     *          Object.minute {Number}: The minute from (0 - 59)
-     *          Object.second {Number}: The second from (0 - 59)
-     *          Object.millisecond {Number}: The milliseconds (from 0 - 999), not available on all platforms
-     *
-     * @throws: GlobalizationError.PARSING_ERROR
-    */
-    private JSONObject getStringtoDate(JSONArray options)throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        Date date;
-        try{
-            //get format pattern from android device (Will only have device specific formatting for short form of date) or options supplied
-            DateFormat fmt = new SimpleDateFormat(getDatePattern(options).getString("pattern"));
-
-            //attempt parsing string based on user preferences
-            date = fmt.parse(options.getJSONObject(0).get(DATESTRING).toString());
-
-            //set Android Time object
-            Time time = new Time();
-            time.set(date.getTime());
-
-            //return properties;
-            obj.put("year", time.year);
-            obj.put("month", time.month);
-            obj.put("day", time.monthDay);
-            obj.put("hour", time.hour);
-            obj.put("minute", time.minute);
-            obj.put("second", time.second);
-            obj.put("millisecond", new Long(0));
-            return obj;
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.PARSING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns a pattern string for formatting and parsing dates according to the client's
-     * user preferences.
-     * @Return: JSONObject
-     *
-     *          Object.pattern {String}: The date and time pattern for formatting and parsing dates.
-     *                                  The patterns follow Unicode Technical Standard #35
-     *                                  http://unicode.org/reports/tr35/tr35-4.html
-     *          Object.timezone {String}: The abbreviated name of the time zone on the client
-     *          Object.utc_offset {Number}: The current difference in seconds between the client's
-     *                                      time zone and coordinated universal time.
-     *          Object.dst_offset {Number}: The current daylight saving time offset in seconds
-     *                                      between the client's non-daylight saving's time zone
-     *                                      and the client's daylight saving's time zone.
-     *
-     * @throws: GlobalizationError.PATTERN_ERROR
-    */
-    private JSONObject getDatePattern(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-
-        try{
-            SimpleDateFormat fmtDate = (SimpleDateFormat)android.text.format.DateFormat.getDateFormat(this.cordova.getActivity()); //default user preference for date
-            SimpleDateFormat fmtTime = (SimpleDateFormat)android.text.format.DateFormat.getTimeFormat(this.cordova.getActivity());  //default user preference for time
-
-            String fmt = fmtDate.toLocalizedPattern() + " " + fmtTime.toLocalizedPattern(); //default SHORT date/time format. ex. dd/MM/yyyy h:mm a
-
-            //get Date value + options (if available)
-            if (options.getJSONObject(0).length() > 1){
-                //options were included
-
-                //get formatLength option
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(FORMATLENGTH)){
-                    String fmtOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(FORMATLENGTH);
-                    if (fmtOpt.equalsIgnoreCase(MEDIUM)){//medium
-                        fmtDate = (SimpleDateFormat)android.text.format.DateFormat.getMediumDateFormat(this.cordova.getActivity());
-                    }else if (fmtOpt.equalsIgnoreCase(LONG) || fmtOpt.equalsIgnoreCase(FULL)){ //long/full
-                        fmtDate = (SimpleDateFormat)android.text.format.DateFormat.getLongDateFormat(this.cordova.getActivity());
-                    }
-                }
-
-                //return pattern type
-                fmt = fmtDate.toLocalizedPattern() + " " + fmtTime.toLocalizedPattern();
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(SELECTOR)){
-                    String selOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(SELECTOR);
-                    if (selOpt.equalsIgnoreCase(DATE)){
-                        fmt =  fmtDate.toLocalizedPattern();
-                    }else if (selOpt.equalsIgnoreCase(TIME)){
-                        fmt = fmtTime.toLocalizedPattern();
-                    }
-                }
-            }
-
-            //TimeZone from users device
-            //TimeZone tz = Calendar.getInstance(Locale.getDefault()).getTimeZone(); //substitute method
-            TimeZone tz = TimeZone.getTimeZone(Time.getCurrentTimezone());
-
-            obj.put("pattern", fmt);
-            obj.put("timezone", tz.getDisplayName(tz.inDaylightTime(Calendar.getInstance().getTime()),TimeZone.SHORT));
-            obj.put("utc_offset", tz.getRawOffset()/1000);
-            obj.put("dst_offset", tz.getDSTSavings()/1000);
-            return obj;
-
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.PATTERN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns an array of either the names of the months or days of the week
-     * according to the client's user preferences and calendar
-     * @Return: JSONObject
-     *          Object.value {Array{String}}: The array of names starting from either
-     *                                      the first month in the year or the
-     *                                      first day of the week.
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-    */
-    @TargetApi(9)
-    private JSONObject getDateNames(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        //String[] value;
-        JSONArray value = new JSONArray();
-        List<String> namesList = new ArrayList<String>();
-        final Map<String,Integer> namesMap; // final needed for sorting with anonymous comparator
-        try{
-            int type = 0; //default wide
-            int item = 0; //default months
-
-            //get options if available
-            if (options.getJSONObject(0).length() > 0){
-                //get type if available
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(TYPE)){
-                    String t = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(TYPE);
-                    if (t.equalsIgnoreCase(NARROW)){type++;} //DateUtils.LENGTH_MEDIUM
-                }
-                //get item if available
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(ITEM)){
-                    String t = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(ITEM);
-                    if (t.equalsIgnoreCase(DAYS)){item += 10;} //Days of week start at 1
-                }
-            }
-            //determine return value
-            int method = item + type;
-            if  (method == 1) { //months and narrow
-                namesMap = Calendar.getInstance().getDisplayNames(Calendar.MONTH, Calendar.SHORT, Locale.getDefault());
-            } else if (method == 10) { //days and wide
-                namesMap = Calendar.getInstance().getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault());
-            } else if (method == 11) { //days and narrow
-                namesMap = Calendar.getInstance().getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.getDefault());
-            } else { //default: months and wide
-                namesMap = Calendar.getInstance().getDisplayNames(Calendar.MONTH, Calendar.LONG, Locale.getDefault());
-            }
-
-            // save names as a list
-            for(String name : namesMap.keySet()) {
-                namesList.add(name);
-            }
-
-            // sort the list according to values in namesMap
-            Collections.sort(namesList, new Comparator<String>() {
-                public int compare(String arg0, String arg1) {
-                    return namesMap.get(arg0).compareTo(namesMap.get(arg1));
-                }
-            });
-
-            // convert nameList into JSONArray of String objects
-            for (int i = 0; i < namesList.size(); i ++){
-                value.put(namesList.get(i));
-            }
-
-            //return array of names
-            return obj.put("value", value);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns whether daylight savings time is in effect for a given date using the client's
-     * time zone and calendar.
-     * @Return: JSONObject
-     *          Object.dst {Boolean}: The value "true" indicates that daylight savings time is
-     *                              in effect for the given date and "false" indicate that it is not.    *
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-    */
-    private JSONObject getIsDayLightSavingsTime(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        boolean dst = false;
-        try{
-            Date date = new Date((Long)options.getJSONObject(0).get(DATE));
-            //TimeZone tz = Calendar.getInstance(Locale.getDefault()).getTimeZone();
-            TimeZone tz = TimeZone.getTimeZone(Time.getCurrentTimezone());
-            dst = tz.inDaylightTime(date); //get daylight savings data from date object and user timezone settings
-
-            return obj.put("dst",dst);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns the first day of the week according to the client's user preferences and calendar.
-     * The days of the week are numbered starting from 1 where 1 is considered to be Sunday.
-     * @Return: JSONObject
-     *          Object.value {Number}: The number of the first day of the week.
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-    */
-    private JSONObject getFirstDayOfWeek(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            int value = Calendar.getInstance(Locale.getDefault()).getFirstDayOfWeek(); //get first day of week based on user locale settings
-            return obj.put("value", value);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns a number formatted as a string according to the client's user preferences.
-     * @Return: JSONObject
-     *          Object.value {String}: The formatted number string.
-     *
-     * @throws: GlobalizationError.FORMATTING_ERROR
-    */
-    private JSONObject getNumberToString(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        String value = "";
-        try{
-            DecimalFormat fmt = getNumberFormatInstance(options);//returns Decimal/Currency/Percent instance
-            value = fmt.format(options.getJSONObject(0).get(NUMBER));
-            return obj.put("value", value);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.FORMATTING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Parses a number formatted as a string according to the client's user preferences and
-     * returns the corresponding number.
-     * @Return: JSONObject
-     *          Object.value {Number}: The parsed number.
-     *
-     * @throws: GlobalizationError.PARSING_ERROR
-    */
-    private JSONObject getStringToNumber(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        Number value;
-        try{
-            DecimalFormat fmt = getNumberFormatInstance(options); //returns Decimal/Currency/Percent instance
-            value = fmt.parse((String)options.getJSONObject(0).get(NUMBERSTRING));
-            return obj.put("value", value);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.PARSING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns a pattern string for formatting and parsing numbers according to the client's user
-     * preferences.
-     * @Return: JSONObject
-     *          Object.pattern {String}: The number pattern for formatting and parsing numbers.
-     *                                  The patterns follow Unicode Technical Standard #35.
-     *                                  http://unicode.org/reports/tr35/tr35-4.html
-     *          Object.symbol {String}: The symbol to be used when formatting and parsing
-     *                                  e.g., percent or currency symbol.
-     *          Object.fraction {Number}: The number of fractional digits to use when parsing and
-     *                                  formatting numbers.
-     *          Object.rounding {Number}: The rounding increment to use when parsing and formatting.
-     *          Object.positive {String}: The symbol to use for positive numbers when parsing and formatting.
-     *          Object.negative: {String}: The symbol to use for negative numbers when parsing and formatting.
-     *          Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
-     *          Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
-     *
-     * @throws: GlobalizationError.PATTERN_ERROR
-    */
-    private JSONObject getNumberPattern(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            //uses java.text.DecimalFormat to format value
-            DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(Locale.getDefault()); //default format
-            String symbol = String.valueOf(fmt.getDecimalFormatSymbols().getDecimalSeparator());
-            //get Date value + options (if available)
-            if (options.getJSONObject(0).length() > 0){
-                //options were included
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(TYPE)){
-                    String fmtOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(TYPE);
-                    if (fmtOpt.equalsIgnoreCase(CURRENCY)){
-                        fmt = (DecimalFormat) DecimalFormat.getCurrencyInstance(Locale.getDefault());
-                        symbol = fmt.getDecimalFormatSymbols().getCurrencySymbol();
-                    }else if(fmtOpt.equalsIgnoreCase(PERCENT)){
-                        fmt = (DecimalFormat) DecimalFormat.getPercentInstance(Locale.getDefault());
-                        symbol = String.valueOf(fmt.getDecimalFormatSymbols().getPercent());
-                    }
-                }
-            }
-
-            //return properties
-            obj.put("pattern", fmt.toPattern());
-            obj.put("symbol", symbol);
-            obj.put("fraction", fmt.getMinimumFractionDigits());
-            obj.put("rounding", new Integer(0));
-            obj.put("positive", fmt.getPositivePrefix());
-            obj.put("negative", fmt.getNegativePrefix());
-            obj.put("decimal", String.valueOf(fmt.getDecimalFormatSymbols().getDecimalSeparator()));
-            obj.put("grouping", String.valueOf(fmt.getDecimalFormatSymbols().getGroupingSeparator()));
-
-            return obj;
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.PATTERN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns a pattern string for formatting and parsing currency values according to the client's
-     * user preferences and ISO 4217 currency code.
-     * @Return: JSONObject
-     *          Object.pattern {String}: The currency pattern for formatting and parsing currency values.
-     *                                  The patterns follow Unicode Technical Standard #35
-     *                                  http://unicode.org/reports/tr35/tr35-4.html
-     *          Object.code {String}: The ISO 4217 currency code for the pattern.
-     *          Object.fraction {Number}: The number of fractional digits to use when parsing and
-     *                                  formatting currency.
-     *          Object.rounding {Number}: The rounding increment to use when parsing and formatting.
-     *          Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
-     *          Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
-     *
-     * @throws: GlobalizationError.FORMATTING_ERROR
-    */
-    private JSONObject getCurrencyPattern(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            //get ISO 4217 currency code
-            String code = options.getJSONObject(0).getString(CURRENCYCODE);
-
-            //uses java.text.DecimalFormat to format value
-            DecimalFormat fmt = (DecimalFormat) DecimalFormat.getCurrencyInstance(Locale.getDefault());
-
-            //set currency format
-            Currency currency = Currency.getInstance(code);
-            fmt.setCurrency(currency);
-
-            //return properties
-            obj.put("pattern", fmt.toPattern());
-            obj.put("code", currency.getCurrencyCode());
-            obj.put("fraction", fmt.getMinimumFractionDigits());
-            obj.put("rounding", new Integer(0));
-            obj.put("decimal", String.valueOf(fmt.getDecimalFormatSymbols().getDecimalSeparator()));
-            obj.put("grouping", String.valueOf(fmt.getDecimalFormatSymbols().getGroupingSeparator()));
-
-            return obj;
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.FORMATTING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Parses a JSONArray from user options and returns the correct Instance of Decimal/Percent/Currency.
-     * @Return: DecimalFormat : The Instance to use.
-     *
-     * @throws: JSONException
-    */
-    private DecimalFormat getNumberFormatInstance(JSONArray options) throws JSONException{
-        DecimalFormat fmt =  (DecimalFormat)DecimalFormat.getInstance(Locale.getDefault()); //default format
-        try{
-            if (options.getJSONObject(0).length() > 1){
-                //options were included
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(TYPE)){
-                    String fmtOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(TYPE);
-                    if (fmtOpt.equalsIgnoreCase(CURRENCY)){
-                        fmt = (DecimalFormat)DecimalFormat.getCurrencyInstance(Locale.getDefault());
-                    }else if(fmtOpt.equalsIgnoreCase(PERCENT)){
-                        fmt = (DecimalFormat)DecimalFormat.getPercentInstance(Locale.getDefault());
-                    }
-                }
-            }
-
-        }catch (JSONException je){}
-        return fmt;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/09ee1837/lib/cordova-android/framework/src/org/apache/cordova/GlobalizationError.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/GlobalizationError.java b/lib/cordova-android/framework/src/org/apache/cordova/GlobalizationError.java
deleted file mode 100644
index 8a171d4..0000000
--- a/lib/cordova-android/framework/src/org/apache/cordova/GlobalizationError.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-
-package org.apache.cordova;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/** 
- * @description Exception class representing defined Globalization error codes
- * @Globalization error codes:
- *      GlobalizationError.UNKNOWN_ERROR = 0;
- *      GlobalizationError.FORMATTING_ERROR = 1;   
- *      GlobalizationError.PARSING_ERROR = 2;   
- *      GlobalizationError.PATTERN_ERROR = 3;
- */
-public class GlobalizationError extends Exception{
-    /**
-     * 
-     */
-    private static final long serialVersionUID = 1L;
-    public static final String UNKNOWN_ERROR = "UNKNOWN_ERROR";
-    public static final String FORMATTING_ERROR = "FORMATTING_ERROR";
-    public static final String PARSING_ERROR = "PARSING_ERROR";
-    public static final String PATTERN_ERROR = "PATTERN_ERROR";
-    
-    int error = 0;  //default unknown error thrown
-    /**
-     * Default constructor        
-     */
-    public GlobalizationError() {}
-    /**
-     * Create an exception returning an error code 
-     *    
-     * @param   s           
-     */
-    public GlobalizationError(String s) {       
-        if (s.equalsIgnoreCase(FORMATTING_ERROR)){
-            error = 1;
-        }else if (s.equalsIgnoreCase(PARSING_ERROR)){
-            error = 2;
-        }else if (s.equalsIgnoreCase(PATTERN_ERROR)){
-            error = 3;
-        }       
-    }
-    /**
-     * get error string based on error code 
-     *    
-     * @param   String msg           
-     */
-    public String getErrorString(){
-        String msg = "";
-        switch (error){
-        case 0:
-            msg = UNKNOWN_ERROR;
-            break;
-        case 1:
-            msg =  FORMATTING_ERROR;
-            break;
-        case 2:
-            msg =  PARSING_ERROR;
-            break;
-        case 3:
-            msg =  PATTERN_ERROR;
-            break;
-        }
-        return msg;
-    }
-    /**
-     * get error code 
-     *    
-     * @param   String msg           
-     */
-    public int getErrorCode(){      
-        return error;
-    }
-    
-    /**
-     * get the json version of this object to return to javascript
-     * @return
-     */
-    public JSONObject toJson() {
-        JSONObject obj = new JSONObject();
-        try {
-            obj.put("code", getErrorCode());
-            obj.put("message", getErrorString());
-        } catch (JSONException e) {
-            // never happens
-        }
-        return obj;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/09ee1837/lib/cordova-android/framework/src/org/apache/cordova/HttpHandler.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/HttpHandler.java b/lib/cordova-android/framework/src/org/apache/cordova/HttpHandler.java
deleted file mode 100755
index 1de8302..0000000
--- a/lib/cordova-android/framework/src/org/apache/cordova/HttpHandler.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-package org.apache.cordova;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.DefaultHttpClient;
-
-public class HttpHandler {
-
-    protected Boolean get(String url, String file)
-    {
-        HttpEntity entity = getHttpEntity(url);
-        try {
-            writeToDisk(entity, file);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-        try {
-            entity.consumeContent();
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        }
-        return true;
-    }
-
-    private HttpEntity getHttpEntity(String url)
-    /**
-     * get the http entity at a given url
-     */
-    {
-        HttpEntity entity = null;
-        try {
-            DefaultHttpClient httpclient = new DefaultHttpClient();
-            HttpGet httpget = new HttpGet(url);
-            HttpResponse response = httpclient.execute(httpget);
-            entity = response.getEntity();
-        } catch (Exception e) { e.printStackTrace(); return null; }
-        return entity;
-    }
-
-    private void writeToDisk(HttpEntity entity, String file) throws IllegalStateException, IOException
-    /**
-     * writes a HTTP entity to the specified filename and location on disk
-     */
-    {
-        //int i = 0;
-        String FilePath = "/sdcard/" + file;
-        InputStream in = entity.getContent();
-        byte buff[] = new byte[1024];
-        FileOutputStream out =
-                new FileOutputStream(FilePath);
-       do {
-            int numread = in.read(buff);
-            if (numread <= 0)
-                break;
-            out.write(buff, 0, numread);
-            //i++;
-        } while (true);
-        out.flush();
-        out.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/09ee1837/lib/cordova-android/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java b/lib/cordova-android/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
deleted file mode 100644
index 847972e..0000000
--- a/lib/cordova-android/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-package org.apache.cordova;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.cordova.api.CordovaInterface;
-import org.apache.cordova.api.LOG;
-
-import android.annotation.TargetApi;
-import android.os.Build;
-import android.webkit.WebResourceResponse;
-import android.webkit.WebView;
-
-@TargetApi(Build.VERSION_CODES.HONEYCOMB)
-public class IceCreamCordovaWebViewClient extends CordovaWebViewClient {
-
-
-    public IceCreamCordovaWebViewClient(CordovaInterface cordova) {
-        super(cordova);
-    }
-    
-    public IceCreamCordovaWebViewClient(CordovaInterface cordova, CordovaWebView view) {
-        super(cordova, view);
-    }
-
-    @Override
-    public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
-        //Check if plugins intercept the request
-        WebResourceResponse ret = super.shouldInterceptRequest(view, url);
-        if(ret == null && (url.contains("?") || url.contains("#") || needsIceCreamSpaceInAssetUrlFix(url))){
-            ret = generateWebResourceResponse(url);
-        }
-        return ret;
-    }
-
-    private WebResourceResponse generateWebResourceResponse(String url) {
-        if (url.startsWith("file:///android_asset/")) {
-            String mimetype = FileHelper.getMimeType(url, cordova);
-
-            try {
-                InputStream stream = FileHelper.getInputStreamFromUriString(url, cordova);
-                WebResourceResponse response = new WebResourceResponse(mimetype, "UTF-8", stream);
-                return response;
-            } catch (IOException e) {
-                LOG.e("generateWebResourceResponse", e.getMessage(), e);
-            }
-        }
-        return null;
-    }
-    
-    private static boolean needsIceCreamSpaceInAssetUrlFix(String url) {
-        if (!url.contains("%20")){
-            return false;
-        }
-
-        switch(android.os.Build.VERSION.SDK_INT){
-            case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH:
-            case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
-                return true;
-            default:
-                return false;
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/09ee1837/lib/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java b/lib/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java
deleted file mode 100644
index 8e78baa..0000000
--- a/lib/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java
+++ /dev/null
@@ -1,813 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-package org.apache.cordova;
-
-import java.util.HashMap;
-import java.util.StringTokenizer;
-
-import org.apache.cordova.api.CallbackContext;
-import org.apache.cordova.api.CordovaPlugin;
-import org.apache.cordova.api.LOG;
-import org.apache.cordova.api.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.annotation.SuppressLint;
-import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.Color;
-import android.net.Uri;
-import android.os.Bundle;
-import android.text.InputType;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.View;
-import android.view.Window;
-import android.view.WindowManager;
-import android.view.WindowManager.LayoutParams;
-import android.view.inputmethod.EditorInfo;
-import android.view.inputmethod.InputMethodManager;
-import android.webkit.WebChromeClient;
-import android.webkit.GeolocationPermissions.Callback;
-import android.webkit.JsPromptResult;
-import android.webkit.WebSettings;
-import android.webkit.WebStorage;
-import android.webkit.WebView;
-import android.webkit.WebViewClient;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-
-@SuppressLint("SetJavaScriptEnabled")
-public class InAppBrowser extends CordovaPlugin {
-
-    private static final String NULL = "null";
-    protected static final String LOG_TAG = "InAppBrowser";
-    private static final String SELF = "_self";
-    private static final String SYSTEM = "_system";
-    // private static final String BLANK = "_blank";
-    private static final String LOCATION = "location";
-    private static final String EXIT_EVENT = "exit";
-    private static final String LOAD_START_EVENT = "loadstart";
-    private static final String LOAD_STOP_EVENT = "loadstop";
-    private static final String LOAD_ERROR_EVENT = "loaderror";
-    private static final String CLOSE_BUTTON_CAPTION = "closebuttoncaption";
-    private long MAX_QUOTA = 100 * 1024 * 1024;
-
-    private Dialog dialog;
-    private WebView inAppWebView;
-    private EditText edittext;
-    private boolean showLocationBar = true;
-    private CallbackContext callbackContext;
-    private String buttonLabel = "Done";
-    
-    /**
-     * Executes the request and returns PluginResult.
-     *
-     * @param action        The action to execute.
-     * @param args          JSONArry of arguments for the plugin.
-     * @param callbackId    The callback id used when calling back into JavaScript.
-     * @return              A PluginResult object with a status and message.
-     */
-    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
-        try {
-            if (action.equals("open")) {
-                this.callbackContext = callbackContext;
-                String url = args.getString(0);
-                String target = args.optString(1);
-                if (target == null || target.equals("") || target.equals(NULL)) {
-                    target = SELF;
-                }
-                HashMap<String, Boolean> features = parseFeature(args.optString(2));
-                
-                Log.d(LOG_TAG, "target = " + target);
-
-                url = updateUrl(url);
-                String result = "";
-
-                // SELF
-                if (SELF.equals(target)) {
-                    Log.d(LOG_TAG, "in self");
-                    // load in webview
-                    if (url.startsWith("file://") || url.startsWith("javascript:") 
-                            || Config.isUrlWhiteListed(url)) {
-                        this.webView.loadUrl(url);
-                    }
-                    //Load the dialer
-                    else if (url.startsWith(WebView.SCHEME_TEL))
-                    {
-                        try {
-                            Intent intent = new Intent(Intent.ACTION_DIAL);
-                            intent.setData(Uri.parse(url));
-                            this.cordova.getActivity().startActivity(intent);
-                        } catch (android.content.ActivityNotFoundException e) {
-                            LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString());
-                        }
-                    }
-                    // load in InAppBrowser
-                    else {
-                        result = this.showWebPage(url, features);
-                    }
-                }
-                // SYSTEM
-                else if (SYSTEM.equals(target)) {
-                    Log.d(LOG_TAG, "in system");
-                    result = this.openExternal(url);
-                }
-                // BLANK - or anything else
-                else {
-                    Log.d(LOG_TAG, "in blank");
-                    result = this.showWebPage(url, features);
-                }
-
-                PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result);
-                pluginResult.setKeepCallback(true);
-                this.callbackContext.sendPluginResult(pluginResult);
-            }
-            else if (action.equals("close")) {
-                closeDialog();
-                this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK));
-            }
-            else if (action.equals("injectScriptCode")) {
-                String jsWrapper = null;
-                if (args.getBoolean(1)) {
-                    jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId());
-                }
-                injectDeferredObject(args.getString(0), jsWrapper);
-            }
-            else if (action.equals("injectScriptFile")) {
-                String jsWrapper;
-                if (args.getBoolean(1)) {
-                    jsWrapper = String.format("(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId());
-                } else {
-                    jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)";
-                }
-                injectDeferredObject(args.getString(0), jsWrapper);
-            }
-            else if (action.equals("injectStyleCode")) {
-                String jsWrapper;
-                if (args.getBoolean(1)) {
-                    jsWrapper = String.format("(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId());
-                } else {
-                    jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)";
-                }
-                injectDeferredObject(args.getString(0), jsWrapper);
-            }
-            else if (action.equals("injectStyleFile")) {
-                String jsWrapper;
-                if (args.getBoolean(1)) {
-                    jsWrapper = String.format("(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId());
-                } else {
-                    jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)";
-                }
-                injectDeferredObject(args.getString(0), jsWrapper);
-            }
-            else {
-                return false;
-            }
-        } catch (JSONException e) {
-            this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
-        }
-        return true;
-    }
-
-    /**
-     * Inject an object (script or style) into the InAppBrowser WebView.
-     *
-     * This is a helper method for the inject{Script|Style}{Code|File} API calls, which
-     * provides a consistent method for injecting JavaScript code into the document.
-     *
-     * If a wrapper string is supplied, then the source string will be JSON-encoded (adding
-     * quotes) and wrapped using string formatting. (The wrapper string should have a single
-     * '%s' marker)
-     *
-     * @param source      The source object (filename or script/style text) to inject into
-     *                    the document.
-     * @param jsWrapper   A JavaScript string to wrap the source string in, so that the object
-     *                    is properly injected, or null if the source string is JavaScript text
-     *                    which should be executed directly.
-     */
-    private void injectDeferredObject(String source, String jsWrapper) {
-        String scriptToInject;
-        if (jsWrapper != null) {
-            org.json.JSONArray jsonEsc = new org.json.JSONArray();
-            jsonEsc.put(source);
-            String jsonRepr = jsonEsc.toString();
-            String jsonSourceString = jsonRepr.substring(1, jsonRepr.length()-1);
-            scriptToInject = String.format(jsWrapper, jsonSourceString);
-        } else {
-            scriptToInject = source;
-        }
-        // This action will have the side-effect of blurring the currently focused element
-        this.inAppWebView.loadUrl("javascript:" + scriptToInject);
-    }
-
-    /**
-     * Put the list of features into a hash map
-     * 
-     * @param optString
-     * @return
-     */
-    private HashMap<String, Boolean> parseFeature(String optString) {
-        if (optString.equals(NULL)) {
-            return null;
-        } else {
-            HashMap<String, Boolean> map = new HashMap<String, Boolean>();
-            StringTokenizer features = new StringTokenizer(optString, ",");
-            StringTokenizer option;
-            while(features.hasMoreElements()) {
-                option = new StringTokenizer(features.nextToken(), "=");
-                if (option.hasMoreElements()) {
-                    String key = option.nextToken();
-                    if (key.equalsIgnoreCase(CLOSE_BUTTON_CAPTION)) {
-                        this.buttonLabel = option.nextToken();
-                    } else {
-                        Boolean value = option.nextToken().equals("no") ? Boolean.FALSE : Boolean.TRUE;
-                        map.put(key, value);
-                    }
-                }
-            }
-            return map;
-        }
-    }
-
-    /**
-     * Convert relative URL to full path
-     * 
-     * @param url
-     * @return 
-     */
-    private String updateUrl(String url) {
-        Uri newUrl = Uri.parse(url);
-        if (newUrl.isRelative()) {
-            url = this.webView.getUrl().substring(0, this.webView.getUrl().lastIndexOf("/")+1) + url;
-        }
-        return url;
-    }
-
-    /**
-     * Display a new browser with the specified URL.
-     *
-     * @param url           The url to load.
-     * @param usePhoneGap   Load url in PhoneGap webview
-     * @return              "" if ok, or error message.
-     */
-    public String openExternal(String url) {
-        try {
-            Intent intent = null;
-            intent = new Intent(Intent.ACTION_VIEW);
-            intent.setData(Uri.parse(url));
-            this.cordova.getActivity().startActivity(intent);
-            return "";
-        } catch (android.content.ActivityNotFoundException e) {
-            Log.d(LOG_TAG, "InAppBrowser: Error loading url "+url+":"+ e.toString());
-            return e.toString();
-        }
-    }
-
-    /**
-     * Closes the dialog
-     */
-    private void closeDialog() {
-        try {
-            this.inAppWebView.loadUrl("about:blank");
-            JSONObject obj = new JSONObject();
-            obj.put("type", EXIT_EVENT);
-
-            sendUpdate(obj, false);
-        } catch (JSONException ex) {
-            Log.d(LOG_TAG, "Should never happen");
-        }
-        
-        if (dialog != null) {
-            dialog.dismiss();
-        }
-    }
-
-    /**
-     * Checks to see if it is possible to go back one page in history, then does so.
-     */
-    private void goBack() {
-        if (this.inAppWebView.canGoBack()) {
-            this.inAppWebView.goBack();
-        }
-    }
-
-    /**
-     * Checks to see if it is possible to go forward one page in history, then does so.
-     */
-    private void goForward() {
-        if (this.inAppWebView.canGoForward()) {
-            this.inAppWebView.goForward();
-        }
-    }
-
-    /**
-     * Navigate to the new page
-     *
-     * @param url to load
-     */
-    private void navigate(String url) {
-        InputMethodManager imm = (InputMethodManager)this.cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
-        imm.hideSoftInputFromWindow(edittext.getWindowToken(), 0);
-
-        if (!url.startsWith("http") && !url.startsWith("file:")) {
-            this.inAppWebView.loadUrl("http://" + url);
-        } else {
-            this.inAppWebView.loadUrl(url);
-        }
-        this.inAppWebView.requestFocus();
-    }
-
-
-    /**
-     * Should we show the location bar?
-     *
-     * @return boolean
-     */
-    private boolean getShowLocationBar() {
-        return this.showLocationBar;
-    }
-
-    /**
-     * Display a new browser with the specified URL.
-     *
-     * @param url           The url to load.
-     * @param jsonObject
-     */
-    public String showWebPage(final String url, HashMap<String, Boolean> features) {
-        // Determine if we should hide the location bar.
-        showLocationBar = true;
-        if (features != null) {
-            Boolean show = features.get(LOCATION);
-            if (show != null) {
-                showLocationBar = show.booleanValue();
-            }
-        }
-        
-        final CordovaWebView thatWebView = this.webView;
-
-        // Create dialog in new thread
-        Runnable runnable = new Runnable() {
-            /**
-             * Convert our DIP units to Pixels
-             *
-             * @return int
-             */
-            private int dpToPixels(int dipValue) {
-                int value = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP,
-                                                            (float) dipValue,
-                                                            cordova.getActivity().getResources().getDisplayMetrics()
-                );
-
-                return value;
-            }
-
-            public void run() {
-                // Let's create the main dialog
-                dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
-                dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
-                dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
-                dialog.setCancelable(true);
-                dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
-                        public void onDismiss(DialogInterface dialog) {
-                            try {
-                                JSONObject obj = new JSONObject();
-                                obj.put("type", EXIT_EVENT);
-
-                                sendUpdate(obj, false);
-                            } catch (JSONException e) {
-                                Log.d(LOG_TAG, "Should never happen");
-                            }
-                        }
-                });
-
-                // Main container layout
-                LinearLayout main = new LinearLayout(cordova.getActivity());
-                main.setOrientation(LinearLayout.VERTICAL);
-
-                // Toolbar layout
-                RelativeLayout toolbar = new RelativeLayout(cordova.getActivity());
-                toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44)));
-                toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2));
-                toolbar.setHorizontalGravity(Gravity.LEFT);
-                toolbar.setVerticalGravity(Gravity.TOP);
-
-                // Action Button Container layout
-                RelativeLayout actionButtonContainer = new RelativeLayout(cordova.getActivity());
-                actionButtonContainer.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
-                actionButtonContainer.setHorizontalGravity(Gravity.LEFT);
-                actionButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL);
-                actionButtonContainer.setId(1);
-
-                // Back button
-                Button back = new Button(cordova.getActivity());
-                RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
-                backLayoutParams.addRule(RelativeLayout.ALIGN_LEFT);
-                back.setLayoutParams(backLayoutParams);
-                back.setContentDescription("Back Button");
-                back.setId(2);
-                back.setText("<");
-                back.setOnClickListener(new View.OnClickListener() {
-                    public void onClick(View v) {
-                        goBack();
-                    }
-                });
-
-                // Forward button
-                Button forward = new Button(cordova.getActivity());
-                RelativeLayout.LayoutParams forwardLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
-                forwardLayoutParams.addRule(RelativeLayout.RIGHT_OF, 2);
-                forward.setLayoutParams(forwardLayoutParams);
-                forward.setContentDescription("Forward Button");
-                forward.setId(3);
-                forward.setText(">");
-                forward.setOnClickListener(new View.OnClickListener() {
-                    public void onClick(View v) {
-                        goForward();
-                    }
-                });
-
-                // Edit Text Box
-                edittext = new EditText(cordova.getActivity());
-                RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
-                textLayoutParams.addRule(RelativeLayout.RIGHT_OF, 1);
-                textLayoutParams.addRule(RelativeLayout.LEFT_OF, 5);
-                edittext.setLayoutParams(textLayoutParams);
-                edittext.setId(4);
-                edittext.setSingleLine(true);
-                edittext.setText(url);
-                edittext.setInputType(InputType.TYPE_TEXT_VARIATION_URI);
-                edittext.setImeOptions(EditorInfo.IME_ACTION_GO);
-                edittext.setInputType(InputType.TYPE_NULL); // Will not except input... Makes the text NON-EDITABLE
-                edittext.setOnKeyListener(new View.OnKeyListener() {
-                    public boolean onKey(View v, int keyCode, KeyEvent event) {
-                        // If the event is a key-down event on the "enter" button
-                        if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
-                          navigate(edittext.getText().toString());
-                          return true;
-                        }
-                        return false;
-                    }
-                });
-
-                // Close button
-                Button close = new Button(cordova.getActivity());
-                RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
-                closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
-                close.setLayoutParams(closeLayoutParams);
-                forward.setContentDescription("Close Button");
-                close.setId(5);
-                close.setText(buttonLabel);
-                close.setOnClickListener(new View.OnClickListener() {
-                    public void onClick(View v) {
-                        closeDialog();
-                    }
-                });
-
-                // WebView
-                inAppWebView = new WebView(cordova.getActivity());
-                inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
-                inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView));
-                WebViewClient client = new InAppBrowserClient(thatWebView, edittext);
-                inAppWebView.setWebViewClient(client);
-                WebSettings settings = inAppWebView.getSettings();
-                settings.setJavaScriptEnabled(true);
-                settings.setJavaScriptCanOpenWindowsAutomatically(true);
-                settings.setBuiltInZoomControls(true);
-                /** 
-                 * We need to be careful of this line as a future Android release may deprecate it out of existence.
-                 * Can't replace it with the API 8 level call right now as our minimum SDK is 7 until May 2013
-                 */
-                // @TODO: replace with settings.setPluginState(android.webkit.WebSettings.PluginState.ON)
-                settings.setPluginsEnabled(true);
-                
-                //Toggle whether this is enabled or not!
-                Bundle appSettings = cordova.getActivity().getIntent().getExtras();
-                boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled", true);
-                if(enableDatabase)
-                {
-                    String databasePath = cordova.getActivity().getApplicationContext().getDir("inAppBrowserDB", Context.MODE_PRIVATE).getPath();
-                    settings.setDatabasePath(databasePath);
-                    settings.setDatabaseEnabled(true);
-                }
-                settings.setDomStorageEnabled(true);
-               
-                inAppWebView.loadUrl(url);
-                inAppWebView.setId(6);
-                inAppWebView.getSettings().setLoadWithOverviewMode(true);
-                inAppWebView.getSettings().setUseWideViewPort(true);
-                inAppWebView.requestFocus();
-                inAppWebView.requestFocusFromTouch();
-
-                // Add the back and forward buttons to our action button container layout
-                actionButtonContainer.addView(back);
-                actionButtonContainer.addView(forward);
-
-                // Add the views to our toolbar
-                toolbar.addView(actionButtonContainer);
-                toolbar.addView(edittext);
-                toolbar.addView(close);
-
-                // Don't add the toolbar if its been disabled
-                if (getShowLocationBar()) {
-                    // Add our toolbar to our main view/layout
-                    main.addView(toolbar);
-                }
-
-                // Add our webview to our main view/layout
-                main.addView(inAppWebView);
-
-                WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
-                lp.copyFrom(dialog.getWindow().getAttributes());
-                lp.width = WindowManager.LayoutParams.MATCH_PARENT;
-                lp.height = WindowManager.LayoutParams.MATCH_PARENT;
-
-                dialog.setContentView(main);
-                dialog.show();
-                dialog.getWindow().setAttributes(lp);
-            }
-        };
-        this.cordova.getActivity().runOnUiThread(runnable);
-        return "";
-    }
-
-    /**
-     * Create a new plugin success result and send it back to JavaScript
-     *
-     * @param obj a JSONObject contain event payload information
-     */
-    private void sendUpdate(JSONObject obj, boolean keepCallback) {
-        sendUpdate(obj, keepCallback, PluginResult.Status.OK);
-    }
-
-    /**
-     * Create a new plugin result and send it back to JavaScript
-     *
-     * @param obj a JSONObject contain event payload information
-     * @param status the status code to return to the JavaScript environment
-     */    private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) {
-        PluginResult result = new PluginResult(status, obj);
-        result.setKeepCallback(keepCallback);
-        this.callbackContext.sendPluginResult(result);
-    }
-
-    public class InAppChromeClient extends WebChromeClient {
-
-        private CordovaWebView webView;
-
-        public InAppChromeClient(CordovaWebView webView) {
-            super();
-            this.webView = webView;
-        }
-        /**
-         * Handle database quota exceeded notification.
-         *
-         * @param url
-         * @param databaseIdentifier
-         * @param currentQuota
-         * @param estimatedSize
-         * @param totalUsedQuota
-         * @param quotaUpdater
-         */
-        @Override
-        public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
-                long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
-        {
-            LOG.d(LOG_TAG, "onExceededDatabaseQuota estimatedSize: %d  currentQuota: %d  totalUsedQuota: %d", estimatedSize, currentQuota, totalUsedQuota);
-
-            if (estimatedSize < MAX_QUOTA)
-            {
-                //increase for 1Mb
-                long newQuota = estimatedSize;
-                LOG.d(LOG_TAG, "calling quotaUpdater.updateQuota newQuota: %d", newQuota);
-                quotaUpdater.updateQuota(newQuota);
-            }
-            else
-            {
-                // Set the quota to whatever it is and force an error
-                // TODO: get docs on how to handle this properly
-                quotaUpdater.updateQuota(currentQuota);
-            }
-        }
-
-        /**
-         * Instructs the client to show a prompt to ask the user to set the Geolocation permission state for the specified origin.
-         *
-         * @param origin
-         * @param callback
-         */
-        @Override
-        public void onGeolocationPermissionsShowPrompt(String origin, Callback callback) {
-            super.onGeolocationPermissionsShowPrompt(origin, callback);
-            callback.invoke(origin, true, false);
-        }
-
-        /**
-         * Tell the client to display a prompt dialog to the user.
-         * If the client returns true, WebView will assume that the client will
-         * handle the prompt dialog and call the appropriate JsPromptResult method.
-         *
-         * The prompt bridge provided for the InAppBrowser is capable of executing any
-         * oustanding callback belonging to the InAppBrowser plugin. Care has been
-         * taken that other callbacks cannot be triggered, and that no other code
-         * execution is possible.
-         *
-         * To trigger the bridge, the prompt default value should be of the form:
-         *
-         * gap-iab://<callbackId>
-         *
-         * where <callbackId> is the string id of the callback to trigger (something
-         * like "InAppBrowser0123456789")
-         *
-         * If present, the prompt message is expected to be a JSON-encoded value to
-         * pass to the callback. A JSON_EXCEPTION is returned if the JSON is invalid.
-         *
-         * @param view
-         * @param url
-         * @param message
-         * @param defaultValue
-         * @param result
-         */
-        @Override
-        public boolean onJsPrompt(WebView view, String url, String message, String defaultValue, JsPromptResult result) {
-            // See if the prompt string uses the 'gap-iab' protocol. If so, the remainder should be the id of a callback to execute.
-            if (defaultValue != null && defaultValue.startsWith("gap-iab://")) {
-                PluginResult scriptResult;
-                String scriptCallbackId = defaultValue.substring(10);
-                if (scriptCallbackId.startsWith("InAppBrowser")) {
-                    if(message == null || message.length() == 0) {
-                        scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray());
-                    } else {
-                        try {
-                            scriptResult = new PluginResult(PluginResult.Status.OK, new JSONArray(message));
-                        } catch(JSONException e) {
-                            scriptResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
-                        }
-                    }
-                    this.webView.sendPluginResult(scriptResult, scriptCallbackId);
-                    result.confirm("");
-                    return true;
-                }
-            }
-            return false;
-        }
-
-    }
-    
-    /**
-     * The webview client receives notifications about appView
-     */
-    public class InAppBrowserClient extends WebViewClient {
-        EditText edittext;
-        CordovaWebView webView;
-
-        /**
-         * Constructor.
-         *
-         * @param mContext
-         * @param edittext
-         */
-        public InAppBrowserClient(CordovaWebView webView, EditText mEditText) {
-            this.webView = webView;
-            this.edittext = mEditText;
-        }
-
-        /**
-         * Notify the host application that a page has started loading.
-         *
-         * @param view          The webview initiating the callback.
-         * @param url           The url of the page.
-         */
-        @Override
-        public void onPageStarted(WebView view, String url,  Bitmap favicon) {
-            super.onPageStarted(view, url, favicon);
-            String newloc = "";
-            if (url.startsWith("http:") || url.startsWith("https:") || url.startsWith("file:")) {
-                newloc = url;
-            } 
-            // If dialing phone (tel:5551212)
-            else if (url.startsWith(WebView.SCHEME_TEL)) {
-                try {
-                    Intent intent = new Intent(Intent.ACTION_DIAL);
-                    intent.setData(Uri.parse(url));
-                    cordova.getActivity().startActivity(intent);
-                } catch (android.content.ActivityNotFoundException e) {
-                    LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString());
-                }
-            }
-
-            else if (url.startsWith("geo:") || url.startsWith(WebView.SCHEME_MAILTO) || url.startsWith("market:")) {
-                try {
-                    Intent intent = new Intent(Intent.ACTION_VIEW);
-                    intent.setData(Uri.parse(url));
-                    cordova.getActivity().startActivity(intent);
-                } catch (android.content.ActivityNotFoundException e) {
-                    LOG.e(LOG_TAG, "Error with " + url + ": " + e.toString());
-                }
-            }
-            // If sms:5551212?body=This is the message
-            else if (url.startsWith("sms:")) {
-                try {
-                    Intent intent = new Intent(Intent.ACTION_VIEW);
-
-                    // Get address
-                    String address = null;
-                    int parmIndex = url.indexOf('?');
-                    if (parmIndex == -1) {
-                        address = url.substring(4);
-                    }
-                    else {
-                        address = url.substring(4, parmIndex);
-
-                        // If body, then set sms body
-                        Uri uri = Uri.parse(url);
-                        String query = uri.getQuery();
-                        if (query != null) {
-                            if (query.startsWith("body=")) {
-                                intent.putExtra("sms_body", query.substring(5));
-                            }
-                        }
-                    }
-                    intent.setData(Uri.parse("sms:" + address));
-                    intent.putExtra("address", address);
-                    intent.setType("vnd.android-dir/mms-sms");
-                    cordova.getActivity().startActivity(intent);
-                } catch (android.content.ActivityNotFoundException e) {
-                    LOG.e(LOG_TAG, "Error sending sms " + url + ":" + e.toString());
-                }
-            }
-            else {
-                newloc = "http://" + url;
-            }
-
-            if (!newloc.equals(edittext.getText().toString())) {
-                edittext.setText(newloc);
-            }
-
-            try {
-                JSONObject obj = new JSONObject();
-                obj.put("type", LOAD_START_EVENT);
-                obj.put("url", newloc);
-    
-                sendUpdate(obj, true);
-            } catch (JSONException ex) {
-                Log.d(LOG_TAG, "Should never happen");
-            }
-        }
-        
-        public void onPageFinished(WebView view, String url) {
-            super.onPageFinished(view, url);
-            
-            try {
-                JSONObject obj = new JSONObject();
-                obj.put("type", LOAD_STOP_EVENT);
-                obj.put("url", url);
-    
-                sendUpdate(obj, true);
-            } catch (JSONException ex) {
-                Log.d(LOG_TAG, "Should never happen");
-            }
-        }
-        
-        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
-            super.onReceivedError(view, errorCode, description, failingUrl);
-            
-            try {
-                JSONObject obj = new JSONObject();
-                obj.put("type", LOAD_ERROR_EVENT);
-                obj.put("url", failingUrl);
-                obj.put("code", errorCode);
-                obj.put("message", description);
-    
-                sendUpdate(obj, true, PluginResult.Status.ERROR);
-            } catch (JSONException ex) {
-                Log.d(LOG_TAG, "Should never happen");
-            }
-        	
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/09ee1837/lib/cordova-android/framework/src/org/apache/cordova/JSONUtils.java
----------------------------------------------------------------------
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/JSONUtils.java b/lib/cordova-android/framework/src/org/apache/cordova/JSONUtils.java
deleted file mode 100644
index da777c1..0000000
--- a/lib/cordova-android/framework/src/org/apache/cordova/JSONUtils.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-       Licensed to the Apache Software Foundation (ASF) under one
-       or more contributor license agreements.  See the NOTICE file
-       distributed with this work for additional information
-       regarding copyright ownership.  The ASF licenses this file
-       to you under the Apache License, Version 2.0 (the
-       "License"); you may not use this file except in compliance
-       with the License.  You may obtain a copy of the License at
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing,
-       software distributed under the License is distributed on an
-       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-       KIND, either express or implied.  See the License for the
-       specific language governing permissions and limitations
-       under the License.
-*/
-package org.apache.cordova;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-
-public class JSONUtils {
-	public static List<String> toStringList(JSONArray array) throws JSONException {
-        if(array == null) {
-            return null;
-        }
-        else {
-            List<String> list = new ArrayList<String>();
-
-            for (int i = 0; i < array.length(); i++) {
-                list.add(array.get(i).toString());
-            }
-
-            return list;
-        }
-    }
-}


Mime
View raw message