Search in sources :

Example 1 with OnScrollChangedListener

use of android.view.ViewTreeObserver.OnScrollChangedListener in project Osmand by osmandapp.

the class MenuBottomSheetDialogFragment method setupScrollShadow.

private void setupScrollShadow(View view) {
    final View scrollView;
    if (useScrollableItemsContainer()) {
        scrollView = view.findViewById(R.id.scroll_view);
    } else {
        scrollView = itemsContainer;
    }
    scrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {

        @Override
        public void onScrollChanged() {
            boolean scrollToBottomAvailable = scrollView.canScrollVertically(1);
            if (scrollToBottomAvailable) {
                showShadowButton();
            } else {
                hideShadowButton();
            }
        }
    });
}
Also used : OnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener) View(android.view.View) ScrollView(android.widget.ScrollView)

Example 2 with OnScrollChangedListener

use of android.view.ViewTreeObserver.OnScrollChangedListener in project OsmAnd by osmandapp.

the class MenuBottomSheetDialogFragment method setupScrollShadow.

private void setupScrollShadow(View view) {
    final View scrollView;
    if (useScrollableItemsContainer()) {
        scrollView = view.findViewById(R.id.scroll_view);
    } else {
        scrollView = itemsContainer;
    }
    scrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {

        @Override
        public void onScrollChanged() {
            boolean scrollToBottomAvailable = scrollView.canScrollVertically(1);
            if (scrollToBottomAvailable) {
                showShadowButton();
            } else {
                hideShadowButton();
            }
        }
    });
}
Also used : OnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener) View(android.view.View) ScrollView(android.widget.ScrollView)

Aggregations

View (android.view.View)2 OnScrollChangedListener (android.view.ViewTreeObserver.OnScrollChangedListener)2 ScrollView (android.widget.ScrollView)2