Changing DroidGap back and duplicating code so that we don't have a regression on CB-1568

This commit is contained in:
Joe Bowser 2012-10-25 13:18:28 -07:00
parent 32526a8c16
commit 7f4ee7b20a
2 changed files with 13 additions and 4 deletions

View File

@ -122,7 +122,6 @@ public class CordovaWebView extends WebView {
{ {
Log.d(TAG, "Your activity must implement CordovaInterface to work"); Log.d(TAG, "Your activity must implement CordovaInterface to work");
} }
this.initWebViewClient(this.cordova);
this.loadConfiguration(); this.loadConfiguration();
this.setup(); this.setup();
} }

View File

@ -301,7 +301,16 @@ public class DroidGap extends Activity implements CordovaInterface {
*/ */
public void init() { public void init() {
CordovaWebView webView = new CordovaWebView(DroidGap.this); CordovaWebView webView = new CordovaWebView(DroidGap.this);
this.init(webView, new CordovaChromeClient(this, webView)); CordovaWebViewClient webViewClient;
if(android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB)
{
webViewClient = new CordovaWebViewClient(this, webView);
}
else
{
webViewClient = new IceCreamCordovaWebViewClient(this, webView);
}
this.init(webView, webViewClient, new CordovaChromeClient(this, webView));
} }
/** /**
@ -311,16 +320,17 @@ public class DroidGap extends Activity implements CordovaInterface {
* @param webViewClient * @param webViewClient
* @param webChromeClient * @param webChromeClient
*/ */
public void init(CordovaWebView webView, CordovaChromeClient webChromeClient) { public void init(CordovaWebView webView, CordovaWebViewClient webViewClient, CordovaChromeClient webChromeClient) {
LOG.d(TAG, "DroidGap.init()"); LOG.d(TAG, "DroidGap.init()");
// Set up web container // Set up web container
this.appView = webView; this.appView = webView;
this.appView.setId(100); this.appView.setId(100);
this.appView.setWebViewClient(webViewClient);
this.appView.setWebChromeClient(webChromeClient); this.appView.setWebChromeClient(webChromeClient);
webViewClient.setWebView(this.appView);
webChromeClient.setWebView(this.appView); webChromeClient.setWebView(this.appView);
webViewClient = appView.viewClient;
this.appView.setLayoutParams(new LinearLayout.LayoutParams( this.appView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,