use of android.webkit.WebView in project cw-advandroid by commonsguy.
the class WeatherFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
View result = inflater.inflate(R.layout.fragment, parent, false);
browser = (WebView) result.findViewById(R.id.webkit);
if (forecast != null) {
showForecast();
}
return (result);
}
use of android.webkit.WebView in project philm by chrisbanes.
the class LicencesFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mWebView = new WebView(getActivity());
mWebView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
return mWebView;
}
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);
}
use of android.webkit.WebView in project materialistic by hidroh.
the class WebFragmentLocalTest method testMenu.
@Test
public void testMenu() {
TestWebItem item = new TestWebItem() {
@NonNull
@Override
public String getType() {
return STORY_TYPE;
}
@Override
public String getId() {
return "1";
}
@Override
public String getUrl() {
return String.format(HackerNewsClient.WEB_ITEM_PATH, "1");
}
@Override
public String getDisplayedTitle() {
return "Ask HN";
}
};
Intent intent = new Intent();
intent.putExtra(WebActivity.EXTRA_ITEM, item);
controller.withIntent(intent).create().start().resume().visible();
verify(itemManager).getItem(eq("1"), eq(ItemManager.MODE_DEFAULT), listener.capture());
listener.getValue().onResponse(new TestItem() {
@Override
public String getText() {
return "text";
}
});
Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(WebFragment.class.getName());
assertTrue(fragment.hasOptionsMenu());
fragment.onOptionsItemSelected(new RoboMenuItem(R.id.menu_font_options));
assertNotNull(ShadowDialog.getLatestDialog());
PreferenceManager.getDefaultSharedPreferences(activity).edit().putString(activity.getString(R.string.pref_readability_font), "DroidSans.ttf").apply();
WebView webView = (WebView) activity.findViewById(R.id.web_view);
ShadowWebView shadowWebView = shadowOf(webView);
shadowWebView.getWebViewClient().onPageFinished(webView, "about:blank");
assertThat(shadowWebView.getLastLoadDataWithBaseURL().data).contains("text").contains("DroidSans.ttf");
}
Aggregations