@Test public void startUriIntentCheck() { StandardActivity activity = (StandardActivity) mActivityRule.getActivity(); final SystemWebView webView = (SystemWebView) activity.getWindow().getCurrentFocus(); try { mActivityRule.runOnUiThread(new Runnable() { @Override public void run() { String uri = webView.getUrl(); assertFalse(uri.equals(FALSE_URI)); } }); } catch (Throwable throwable) { throwable.printStackTrace(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Set up the webview ConfigXmlParser parser = new ConfigXmlParser(); parser.parse(this); SystemWebView webView = (SystemWebView) findViewById(R.id.cordovaWebView); webInterface = new CordovaWebViewImpl(new SystemWebViewEngine(webView)); webInterface.init(cordovaInterface, parser.getPluginEntries(), parser.getPreferences()); webView.loadUrl(parser.getLaunchUrl()); }
@Test public void webViewCheck() { StandardActivity activity = (StandardActivity) mActivityRule.getActivity(); //Fish the webview out of the mostly locked down Activity using the Android SDK View view = activity.getWindow().getCurrentFocus(); assertEquals(SystemWebView.class, view.getClass()); }
@Test public void checkBackgroundIntentCheck() { StandardActivity activity = (StandardActivity) mActivityRule.getActivity(); final SystemWebView webView = (SystemWebView) activity.getWindow().getCurrentFocus(); CordovaWebView webInterface = webView.getCordovaWebView(); CordovaPreferences prefs = webInterface.getPreferences(); assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == Color.GREEN); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set by <content src="index.html" /> in config.xml loadUrl(launchUrl); WebSettings ws = ((SystemWebView)super.appView.getView()).getSettings(); ws.setMediaPlaybackRequiresUserGesture(false); }
private WebChromeClient encapulateWebChromeClientForView(WebView view) { if (view.getClass().getSimpleName().equalsIgnoreCase("CordovaWebView")) { return encapsulatedCordovaChromeClientForView((CordovaWebView)view); } else if (view.getClass().getSimpleName().equalsIgnoreCase("SystemWebView")) { return new ExtendedSystemWebChromeClient(new SystemWebViewEngine((SystemWebView)view)); } else { try { Object webChromeClient = getWebClientViaReflection(view, "mWebChromeClient"); if (webChromeClient != null) { return new WrappedChromeClient((WebChromeClient) webChromeClient); } } catch(Exception e) {} return new SelendroidWebChromeClient(); } }
public InjectWebViewEngine(SystemWebView webView) { super(webView); webView.setWebViewClient(new InjectWebViewClient(this)); }
public SelendroidSystemWebViewClient(SystemWebView view) { super(new SystemWebViewEngine(view)); }