CB-481 refactored prompt() call in JS to exec, moved showing of webview out of chrome client and into app plugin (so we can invoke via exec)

This commit is contained in:
Fil Maj
2012-05-10 15:50:02 -07:00
parent de6652dd9d
commit a705b72740
3 changed files with 351 additions and 117 deletions
+10
View File
@@ -27,6 +27,8 @@ import org.json.JSONException;
import org.json.JSONObject;
import android.webkit.WebView;
import android.app.Activity;
import android.view.View;
import java.util.HashMap;
@@ -51,6 +53,14 @@ public class App extends Plugin {
if (action.equals("clearCache")) {
this.clearCache();
}
else if (action.equals("show")) {
final CordovaWebView wv = this.webView;
((Activity)this.ctx).runOnUiThread(new Runnable() {
public void run() {
wv.setVisibility(View.VISIBLE);
}
});
}
else if (action.equals("loadUrl")) {
this.loadUrl(args.getString(0), args.optJSONObject(1));
}
@@ -227,14 +227,6 @@ public class CordovaChromeClient extends WebChromeClient {
result.confirm(r);
}
// Cordova JS has initialized, so show webview
// (This solves white flash seen when rendering HTML)
else if (reqOk && defaultValue != null && defaultValue.equals("gap_init:")) {
appView.setVisibility(View.VISIBLE);
//ctx.spinnerStop();
result.confirm("OK");
}
// Show dialog
else {
final JsPromptResult res = result;