Android Open Source - EditText-ErrorPopup-Scroll-View Non Focusing Scroll View






From Project

Back to project page EditText-ErrorPopup-Scroll-View.

License

The source code is released under:

Apache License

If you think the Android project EditText-ErrorPopup-Scroll-View listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.catglo.errorpopupinascrollviewtest;
/* w w  w .  j  a v  a 2s . com*/
import java.util.ArrayList;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ScrollView;


public class NonFocusingScrollView extends ScrollView {

    private boolean mBlockRequestFocusOnFling = false;

    public NonFocusingScrollView(Context context) {
        super(context);
    }

    public NonFocusingScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public NonFocusingScrollView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public ArrayList<View> getFocusables(int direction) {
        if(mBlockRequestFocusOnFling)
            return new ArrayList<View>();
        return super.getFocusables(direction);
    }

    @Override
    public void requestChildFocus(View child, View focused) {
        if(!mBlockRequestFocusOnFling)
        super.requestChildFocus(child, focused);
    }


    @Override
    public void fling(int velocityY) {
        mBlockRequestFocusOnFling = true;
        super.fling(velocityY);
        mBlockRequestFocusOnFling = false;
    }
}




Java Source Code List

com.catglo.errorpopupinascrollviewtest.MainActivity.java
com.catglo.errorpopupinascrollviewtest.MyEditText.java
com.catglo.errorpopupinascrollviewtest.NonFocusingScrollView.java