Sliding event processing method, device, medium and electronic device
Patent Information
- Application Number
- CN202211478199.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-23
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-11-23
AI Technical Summary
[0003]然而,在子视图未实现子接口的情况下,子视图是无法处理滑动事件的,从而导致滑动事件无法被处理,嵌套滑动流程无法正常进行
[0015]通过上述技术方案,通过设置能同时实现父接口和子接口的中间层,即中间层既能传递滑动事件又能处理滑动事件,因此,嵌套滑动布局中子视图可以是能处理滑动事件或不能处理滑动事件的子视图,即子视图可以实现或未实现子接口。即使子视图未实现子接口,也能通过中间层对滑动事件进行处理,保证嵌套滑动流程的正常进行。
Smart Images

Figure CN115809110B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a sliding event processing method, apparatus, medium, and electronic device. Background Technology
[0002] Nested sliding mechanisms allow parent and child views to coordinate and cooperate during sliding, thus achieving a smooth nested sliding motion. Therefore, a nested sliding mechanism can be implemented using a nested sliding layout consisting of parent and child views. To implement a nested sliding mechanism, the parent view needs to implement the parent interface, and the child views need to implement the child interface.
[0003] However, if a subview does not implement a sub-interface, the subview cannot handle swipe events, which means that swipe events cannot be processed and nested swipe processes cannot proceed normally. Summary of the Invention
[0004] This summary section is provided to briefly introduce the concepts, which will be described in detail in the detailed description section below. This summary section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] In a first aspect, this disclosure provides a method for handling sliding events, the method comprising:
[0006] In response to a parent view on the page receiving a swipe event, the parent view passes the swipe event to an intermediate layer. The intermediate layer can implement a parent interface and a child interface. The parent interface is used to pass the swipe event, and the child interface is used to process the swipe event. The intermediate layer includes a child view.
[0007] Based on the processing status of the subview for the sliding event, the sliding event is processed according to the intermediate layer. The processing status is used to reflect whether the subview can handle the sliding event. The parent view and the subview constitute a nested sliding layout.
[0008] Secondly, this disclosure provides a sliding event handling apparatus, the apparatus comprising:
[0009] The delivery module is configured to respond to a parent view on the page receiving a swipe event, and to pass the swipe event to an intermediate layer through the parent view. The intermediate layer can implement a parent interface and a child interface. The parent interface is used to pass the swipe event, and the child interface is used to process the swipe event. The intermediate layer includes a child view.
[0010] The processing module is configured to process the sliding event based on the processing status of the subview and according to the intermediate layer. The processing status is used to reflect whether the subview can handle the sliding event. The parent view and the subview constitute a nested sliding layout.
[0011] Thirdly, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0012] Fourthly, this disclosure provides an electronic device, comprising:
[0013] A storage device on which computer programs are stored;
[0014] A processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect.
[0015] The above technical solution establishes an intermediate layer that can simultaneously implement both parent and child interfaces. This intermediate layer can both transmit and process sliding events. Therefore, in a nested sliding layout, the child views can be either capable of handling sliding events or not; that is, the child views may or may not implement the child interfaces. Even if a child view does not implement a child interface, the intermediate layer can still handle sliding events, ensuring the normal operation of the nested sliding process.
[0016] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0017] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale. In the drawings:
[0018] Figure 1 This is an interactive flowchart illustrating the nested scrolling mechanism of NestedScrolling according to an exemplary embodiment.
[0019] Figure 2 This is a flowchart illustrating a sliding event handling method according to an exemplary embodiment.
[0020] Figure 3 This is an exemplary flowchart illustrating a sliding event handling method according to an exemplary embodiment.
[0021] Figure 4 This is a block diagram illustrating a sliding event handling device according to an exemplary embodiment.
[0022] Figure 5 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation
[0023] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0024] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0025] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0026] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0027] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0028] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0029] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0030] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0031] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0032] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0033] Meanwhile, it is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0034] As mentioned in the background section, nested scrolling mechanisms can be implemented using nested scrolling layouts consisting of a parent view and child views. To implement a nested scrolling mechanism, the parent view needs to implement the parent interface, and the child views need to implement the child interface. For example, in the Android system, a nested scrolling mechanism could be NestedScrolling. NestedScrolling provides a set of interaction mechanisms between parent and child views. To achieve this interaction, the parent view needs to implement the NestedScrollingParent interface (the parent interface), while the child view needs to implement the NestedScrollingChild interface (the child interface).
[0035] like Figure 1 As shown, Figure 1 This is an interactive flowchart illustrating the nested scrolling mechanism of NestedScrolling according to an exemplary embodiment, wherein the parent view implementing the nested scrolling mechanism can implement the NestedScrollingParent interface, and the child view implementing the nested scrolling mechanism can implement the NestedScrollingChild interface.
[0036] like Figure 1As shown, when a child view needs to scroll, it calls the `startNestedScroll` method to inform the parent view that it has started scrolling, thus finding a parent view that can cooperate with the child view in nested scrolling. The parent view calls back the `onstartNestedScroll` method to decide whether to cooperate with the child view in responding. If cooperation is needed, it then calls back the `onNestedScrollAccepted` method. Before the scrolling event occurs and the child view has processed it, the child view calls the `dispatchNestedPreScroll` method to pass the event to the parent view, allowing the parent view to receive the child view's scrolling message in the `onNestedPreScroll` method and then perform the appropriate processing. The processed result is passed to the child view. After the child view executes the dispatchNestedPreScroll method, it consumes the scroll event internally. This internal consumption event can be the child view's own scroll event. If the parent view needs to process related events after the child view scrolls, it can call the child view's dispatchNestedScroll method after the child view's event processing is complete. Then, the parent view will call back the onNestedScroll method. Finally, when the scrolling ends, the child view calls the StopNestedScroll method to indicate that the current scroll event processing is over, and the parent view calls the onStopNestedScroll method to indicate that the current processing is over.
[0037] Therefore, to implement the nested scrolling mechanism of NestedScrolling, the parent view needs to implement the NestedScrollingParent interface, i.e., the parent interface, and the child view needs to implement the NestedScrollingChild interface, i.e., the child interface.
[0038] Therefore, if a subview does not implement a sub-interface, it cannot handle scrolling events. Consequently, scrolling events cannot be processed by either the subview or the parent view, and the subview cannot interact with a parent view that inherits from the parent interface (e.g., the NestedScrollingParent interface). This prevents the nested scrolling flow from functioning correctly. For example, if the subview contains list data, a loading image or a network error image might be displayed before the list data is shown on the page. Loading images and network error images do not implement sub-interfaces, and in this case, the subview also does not implement the sub-interface. This prevents the subview from interacting with its parent view, and the nested scrolling flow cannot function correctly.
[0039] It is worth noting that the sliding event handling method disclosed herein can be applied to any scenario involving nested sliding layouts, such as interactive interfaces in applications that interact with the user, like the interactive design pages of information feed pages or product detail pages, or horizontally and vertically nested sliding lists in game applications. This disclosure does not impose any restrictions on the application scenarios of nested sliding layouts.
[0040] Figure 2 This is a flowchart illustrating a sliding event handling method according to an exemplary embodiment, which can be applied to a terminal device. Figure 2 As shown, the sliding event handling method may include the following steps.
[0041] Step 210: In response to the parent view on the page receiving a swipe event, the parent view passes the swipe event to the intermediate layer. The intermediate layer can implement the parent interface and the child interface. The parent interface is used to pass the swipe event, and the child interface is used to process the swipe event. The intermediate layer includes the child view.
[0042] Step 220: Based on the handling status of the subview for the sliding event, the sliding event is processed according to the intermediate layer. The handling status is used to reflect whether the subview can handle the sliding event. The parent view and the subview constitute a nested sliding layout.
[0043] In some embodiments, the parent view can be the outermost layout of a nested scrolling layout. The parent and child views can be specifically configured according to the actual situation. For example, the parent view can be a CoordinatorLayout, and the child views can be NestedScrollView or RecyclerView, etc. In some embodiments, the parent view implements the parent interface, so the parent view can pass scrolling events.
[0044] In some embodiments, the parent interface can be a NestedScrollingParent interface, and the child interface can be a NestedScrollingChild interface. In some embodiments, the intermediate layer can be a custom layout layer, for example, a NestedFrameLayout. The child views in the intermediate layer are linked with the parent view, that is, the child views and the parent view together form a nested scrolling layout. Since the intermediate layer is a custom layout layer, it will not affect the drawing and layout process of the child views, and can also be used with any parent view in the system of the terminal device (such as RecyclerView), and the intermediate layer will not conflict with the use of system child views.
[0045] This embodiment of the disclosure sets up an intermediate layer that can simultaneously implement both parent and child interfaces. This intermediate layer can both transmit and process sliding events. Therefore, subviews in a nested sliding layout can be subviews that can or cannot handle sliding events; that is, subviews may or may not implement the sub-interface. Even if a subview does not implement the sub-interface, the intermediate layer can still process the sliding events, ensuring the normal operation of the nested sliding flow. Furthermore, even if a subview linked to the parent view changes from one that implemented the sub-interface to one that does not, the intermediate layer can still ensure the entire nested sliding flow functions correctly. Therefore, regardless of how the subviews in the nested sliding layout change or whether they implement the sub-interface, the nested sliding events can flow normally.
[0046] In some embodiments, processing the sliding event based on the subview's handling status and according to the intermediate layer includes: when the handling status indicates that the subview cannot handle the sliding event, processing the sliding event according to the intermediate layer's pre-set sub-interface, where the pre-set is used to indicate whether the intermediate layer needs to handle the sliding event. In some embodiments, when the subview cannot implement the sub-interface, the subview's handling status indicates that the subview cannot handle the sliding event.
[0047] In some embodiments, the preset settings can be written by the developer in the sub-interface. The preset settings can be used to reflect whether the intermediate layer needs to process the sliding event, that is, whether the intermediate layer consumes the sliding event.
[0048] In some embodiments, based on the pre-setting of sub-interfaces in the intermediate layer, the processing of sliding events according to the intermediate layer includes: processing the sliding events according to the sub-interfaces of the intermediate layer when the pre-settings indicate that the intermediate layer needs to handle sliding events. This embodiment of the disclosure processes sliding events through the sub-interfaces of the intermediate layer when the subview cannot handle sliding events (i.e., the subview cannot implement the sub-interface), but the intermediate layer needs to handle sliding events. Therefore, even if the subview cannot handle sliding events, they can still be processed through the sub-interfaces of the intermediate layer, thereby ensuring the normal operation of the nested sliding process by consuming the sliding events through the intermediate layer.
[0049] In some embodiments, based on the pre-configuration of the sub-interfaces of the intermediate layer, the processing of sliding events according to the intermediate layer includes: when the pre-configuration indicates that the intermediate layer does not need to process sliding events, the sliding event is returned to the parent view through the parent interface of the intermediate layer, and the sliding event is processed by the parent view. This embodiment of the disclosure, by returning the sliding event to the parent view through the parent interface of the intermediate layer when the subview cannot process the sliding event (i.e., the subview cannot implement the sub-interface and the intermediate layer does not need to process the sliding event), allows the parent view to consume the sliding event. Therefore, even if the subview cannot process the sliding event, the sliding event can still be returned to the parent view through the intermediate layer for consumption, thus ensuring the normal operation of the nested sliding process.
[0050] As can be seen from the above embodiments, this disclosure sets up an intermediate layer. When the subview does not implement the sub-interface, the intermediate layer's pre-defined sub-interface determines whether it consumes the sliding event. When the intermediate layer consumes the sliding event, it does so; when it does not, it sends the sliding event back to the parent view, which then consumes it. Therefore, regardless of whether the intermediate layer itself consumes the sliding event, the sliding event can ultimately be consumed, ensuring the normal operation of the nested sliding process.
[0051] In some embodiments, processing a sliding event based on the subview's handling state of the sliding event, according to the intermediate layer, includes: if the handling state reflects that the subview can handle the sliding event, passing the sliding event to the subview according to the parent interface of the intermediate layer, and processing the sliding event according to the subview. In some embodiments, when the subview can implement the sub-interface, the subview's handling state reflects that the subview can handle the sliding event.
[0052] In some embodiments, handling scroll events based on a subview includes: if the subview needs to handle the scroll event, then handling the scroll event based on the subview. In some embodiments, handling scroll events based on a subview includes: if the subview does not need to handle the scroll event, then passing the scroll event back to the parent view through the parent interface of the subview and the intermediate layer, and then handling the scroll event through the parent view. In some embodiments, the subview implements a sub-interface (e.g., the NestedScrollingChild interface), and whether the subview needs to handle the scroll event can be determined through the preset settings of this sub-interface.
[0053] This embodiment of the disclosure, by having a subview capable of handling scroll events (i.e., implementing a sub-interface), passes scroll events to the subview through the parent interface of the intermediate layer. Since the subview implements the sub-interface, it can process scroll events when needed and return them to the parent view for consumption when no further processing is required. Thus, a nested scrolling process is completed through this subview.
[0054] To more clearly illustrate the flow of the sliding event handling method disclosed herein, the following will combine... Figure 3 Taking a parent view of CoordinatorLayout, a child view of RecyclerView, a parent interface of NestedScrollingParent, and a child interface of NestedScrollingChild as an example, this paper explains the scrolling event handling method disclosed herein. Figure 3 As shown, the intermediate layer can implement the parent interface NestedScrollingParent and the child interface NestedScrollingChild. After receiving a scrolling event, CoordinatorLayout will pass it to the intermediate layer.
[0055] At this point, if the child view of the intermediate layer does not implement the NestedScrollingChild interface, the process indicated by the thick arrow is executed. The CoordinatorLayout dispatches the scrolling event to the intermediate layer. If the intermediate layer needs to handle the scrolling event, it calls the NestedScrollingChild interface to consume the event. If the intermediate layer does not need to handle the event, it calls the NestedScrollingParent interface to return the scrolling event to the CoordinatorLayout, which then consumes it. The return process in this step is not explicitly defined in the code. Figure 3 As shown in the image.
[0056] If the child views of the intermediate layer (not shown) implement the NestedScrollingChild interface, for example, Figure 3The RecyclerView subview shown executes the process indicated by the thin arrow. The intermediate layer passes the scroll event to the RecyclerView. If the RecyclerView can consume the scroll event, it does so. If not, the scroll event is passed back to the CoordinatorLayout via the RecyclerView and the intermediate layer's parent interface, NestedScrollingParent, for the CoordinatorLayout to consume it. It's worth noting that... Figure 3 The subview RecyclerView in the diagram is drawn outside the middle layer for the purpose of illustrating the process. In practice, the subview RecyclerView is set inside the middle layer.
[0057] Figure 4 This is a block diagram illustrating a sliding event handling device according to an exemplary embodiment, such as... Figure 4 As shown, the sliding event handling device 400 may include a transmission module 410 and a processing module 420.
[0058] The transmission module 410 is configured to, in response to a parent view on the page receiving a sliding event, pass the sliding event to an intermediate layer through the parent view. The intermediate layer can implement a parent interface and a child interface. The parent interface is used to transmit the sliding event, and the child interface is used to process the sliding event. The intermediate layer includes a child view.
[0059] The processing module 420 is configured to process the sliding event based on the processing status of the subview and according to the intermediate layer. The processing status is used to reflect whether the subview can handle the sliding event. The parent view and the subview constitute a nested sliding layout.
[0060] In some embodiments, the processing module 420 is further configured to:
[0061] If the processing status indicates that the subview cannot handle the sliding event, the sliding event is processed by the intermediate layer based on the preset settings of the sub-interface of the intermediate layer. The preset settings are used to reflect whether the intermediate layer needs to process the sliding event.
[0062] In some embodiments, the processing module 420 is further configured to:
[0063] If the preset condition indicates that the intermediate layer needs to process the sliding event, the sliding event is processed according to the sub-interface of the intermediate layer.
[0064] In some embodiments, the processing module 420 is further configured to:
[0065] If the preset condition indicates that the intermediate layer does not need to process the sliding event, the sliding event is sent back to the parent view through the parent interface of the intermediate layer, and the sliding event is processed according to the parent view.
[0066] In some embodiments, the processing module 420 is further configured to:
[0067] If the processing state indicates that the subview is capable of handling the sliding event, the sliding event is passed to the subview according to the parent interface of the intermediate layer, and the sliding event is processed according to the subview.
[0068] In some embodiments, the processing module 420 is further configured to:
[0069] If the subview needs to handle the sliding event, the sliding event is handled according to the subview.
[0070] In some embodiments, the processing module 420 is further configured to:
[0071] If the subview does not need to handle the sliding event, the sliding event is passed back to the parent view through the parent interface of the subview and the intermediate layer, and the parent view handles the sliding event.
[0072] In some embodiments, wherein
[0073] When the subview is able to implement the sub-interface, the processing status of the subview reflects that the subview is able to handle the sliding event;
[0074] When the subview cannot implement the sub-interface, the processing status of the subview reflects that the subview cannot handle the sliding event.
[0075] The following is for reference. Figure 5 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 2 The diagram below shows the structure of the terminal device 500. The terminal device in this embodiment may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0076] like Figure 5 As shown, the electronic device 500 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0077] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0078] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.
[0079] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0080] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0081] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0082] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: respond to a parent view on a page receiving a swipe event, pass the swipe event to an intermediate layer through the parent view, the intermediate layer implementing a parent interface and a child interface, the parent interface for passing the swipe event, the child interface for processing the swipe event, and the intermediate layer including a child view; and process the swipe event according to the intermediate layer based on the processing state of the child view on the swipe event, the processing state reflecting whether the child view can handle the swipe event, the parent view and the child view forming a nested swipe layout.
[0083] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0084] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0085] The modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules are not, in some cases, intended to limit the functionality of the module itself.
[0086] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0087] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0088] According to one or more embodiments of this disclosure, Example 1 provides a sliding event handling method, the method comprising:
[0089] In response to a parent view on the page receiving a swipe event, the parent view passes the swipe event to an intermediate layer. The intermediate layer can implement a parent interface and a child interface. The parent interface is used to pass the swipe event, and the child interface is used to process the swipe event. The intermediate layer includes a child view.
[0090] Based on the processing status of the subview for the sliding event, the sliding event is processed according to the intermediate layer. The processing status is used to reflect whether the subview can handle the sliding event. The parent view and the subview constitute a nested sliding layout.
[0091] According to one or more embodiments of this disclosure, Example 2 provides a sliding event handling method of Example 1, wherein the sliding event is processed based on the processing state of the sliding event by the subview and according to the intermediate layer, including:
[0092] If the processing status indicates that the subview cannot handle the sliding event, the sliding event is processed by the intermediate layer based on the preset settings of the sub-interface of the intermediate layer. The preset settings are used to reflect whether the intermediate layer needs to process the sliding event.
[0093] According to one or more embodiments of this disclosure, Example 3 provides a sliding event handling method of Example 2, wherein the sliding event is processed according to the intermediate layer based on the pre-setting of the sub-interface of the intermediate layer, including:
[0094] If the preset condition indicates that the intermediate layer needs to process the sliding event, the sliding event is processed according to the sub-interface of the intermediate layer.
[0095] According to one or more embodiments of this disclosure, Example 4 provides a sliding event handling method of Example 2, wherein the sliding event is processed according to the intermediate layer based on the pre-setting of the sub-interface of the intermediate layer, including:
[0096] If the preset condition indicates that the intermediate layer does not need to process the sliding event, the sliding event is sent back to the parent view through the parent interface of the intermediate layer, and the sliding event is processed according to the parent view.
[0097] According to one or more embodiments of this disclosure, Example 5 provides a sliding event handling method as described in any one of Examples 1-4, wherein processing the sliding event based on the processing state of the sliding event by the subview and according to the intermediate layer includes:
[0098] If the processing state indicates that the subview is capable of handling the sliding event, the sliding event is passed to the subview according to the parent interface of the intermediate layer, and the sliding event is processed according to the subview.
[0099] According to one or more embodiments of this disclosure, Example 6 provides a sliding event handling method of Example 5, wherein processing the sliding event according to the subview includes:
[0100] If the subview needs to handle the sliding event, the sliding event is handled according to the subview.
[0101] According to one or more embodiments of this disclosure, Example 7 provides a sliding event handling method of Example 5, wherein processing the sliding event according to the subview includes:
[0102] If the subview does not need to handle the sliding event, the sliding event is passed back to the parent view through the parent interface of the subview and the intermediate layer, and the parent view handles the sliding event.
[0103] According to one or more embodiments of this disclosure, Example 8 provides the sliding event handling method of Example 1, wherein,
[0104] When the subview is able to implement the sub-interface, the processing status of the subview reflects that the subview is able to handle the sliding event;
[0105] When the subview cannot implement the sub-interface, the processing status of the subview reflects that the subview cannot handle the sliding event.
[0106] According to one or more embodiments of this disclosure, Example 9 provides a sliding event handling apparatus, the apparatus comprising:
[0107] The delivery module is configured to respond to a parent view on the page receiving a swipe event, and to pass the swipe event to an intermediate layer through the parent view. The intermediate layer can implement a parent interface and a child interface. The parent interface is used to pass the swipe event, and the child interface is used to process the swipe event. The intermediate layer includes a child view.
[0108] The processing module is configured to process the sliding event based on the processing status of the subview and according to the intermediate layer. The processing status is used to reflect whether the subview can handle the sliding event. The parent view and the subview constitute a nested sliding layout.
[0109] According to one or more embodiments of this disclosure, Example 10 provides a sliding event handling apparatus of Example 9, wherein the processing module is further configured to:
[0110] If the processing status indicates that the subview cannot handle the sliding event, the sliding event is processed by the intermediate layer based on the preset settings of the sub-interface of the intermediate layer. The preset settings are used to reflect whether the intermediate layer needs to process the sliding event.
[0111] According to one or more embodiments of this disclosure, Example 11 provides a sliding event handling apparatus of Example 10, wherein the processing module is further configured to:
[0112] If the preset condition indicates that the intermediate layer needs to process the sliding event, the sliding event is processed according to the sub-interface of the intermediate layer.
[0113] According to one or more embodiments of this disclosure, Example 12 provides a sliding event handling apparatus of Example 10, wherein the processing module is further configured to:
[0114] If the preset condition indicates that the intermediate layer does not need to process the sliding event, the sliding event is sent back to the parent view through the parent interface of the intermediate layer, and the sliding event is processed according to the parent view.
[0115] According to one or more embodiments of this disclosure, Example 13 provides a sliding event handling apparatus as described in any one of Examples 9-12, wherein the processing module is further configured to:
[0116] If the processing state indicates that the subview is capable of handling the sliding event, the sliding event is passed to the subview according to the parent interface of the intermediate layer, and the sliding event is processed according to the subview.
[0117] According to one or more embodiments of this disclosure, Example 14 provides a sliding event handling apparatus of Example 13, wherein the processing module is further configured to:
[0118] If the subview needs to handle the sliding event, the sliding event is handled according to the subview.
[0119] According to one or more embodiments of this disclosure, Example 15 provides a sliding event handling apparatus of Example 13, wherein the processing module is further configured to:
[0120] If the subview does not need to handle the sliding event, the sliding event is passed back to the parent view through the parent interface of the subview and the intermediate layer, and the parent view handles the sliding event.
[0121] According to one or more embodiments of this disclosure, Example 16 provides a sliding event handling apparatus of Example 9, wherein,
[0122] When the subview is able to implement the sub-interface, the processing status of the subview reflects that the subview is able to handle the sliding event;
[0123] When the subview cannot implement the sub-interface, the processing status of the subview reflects that the subview cannot handle the sliding event.
[0124] According to one or more embodiments of the present disclosure, Example 17 provides a computer-readable medium having a computer program stored thereon that, when executed by a processing device, implements the steps of the method described in any one of Examples 1-8.
[0125] According to one or more embodiments of this disclosure, Example 18 provides an electronic device, including:
[0126] A storage device on which computer programs are stored;
[0127] A processing device for executing the computer program in the storage device to implement the steps of any one of the methods in Examples 1-8.
[0128] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0129] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0130] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. A sliding event handling method, characterized in that, The method includes: In response to a parent view on the page receiving a swipe event, the parent view passes the swipe event to an intermediate layer. The intermediate layer can implement a parent interface and a child interface. The parent interface is used to pass the swipe event, and the child interface is used to process the swipe event. The intermediate layer includes a child view. Based on the processing status of the subview for the sliding event, the sliding event is processed according to the intermediate layer. The processing status is used to reflect whether the subview can handle the sliding event. The parent view and the subview constitute a nested sliding layout. The processing of the sliding event based on the subview's processing status, and the processing of the sliding event according to the intermediate layer, includes: If the processing status indicates that the subview cannot handle the sliding event, the sliding event is processed according to the preset settings of the sub-interface of the intermediate layer. The preset settings are used to reflect whether the intermediate layer needs to process the sliding event. The fact that the subview cannot handle the sliding event indicates that the subview has not implemented the sub-interface.
2. The sliding event handling method according to claim 1, characterized in that, The pre-setting of the sub-interface based on the intermediate layer, and the processing of the sliding event according to the intermediate layer, include: If the preset condition indicates that the intermediate layer needs to process the sliding event, the sliding event is processed according to the sub-interface of the intermediate layer.
3. The sliding event handling method according to claim 1, characterized in that, The pre-setting of the sub-interface based on the intermediate layer, and the processing of the sliding event according to the intermediate layer, include: If the preset condition indicates that the intermediate layer does not need to process the sliding event, the sliding event is sent back to the parent view through the parent interface of the intermediate layer, and the sliding event is processed according to the parent view.
4. The sliding event handling method according to any one of claims 1-3, characterized in that, The processing of the sliding event based on the subview's processing status, and the processing of the sliding event according to the intermediate layer, includes: If the processing state indicates that the subview is capable of handling the sliding event, the sliding event is passed to the subview according to the parent interface of the intermediate layer, and the sliding event is processed according to the subview.
5. The sliding event handling method according to claim 4, characterized in that, The process of handling the sliding event based on the subview includes: If the subview needs to handle the sliding event, the sliding event is handled according to the subview.
6. The sliding event handling method according to claim 4, characterized in that, The process of handling the sliding event based on the subview includes: If the subview does not need to handle the sliding event, the sliding event is passed back to the parent view through the parent interface of the subview and the intermediate layer, and the parent view handles the sliding event.
7. The sliding event handling method according to claim 1, characterized in that, in, When the subview is able to implement the sub-interface, the processing status of the subview reflects that the subview is able to handle the sliding event; When the subview cannot implement the sub-interface, the processing status of the subview reflects that the subview cannot handle the sliding event.
8. A sliding event handling device, characterized in that, The device includes: The delivery module is configured to respond to a parent view on the page receiving a swipe event, and to pass the swipe event to an intermediate layer through the parent view. The intermediate layer can implement a parent interface and a child interface. The parent interface is used to pass the swipe event, and the child interface is used to process the swipe event. The intermediate layer includes a child view. The processing module is configured to process the sliding event based on the processing status of the subview and according to the intermediate layer. The processing status is used to reflect whether the subview can handle the sliding event. The parent view and the subview constitute a nested sliding layout. The processing module is further configured to, when the processing status reflects that the subview cannot handle the sliding event, process the sliding event according to the preset settings of the sub-interface of the intermediate layer. The preset settings are used to reflect whether the intermediate layer needs to process the sliding event, and the fact that the subview cannot handle the sliding event is used to characterize that the subview has not implemented the sub-interface.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When executed by the processing device, the program implements the steps of the method described in any one of claims 1-7.
10. An electronic device, characterized in that, include: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method according to any one of claims 1-7.