public void initialize(CordovaInterface paramCordovaInterface, CordovaWebView paramCordovaWebView) { super.initialize(paramCordovaInterface, paramCordovaWebView); this.sockMan = ((ConnectivityManager)paramCordovaInterface.getActivity().getSystemService("connectivity")); this.connectionCallbackContext = null; IntentFilter localIntentFilter = new IntentFilter(); localIntentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); if (this.receiver == null) { this.receiver = new BroadcastReceiver() { public void onReceive(Context paramContext, Intent paramIntent) { if (NetworkManager.this.webView != null) NetworkManager.this.updateConnectionInfo(NetworkManager.this.sockMan.getActiveNetworkInfo()); } }; paramCordovaInterface.getActivity().registerReceiver(this.receiver, localIntentFilter); this.registered = true; } }
@TargetApi(11) public CordovaWebView(Context paramContext, AttributeSet paramAttributeSet, int paramInt, boolean paramBoolean) { super(paramContext, paramAttributeSet, paramInt, paramBoolean); if (CordovaInterface.class.isInstance(paramContext)) this.cordova = ((CordovaInterface)paramContext); while (true) { setWebChromeClient(new CordovaChromeClient(this.cordova)); initWebViewClient(this.cordova); loadConfiguration(); setup(); return; Log.d("CordovaWebView", "Your activity must implement CordovaInterface to work"); } }
public static String getRealPath(String paramString, CordovaInterface paramCordovaInterface) { String str; if (paramString.startsWith("content://")) { String[] arrayOfString = { "_data" }; Cursor localCursor = paramCordovaInterface.getActivity().managedQuery(Uri.parse(paramString), arrayOfString, null, null, null); int i = localCursor.getColumnIndexOrThrow("_data"); localCursor.moveToFirst(); str = localCursor.getString(i); if (str == null) LOG.e("FileUtils", "Could get real path for URI string %s", new Object[] { paramString }); } while (true) { return str; if (!paramString.startsWith("file://")) break; str = paramString.substring(7); if (!str.startsWith("/android_asset/")) continue; LOG.e("FileUtils", "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", new Object[] { paramString }); return null; } return paramString; }
public PluginResult dispatch(CordovaInterface paramCordovaInterface, JSONArray paramJSONArray) throws Throwable { Context localContext = new Context(paramCordovaInterface); collectParameters(localContext, paramJSONArray); if (this.logger.isLoggable(3)) { this.logger.logDebug("invoking action dispatcher \"" + this.name + "\" with parameters:"); Iterator localIterator = this.parameters.iterator(); while (localIterator.hasNext()) { Parameter localParameter = (Parameter)localIterator.next(); String str = localParameter.getName(); if (localParameter.isLoggable()) { this.logger.logDebug(" " + str + "=" + localContext.getUntypedParameter(str)); continue; } this.logger.logDebug(" " + str + "=[value not logged]"); } } return dispatch(localContext); }
/** * Sets the context of the Command. This can then be used to do things like * get file paths associated with the Activity. * * @param cordova The context of the main Activity. * @param webView The CordovaWebView Cordova is running in. */ public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); this.sockMan = (ConnectivityManager) cordova.getActivity().getSystemService(Context.CONNECTIVITY_SERVICE); this.connectionCallbackContext = null; // We need to listen to connectivity events to update navigator.connection IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); if (this.receiver == null) { this.receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // (The null check is for the ARM Emulator, please use Intel Emulator for better results) if(NetworkManager.this.webView != null) updateConnectionInfo(sockMan.getActiveNetworkInfo()); } }; cordova.getActivity().registerReceiver(this.receiver, intentFilter); this.registered = true; } }
/** * Constructor. * * @param context * @param attrs */ public CordovaWebView(Context context, AttributeSet attrs) { super(context, attrs); if (CordovaInterface.class.isInstance(context)) { this.cordova = (CordovaInterface) context; } else { Log.d(TAG, "Your activity must implement CordovaInterface to work"); } this.setWebChromeClient(new CordovaChromeClient(this.cordova, this)); this.initWebViewClient(this.cordova); this.loadConfiguration(); this.setup(); }
/** * Constructor. * * @param context * @param attrs * @param defStyle * */ public CordovaWebView(Context context, AttributeSet attrs, int defStyle) { super(context,attrs); //super(context, attrs, defStyle); if (CordovaInterface.class.isInstance(context)) { this.cordova = (CordovaInterface) context; } else { Log.d(TAG, "Your activity must implement CordovaInterface to work"); } this.setWebChromeClient(new CordovaChromeClient(this.cordova, this)); this.loadConfiguration(); this.setup(); }
/** * Constructor. * * @param context * @param attrs * @param defStyle * @param privateBrowsing */ @TargetApi(11) public CordovaWebView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) { super(context,attrs); //super(context, attrs, defStyle, privateBrowsing); if (CordovaInterface.class.isInstance(context)) { this.cordova = (CordovaInterface) context; } else { Log.d(TAG, "Your activity must implement CordovaInterface to work"); } this.setWebChromeClient(new CordovaChromeClient(this.cordova)); this.initWebViewClient(this.cordova); this.loadConfiguration(); this.setup(); }
/** * Returns the real path of the given URI string. * If the given URI string represents a content:// URI, the real path is retrieved from the media store. * * @param uriString the URI string of the audio/image/video * @param cordova the current application context * @return the full path to the file */ @SuppressWarnings("deprecation") public static String getRealPath(String uriString, CordovaInterface cordova) { String realPath = null; if (uriString.startsWith("content://")) { String[] proj = { _DATA }; Cursor cursor = cordova.getActivity().managedQuery(Uri.parse(uriString), proj, null, null, null); int column_index = cursor.getColumnIndexOrThrow(_DATA); cursor.moveToFirst(); realPath = cursor.getString(column_index); if (realPath == null) { LOG.e(LOG_TAG, "Could get real path for URI string %s", uriString); } } else if (uriString.startsWith("file://")) { realPath = uriString.substring(7); if (realPath.startsWith("/android_asset/")) { LOG.e(LOG_TAG, "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", uriString); realPath = null; } } else { realPath = uriString; } return realPath; }
/** * Returns the mime type of the data specified by the given URI string. * * @param uriString the URI string of the data * @return the mime type of the specified data */ public static String getMimeType(String uriString, CordovaInterface cordova) { String mimeType = null; Uri uri = Uri.parse(uriString); if (uriString.startsWith("content://")) { mimeType = cordova.getActivity().getContentResolver().getType(uri); } else { // MimeTypeMap.getFileExtensionFromUrl() fails when there are query parameters. String extension = uri.getPath(); int lastDot = extension.lastIndexOf('.'); if (lastDot != -1) { extension = extension.substring(lastDot + 1); } // Convert the URI string to lower case to ensure compatibility with MimeTypeMap (see CB-2185). extension = extension.toLowerCase(); if (extension.equals("3ga")) { mimeType = "audio/3gpp"; } else { mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); } } return mimeType; }
/** * Show the spinner. * * @param title Title of the dialog * @param message The message of the dialog */ public synchronized void activityStart(final String title, final String message) { if (this.spinnerDialog != null) { this.spinnerDialog.dismiss(); this.spinnerDialog = null; } final CordovaInterface cordova = this.cordova; Runnable runnable = new Runnable() { public void run() { Notification.this.spinnerDialog = ProgressDialog.show(cordova.getActivity(), title, message, true, true, new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { Notification.this.spinnerDialog = null; } }); } }; this.cordova.getActivity().runOnUiThread(runnable); }
/** * Constructor. * * @param context * @param attrs */ public CordovaWebView(Context context, AttributeSet attrs) { super(context, attrs); if (CordovaInterface.class.isInstance(context)) { this.cordova = (CordovaInterface) context; } else { Log.d(TAG, "Your activity must implement CordovaInterface to work"); } this.setWebChromeClient(new CordovaChromeClient(this.cordova, this)); this.initWebViewClient(this.cordova); this.loadConfiguration(); //this.setup(); }
/** * Constructor. * * @param context * @param attrs * @param defStyle * @param privateBrowsing */ @TargetApi(11) public CordovaWebView(Context context, AttributeSet attrs, int defStyle, boolean privateBrowsing) { super(context, attrs, defStyle, privateBrowsing); if (CordovaInterface.class.isInstance(context)) { this.cordova = (CordovaInterface) context; } else { Log.d(TAG, "Your activity must implement CordovaInterface to work"); } this.setWebChromeClient(new CordovaChromeClient(this.cordova)); this.initWebViewClient(this.cordova); this.loadConfiguration(); this.setup(); }
public NativeToJsMessageQueue(CordovaWebView paramCordovaWebView, CordovaInterface paramCordovaInterface) { this.cordova = paramCordovaInterface; this.webView = paramCordovaWebView; this.registeredListeners = new BridgeMode[4]; this.registeredListeners[0] = null; this.registeredListeners[1] = new LoadUrlBridgeMode(null); this.registeredListeners[2] = new OnlineEventsBridgeMode(); this.registeredListeners[3] = new PrivateApiBridgeMode(null); reset(); }
public CordovaWebView(Context paramContext) { super(paramContext); if (CordovaInterface.class.isInstance(paramContext)) this.cordova = ((CordovaInterface)paramContext); while (true) { loadConfiguration(); setup(); return; Log.d("CordovaWebView", "Your activity must implement CordovaInterface to work"); } }
public CordovaWebView(Context paramContext, AttributeSet paramAttributeSet) { super(paramContext, paramAttributeSet); if (CordovaInterface.class.isInstance(paramContext)) this.cordova = ((CordovaInterface)paramContext); while (true) { setWebChromeClient(new CordovaChromeClient(this.cordova, this)); initWebViewClient(this.cordova); loadConfiguration(); setup(); return; Log.d("CordovaWebView", "Your activity must implement CordovaInterface to work"); } }
public CordovaWebView(Context paramContext, AttributeSet paramAttributeSet, int paramInt) { super(paramContext, paramAttributeSet, paramInt); if (CordovaInterface.class.isInstance(paramContext)) this.cordova = ((CordovaInterface)paramContext); while (true) { setWebChromeClient(new CordovaChromeClient(this.cordova, this)); loadConfiguration(); setup(); return; Log.d("CordovaWebView", "Your activity must implement CordovaInterface to work"); } }
private void initWebViewClient(CordovaInterface paramCordovaInterface) { if ((Build.VERSION.SDK_INT < 11) || (Build.VERSION.SDK_INT > 17)) { setWebViewClient(new CordovaWebViewClient(this.cordova, this)); return; } setWebViewClient(new IceCreamCordovaWebViewClient(this.cordova, this)); }
public static InputStream getInputStreamFromUriString(String paramString, CordovaInterface paramCordovaInterface) throws IOException { if (paramString.startsWith("content")) { Uri localUri = Uri.parse(paramString); return paramCordovaInterface.getActivity().getContentResolver().openInputStream(localUri); } if (paramString.startsWith("file:///android_asset/")) { String str = paramString.substring(22); return paramCordovaInterface.getActivity().getAssets().open(str); } return new FileInputStream(getRealPath(paramString, paramCordovaInterface)); }
public static String getMimeType(String paramString, CordovaInterface paramCordovaInterface) { if (paramString.startsWith("content://")) { Uri localUri = Uri.parse(paramString); return paramCordovaInterface.getActivity().getContentResolver().getType(localUri); } String str = MimeTypeMap.getFileExtensionFromUrl(paramString.replace(" ", "%20").toLowerCase()); if (str.equals("3ga")) return "audio/3gpp"; return MimeTypeMap.getSingleton().getMimeTypeFromExtension(str); }
public void initialize(CordovaInterface paramCordovaInterface, CordovaWebView paramCordovaWebView) { super.initialize(paramCordovaInterface, paramCordovaWebView); validateGCMSetup(); if (this.isGCMSetupValid) { unregisterReceivers(); if (paramCordovaInterface != null) { if (this.onMessageReceiver == null) this.onMessageReceiver = new BroadcastReceiver() { public void onReceive(Context paramContext, Intent paramIntent) { WLUtils.debug("Queuing message for dispatch to javascript"); synchronized (Push.this.pending) { Push.this.pending.add((WLGCMIntentService.Message)paramIntent.getParcelableExtra("message")); Push.this.dispatchPending(); if (!paramIntent.getBooleanExtra("notificationBar", false)) setResultCode(-1); return; } } }; paramCordovaInterface.getActivity().registerReceiver(this.onMessageReceiver, new IntentFilter(WLUtils.getFullAppName(paramCordovaInterface.getActivity()) + ".C2DM_MESSAGE")); Activity localActivity = (Activity)paramCordovaInterface; if ((WLUtils.getFullAppName(this.cordova.getActivity()) + ".NOTIFICATION").equals(localActivity.getIntent().getAction())) { WLUtils.debug("Activity started from message notification"); localActivity.getIntent().putExtra("notificationBar", true); this.onMessageReceiver.onReceive(this.cordova.getActivity(), localActivity.getIntent()); } } dispatchPending(); } }
private ActionDispatcherRunnable(ActionDispatcher paramJSONArray, JSONArray paramCordovaInterface, CordovaInterface paramCallbackContext, CallbackContext arg5) { this.args = paramCordovaInterface; Object localObject; this.callbackContext = localObject; this.context = paramCallbackContext; this.dispatcher = paramJSONArray; }
/** * Initialize the Plugin, Cordova handles this. * * @param cordova Used to get register Handler with the Context accessible from this interface * @param view Passed straight to super's initialization. */ public void initialize(CordovaInterface cordova, CordovaWebView view) { super.initialize(cordova, view); _bluetooth = new BluetoothWrapper(cordova.getActivity().getBaseContext(), _handler); _wasDiscoveryCanceled = false; }
public NativeToJsMessageQueue(CordovaWebView webView, CordovaInterface cordova) { this.cordova = cordova; this.webView = webView; registeredListeners = new BridgeMode[4]; registeredListeners[0] = null; // Polling. Requires no logic. registeredListeners[1] = new LoadUrlBridgeMode(); registeredListeners[2] = new OnlineEventsBridgeMode(); registeredListeners[3] = new PrivateApiBridgeMode(); reset(); }
/** * Constructor. * * @param context */ public CordovaWebView(Context context) { super(context); if (CordovaInterface.class.isInstance(context)) { this.cordova = (CordovaInterface) context; } else { Log.d(TAG, "Your activity must implement CordovaInterface to work"); } this.loadConfiguration(); this.setup(); }
private void initWebViewClient(CordovaInterface cordova) { if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB || android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { this.setWebViewClient(new CordovaWebViewClient(this.cordova, this)); } else { this.setWebViewClient(new IceCreamCordovaWebViewClient(this.cordova, this)); } }
/** * Show the progress dialog. * * @param title Title of the dialog * @param message The message of the dialog */ public synchronized void progressStart(final String title, final String message) { if (this.progressDialog != null) { this.progressDialog.dismiss(); this.progressDialog = null; } final Notification notification = this; final CordovaInterface cordova = this.cordova; Runnable runnable = new Runnable() { public void run() { notification.progressDialog = new ProgressDialog(cordova.getActivity()); notification.progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); notification.progressDialog.setTitle(title); notification.progressDialog.setMessage(message); notification.progressDialog.setCancelable(true); notification.progressDialog.setMax(100); notification.progressDialog.setProgress(0); notification.progressDialog.setOnCancelListener( new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { notification.progressDialog = null; } }); notification.progressDialog.show(); } }; this.cordova.getActivity().runOnUiThread(runnable); }