@Test @SuppressLint("JavascriptInterface") public void newInstance_addsJavascriptInterfaceToWebView() { WebView webView = mock(WebView.class); when(webView.getSettings()).thenReturn(mock(WebSettings.class)); PopupBridge popupBridge = PopupBridge.newInstance(mAppCompatActivity, webView); verify(webView).addJavascriptInterface(eq(popupBridge), eq("popupBridge")); }
@SuppressLint("SetJavaScriptEnabled") public static PopupBridge newInstance(AppCompatActivity activity, WebView webView) throws IllegalArgumentException { return newInstance((FragmentActivity)activity, webView); }
PopupBridge extends BrowserSwitchFragment { @SuppressLint("SetJavaScriptEnabled") public static PopupBridge newInstance(AppCompatActivity activity, WebView webView) throws IllegalArgumentException { return newInstance((FragmentActivity)activity, webView); } }
PopupBridge extends BrowserSwitchFragment { @SuppressLint("SetJavaScriptEnabled") public static PopupBridge newInstance(AppCompatActivity activity, WebView webView) throws IllegalArgumentException { return newInstance((FragmentActivity)activity, webView); } PopupBridge(); }
PopupBridge extends BrowserSwitchFragment { @SuppressLint("SetJavaScriptEnabled") public static PopupBridge newInstance(AppCompatActivity activity, WebView webView) throws IllegalArgumentException { return newInstance((FragmentActivity)activity, webView); } PopupBridge(); @SuppressLint("SetJavaScriptEnabled") static PopupBridge newInstance(AppCompatActivity activity, WebView webView); @SuppressLint("SetJavaScriptEnabled") static PopupBridge newInstance(FragmentActivity activity, WebView webView); @Override void onAttach(@NonNull Context context); @Override void onCreate(Bundle savedInstanceState); @Override void onBrowserSwitchResult(int requestCode, BrowserSwitchResult result, @Nullable Uri returnUri); @Override String getReturnUrlScheme(); @JavascriptInterface String getReturnUrlPrefix(); @JavascriptInterface void open(String url); @JavascriptInterface void sendMessage(String messageName); @JavascriptInterface void sendMessage(String messageName, String data); void setNavigationListener(PopupBridgeNavigationListener listener); void setMessageListener(PopupBridgeMessageListener listener); }
PopupBridge extends BrowserSwitchFragment { @SuppressLint("SetJavaScriptEnabled") public static PopupBridge newInstance(AppCompatActivity activity, WebView webView) throws IllegalArgumentException { return newInstance((FragmentActivity)activity, webView); } PopupBridge(); @SuppressLint("SetJavaScriptEnabled") static PopupBridge newInstance(AppCompatActivity activity, WebView webView); @SuppressLint("SetJavaScriptEnabled") static PopupBridge newInstance(FragmentActivity activity, WebView webView); @Override void onAttach(@NonNull Context context); @Override void onCreate(Bundle savedInstanceState); @Override void onBrowserSwitchResult(int requestCode, BrowserSwitchResult result, @Nullable Uri returnUri); @Override String getReturnUrlScheme(); @JavascriptInterface String getReturnUrlPrefix(); @JavascriptInterface void open(String url); @JavascriptInterface void sendMessage(String messageName); @JavascriptInterface void sendMessage(String messageName, String data); void setNavigationListener(PopupBridgeNavigationListener listener); void setMessageListener(PopupBridgeMessageListener listener); static final String POPUP_BRIDGE_NAME; static final String POPUP_BRIDGE_URL_HOST; }