android-8~23 View.java-dispatchtouchevent Source

Source: Internet
Author: User

Android-8

/*** Pass the touch screen motion event to the target view, or this * view if it is the target. *     * @paramEvent The motion event to being dispatched. * @returnTrue If the event is handled by the view, false otherwise. */     Public Booleandispatchtouchevent (Motionevent event) {if(Montouchlistener! =NULL&& (Mviewflags & enabled_mask) = = ENABLED &&Montouchlistener.ontouch ( This, event)) {            return true; }        returnontouchevent (event); }

Android-14, Android-15, android-16, ANDROID-17, android-18, android-19, android-20

   /*** Pass the touch screen motion event to the target view, or this * view if it is the target. *     * @paramEvent The motion event to being dispatched. * @returnTrue If the event is handled by the view, false otherwise. */     Public Booleandispatchtouchevent (Motionevent event) {if(Minputeventconsistencyverifier! =NULL) {minputeventconsistencyverifier.ontouchevent (event,0); }        if(Onfiltertoucheventforsecurity (event)) {//noinspection simplifiableifstatement            if(Montouchlistener! =NULL&& (Mviewflags & enabled_mask) = = ENABLED &&Montouchlistener.ontouch ( This, event)) {                return true; }            if(Ontouchevent (event)) {return true; }        }        if(Minputeventconsistencyverifier! =NULL) {minputeventconsistencyverifier.onunhandledevent (event,0); }        return false; }

Android-21

 /*** Pass the touch screen motion event to the target view, or this * view if it is the target. *     * @paramEvent The motion event to being dispatched. * @returnTrue If the event is handled by the view, false otherwise. */     Public Booleandispatchtouchevent (Motionevent event) {Booleanresult =false; if(Minputeventconsistencyverifier! =NULL) {minputeventconsistencyverifier.ontouchevent (event,0); }        Final intactionmasked =event.getactionmasked (); if(actionmasked = =Motionevent.action_down) {            //defensive Cleanup for new gestureStopnestedscroll (); }        if(Onfiltertoucheventforsecurity (event)) {//noinspection simplifiableifstatementListenerinfo Li =Mlistenerinfo; if(Li! =NULL&& Li.montouchlistener! =NULL&& (Mviewflags & enabled_mask) = =ENABLED&& Li.mOnTouchListener.onTouch ( This, event)) {Result=true; }            if(!result &&ontouchevent (event)) {Result=true; }        }        if(!result && Minputeventconsistencyverifier! =NULL) {minputeventconsistencyverifier.onunhandledevent (event,0); }        //nested Scrolls If this is the end of a gesture; //also cancel it if we tried an action_down but we didn ' t want the rest//of the gesture.        if(actionmasked = = Motionevent.action_up | |actionmasked= = Motionevent.action_cancel | |(actionmasked= = Motionevent.action_down &&!result))        {Stopnestedscroll (); }        returnresult; }

Android-22, android-23

/*** Pass the touch screen motion event to the target view, or this * view if it is the target. *     * @paramEvent The motion event to being dispatched. * @returnTrue If the event is handled by the view, false otherwise. */     Public Booleandispatchtouchevent (Motionevent event) {//If The event should is handled by accessibility focus first.        if(Event.istargetaccessibilityfocus ()) {//We don't have a focus or no virtual descendant has it, does not handle the event.            if(!Isaccessibilityfocusedvieworhost ()) {                return false; }            //We have a focus and got the event, then use Normal event dispatch.Event.settargetaccessibilityfocus (false); }        Booleanresult =false; if(Minputeventconsistencyverifier! =NULL) {minputeventconsistencyverifier.ontouchevent (event,0); }        Final intactionmasked =event.getactionmasked (); if(actionmasked = =Motionevent.action_down) {            //defensive Cleanup for new gestureStopnestedscroll (); }        if(Onfiltertoucheventforsecurity (event)) {//noinspection simplifiableifstatementListenerinfo Li =Mlistenerinfo; if(Li! =NULL&& Li.montouchlistener! =NULL&& (Mviewflags & enabled_mask) = =ENABLED&& Li.mOnTouchListener.onTouch ( This, event)) {Result=true; }            if(!result &&ontouchevent (event)) {Result=true; }        }        if(!result && Minputeventconsistencyverifier! =NULL) {minputeventconsistencyverifier.onunhandledevent (event,0); }        //nested Scrolls If this is the end of a gesture; //also cancel it if we tried an action_down but we didn ' t want the rest//of the gesture.        if(actionmasked = = Motionevent.action_up | |actionmasked= = Motionevent.action_cancel | |(actionmasked= = Motionevent.action_down &&!result))        {Stopnestedscroll (); }        returnresult; }

android-8~23 View.java-dispatchtouchevent Source

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.