use of android.webkit.WebView in project materialistic by hidroh.
the class ReadabilityFragmentTest method testFontMenu.
@Test
public void testFontMenu() {
verify(readabilityClient).parse(eq("1"), eq("http://example.com/article.html"), callback.capture());
callback.getValue().onResponse("<div>content</div>");
PreferenceManager.getDefaultSharedPreferences(activity).edit().putString(activity.getString(R.string.pref_readability_font), "DroidSans.ttf").apply();
WebView webView = (WebView) activity.findViewById(R.id.web_view);
shadowOf(webView).getWebViewClient().onPageFinished(webView, "about:blank");
assertThat(shadowOf(webView).getLastLoadDataWithBaseURL().data).contains("DroidSans.ttf");
assertEquals("DroidSans.ttf", Preferences.Theme.getReadabilityTypeface(activity));
controller.pause().stop().destroy();
}
use of android.webkit.WebView in project materialistic by hidroh.
the class ReadabilityFragmentTest method testFontSizeMenu.
@Test
public void testFontSizeMenu() {
verify(readabilityClient).parse(eq("1"), eq("http://example.com/article.html"), callback.capture());
callback.getValue().onResponse("<div>content</div>");
fragment.onOptionsItemSelected(new RoboMenuItem(R.id.menu_font_options));
assertThat(fragment.getFragmentManager()).hasFragmentWithTag(PopupSettingsFragment.class.getName());
PreferenceManager.getDefaultSharedPreferences(activity).edit().putString(activity.getString(R.string.pref_readability_text_size), "3").apply();
WebView webView = (WebView) activity.findViewById(R.id.web_view);
shadowOf(webView).getWebViewClient().onPageFinished(webView, "about:blank");
assertThat(shadowOf(webView).getLastLoadDataWithBaseURL().data).contains("20");
assertEquals(R.style.AppTextSize_XLarge, Preferences.Theme.resolvePreferredReadabilityTextSize(activity));
controller.pause().stop().destroy();
}
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);
}
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);
}
}
}
use of android.webkit.WebView in project Inscription by MartinvanZ.
the class CustomChangelogActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_changelog);
final ChangeLogDialog changeLog = new ChangeLogDialog(this);
final WebView webView = (WebView) findViewById(R.id.webView1);
webView.loadDataWithBaseURL(null, changeLog.getHTML(), "text/html", "utf-8", null);
}
Aggregations