Search in sources :

Example 1 with WebView

use of android.webkit.WebView in project cw-omnibus by commonsguy.

the class MainActivity method printReport.

private void printReport() {
    Template tmpl = Mustache.compiler().compile(getString(R.string.report_body));
    WebView print = prepPrintWebView(getString(R.string.tps_report));
    print.loadData(tmpl.execute(new TpsReportContext(prose.getText().toString())), "text/html", "UTF-8");
}
Also used : WebView(android.webkit.WebView) Template(com.samskivert.mustache.Template)

Example 2 with WebView

use of android.webkit.WebView in project cw-omnibus by commonsguy.

the class MainActivity method printWebPage.

private void printWebPage() {
    WebView print = prepPrintWebView(getString(R.string.web_page));
    print.loadUrl("https://commonsware.com/Android");
}
Also used : WebView(android.webkit.WebView)

Example 3 with WebView

use of android.webkit.WebView in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    browser = (WebView) findViewById(R.id.browser);
    browser.getSettings().setJavaScriptEnabled(true);
    browser.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return (true);
        }
    });
    visit(getIntent());
}
Also used : WebView(android.webkit.WebView) WebViewClient(android.webkit.WebViewClient) SuppressLint(android.annotation.SuppressLint)

Example 4 with WebView

use of android.webkit.WebView in project cw-omnibus by commonsguy.

the class BrowserDemo4 method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    browser = (WebView) findViewById(R.id.webkit);
    browser.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return (true);
        }
    });
    browser.loadUrl("http://commonsware.com");
}
Also used : WebView(android.webkit.WebView) WebViewClient(android.webkit.WebViewClient)

Example 5 with WebView

use of android.webkit.WebView in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@SuppressLint({ "AddJavascriptInterface", "SetJavaScriptEnabled" })
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mgr = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    light = mgr.getDefaultSensor(Sensor.TYPE_LIGHT);
    wv = (WebView) findViewById(R.id.webkit);
    wv.getSettings().setJavaScriptEnabled(true);
    wv.addJavascriptInterface(jsInterface, "LIGHT_SENSOR");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        wv.setWebViewClient(new WebViewClient() {

            @Override
            public void onPageFinished(WebView view, String url) {
                initPort();
            }
        });
    }
    wv.loadUrl(URL);
}
Also used : WebView(android.webkit.WebView) WebViewClient(android.webkit.WebViewClient) SuppressLint(android.annotation.SuppressLint)

Aggregations

WebView (android.webkit.WebView)617 WebViewClient (android.webkit.WebViewClient)226 View (android.view.View)184 WebSettings (android.webkit.WebSettings)110 Intent (android.content.Intent)96 SuppressLint (android.annotation.SuppressLint)88 WebChromeClient (android.webkit.WebChromeClient)84 TextView (android.widget.TextView)66 Bitmap (android.graphics.Bitmap)63 LinearLayout (android.widget.LinearLayout)41 WebResourceRequest (android.webkit.WebResourceRequest)38 DialogInterface (android.content.DialogInterface)37 ImageView (android.widget.ImageView)36 Uri (android.net.Uri)32 Test (org.junit.Test)27 Bundle (android.os.Bundle)26 AlertDialog (android.app.AlertDialog)25 Activity (android.app.Activity)22 WebResourceError (android.webkit.WebResourceError)22 Handler (android.os.Handler)21