Search in sources :

Example 61 with WebView

use of android.webkit.WebView in project SeriesGuide by UweTrottmann.

the class BaseOAuthActivity method setupViews.

private void setupViews() {
    webview = (WebView) findViewById(R.id.webView);
    buttonContainer = findViewById(R.id.containerOauthButtons);
    progressBar = findViewById(R.id.progressBarOauth);
    textViewMessage = (TextView) buttonContainer.findViewById(R.id.textViewOauthMessage);
    // setup buttons (can be used if browser launch fails or user comes back without code)
    Button buttonBrowser = (Button) findViewById(R.id.buttonOauthBrowser);
    buttonBrowser.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            launchBrowser();
        }
    });
    Button buttonWebView = (Button) findViewById(R.id.buttonOauthWebView);
    buttonWebView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            activateWebView();
        }
    });
    activateFallbackButtons();
    setMessage(null);
}
Also used : Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) WebView(android.webkit.WebView)

Example 62 with WebView

use of android.webkit.WebView in project XPrivacy by M66B.

the class XWebView method after.

@Override
protected void after(XParam param) throws Throwable {
    switch(mMethod) {
        case WebView:
            if (param.args.length > 0 && param.thisObject instanceof WebView) {
                if (isRestricted(param, PrivacyManager.cView, "initUserAgentString")) {
                    String ua = (String) PrivacyManager.getDefacedProp(Binder.getCallingUid(), "UA");
                    WebView webView = (WebView) param.thisObject;
                    if (webView.getSettings() != null)
                        webView.getSettings().setUserAgentString(ua);
                }
            }
            break;
        case loadUrl:
        case postUrl:
            // Do nothing
            break;
        case getSettings:
            if (param.getResult() != null) {
                Class<?> clazz = param.getResult().getClass();
                if (PrivacyManager.getTransient(clazz.getName(), null) == null) {
                    PrivacyManager.setTransient(clazz.getName(), Boolean.toString(true));
                    XPrivacy.hookAll(XWebSettings.getInstances(param.getResult()), clazz.getClassLoader(), getSecret(), true);
                }
            }
            break;
    }
}
Also used : WebView(android.webkit.WebView)

Example 63 with WebView

use of android.webkit.WebView in project material-dialogs by afollestad.

the class MDRootLayout method setUpDividersVisibility.

private void setUpDividersVisibility(final View view, final boolean setForTop, final boolean setForBottom) {
    if (view == null) {
        return;
    }
    if (view instanceof ScrollView) {
        final ScrollView sv = (ScrollView) view;
        if (canScrollViewScroll(sv)) {
            addScrollListener(sv, setForTop, setForBottom);
        } else {
            if (setForTop) {
                drawTopDivider = false;
            }
            if (setForBottom) {
                drawBottomDivider = false;
            }
        }
    } else if (view instanceof AdapterView) {
        final AdapterView sv = (AdapterView) view;
        if (canAdapterViewScroll(sv)) {
            addScrollListener(sv, setForTop, setForBottom);
        } else {
            if (setForTop) {
                drawTopDivider = false;
            }
            if (setForBottom) {
                drawBottomDivider = false;
            }
        }
    } else if (view instanceof WebView) {
        view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {

            @Override
            public boolean onPreDraw() {
                if (view.getMeasuredHeight() != 0) {
                    if (!canWebViewScroll((WebView) view)) {
                        if (setForTop) {
                            drawTopDivider = false;
                        }
                        if (setForBottom) {
                            drawBottomDivider = false;
                        }
                    } else {
                        addScrollListener((ViewGroup) view, setForTop, setForBottom);
                    }
                    view.getViewTreeObserver().removeOnPreDrawListener(this);
                }
                return true;
            }
        });
    } else if (view instanceof RecyclerView) {
        boolean canScroll = canRecyclerViewScroll((RecyclerView) view);
        if (setForTop) {
            drawTopDivider = canScroll;
        }
        if (setForBottom) {
            drawBottomDivider = canScroll;
        }
        if (canScroll) {
            addScrollListener((ViewGroup) view, setForTop, setForBottom);
        }
    } else if (view instanceof ViewGroup) {
        View topView = getTopView((ViewGroup) view);
        setUpDividersVisibility(topView, setForTop, setForBottom);
        View bottomView = getBottomView((ViewGroup) view);
        if (bottomView != topView) {
            setUpDividersVisibility(bottomView, false, true);
        }
    }
}
Also used : ScrollView(android.widget.ScrollView) ViewGroup(android.view.ViewGroup) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) WebView(android.webkit.WebView) ViewTreeObserver(android.view.ViewTreeObserver) RecyclerView(android.support.v7.widget.RecyclerView) ScrollView(android.widget.ScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) WebView(android.webkit.WebView)

Example 64 with WebView

use of android.webkit.WebView in project AirMapView by airbnb.

the class WebViewMapFragment method onCreateView.

@SuppressLint({ "SetJavaScriptEnabled", "AddJavascriptInterface" })
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_webview, container, false);
    webView = (WebView) view.findViewById(R.id.webview);
    mLayout = (ViewGroup) view;
    WebSettings webViewSettings = webView.getSettings();
    webViewSettings.setSupportZoom(true);
    webViewSettings.setBuiltInZoomControls(false);
    webViewSettings.setJavaScriptEnabled(true);
    webViewSettings.setGeolocationEnabled(true);
    webViewSettings.setAllowFileAccess(false);
    webViewSettings.setAllowContentAccess(false);
    webView.setWebChromeClient(new GeoWebChromeClient());
    AirMapType mapType = AirMapType.fromBundle(getArguments());
    webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null);
    webView.addJavascriptInterface(new MapsJavaScriptInterface(), "AirMapView");
    return view;
}
Also used : WebSettings(android.webkit.WebSettings) View(android.view.View) WebView(android.webkit.WebView) SuppressLint(android.annotation.SuppressLint)

Example 65 with WebView

use of android.webkit.WebView in project FadingActionBar by ManuelPeinado.

the class WebViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FadingActionBarHelper helper = new FadingActionBarHelper().actionBarBackground(R.drawable.ab_background).headerLayout(R.layout.header).contentLayout(R.layout.activity_webview);
    setContentView(helper.createView(this));
    helper.initActionBar(this);
    WebView webView = (WebView) findViewById(R.id.webView);
    webView.setWebViewClient(new WebViewClient());
    webView.loadUrl("http://en.wikipedia.org/wiki/New_York_City");
}
Also used : FadingActionBarHelper(com.manuelpeinado.fadingactionbar.extras.actionbarcompat.FadingActionBarHelper) WebView(android.webkit.WebView) WebViewClient(android.webkit.WebViewClient)

Aggregations

WebView (android.webkit.WebView)328 WebViewClient (android.webkit.WebViewClient)108 View (android.view.View)82 WebSettings (android.webkit.WebSettings)48 Intent (android.content.Intent)42 SuppressLint (android.annotation.SuppressLint)37 WebChromeClient (android.webkit.WebChromeClient)37 TextView (android.widget.TextView)28 DialogInterface (android.content.DialogInterface)23 LinearLayout (android.widget.LinearLayout)23 ImageView (android.widget.ImageView)22 Bitmap (android.graphics.Bitmap)19 AlertDialog (android.app.AlertDialog)17 Test (org.junit.Test)15 Uri (android.net.Uri)12 Bundle (android.os.Bundle)12 Handler (android.os.Handler)11 WebResourceRequest (android.webkit.WebResourceRequest)11 Drawable (android.graphics.drawable.Drawable)10 Button (android.widget.Button)10