android.view.ViewTreeObserver.OnScrollChangedListener Java Examples

The following examples show how to use android.view.ViewTreeObserver.OnScrollChangedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PopupWindowCompat.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
private void init() {
    if (superListenerField != null) {
        try {
            mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
            superListenerField.set(this, NOP);
        } catch (Exception e) {
            mSuperScrollListener = null;
        }
    }
}
 
Example #2
Source File: IncognitoBottomSheetContent.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a new IncognitoBottomSheetContent.
 * @param activity The {@link Activity} displaying this bottom sheet content.
 */
public IncognitoBottomSheetContent(final Activity activity) {
    LayoutInflater inflater = LayoutInflater.from(activity);
    mView = inflater.inflate(R.layout.incognito_bottom_sheet_content, null);

    View learnMore = mView.findViewById(R.id.learn_more);
    learnMore.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            HelpAndFeedback.getInstance(activity).show(activity,
                    activity.getString(R.string.help_context_incognito_learn_more),
                    Profile.getLastUsedProfile(), null);
        }
    });

    final FadingShadowView shadow = (FadingShadowView) mView.findViewById(R.id.shadow);
    shadow.init(
            ApiCompatibilityUtils.getColor(mView.getResources(), R.color.toolbar_shadow_color),
            FadingShadow.POSITION_TOP);

    mScrollView = (ScrollView) mView.findViewById(R.id.scroll_view);
    mScrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
        @Override
        public void onScrollChanged() {
            boolean shadowVisible = mScrollView.canScrollVertically(-1);
            shadow.setVisibility(shadowVisible ? View.VISIBLE : View.GONE);
        }
    });
}
 
Example #3
Source File: PopupWindowCompat.java    From zen4android with MIT License 5 votes vote down vote up
private void init() {
    if (superListenerField != null) {
        try {
            mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
            superListenerField.set(this, NOP);
        } catch (Exception e) {
            mSuperScrollListener = null;
        }
    }
}
 
Example #4
Source File: PopupWindowCompat.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
private void init() {
    if (superListenerField != null) {
        try {
            mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
            superListenerField.set(this, NOP);
        } catch (Exception e) {
            mSuperScrollListener = null;
        }
    }
}
 
Example #5
Source File: PopupWindowCompat.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
private void init() {
    if (superListenerField != null) {
        try {
            mSuperScrollListener = (OnScrollChangedListener) superListenerField.get(this);
            superListenerField.set(this, NOP);
        } catch (Exception e) {
            mSuperScrollListener = null;
        }
    }
}