use of androidx.core.widget.NestedScrollView in project materialistic by hidroh.
the class OfflineWebActivity method onCreate.
@SuppressWarnings("ConstantConditions")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String url = getIntent().getStringExtra(EXTRA_URL);
if (TextUtils.isEmpty(url)) {
finish();
return;
}
setTitle(url);
setContentView(R.layout.activity_offline_web);
final NestedScrollView scrollView = (NestedScrollView) findViewById(R.id.nested_scroll_view);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setOnClickListener(v -> scrollView.smoothScrollTo(0, 0));
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
getSupportActionBar().setSubtitle(R.string.offline);
final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress);
final WebView webView = (WebView) findViewById(R.id.web_view);
webView.setBackgroundColor(Color.TRANSPARENT);
webView.setWebViewClient(new AdBlockWebViewClient(Preferences.adBlockEnabled(this)) {
@Override
public void onPageFinished(WebView view, String url) {
setTitle(view.getTitle());
}
});
webView.setWebChromeClient(new CacheableWebView.ArchiveClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
super.onProgressChanged(view, newProgress);
progressBar.setVisibility(View.VISIBLE);
progressBar.setProgress(newProgress);
if (newProgress == 100) {
progressBar.setVisibility(View.GONE);
webView.setBackgroundColor(Color.WHITE);
webView.setVisibility(View.VISIBLE);
}
}
});
AppUtils.toggleWebViewZoom(webView.getSettings(), true);
webView.loadUrl(url);
}
use of androidx.core.widget.NestedScrollView in project RxBinding by JakeWharton.
the class RxNestedScrollViewTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ScrollView scrollView = new ScrollView(this);
nestedScrollView = new NestedScrollView(this);
emptyView = new FrameLayout(this);
LayoutParams scrollParams = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
LayoutParams emptyParams = new LayoutParams(50000, 50000);
nestedScrollView.addView(emptyView, emptyParams);
scrollView.addView(nestedScrollView, scrollParams);
setContentView(scrollView, scrollParams);
}
use of androidx.core.widget.NestedScrollView in project collect by opendatakit.
the class RankingWidgetDialog method setUpRankingLayout.
private NestedScrollView setUpRankingLayout() {
LinearLayout rankingLayout = new LinearLayout(getContext());
rankingLayout.setOrientation(LinearLayout.HORIZONTAL);
rankingLayout.addView(setUpPositionsLayout());
rankingLayout.addView(setUpRecyclerView());
rankingLayout.setPadding(10, 0, 10, 0);
NestedScrollView scrollView = new NestedScrollView(getContext());
scrollView.addView(rankingLayout);
return scrollView;
}
use of androidx.core.widget.NestedScrollView in project SmoothRefreshLayout by dkzwm.
the class ScrollCompat method flingCompat.
public static void flingCompat(View view, int velocityY) {
if (view instanceof ScrollView) {
ScrollView scrollView = (ScrollView) view;
scrollView.fling(velocityY);
} else if (view instanceof WebView) {
WebView webView = (WebView) view;
webView.flingScroll(0, velocityY);
} else if (view instanceof NestedScrollView) {
NestedScrollView scrollView = (NestedScrollView) view;
scrollView.fling(velocityY);
} else if (view instanceof AbsListView) {
AbsListView listView = (AbsListView) view;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
listView.fling(velocityY);
}
} else if (ViewCatcherUtil.isRecyclerView(view)) {
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.fling(0, velocityY);
}
}
use of androidx.core.widget.NestedScrollView in project SmoothRefreshLayout by dkzwm.
the class ScrollCompat method stopFling.
public static void stopFling(View view) {
if (view instanceof ScrollView) {
ScrollView scrollView = (ScrollView) view;
scrollView.smoothScrollBy(0, 0);
} else if (view instanceof WebView) {
WebView webView = (WebView) view;
webView.flingScroll(0, 0);
} else if (view instanceof NestedScrollView) {
NestedScrollView scrollView = (NestedScrollView) view;
scrollView.smoothScrollBy(0, 0);
} else if (view instanceof AbsListView) {
AbsListView listView = (AbsListView) view;
listView.smoothScrollBy(0, 0);
} else if (ViewCatcherUtil.isRecyclerView(view)) {
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.stopScroll();
}
}
Aggregations