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");
}
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");
}
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());
}
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");
}
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);
}
Aggregations