Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

fix onClickListener not fired #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

linsea
Copy link

@linsea linsea commented Mar 9, 2016

fix onClickListener not fired after set

fix onClickListener not fired after set
@rzimmer
Copy link
Contributor

rzimmer commented Mar 9, 2016

Thanks for your contribution! I don't get why we can't just return false!? onTouchEvent clearly states that false indicates the system that the event was not (fully) handled...

@linsea
Copy link
Author

linsea commented Mar 15, 2016

@rzimmer onClickListener.onClick() is performed in super.onTouchEvent(ev), you can test it by setting a onClickListener for TextureVideoView.
I saw the system VideoView has the same problem, maybe it was designed for some reasons(MediaController?)
So, if not modification for being consistent with the native design and in case some one meet the same issue, here is my way bypassing this problem:

`

    textureVideoView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {

            if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
                     //myPerformOnClick();  //onClick logic here
             }

            return false;

        }
    });

`
hope it helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants