WO2017166858A1 - 反向控制移动端页面的方法和装置 - Google Patents

反向控制移动端页面的方法和装置 Download PDF

Info

Publication number
WO2017166858A1
WO2017166858A1 PCT/CN2016/108933 CN2016108933W WO2017166858A1 WO 2017166858 A1 WO2017166858 A1 WO 2017166858A1 CN 2016108933 W CN2016108933 W CN 2016108933W WO 2017166858 A1 WO2017166858 A1 WO 2017166858A1
Authority
WO
WIPO (PCT)
Prior art keywords
event
gesture
click
drag
touch
Prior art date
Application number
PCT/CN2016/108933
Other languages
English (en)
French (fr)
Inventor
黎河军
Original Assignee
百度在线网络技术(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 百度在线网络技术(北京)有限公司 filed Critical 百度在线网络技术(北京)有限公司
Publication of WO2017166858A1 publication Critical patent/WO2017166858A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Definitions

  • the present invention relates to the field of Internet technologies, and in particular, to a method and apparatus for controlling a mobile page in reverse.
  • the online solution of the projection mobile phone interface to the vehicle display is often used.
  • the operation performed by the user on the vehicle end is synchronously transmitted to the mobile terminal, and the mobile terminal receives the operation to actively trigger the relevant page.
  • the binding behavior of the element is often used.
  • HTML HyperText Markup Language
  • the event is generated by using the underlying event interface of the mobile phone system to generate an event, thereby transmitting an event to the page element at the system level, thereby triggering the binding behavior of the page element.
  • the existing mobile operating system limits the use of the interface, for example, in the iOS system requires auditing, in the android system needs to have root privileges. Therefore, the reverse control implemented by the underlying event interface of the mobile phone system is not convenient in application.
  • the present invention aims to solve at least one of the technical problems in the related art to some extent.
  • an object of the present invention is to provide a method for reversely controlling a mobile page, which can avoid the limitation of the interface used by the mobile operating system and conveniently implement reverse control of the mobile page.
  • Another object of the present invention is to provide an apparatus for back-controlling a mobile page.
  • a method for reversely controlling a mobile page includes: receiving a touch event sent by another terminal for reverse control; identifying a gesture event according to the touch event, and Determining an element to be inversely controlled; if the element is an element in an HTML page, configuring an HTML parameter for the element according to the gesture event, such that the element is processed according to the HTML parameter in response to the gesture event.
  • the method for back-controlling a mobile page proposed by the first aspect of the present invention, by configuring an HTML parameter according to a gesture event, when an element to be reversely controlled is an element in an HTML page,
  • the element can be processed according to the configured HTML parameters in response to the gesture event, thereby implementing reverse control of the elements in the HTML page, and the reverse control flow does not invoke the interface of the operating system, thereby avoiding the interface of the mobile operating system
  • the restrictions used make it easy to implement reverse control of the mobile page.
  • an apparatus for reversely controlling a mobile page includes: a communication module, configured to receive a touch event sent by another terminal for reverse control; and a gesture recognition module, configured to: Identifying a gesture event according to the touch event, and determining an element to be inversely controlled; and a conversion module, configured to configure an HTML parameter for the element according to the gesture event if the element is an element in an HTML page, The element is processed in response to the HTML parameter in response to the gesture event.
  • the device for back-controlling a mobile page proposed by the second aspect of the present invention can make an element according to a configured HTML by configuring an HTML parameter according to a gesture event when an element to be inversely controlled is an element in an HTML page.
  • the parameters are processed in response to the gesture event, thereby implementing reverse control of the elements in the HTML page, and the reverse control flow does not invoke the interface of the operating system, thereby avoiding the limitation of the interface used by the mobile operating system, and conveniently implementing Reverse control of the mobile page.
  • the embodiment of the present application further provides a terminal, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to: receive a touch event sent by another terminal for reverse control Identifying a gesture event based on the touch event and determining a to-be-controlled An element; if the element is an element in an HTML page, configuring an HTML parameter for the element according to the gesture event such that the element is processed according to the HTML parameter in response to the gesture event.
  • the embodiment of the present application further provides a non-transitory computer readable storage medium, when the instructions in the storage medium are executed by a processor of the terminal, enabling the terminal to perform a method for back-controling the mobile page.
  • the method includes: receiving a touch event sent by another terminal for reverse control; identifying a gesture event according to the touch event, and determining an element to be inversely controlled; if the element is an element in an HTML page, according to The gesture event configures an HTML parameter for the element to cause the element to process in accordance with the HTML parameter in response to the gesture event.
  • the embodiment of the present application further provides a computer program product, when an instruction in the computer program product is executed by a processor, performing a method for back-controlling a mobile page, the method comprising: receiving a sending by another terminal a touch event for reverse control; recognizing a gesture event based on the touch event, and determining an element to be inversely controlled; if the element is an element in an HTML page, configuring the element according to the gesture event An HTML parameter to cause the element to process in accordance with the HTML parameter in response to the gesture event.
  • FIG. 1 is a schematic flow chart of a method for back-controling a mobile page according to an embodiment of the present invention
  • FIG. 2 is a schematic flow chart of a method for back-controling a mobile page according to another embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a click event recognition process receiving a press event in the embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a mobile event after receiving a click event in a click event identification process according to an embodiment of the present invention
  • FIG. 5 is a schematic diagram of a click event recognition process receiving a release event in an embodiment of the present invention
  • FIG. 6 is a schematic diagram of a double-click event identification process in an embodiment of the present invention.
  • FIG. 7 is a schematic diagram of a double-click event recognition process after receiving a mobile event in an embodiment of the present invention.
  • FIG. 8 is a schematic diagram of receiving a press event in a drag event recognition process in an embodiment of the present invention.
  • FIG. 9 is a schematic diagram of a motion event after receiving a motion event in a drag event recognition process according to an embodiment of the present invention.
  • FIG. 10 is a schematic diagram of receiving a release event in a drag event recognition process according to an embodiment of the present invention.
  • FIG. 11 is a schematic structural diagram of an apparatus for back-controling a mobile terminal according to an embodiment of the present invention.
  • FIG. 12 is a schematic structural diagram of an apparatus for back-controlling a mobile terminal according to another embodiment of the present invention.
  • FIG. 1 is a schematic flow chart of a method for back-controling a mobile page according to an embodiment of the present invention. The method of this embodiment can be applied to the mobile terminal.
  • the method of this embodiment includes:
  • S11 Receive a touch event sent by another terminal for reverse control.
  • Other terminals refer to the peers that are connected to the mobile terminal.
  • the mobile terminal refers to a mobile phone
  • the other terminal refers to a car phone.
  • the car machine can send a reverse control event to the mobile phone, and the event is a native event of the application, specifically a touch event.
  • Touch events include: pressing an event, moving an event, and releasing an event.
  • Each touch event can include a corresponding parameter.
  • the representation of each touch event and the parameters included may be as follows:
  • the parameter location represents the pressed position coordinate (x, y);
  • parameter points indicate the number of touch points (single finger / double finger / multi finger);
  • Second touch event Move event: NATIVE_EVENT_TOUCH_MOVE
  • the parameter location represents the position coordinate (x, y) to which it is moved;
  • parameter points indicate the number of touch points (single finger / double finger / multi finger);
  • S12 Identify a gesture event according to the touch event, and determine an element to be reversely controlled.
  • the gesture event is an event for triggering the element response.
  • Gesture events include: click events, double click events, long press events, and drag events.
  • Each gesture event can include a corresponding parameter.
  • the representation of each gesture event and the parameters it includes can be as follows:
  • the parameter location indicates the click coordinates (x, y);
  • parameter points indicate the number of touch points (single finger / double finger / multi finger);
  • Second gesture event double click event: H5_EVENT_TYPE_DOUBLECLICK
  • the parameter location represents the double-click position coordinate (x, y);
  • Parameter points indicate the number of touch points (single finger / double finger / multi finger)
  • the third gesture event long press event: H5_EVENT_TYPE_LONGPRESS
  • the parameter location represents the long-press position coordinate (x, y);
  • parameter points indicate the number of touch points (single finger / double finger / multi finger);
  • the fourth gesture event drag event: H5_EVENT_TYPE_DRAG
  • parameter points indicate the number of touch points (single finger / double finger / multi finger);
  • the above parameters of the gesture event may be acquired according to the parameters of the corresponding touch event, for example, the position coordinates of the click event, the occurrence time are the same as the position coordinates of the pressed event, and the pressing time.
  • the element corresponding to the position coordinate may be determined as an element to be reversely controlled.
  • the HTML page can specifically refer to the HTML5 page.
  • the development language of the gesture event is consistent with the operating system of the mobile terminal. For example, if the operating system is an iOS system, the language of the gesture event is ObjectC, and if the operating system is an android system, the language of the gesture event is java.
  • the development language of the HTML page loaded by the application is not the native language. In order to make the elements in the HTML page respond to gesture events, it needs to be based on the gesture event as HTML. The elements in the page configure HTML parameters to enable reverse control of the elements in the HTML page.
  • the process of configuring HTML parameters based on click events can include:
  • the bottom-up search type is a controllable element, and after finding the element whose type is controllable, the element is Click event (click) binding in the HTML page.
  • the tag information of the element may be the type of the tag element, the type may be divided into controllable and unreliable, the controllable element can respond to the click event, and the uncontrollable element cannot respond to the click event.
  • the elements in the HTML page are DOM elements, and the DOM elements are arranged in a tree structure. From bottom to top, according to the tree structure, from the leaf element to the parent element of the leaf element and then to the root element.
  • the process of configuring HTML parameters according to the drag event may include:
  • the first condition the element is the top element, and the size of the element is larger than the view size;
  • the second condition The element is a normal element before the top element, and the size of the element is larger than the size of its parent element.
  • the scrolling parameter in the HTML page can be configured for the element according to the moving distance of the drag event.
  • Whether the element is a scrollable element can be determined according to the scrollable parameter of the element, and the scrollable parameters in the HTML page include: overflow or overflow-x and overflow-y, if overflow Not hidden, or neither overflow-x nor overflow-y are hidden, you can be sure that the element is a scrollable element.
  • the size of the element, the size of the parent element, and the view size can be determined based on the style information in the HTML page, and the like.
  • the moving distance of the drag event may be determined according to the position coordinate of the drag start event and the position coordinate of the drag end event, and the difference between the coordinates of the two positions is taken as the moving position.
  • the scrolling parameters in the HTML page set according to the moving distance may include: scrollleft and scrolltop, wherein scrollleft is used to determine the horizontal moving distance, and scrolltop is used to determine the vertical moving distance.
  • the method may further include:
  • the element to be reversely controlled may be an element in an HTML page, or may be a native control that can be interacted in the application, and the interactive native control refers to a control that can be directly controlled by a gesture event.
  • the mobile terminal operating system provides The method can determine the native control and the control description information of the location. If the control is determined to be a browser control (webview) according to the description of the control, it can be determined that the element to be reversely controlled is an element in the HTML page, otherwise it is interactive. Native controls.
  • the gesture events can be directly responded to the reverse control of the interactive native controls.
  • the recognition of the click event, the double-click event, the long-press event, and the drag event may be started simultaneously after receiving the touch event.
  • the received touch event is a press event
  • an event is pushed onto the stack for the press event
  • the received touch event is a moving event, it is determined whether the moving distance is less than a preset distance value, and if it is less, the event is pushed onto the stack;
  • the received touch event is a release event, it is determined whether the startup time is within a preset range when the recognition is started, and if it is within the preset range, the click event is recognized.
  • the above moving distance may be determined according to the position coordinates of the first event (press event) in the stack and the position coordinates of the current event (moving event), and the difference between the coordinates of the two positions is determined as the moving distance.
  • the above startup time may be determined according to the occurrence time of the first event (press event) in the stack and the occurrence time of the last event (press event or movement event), and the difference between the two times is determined as the startup time.
  • FIG. 3 is a schematic diagram of a click event recognition process receiving a press event in the embodiment of the present invention. Referring to Figure 3, the process includes:
  • the received touch event is a press event.
  • S32 It is judged whether the recognition has been started, and if so, S33 is executed, otherwise, S34 is executed.
  • the identification may be set to identify a state that is not activated, and when the identification is initiated, the identification is updated to identify the activated state.
  • the recognition is initiated and the pressed event is placed on the stack.
  • events When events are placed on the stack, they can be placed in order, so that the first and last events in the stack can be identified in subsequent processes.
  • FIG. 4 is a schematic diagram of a mobile event after receiving a click event identification process in an embodiment of the present invention. Referring to Figure 4, the process includes:
  • the received touch event is a mobile event.
  • S42 It is judged whether the recognition has been started, and if so, S43 is executed, otherwise, S45 is executed.
  • the identification may be set to identify a state that is not activated, and when the identification is initiated, the identification is updated to identify the activated state.
  • the preset distance value can be set according to experience or the like.
  • FIG. 5 is a schematic diagram of a click event recognition process receiving a release event in an embodiment of the present invention. Referring to Figure 5, the process includes:
  • S51 Receiving the touch event is a release event.
  • S52 It is judged whether the recognition has been started, and if so, S53 is executed, otherwise, S55 is executed.
  • the identification may be set to identify a state that is not activated, and when the identification is initiated, the identification is updated to identify the activated state.
  • the preset range can be set based on experience and the like.
  • double-clicking event recognition when double-clicking event recognition, it may be based on the identification of a click event, including the following process.
  • FIG. 6 is a schematic diagram of a double-click event recognition process in an embodiment of the present invention. Referring to Figure 6, the process includes:
  • the identified click event may be one or more. If it is one, the last click event refers to the one click event, and if there are multiple, the time of each click event may be determined. Clicks the most recent click event from the current time as the last click event.
  • the time of the last click event can be set to null, and subsequent updates can be made as appropriate.
  • S63 When not empty, calculate a difference between the current time and the time of the last click event, and determine whether the difference is less than a preset interval. If yes, execute S65, otherwise execute S64.
  • the received touch event is a press event
  • an event is pushed onto the stack for the press event
  • the received touch event is a moving event, it is determined whether the moving distance is less than a second preset distance value, and if it is less, determining whether the starting time is greater than a preset duration; if greater than, determining to identify a long press event;
  • the identification ends.
  • the above moving distance may be determined according to the position coordinates of the first event (press event) in the stack and the position coordinates of the current event (moving event), and the difference between the coordinates of the two positions is determined as the moving distance.
  • the above startup time may be determined according to the occurrence time of the first event (press event) in the stack and the occurrence time of the current component (moving event), and the difference between the two times is determined as the startup time.
  • FIG. 7 is a schematic diagram of a double-click event recognition process in the embodiment of the present invention after receiving a mobile event. Referring to Figure 7, the process includes:
  • the received touch event is a mobile event.
  • S72 It is judged whether the recognition has been started, and if so, S73 is executed, otherwise, S76 is executed.
  • the second preset distance value may be set according to experience or the like, and may be the same as or different from the first preset distance value described above.
  • the preset duration can be set according to experience and the like.
  • the received touch event is a press event
  • the event is pushed onto the stack, and the control corresponding to the position coordinate of the pressed event is acquired, and when the space is a draggable control, the drag start event is sent;
  • the received touch event is a moving event
  • the event is pushed onto the mobile event, and the position coordinate of the moving event is determined to be inside the draggable control, and if it is internal, the dragging event is sent;
  • the received touch event is a release event
  • an event is pushed onto the stack, and a position of the release event is determined to be inside the draggable control, and if it is internal, a drag end event is sent.
  • FIG. 8 is a schematic diagram of a drag event recognition process receiving a press event in the embodiment of the present invention. Referring to Figure 8, the process includes:
  • the received touch event is a press event.
  • the initialization identification includes, for example, determining whether the recognition has been initiated, and if it has been started, ending the identification, and if not, initiating the identification.
  • Draggable controls include, for example, UIScrollView, BTapDetectingView, and UIWebView.
  • control at the position coordinate of the pressed event is any of the above controls, it is determined that the control is a draggable control.
  • the drag start event can be recognized and a drag start event can be sent.
  • FIG. 9 is a schematic diagram of a motion event after receiving a motion event in a drag event recognition process according to an embodiment of the present invention. Referring to Figure 9, the process includes:
  • the received touch event is a mobile event.
  • S92 It is judged whether the recognition has been started, and if so, S94 is executed, otherwise, S93 is executed.
  • the dragging event can be recognized, and the drag can be sent to perform the event.
  • the drag end event can be recognized and the drag end event can be sent.
  • FIG. 10 is a schematic diagram of a drag event recognition process in a process of receiving a release event in an embodiment of the present invention. Referring to Figure 10, the process includes:
  • S101 Receiving a touch event is a release event.
  • S102 It is judged whether the recognition has been started, and if so, S103 is executed, otherwise, S106 is executed.
  • S104 Determine whether the position coordinate of the release event is inside the draggable control, and if yes, execute S105; otherwise, execute S106.
  • the drag end event can be recognized and the drag end event can be sent.
  • the corresponding gesture event may be sent to the subsequent module for event distribution at one time.
  • the event can be sent to the subsequent module for event distribution multiple times during the entire drag process.
  • the element to be reversely controlled is an element in the HTML page
  • the potential event configures the HTML parameter for the element, which can cause the element to process according to the configured HTML parameter in response to the gesture event, thereby implementing reverse control of the element in the HTML page, and the reverse control flow does not call the interface of the operating system, so Avoid the restrictions on the use of the interface by the mobile operating system, and conveniently implement reverse control of the mobile page.
  • FIG. 11 is a schematic structural diagram of an apparatus for back-controling a mobile terminal according to an embodiment of the present invention.
  • the device 110 includes a communication module 111, a gesture recognition module 112, and a conversion module 113.
  • the communication module 111 is configured to receive a touch event sent by another terminal for reverse control;
  • the communication module can receive a touch event sent by the vehicle.
  • the gesture recognition module 112 is configured to identify a gesture event according to the touch event, and determine an element to be reversely controlled;
  • the conversion module 113 is configured to configure an HTML parameter for the element according to the gesture event if the element is an element in an HTML page, so that the element is processed according to the HTML parameter in response to the gesture event.
  • the touch event includes: a press event, a move event, and a release event;
  • the gesture events include: a click event, a double click event, a long press event, and a drag event;
  • the gesture recognition module is specifically configured to:
  • the gesture recognition module 112 includes: a first unit, a second unit, a third unit, and a fourth unit;
  • the first unit is for:
  • the received touch event is a press event
  • an event is pushed onto the stack for the press event
  • the received touch event is a moving event, it is determined whether the moving distance is less than a preset distance value, and if it is less, the event is pushed onto the stack;
  • the received touch event is a release event, it is determined whether the startup time is within a preset range, and if it is within the preset range, it is determined that the click event is recognized.
  • the second unit is for:
  • the time of the last click event is updated to null and it is determined that the double-click event is recognized.
  • the third unit is used to:
  • the received touch event is a press event
  • an event is pushed onto the stack for the press event
  • the received touch event is a mobile event, determine whether the moving distance is less than a second preset distance value, and if it is less, determine whether the starting time is greater than a preset duration; if greater than, determine to identify the long By event;
  • the identification ends.
  • the fourth unit is used to:
  • the received touch event is a press event
  • the event is pushed onto the stack, and the control corresponding to the position coordinate of the pressed event is acquired, and when the space is a draggable control, the drag start event is sent;
  • the received touch event is a moving event
  • the event is pushed onto the mobile event, and the position coordinate of the moving event is determined to be inside the draggable control, and if it is internal, the dragging event is sent;
  • the received touch event is a release event
  • an event is pushed onto the stack, and a position of the release event is determined to be inside the draggable control, and if it is internal, a drag end event is sent.
  • the converting module is configured to configure an HTML parameter for the element according to the gesture event, including:
  • the gesture event is a click event
  • the bottom-up search type is a controllable element, and the type is found. After being a controllable element, bind the element to a click event in an HTML page.
  • the converting module is configured to configure an HTML parameter for the element according to the gesture event, including:
  • gesture event is a drag event, starting from an element corresponding to the position coordinate of the drag event, searching for a scrollable element from bottom to top, and after finding the scrollable element, determining whether the element is still Meet any of the following conditions:
  • the element is a top element, and the size of the element is larger than a view size; or,
  • the element is a normal element, and the size of the element is larger than the size of the parent element of the element;
  • the scrolling parameter in the HTML page is configured for the element according to the moving distance of the drag event.
  • the apparatus 110 further includes:
  • the event distribution module 114 is configured to determine whether an element to be reversely controlled is an element in an HTML page, and send the gesture event to the conversion module when the element is an element in an HTML page, When the element is an interactive native control, the gesture event is sent to the interaction module;
  • the interaction module 115 is configured to send the received gesture event to the interactive native control, so that the interactive native control responds to the gesture event.
  • the HTML parameter is configured for the element according to the gesture event, so that the element can be processed according to the configured HTML parameter to respond to the gesture event, thereby implementing the HTML page.
  • the reverse control of the element, and the reverse control process does not call the interface of the operating system, so the restriction of the interface used by the mobile operating system can be avoided, and the reverse control of the mobile page can be conveniently implemented.
  • the embodiment of the present application further provides a terminal, including: a processor; a memory of instructions, wherein the processor is configured to: receive a touch event sent by another terminal for reverse control; identify a gesture event according to the touch event, and determine an element to be reversely controlled;
  • the element is an element in an HTML page that is configured with HTML parameters in accordance with the gesture event such that the element is processed in response to the gesture event in response to the HTML parameter.
  • the embodiment of the present application further provides a non-transitory computer readable storage medium, when the instructions in the storage medium are executed by a processor of the terminal, enabling the terminal to perform a method for back-controling the mobile page.
  • the method includes: receiving a touch event sent by another terminal for reverse control; identifying a gesture event according to the touch event, and determining an element to be inversely controlled; if the element is an element in an HTML page, according to The gesture event configures an HTML parameter for the element to cause the element to process in accordance with the HTML parameter in response to the gesture event.
  • the embodiment of the present application further provides a computer program product, when an instruction in the computer program product is executed by a processor, performing a method for back-controlling a mobile page, the method comprising: receiving a sending by another terminal a touch event for reverse control; recognizing a gesture event based on the touch event, and determining an element to be inversely controlled; if the element is an element in an HTML page, configuring the element according to the gesture event An HTML parameter to cause the element to process in accordance with the HTML parameter in response to the gesture event.
  • portions of the invention may be implemented in hardware, software, firmware or a combination thereof.
  • multiple steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system.
  • a suitable instruction execution system For example, if implemented in hardware, as in another embodiment, it can be implemented by any one or combination of the following techniques well known in the art: having logic gates for implementing logic functions on data signals. Discrete logic circuits, application specific integrated circuits with suitable combinational logic gates, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
  • each functional unit in each embodiment of the present invention may be integrated into one processing module, or each unit may exist physically separately, or two or more units may be integrated into one module.
  • the above integrated modules can be implemented in the form of hardware or in the form of software functional modules.
  • the integrated modules, if implemented in the form of software functional modules and sold or used as stand-alone products, may also be stored in a computer readable storage medium.
  • the above mentioned storage medium may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

一种反向控制移动端页面的方法和装置,该反向控制移动端页面的方法包括:接收其他终端发送的用于反向控制的触摸事件(S11);根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素(S12);如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件(S13)。该方法能够避开移动端操作***对接口使用的限制,方便的实现对移动端页面的反向控制。

Description

反向控制移动端页面的方法和装置
相关申请的交叉引用
本申请要求百度在线网络技术(北京)有限公司于2016年3月31日提交的、发明名称为“反向控制移动页面的方法和装置”的、中国专利申请号“201610202382.5”的优先权。
技术领域
本发明涉及互联网技术领域,尤其涉及一种反向控制移动端页面的方法和装置。
背景技术
在手机与车机的互联方案中,经常采用投影手机端界面到车机显示器的联机方案,此时用户在车机端进行的操作会同步传输到手机端,手机端接收到操作主动触发相关页面元素的绑定行为。
手机端显示的应用程序的页面是超文本标记语言(HyperText Markup Language,HTML)页面时,由于HTML页面在很多情况下都是通过网络动态加载,并且HTML5页面的上下文环境与应用程序的代码运行的上下文环境是相互独立的,所以需要有一套完善的机制来实现车机对手机端的HTML页面的 反向控制。
相关技术中,通过使用手机***底层事件接口模拟产生相关事件,从而在***层面将事件传递给页面元素,从而触发页面元素的绑定行为。但是,现有的手机操作***都限制了接口的使用,比如,在iOS***中需要审核,在android***中需要具有root权限。因此,通过手机***底层事件接口实现的反向控制在应用上并不方便。
发明内容
本发明旨在至少在一定程度上解决相关技术中的技术问题之一。
为此,本发明的一个目的在于提出一种反向控制移动端页面的方法,该方法可以避开移动端操作***对接口使用的限制,方便的实现对移动端页面的反向控制。
本发明的另一个目的在于提出一种反向控制移动端页面的装置。
为达到上述目的,本发明第一方面实施例提出的反向控制移动端页面的方法,包括:接收其他终端发送的用于反向控制的触摸事件;根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
本发明第一方面实施例提出的反向控制移动端页面的方法,通过在待反向控制的元素是HTML页面中的元素时,根据手势事件为元素配置HTML参数, 可以使得元素根据配置的HTML参数进行处理以响应手势事件,从而实现对HTML页面中元素的反向控制,并且该反向控制流程没有调用操作***的接口,因此可以避开移动端操作***对接口使用的限制,方便的实现对移动端页面的反向控制。
为达到上述目的,本发明第二方面实施例提出的反向控制移动端页面的装置,包括:通信模块,用于接收其他终端发送的用于反向控制的触摸事件;手势识别模块,用于根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;转换模块,用于如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
本发明第二方面实施例提出的反向控制移动端页面的装置,通过在待反向控制的元素是HTML页面中的元素时,根据手势事件为元素配置HTML参数,可以使得元素根据配置的HTML参数进行处理以响应手势事件,从而实现对HTML页面中元素的反向控制,并且该反向控制流程没有调用操作***的接口,因此可以避开移动端操作***对接口使用的限制,方便的实现对移动端页面的反向控制。
本申请实施例还提出了一种终端,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为:接收其他终端发送的用于反向控制的触摸事件;根据所述触摸事件识别出手势事件,以及确定出待反向控制的 元素;如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
本申请实施例还提出了一种非临时性计算机可读存储介质,当所述存储介质中的指令由终端的处理器执行时,使得终端能够执行一种反向控制移动端页面的方法,所述方法包括:接收其他终端发送的用于反向控制的触摸事件;根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
本申请实施例还提出了一种计算机程序产品,当所述计算机程序产品中的指令被处理器执行时,执行一种反向控制移动端页面的方法,所述方法包括:接收其他终端发送的用于反向控制的触摸事件;根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
本发明附加的方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本发明的实践了解到。
附图说明
本发明上述的和/或附加的方面和优点从下面结合附图对实施例的描述中 将变得明显和容易理解,其中:
图1是本发明一个实施例提出的反向控制移动端页面的方法的流程示意图;
图2是本发明另一个实施例提出的反向控制移动端页面的方法的流程示意图;
图3是本发明实施例中单击事件识别流程中接收到按下事件后的示意图;
图4是本发明实施例中单击事件识别流程中接收到移动事件后的示意图;
图5是本发明实施例中单击事件识别流程中接收到松开事件后的示意图;
图6是本发明实施例中双击事件识别流程示意图;
图7是本发明实施例中双击事件识别流程中接收到移动事件后的示意图;
图8是本发明实施例中拖动事件识别流程中接收到按下事件后的示意图;
图9是本发明实施例中拖动事件识别流程中接收到移动事件后的示意图;
图10是本发明实施例中拖动事件识别流程中接收到松开事件后的示意图;
图11是本发明一个实施例提出的反向控制移动端页面的装置的结构示意图;
图12是本发明另一个实施例提出的反向控制移动端页面的装置的结构示意图。
具体实施方式
下面详细描述本发明的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的模块或具有相同或类似功能的模块。 下面通过参考附图描述的实施例是示例性的,仅用于解释本发明,而不能理解为对本发明的限制。相反,本发明的实施例包括落入所附加权利要求书的精神和内涵范围内的所有变化、修改和等同物。
图1是本发明一个实施例提出的反向控制移动端页面的方法的流程示意图。本实施例的方法可以应用在移动端。
参见图1,本实施例的方法包括:
S11:接收其他终端发送的用于反向控制的触摸事件。
其他终端是指与移动端进行联网的对端。例如,在手机和车机的联网方案中,移动端是指手机,其他终端是指车机。
在车机端需要反向控制手机端时,车机可以向手机发送反向控制的事件,该事件是应用程序的原生事件,具体是触摸事件。
触摸事件包括:按下事件、移动事件和松开事件。
每种触摸事件可以包括相应的参数。一些具体示例中,每种触摸事件的表示及包括的参数可以如下所示:
第一种触摸事件:按下事件:NATIVE_EVENT_TOUCH_DOWN
(a)参数location表示按下位置坐标(x,y);
(b)参数points表示触控点数量(单指/双指/多指);
(c)参数timestamp表示发生时间。
第二种触摸事件:移动事件:NATIVE_EVENT_TOUCH_MOVE
(a)参数location表示移动到的位置坐标(x,y);
(b)参数points表示触控点数量(单指/双指/多指);
(c)参数timestamp表示发生时间。
第三种触摸事件:松开事件:NATIVE_EVENT_TOUCH_UP
S12:根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素。
其中,手势事件是用于触发元素响应的事件。
手势事件包括:单击事件、双击事件、长按事件和拖动事件。
每种手势事件可以包括相应的参数。一些具体示例中,每种手势事件的表示及包括的参数可以如下所示:
第一种手势事件:单击事件:H5_EVENT_TYPE_CLICK
(a)参数location表示单击坐标(x,y);
(b)参数points表示触控点数量(单指/双指/多指);
(c)参数timestamp表示发生时间。
第二种手势事件:双击事件:H5_EVENT_TYPE_DOUBLECLICK
(a)参数location表示双击位置坐标(x,y);
(b)参数points表示触控点数量(单指/双指/多指)
(c)参数timestamp表示发生时间。
第三种手势事件:长按事件:H5_EVENT_TYPE_LONGPRESS
(a)参数location表示长按位置坐标(x,y);
(b)参数points表示触控点数量(单指/双指/多指);
(c)参数timestamp表示发生时间。
第四种手势事件:拖动事件:H5_EVENT_TYPE_DRAG
(a)参数location表示拖动到位置坐标(x,y);
(b)参数points表示触控点数量(单指/双指/多指);
(c)参数timestamp表示发生时间。
在手势事件识别时,手势事件的上述参数可以根据对应的触摸事件的参数获取,例如,单击事件的位置坐标、发生时间分别与按下事件的位置坐标、按下时间相同。在确定出手势事件的位置坐标后,可以将该位置坐标对应的元素确定为待反向控制的元素。
根据触摸事件识别出手势事件的具体流程可以参见后续描述。
S13:如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
其中,HTML页面可以具体是指HTML5页面。
手势事件的开发语言与移动端的操作***一致。例如,如果操作***是iOS***,则手势事件的语言是ObjectC,如果操作***是android***,则手势事件的语言是java。而应用程序加载的HTML页面的开发语言并不是原生语言,为了使得HTML页面中的元素可以响应手势事件,需要根据手势事件为HTML 页面中的元素配置HTML参数,从而实现对HTML页面中元素的反向控制。
根据单击事件配置HTML参数的流程可以包括:
根据预先对HTML页面中的元素的标记信息,从单击事件的位置坐标对应的元素开始,从下至上查找类型是可控的元素,在查找到类型是可控的元素后,将该元素与HTML页面中的点击事件(click)绑定。
其中,元素的标记信息可以是标记元素的类型,类型可以分为可控和不可靠,可控的元素能够响应单击事件,不可控的元素不能响应单击事件。
HTML页面中的元素是DOM元素,DOM元素采用树形结构排布,从下至上是指按照树形结构,从叶子元素到叶子元素的父元素再向根元素的方向进行。
根据拖动事件配置HTML参数的流程可以包括:
从拖动事件的位置坐标对应的元素开始,从下至上查找可滚动的元素,在查找到可滚动的元素后,判断该元素是否还满足如下条件中的任一项:
第一项条件:该元素是顶层元素(body),且该元素的尺寸大于视图尺寸;
第二项条件:该元素是除顶层元素之前的普通元素,且该元素的尺寸大于其父元素的尺寸。
如果该元素是可滚动的元素,且还满足上述任一项条件,则可以根据所述拖动事件的移动距离为所述元素配置HTML页面中的滚动参数。
其中,元素是否是可滚动的元素,可以根据元素的可滚动参数确定,HTML页面中该可滚动参数包括:overflow或者overflow-x和overflow-y,如果overflow 不是hidden,或者,overflow-x和overflow-y都不是hidden,则可以确定该元素是可滚动的元素。
元素的尺寸、父元素的尺寸及视图尺寸可以根据HTML页面中的样式信息等确定。
拖动事件的移动距离可以根据拖动开始事件的位置坐标与拖动结束事件的位置坐标确定,将这两个位置坐标的差值作为移动位置。
根据移动距离设置的HTML页面中的滚动参数可以包括:scrollleft和scrolltop,其中,scrollleft用于确定横向的移动距离,scrolltop用于确定纵向的移动距离。
由于反向控制中经常使用的手势事件是单击事件和拖动事件,上述给出了如何根据单击事件和拖动事件配置HTML参数的方法,可以理解的是,根据双击事件和长按事件配置HTML参数的方式也可以参照执行,在此不再详细说明。
一些实施例中,如图2所示,该方法还可以包括:
S14:判断待反向控制的元素是否是HTML页面中的元素,若是,执行上述的S13,否则,执行S15。
其中,待反向控制的元素可以是HTML页面中的元素,或者,也可以是应用程序中可交互的原生控件,可交互的原生控件是指可以由手势事件直接进行控制的控件。
具体的,在手势事件识别时确定出位置坐标后,根据移动端操作***提供 的方法可以确定该位置的原生控件及控件描述信息,如果根据控件描述信息确定该控件是浏览器控件(webview),则可以确定待反向控制的元素是HTML页面中的元素,否则是可交互的原生控件。
S15:如果上述的元素是可交互的原生控件,则将识别出的手势事件发送给可交互的原生控件,以使可交互的原生控件响应手势事件。
由于可交互的原生控件与手势事件的语言一致,可以直接响应手势事件,从而完成对可交互的原生控件的反向控制。
在上述流程中,涉及了根据触摸事件识别出手势事件的流程,具体的该流程可以如下所示。
其中,在根据触摸事件识别手势事件的流程时,可以是接收到触摸事件后,同时启动对单击事件、双击事件、长按事件和拖动事件的识别。
一些实施例中,在单击事件识别时,可以包括如下流程:
如果接收的触摸事件是按下事件,对按下事件进行事件入栈;
如果接收的触摸事件是移动事件,判断移动距离是否小于预设距离值,如果小于,则对移动事件进行事件入栈;
如果接收的触摸事件是松开事件,则在启动识别时,判断启动时间是否在预设范围内,如果在预设范围内,则识别出单击事件。
上述的移动距离可以根据栈内的首个事件(按下事件)的位置坐标与当前事件(移动事件)的位置坐标确定,将这两个位置坐标的差值确定为移动距离。
上述的启动时间可以根据栈内的首个事件(按下事件)的发生时间与最后事件(按下事件或移动事件)的发生时间确定,将这两个时间的差值确定为启动时间。
上述的单击事件识别过程中,接收到各触摸事件的具体处理流程可以参见如下的实施例。
图3是本发明实施例中单击事件识别流程中接收到按下事件后的示意图。参见图3,该流程包括:
S31:接收到触摸事件是按下事件。
S32:判断识别是否已启动,若是,执行S33,否则,执行S34。
其中,可以设置是否启动的标识,根据该标识可以判断识别是否已启动。
初始时,可以设置该标识为识别未启动的状态,当启动识别后,将该标识更新为识别已启动的状态。
S33:结束识别。
S34:启动识别,并对按下事件进行事件入栈。
在没有启动识别时,启动识别,并且,将按下事件放入栈内。
在将事件放入栈内时,可以按序放入,从而在后续流程中可以识别出栈内的首次事件和最后事件。
图4是本发明实施例中单击事件识别流程中接收到移动事件后的示意图。参见图4,该流程包括:
S41:接收到触摸事件是移动事件。
S42:判断识别是否已启动,若是,执行S43,否则,执行S45。
其中,可以设置是否启动的标识,根据该标识可以判断识别是否已启动。
初始时,可以设置该标识为识别未启动的状态,当启动识别后,将该标识更新为识别已启动的状态。
S43:判断移动距离是否小于第一预设距离值,若是,执行S44,否则,执行S45。
预设距离值可以根据经验等设置。
S44:对所述移动事件进行事件入栈。
S45:结束识别。
图5是本发明实施例中单击事件识别流程中接收到松开事件后的示意图。参见图5,该流程包括:
S51:接收到触摸事件是松开事件。
S52:判断识别是否已启动,若是,执行S53,否则,执行S55。
其中,可以设置是否启动的标识,根据该标识可以判断识别是否已启动。
初始时,可以设置该标识为识别未启动的状态,当启动识别后,将该标识更新为识别已启动的状态。
S53:判断启动时间是否在预设范围内,若是,执行S54,否则,执行S55。
预设范围可以根据经验等设置。
S54:确定识别出单击事件。
S55:结束识别。
一些实施例中,在双击事件识别时,可以基于单击事件的识别,包括如下流程。
图6是本发明实施例中双击事件识别流程示意图。参见图6,该流程包括:
S61:识别出单击事件。
其中,单击事件的识别流程可以参见上述实施例,在此不再详细说明。
S62:判断上次单击事件的时间是否不为空,若是,执行S63,否则,执行S64。
其中,识别出的单击事件可以是一个或多个,如果为一个时,上次单击事件是指该一个单击事件,如果为多个,则可以确定每个单击事件的发生时间,将距离当前时间最近的单击事件作为上次单击事件。
初始时,上次单击事件的时间可以设置为空,后续可以根据情况更新。
S63:在不为空时,计算当前时间与上次单击事件的时间之间的差值,并判断该差值是否小于预设间隔,若是,执行S65,否则执行S64。
S64:在为空或者小于预设间隔时,将上次单击事件的时间更新为当前时间。
S65:将上次单击事件的时间更新为空。
S66:确定识别出双击事件。
一些实施例中,在长按事件识别时,可以包括如下流程:
如果接收的触摸事件是按下事件,对按下事件进行事件入栈;
如果接收的触摸事件是移动事件,判断移动距离是否小于第二预设距离值,如果小于,则判断启动时间是否大于预设持续时间;如果大于,确定识别出长按事件;
如果接收的触摸事件是松开事件,则结束识别。
上述的移动距离可以根据栈内的首个事件(按下事件)的位置坐标与当前事件(移动事件)的位置坐标确定,将这两个位置坐标的差值确定为移动距离。
上述的启动时间可以根据栈内的首个事件(按下事件)的发生时间与当前件(移动事件)的发生时间确定,将这两个时间的差值确定为启动时间。
图7是本发明实施例中双击事件识别流程中接收到移动事件后的示意图。参见图7,该流程包括:
S71:接收到触摸事件是移动事件。
S72:判断识别是否已启动,若是,执行S73,否则,执行S76。
S73:判断移动距离是否小于第二预设距离值,若是,执行S74,否则,执行S76。
第二预设距离值可以根据经验等设置,与上述的第一预设距离值可以相同或不同。
S74:判断启动时间是否大于预设持续时间,若是,执行S75,否则,执行 S76。
预设持续时间可以根据经验等设置。
S75:确定识别出长按事件。
S76:结束识别。
一些实施例中,在拖动事件识别时,可以包括如下流程:
如果接收的触摸事件是按下事件,对按下事件进行事件入栈,以及,获取按下事件的位置坐标对应的控件,在所述空间是可拖动控件时,发送拖动开始事件;
如果接收的触摸事件是移动事件,对移动事件进行事件入栈,以及判断移动事件的位置坐标是否在可拖动控件内部,如果在内部,则发送拖动进行事件;
如果接收的触摸事件是松开事件,对松开事件进行事件入栈,以及,判断松开事件的位置坐标是否在可拖动控件内部,如果在内部,则发送拖动结束事件。
上述的拖动事件识别过程中,接收到各触摸事件的具体处理流程可以参见如下的实施例。
图8是本发明实施例中拖动事件识别流程中接收到按下事件后的示意图。参见图8,该流程包括:
S81:接收到触摸事件是按下事件。
S82:初始化识别。
初始化识别时例如包括:判断识别是否已启动,如果已启动,则结束识别,如果未启动,则启动识别。
S83:在启动识别后,对按下事件进行事件入栈。
S84:获取按下事件的位置坐标对应的控件,并判断该控件是否是可拖动控件,若是,执行S85,否则,执行S86。
可拖动控件例如包括:UIScrollView、BTapDetectingView、UIWebView。
如果按下事件的位置坐标处的控件是上述控件的任一种,则确定该控件是可拖动控件。
S85:发送拖动开始事件。
此时可以识别出拖动开始事件,并可以发送拖动开始事件。
S86:结束识别。
图9是本发明实施例中拖动事件识别流程中接收到移动事件后的示意图。参见图9,该流程包括:
S91:接收到触摸事件是移动事件。
S92:判断识别是否已启动,若是,执行S94,否则,执行S93。
S93:结束识别。
S94:对移动事件进行事件入栈。
S95:判断移动事件的位置坐标是否在可拖动控件内部,若是,执行S96,否则,执行S97。
S96:发送拖动进行事件。
此时可以识别出拖动进行事件,并可以发送拖动进行事件。
S97:发送拖动结束事件。
此时可以识别出拖动结束事件,并可以发送拖动结束事件。
图10是本发明实施例中拖动事件识别流程中接收到松开事件后的示意图。参见图10,该流程包括:
S101:接收到触摸事件是松开事件。
S102:判断识别是否已启动,若是,执行S103,否则,执行S106。
S103:对松开事件进行事件入栈。
S104:判断松开事件的位置坐标是否在可拖动控件内部,若是,执行S105,否则,执行S106。
S105:发送拖动结束事件。
此时可以识别出拖动结束事件,并可以发送拖动结束事件。
S106:结束识别。
可以理解的是,在上述手势事件识别过程中,在识别出单击事件、双击事件或长按事件后,可以一次性将相应的手势事件发送给后续的用于事件分发的模块。而在拖动事件的识别过程中,由于拖动事件是持续一段时间的事件,因此可以在整个拖动过程中多次发送事件给后续的用于事件分发的模块。
本实施例中,通过在待反向控制的元素是HTML页面中的元素时,根据手 势事件为元素配置HTML参数,可以使得元素根据配置的HTML参数进行处理以响应手势事件,从而实现对HTML页面中元素的反向控制,并且该反向控制流程没有调用操作***的接口,因此可以避开移动端操作***对接口使用的限制,方便的实现对移动端页面的反向控制。
图11是本发明一个实施例提出的反向控制移动端页面的装置的结构示意图。参见图11,该装置110包括:通信模块111、手势识别模块112和转换模块113。
通信模块111用于接收其他终端发送的用于反向控制的触摸事件;
以其他终端是车机为例,则参见图12,通信模块可以接收车机发送的触摸事件。
手势识别模块112用于根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;
转换模块113用于如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
可选的,所述触摸事件包括:按下事件、移动事件和松开事件;
所述手势事件包括:单击事件、双击事件、长按事件和拖动事件;
所述手势识别模块具体用于:
在接收到所述触摸事件时,同时启动对单击事件、双击事件、长按事件和 拖动事件的识别。
一些实施例中,参见图12,手势识别模块112包括:第一单元、第二单元、第三单元和第四单元;
所述第一单元用于:
如果接收的触摸事件是按下事件,对按下事件进行事件入栈;
如果接收的触摸事件是移动事件,判断移动距离是否小于预设距离值,如果小于,则对移动事件进行事件入栈;
如果接收的触摸事件是松开事件,判断启动时间是否在预设范围内,如果在预设范围内,则确定识别出单击事件。
所述第二单元用于:
识别出单击事件;
判断上次单击事件的时间是否不为空;
如果不为空,计算当前时间与上次单击事件的时间的差值,并判断所述差值是否小于预设时间间隔;
如果小于,将上次单击事件的时间更新为空,并确定识别出双击事件。
所述第三单元用于:
如果接收的触摸事件是按下事件,对按下事件进行事件入栈;
如果接收的触摸事件是移动事件,判断移动距离是否小于第二预设距离值,如果小于,则判断启动时间是否大于预设持续时间;如果大于,确定识别出长 按事件;
如果接收的触摸事件是松开事件,则结束识别。
所述第四单元用于:
如果接收的触摸事件是按下事件,对按下事件进行事件入栈,以及,获取按下事件的位置坐标对应的控件,在所述空间是可拖动控件时,发送拖动开始事件;
如果接收的触摸事件是移动事件,对移动事件进行事件入栈,以及判断移动事件的位置坐标是否在可拖动控件内部,如果在内部,则发送拖动进行事件;
如果接收的触摸事件是松开事件,对松开事件进行事件入栈,以及,判断松开事件的位置坐标是否在可拖动控件内部,如果在内部,则发送拖动结束事件。
所述转换模块用于根据所述手势事件为所述元素配置HTML参数,包括:
如果所述手势事件是单击事件,则根据预先对HTML页面中的元素的标记信息,从单击事件的位置坐标对应的元素开始,从下至上查找类型是可控的元素,在查找到类型是可控的元素后,将所述元素与HTML页面中的点击事件绑定。
所述转换模块用于根据所述手势事件为所述元素配置HTML参数,包括:
如果所述手势事件是拖动事件,从拖动事件的位置坐标对应的元素开始,从下至上查找可滚动的元素,在查找到可滚动的元素后,判断所述元素是否还 满足如下条件中的任一项:
所述元素是顶层元素,且所述元素的尺寸大于视图尺寸;或者,
所述元素是普通元素,且所述元素的尺寸大于所述元素的父元素的尺寸;
如果所述元素是可滚动元素,且还满足上述条件中的任一项,根据所述拖动事件的移动距离为所述元素配置HTML页面中的滚动参数。
一些实施例中,参见图12,该装置110还包括:
事件分发模块114,用于判断待反向控制的元素是否是HTML页面中的元素,并在所述元素是HTML页面中的元素时,将所述手势事件发送给所述转换模块,在所述元素是可交互的原生控件时,将所述手势事件发送给交互模块;
交互模块115,用于将接收的所述手势事件发送给可交互的原生控件,以使可交互的原生控件响应所述手势事件。
可以理解的是,本实施例与上述的方法实施例对应,具体内容可以参见方法实施例中的相关描述,在此不再详细说明。
本实施例中,通过在待反向控制的元素是HTML页面中的元素时,根据手势事件为元素配置HTML参数,可以使得元素根据配置的HTML参数进行处理以响应手势事件,从而实现对HTML页面中元素的反向控制,并且该反向控制流程没有调用操作***的接口,因此可以避开移动端操作***对接口使用的限制,方便的实现对移动端页面的反向控制。
本申请实施例还提出了一种终端,包括:处理器;用于存储处理器可执行 指令的存储器;其中,所述处理器被配置为:接收其他终端发送的用于反向控制的触摸事件;根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
本申请实施例还提出了一种非临时性计算机可读存储介质,当所述存储介质中的指令由终端的处理器执行时,使得终端能够执行一种反向控制移动端页面的方法,所述方法包括:接收其他终端发送的用于反向控制的触摸事件;根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
本申请实施例还提出了一种计算机程序产品,当所述计算机程序产品中的指令被处理器执行时,执行一种反向控制移动端页面的方法,所述方法包括:接收其他终端发送的用于反向控制的触摸事件;根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
需要说明的是,在本发明的描述中,术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性。此外,在本发明的描述中,除非另 有说明,“多个”的含义是指至少两个。
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本发明的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本发明的实施例所属技术领域的技术人员所理解。
应当理解,本发明的各部分可以用硬件、软件、固件或它们的组合来实现。在上述实施方式中,多个步骤或方法可以用存储在存储器中且由合适的指令执行***执行的软件或固件来实现。例如,如果用硬件来实现,和在另一实施方式中一样,可用本领域公知的下列技术中的任一项或他们的组合来实现:具有用于对数据信号实现逻辑功能的逻辑门电路的离散逻辑电路,具有合适的组合逻辑门电路的专用集成电路,可编程门阵列(PGA),现场可编程门阵列(FPGA)等。
本技术领域的普通技术人员可以理解实现上述实施例方法携带的全部或部分步骤是可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,该程序在执行时,包括方法实施例的步骤之一或其组合。
此外,在本发明各个实施例中的各功能单元可以集成在一个处理模块中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个模块 中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。
上述提到的存储介质可以是只读存储器,磁盘或光盘等。
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。
尽管上面已经示出和描述了本发明的实施例,可以理解的是,上述实施例是示例性的,不能理解为对本发明的限制,本领域的普通技术人员在本发明的范围内可以对上述实施例进行变化、修改、替换和变型。

Claims (22)

  1. 一种反向控制移动端页面的方法,其特征在于,包括:
    接收其他终端发送的用于反向控制的触摸事件;
    根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;
    如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
  2. 根据权利要求1所述的方法,其特征在于,
    所述触摸事件包括:按下事件、移动事件和松开事件;
    所述手势事件包括:单击事件、双击事件、长按事件和拖动事件。
  3. 根据权利要求2所述的方法,其特征在于,所述根据所述触摸事件识别出手势事件,包括:
    在接收到所述触摸事件时,同时启动对单击事件、双击事件、长按事件和拖动事件的识别。
  4. 根据权利要求2-3任一项所述的方法,其特征在于,在识别单击事件时,所述根据所述触摸事件识别出手势事件,包括:
    如果接收的触摸事件是按下事件,对按下事件进行事件入栈;
    如果接收的触摸事件是移动事件,判断移动距离是否小于预设距离值,如果小于,则对移动事件进行事件入栈;
    如果接收的触摸事件是松开事件,判断启动时间是否在预设范围内,如果在预设范围内,则确定识别出单击事件。
  5. 根据权利要求2-4任一项所述的方法,其特征在于,在识别双击事件时,所述根据所述触摸事件识别出手势事件,包括:
    识别出单击事件;
    判断上次单击事件的时间是否不为空;
    如果不为空,计算当前时间与上次单击事件的时间的差值,并判断所述差值是否小于预设时间间隔;
    如果小于,将上次单击事件的时间更新为空,并确定识别出双击事件。
  6. 根据权利要求2-5任一项所述的方法,其特征在于,在识别长按事件时,所述根据所述触摸事件识别出手势事件,包括:
    如果接收的触摸事件是按下事件,对按下事件进行事件入栈;
    如果接收的触摸事件是移动事件,判断移动距离是否小于第二预设距离值,如果小于,则判断启动时间是否大于预设持续时间;如果大于,确定识别出长按事件;
    如果接收的触摸事件是松开事件,则结束识别。
  7. 根据权利要求2-6任一项所述的方法,其特征在于,在识别拖动事件时,所述拖动事件包括:拖动开始事件、拖动进行事件和拖动结束事件,所述根据所述触摸事件识别出手势事件,包括:
    如果接收的触摸事件是按下事件,对按下事件进行事件入栈,以及,获取按下事件的位置坐标对应的控件,在所述空间是可拖动控件时,发送拖动开始事件;
    如果接收的触摸事件是移动事件,对移动事件进行事件入栈,以及判断移动事件的位置坐标是否在可拖动控件内部,如果在内部,则发送拖动进行事件;
    如果接收的触摸事件是松开事件,对松开事件进行事件入栈,以及,判断松开事件的位置坐标是否在可拖动控件内部,如果在内部,则发送拖动结束事件。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述根据所述手势事件为所述元素配置HTML参数,包括:
    如果所述手势事件是单击事件,则根据预先对HTML页面中的元素的标记信息,从单击事件的位置坐标对应的元素开始,从下至上查找类型是可控的元素,在查找到类型是可控的元素后,将所述元素与HTML页面中的点击事件绑定。
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述根据所述手势事件为所述元素配置HTML参数,包括:
    如果所述手势事件是拖动事件,从拖动事件的位置坐标对应的元素开始,从下至上查找可滚动的元素,在查找到可滚动的元素后,判断所述元素是否还满足如下条件中的任一项:
    所述元素是顶层元素,且所述元素的尺寸大于视图尺寸;或者,
    所述元素是普通元素,且所述元素的尺寸大于所述元素的父元素的尺寸;
    如果所述元素是可滚动元素,且还满足上述条件中的任一项,根据所述拖动事件的移动距离为所述元素配置HTML页面中的滚动参数。
  10. 根据权利要求1-9任一项所述的方法,其特征在于,还包括:
    判断待反向控制的元素是否是HTML页面中的元素;
    如果所述待反向控制的元素是可交互的原生控件,则将识别出的手势事件发送给可交互的原生控件,以使可交互的原生控件响应所述手势事件。
  11. 一种反向控制移动端页面的装置,其特征在于,包括:
    通信模块,用于接收其他终端发送的用于反向控制的触摸事件;
    手势识别模块,用于根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;
    转换模块,用于如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
  12. 根据权利要求11所述的装置,其特征在于,所述触摸事件包括:按下事件、移动事件和松开事件;所述手势事件包括:单击事件、双击事件、长按事件和拖动事件;所述手势识别模块具体用于:
    在接收到所述触摸事件时,同时启动对单击事件、双击事件、长按事件和 拖动事件的识别。
  13. 根据权利要求11-12任一项所述的装置,其特征在于,所述手势识别模块包括用于识别单击事件的第一单元,所述第一单元用于:
    如果接收的触摸事件是按下事件,对按下事件进行事件入栈;
    如果接收的触摸事件是移动事件,判断移动距离是否小于预设距离值,如果小于,则对移动事件进行事件入栈;
    如果接收的触摸事件是松开事件,判断启动时间是否在预设范围内,如果在预设范围内,则确定识别出单击事件。
  14. 根据权利要求11-13任一项所述的装置,其特征在于,所述手势识别模块包括用于识别双击事件的第二单元,所述第二单元用于:
    识别出单击事件;
    判断上次单击事件的时间是否不为空;
    如果不为空,计算当前时间与上次单击事件的时间的差值,并判断所述差值是否小于预设时间间隔;
    如果小于,将上次单击事件的时间更新为空,并确定识别出双击事件。
  15. 根据权利要求11-14任一项所述的装置,其特征在于,所述手势识别模块包括用于识别长按事件的第三单元,所述第三单元用于:
    如果接收的触摸事件是按下事件,对按下事件进行事件入栈;
    如果接收的触摸事件是移动事件,判断移动距离是否小于第二预设距离值, 如果小于,则判断启动时间是否大于预设持续时间;如果大于,确定识别出长按事件;
    如果接收的触摸事件是松开事件,则结束识别。
  16. 根据权利要求11-15任一项所述的装置,其特征在于,所述拖动事件包括:拖动开始事件、拖动进行事件和拖动结束事件,所述手势识别模块包括用于识别拖动事件的第四单元,所述第四单元用于:
    如果接收的触摸事件是按下事件,对按下事件进行事件入栈,以及,获取按下事件的位置坐标对应的控件,在所述空间是可拖动控件时,发送拖动开始事件;
    如果接收的触摸事件是移动事件,对移动事件进行事件入栈,以及判断移动事件的位置坐标是否在可拖动控件内部,如果在内部,则发送拖动进行事件;
    如果接收的触摸事件是松开事件,对松开事件进行事件入栈,以及,判断松开事件的位置坐标是否在可拖动控件内部,如果在内部,则发送拖动结束事件。
  17. 根据权利要求11-16任一项所述的装置,其特征在于,所述转换模块用于根据所述手势事件为所述元素配置HTML参数,包括:
    如果所述手势事件是单击事件,则根据预先对HTML页面中的元素的标记信息,从单击事件的位置坐标对应的元素开始,从下至上查找类型是可控的元素,在查找到类型是可控的元素后,将所述元素与HTML页面中的点击事件绑 定。
  18. 根据权利要求11-17任一项所述的装置,其特征在于,所述转换模块用于根据所述手势事件为所述元素配置HTML参数,包括:
    如果所述手势事件是拖动事件,从拖动事件的位置坐标对应的元素开始,从下至上查找可滚动的元素,在查找到可滚动的元素后,判断所述元素是否还满足如下条件中的任一项:
    所述元素是顶层元素,且所述元素的尺寸大于视图尺寸;或者,
    所述元素是普通元素,且所述元素的尺寸大于所述元素的父元素的尺寸;
    如果所述元素是可滚动元素,且还满足上述条件中的任一项,根据所述拖动事件的移动距离为所述元素配置HTML页面中的滚动参数。
  19. 根据权利要求11-18任一项所述的装置,其特征在于,还包括:
    事件分发模块,用于判断待反向控制的元素是否是HTML页面中的元素,并在所述元素是HTML页面中的元素时,将所述手势事件发送给所述转换模块,在所述元素是可交互的原生控件时,将所述手势事件发送给交互模块;
    交互模块,用于将接收的所述手势事件发送给可交互的原生控件,以使可交互的原生控件响应所述手势事件。
  20. 一种终端,其特征在于,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为:
    接收其他终端发送的用于反向控制的触摸事件;
    根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;
    如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
  21. 一种非临时性计算机可读存储介质,其特征在于,当所述存储介质中的指令由终端的处理器执行时,使得终端能够执行一种反向控制移动端页面的方法,所述方法包括:
    接收其他终端发送的用于反向控制的触摸事件;
    根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;
    如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
  22. 一种计算机程序产品,其特征在于,当所述计算机程序产品中的指令被处理器执行时,执行一种反向控制移动端页面的方法,所述方法包括:
    接收其他终端发送的用于反向控制的触摸事件;
    根据所述触摸事件识别出手势事件,以及确定出待反向控制的元素;
    如果所述元素是HTML页面中的元素,根据所述手势事件为所述元素配置HTML参数,以使所述元素根据所述HTML参数进行处理以响应所述手势事件。
PCT/CN2016/108933 2016-03-31 2016-12-07 反向控制移动端页面的方法和装置 WO2017166858A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610202382.5 2016-03-31
CN201610202382.5A CN105912319B (zh) 2016-03-31 2016-03-31 反向控制移动端页面的方法和装置

Publications (1)

Publication Number Publication Date
WO2017166858A1 true WO2017166858A1 (zh) 2017-10-05

Family

ID=56745274

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/108933 WO2017166858A1 (zh) 2016-03-31 2016-12-07 反向控制移动端页面的方法和装置

Country Status (2)

Country Link
CN (1) CN105912319B (zh)
WO (1) WO2017166858A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637539A (zh) * 2020-12-15 2021-04-09 浪潮云信息技术股份公司 一种基于Canvas绘制录像回放时间轴的方法

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105912319B (zh) * 2016-03-31 2019-03-12 百度在线网络技术(北京)有限公司 反向控制移动端页面的方法和装置
CN108268205A (zh) * 2016-12-30 2018-07-10 乐视汽车(北京)有限公司 车机对移动终端的触屏反控方法和***
CN110794999B (zh) * 2019-10-28 2021-01-15 珠海格力电器股份有限公司 基于界面分割的自动控制方法、装置及终端

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840299A (zh) * 2010-03-18 2010-09-22 华为终端有限公司 一种触摸操作方法、装置和移动终端
CN103076919A (zh) * 2012-12-29 2013-05-01 广东志成冠军集团有限公司 一种无线触摸遥控方法和***
US20140223490A1 (en) * 2013-02-07 2014-08-07 Shanghai Powermo Information Tech. Co. Ltd. Apparatus and method for intuitive user interaction between multiple devices
CN104571981A (zh) * 2013-10-14 2015-04-29 苏州峰通光电有限公司 一种显示控制终端及一种车用电子装置
CN105912319A (zh) * 2016-03-31 2016-08-31 百度在线网络技术(北京)有限公司 反向控制移动端页面的方法和装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8416196B2 (en) * 2008-03-04 2013-04-09 Apple Inc. Touch event model programming interface
US8174502B2 (en) * 2008-03-04 2012-05-08 Apple Inc. Touch event processing for web pages
KR101384603B1 (ko) * 2013-02-20 2014-04-11 주식회사 알엔웨어 무선 영상 송수신 및 역방향 제어 시스템
CN104035714B (zh) * 2014-06-24 2017-05-03 中科创达软件股份有限公司 一种基于安卓***的触摸事件处理方法、装置和设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840299A (zh) * 2010-03-18 2010-09-22 华为终端有限公司 一种触摸操作方法、装置和移动终端
CN103076919A (zh) * 2012-12-29 2013-05-01 广东志成冠军集团有限公司 一种无线触摸遥控方法和***
US20140223490A1 (en) * 2013-02-07 2014-08-07 Shanghai Powermo Information Tech. Co. Ltd. Apparatus and method for intuitive user interaction between multiple devices
CN104571981A (zh) * 2013-10-14 2015-04-29 苏州峰通光电有限公司 一种显示控制终端及一种车用电子装置
CN105912319A (zh) * 2016-03-31 2016-08-31 百度在线网络技术(北京)有限公司 反向控制移动端页面的方法和装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112637539A (zh) * 2020-12-15 2021-04-09 浪潮云信息技术股份公司 一种基于Canvas绘制录像回放时间轴的方法

Also Published As

Publication number Publication date
CN105912319B (zh) 2019-03-12
CN105912319A (zh) 2016-08-31

Similar Documents

Publication Publication Date Title
US10990268B2 (en) Operation method and terminal device
EP2990930B1 (en) Scraped information providing method and apparatus
WO2017166858A1 (zh) 反向控制移动端页面的方法和装置
WO2019206158A1 (zh) 一种界面显示方法、装置及设备
US10007396B2 (en) Method for executing program and electronic device thereof
US11200293B2 (en) Method and system for controlling presentation of web resources in a browser window
CN105320417B (zh) 页面切换方法及客户端
US20190068661A1 (en) Method, apparatus, and computer-readable medium for desktop sharing over a web socket connection in a networked collaboration workspace
WO2015031546A1 (en) Gesture-based content sharing between devices
KR20140091439A (ko) 네트워크 디바이스 간의 어플리케이션 데이터 전송 개시 및 완료를 위한 3차원 제스처 검출 시스템 및 방법
CN103150109A (zh) 用于web页面的触摸事件模型
US20130162519A1 (en) Cross-platform human input customization
WO2017032088A1 (zh) 一种主题确定方法及终端
WO2013182141A1 (zh) 一种人机交互方法、装置及其电子设备
CN106528163B (zh) 一种页面切换方法和装置
WO2017215671A1 (zh) 接入设备的控制方法、装置及***
US10779148B2 (en) Data transmission method and first electronic device
US9691270B1 (en) Automatically configuring a remote control for a device
US11334240B2 (en) Method, device, electronic device, and storage medium for sending and receiving message
KR101961907B1 (ko) 사용자 터치 유지 시간에 기초한 이동단말기의 컨텐츠 제공 방법
WO2017096797A1 (zh) 一种基于体感的操作组件控制方法和***
KR101491056B1 (ko) 터미널 환경의 서버 기반 컴퓨팅 시스템에서 마우스 ui 지원을 위한 터치 스크린 단말 장치 및 마우스 ui 지원 방법
US10445488B2 (en) Intuitive touch gesture-based data transfer between devices
KR101506006B1 (ko) 터미널 환경의 서버 기반 컴퓨팅 시스템에서 동적 표시되는 마우스 ui 지원을 위한 터치 스크린 단말 장치 및 마우스 ui 지원 방법
CN107291351A (zh) 数据输入方法及装置

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16896626

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16896626

Country of ref document: EP

Kind code of ref document: A1