Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser
This commit is contained in:
commit
6b25158e07
@ -78,3 +78,7 @@
|
|||||||
* Validate that callbackId is correctly formed
|
* Validate that callbackId is correctly formed
|
||||||
* CB-6035 Move js-module so it is not loaded on unsupported platforms
|
* CB-6035 Move js-module so it is not loaded on unsupported platforms
|
||||||
* Removed some iOS6 Deprecations
|
* Removed some iOS6 Deprecations
|
||||||
|
|
||||||
|
### 0.3.3 (Mar 5, 2014)
|
||||||
|
* CB-6172 Fix broken install on case-sensitive file-systems
|
||||||
|
|
||||||
|
@ -133,7 +133,6 @@ The object returned from a call to `window.open`.
|
|||||||
|
|
||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- BlackBerry 10
|
|
||||||
- iOS
|
- iOS
|
||||||
- Windows Phone 7 and 8
|
- Windows Phone 7 and 8
|
||||||
|
|
||||||
@ -164,7 +163,6 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
|
|
||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- BlackBerry 10
|
|
||||||
- iOS
|
- iOS
|
||||||
- Windows Phone 7 and 8
|
- Windows Phone 7 and 8
|
||||||
|
|
||||||
@ -187,7 +185,6 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
|
|
||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- BlackBerry 10
|
|
||||||
- iOS
|
- iOS
|
||||||
- Windows Phone 7 and 8
|
- Windows Phone 7 and 8
|
||||||
|
|
||||||
@ -208,7 +205,6 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
|
|
||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- BlackBerry 10
|
|
||||||
- iOS
|
- iOS
|
||||||
|
|
||||||
### Quick Example
|
### Quick Example
|
||||||
@ -240,7 +236,6 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
|
|
||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- BlackBerry 10
|
|
||||||
- iOS
|
- iOS
|
||||||
|
|
||||||
### Quick Example
|
### Quick Example
|
||||||
@ -268,7 +263,6 @@ The function is passed an `InAppBrowserEvent` object.
|
|||||||
|
|
||||||
- Amazon Fire OS
|
- Amazon Fire OS
|
||||||
- Android
|
- Android
|
||||||
- BlackBerry 10
|
|
||||||
- iOS
|
- iOS
|
||||||
|
|
||||||
### Quick Example
|
### Quick Example
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
|
||||||
id="org.apache.cordova.inappbrowser"
|
id="org.apache.cordova.inappbrowser"
|
||||||
version="0.3.2">
|
version="0.3.3">
|
||||||
|
|
||||||
<name>InAppBrowser</name>
|
<name>InAppBrowser</name>
|
||||||
<description>Cordova InAppBrowser Plugin</description>
|
<description>Cordova InAppBrowser Plugin</description>
|
||||||
@ -27,6 +27,7 @@
|
|||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<source-file src="src/android/InAppBrowser.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
<source-file src="src/android/InAppBrowser.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||||
|
<source-file src="src/android/InAppBrowserDialog.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||||
<source-file src="src/android/InAppChromeClient.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
<source-file src="src/android/InAppChromeClient.java" target-dir="src/org/apache/cordova/inappbrowser" />
|
||||||
|
|
||||||
<!-- drawable src/android/resources -->
|
<!-- drawable src/android/resources -->
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
package org.apache.cordova.inappbrowser;
|
package org.apache.cordova.inappbrowser;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Dialog;
|
import org.apache.cordova.inappbrowser.InAppBrowserDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@ -80,7 +79,7 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
private static final String CLEAR_ALL_CACHE = "clearcache";
|
private static final String CLEAR_ALL_CACHE = "clearcache";
|
||||||
private static final String CLEAR_SESSION_CACHE = "clearsessioncache";
|
private static final String CLEAR_SESSION_CACHE = "clearsessioncache";
|
||||||
|
|
||||||
private Dialog dialog;
|
private InAppBrowserDialog dialog;
|
||||||
private WebView inAppWebView;
|
private WebView inAppWebView;
|
||||||
private EditText edittext;
|
private EditText edittext;
|
||||||
private CallbackContext callbackContext;
|
private CallbackContext callbackContext;
|
||||||
@ -337,12 +336,21 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
this.cordova.getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
childView.loadUrl("about:blank");
|
childView.setWebViewClient(new WebViewClient() {
|
||||||
|
// NB: wait for about:blank before dismissing
|
||||||
|
public void onPageFinished(WebView view, String url) {
|
||||||
if (dialog != null) {
|
if (dialog != null) {
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// NB: From SDK 19: "If you call methods on WebView from any thread
|
||||||
|
// other than your app's UI thread, it can cause unexpected results."
|
||||||
|
// http://developer.android.com/guide/webapps/migrating.html#Threads
|
||||||
|
childView.loadUrl("about:blank");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JSONObject obj = new JSONObject();
|
JSONObject obj = new JSONObject();
|
||||||
obj.put("type", EXIT_EVENT);
|
obj.put("type", EXIT_EVENT);
|
||||||
@ -350,7 +358,6 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
} catch (JSONException ex) {
|
} catch (JSONException ex) {
|
||||||
Log.d(LOG_TAG, "Should never happen");
|
Log.d(LOG_TAG, "Should never happen");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -398,6 +405,10 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
return this.showLocationBar;
|
return this.showLocationBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InAppBrowser getInAppBrowser(){
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a new browser with the specified URL.
|
* Display a new browser with the specified URL.
|
||||||
*
|
*
|
||||||
@ -448,15 +459,11 @@ public class InAppBrowser extends CordovaPlugin {
|
|||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
// Let's create the main dialog
|
// Let's create the main dialog
|
||||||
dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
dialog = new InAppBrowserDialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
|
||||||
dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
|
dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
|
||||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
dialog.setCancelable(true);
|
dialog.setCancelable(true);
|
||||||
dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
dialog.setInAppBroswer(getInAppBrowser());
|
||||||
public void onDismiss(DialogInterface dialog) {
|
|
||||||
closeDialog();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Main container layout
|
// Main container layout
|
||||||
LinearLayout main = new LinearLayout(cordova.getActivity());
|
LinearLayout main = new LinearLayout(cordova.getActivity());
|
||||||
|
54
src/android/InAppBrowserDialog.java
Normal file
54
src/android/InAppBrowserDialog.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
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.inappbrowser;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Oliver on 22/11/2013.
|
||||||
|
*/
|
||||||
|
public class InAppBrowserDialog extends Dialog {
|
||||||
|
Context context;
|
||||||
|
InAppBrowser inAppBrowser = null;
|
||||||
|
|
||||||
|
public InAppBrowserDialog(Context context, int theme) {
|
||||||
|
super(context, theme);
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInAppBroswer(InAppBrowser browser) {
|
||||||
|
this.inAppBrowser = browser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBackPressed () {
|
||||||
|
if (this.inAppBrowser == null) {
|
||||||
|
this.dismiss();
|
||||||
|
} else {
|
||||||
|
// better to go through the in inAppBrowser
|
||||||
|
// because it does a clean up
|
||||||
|
this.inAppBrowser.closeDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user