Text dragging method and related device
By setting a timer on electronic devices to determine the user's long-press intention and displaying a drag-and-drop box, the problem of cumbersome content transfer operations is solved, thus improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2023-09-06
- Publication Date
- 2026-05-15
AI Technical Summary
Transferring content between different applications is cumbersome and reduces the user experience of using electronic devices.
By setting a timer on the electronic device to determine the true intention of the user's long press operation, a drag box is displayed when the intention is determined to be drag, prompting the user that the text content has been copied and can be dragged, thus reducing the number of copy operations.
It improves the user experience of electronic devices by simplifying the process of transferring content between different applications.
Smart Images

Figure CN119620906B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to a text drag-and-drop method and related apparatus. Background Technology
[0002] With the development of terminal technology, electronic devices now offer copy and paste functionality for content within applications. In one possible implementation, users can copy content from one application on their electronic device and paste it into another, thus enabling the transfer and processing of content between different applications.
[0003] However, transferring content between different applications is cumbersome and may reduce the user experience of using electronic devices. Summary of the Invention
[0004] This application provides a text drag-and-drop method, applied in the field of terminal technology. By using a timer whose duration is longer than the system long-press duration of the electronic device's native system, the true intent of the user's long-press operation is determined. When it is determined that the user's intent in long-pressing the target text content is to drag it, the electronic device displays a drag box containing the target text content. This prompts the user that the copying of the target text content has been completed and can be dragged while the user maintains the long press, reducing the number of times the target text content needs to be copied and improving the user experience of the electronic device.
[0005] In a first aspect, embodiments of this application propose a text drag-and-drop method, which includes:
[0006] An electronic device displays a first interface of a first application. The first interface includes a first view, and the first view includes first text content. In response to a first touch operation applied to the first text content, the electronic device starts a first timer and a second timer. The duration of the first timer is a first duration, and the duration of the second timer is a second duration, which is the sum of the first duration and a delay duration. While the first touch operation is held down, in response to the first timer reaching its first duration, the electronic device displays a first pop-up window around the first text content. The first pop-up window includes one or more controls. While the first touch operation is held down, in response to the second timer reaching its second duration, the electronic device displays a drag-and-drop box, which includes the first text content.
[0007] In this way, the second duration can be used to determine whether the user intent corresponding to the first touch operation is a drag-and-drop intent. If the second timer reaches the second duration while the first touch operation is held down, it can be determined that the user intent corresponding to the first touch operation is a drag-and-drop intent. The electronic device can then display a drag-and-drop box containing the first text content. This prompts the user that the copying of the first text content is complete and can be dragged when the first touch operation is neither lifted nor moved, reducing the number of times the first text content needs to be copied and thus improving the user experience. The second duration is the sum of the first duration and the delay duration, and it also ensures compatibility between the drag-and-drop box display logic and the pop-up window display logic.
[0008] In one possible implementation, before the electronic device displays the drag-and-drop box, the method further includes: when a second timer reaches a second duration, the electronic device detects that it has displayed a first pop-up window in response to a first touch operation. The electronic device then starts a third timer, the duration of which is a third duration. The third duration is greater than or equal to a delay duration. When the third timer reaches the third duration, the electronic device processes the first text content to obtain the drag-and-drop box.
[0009] For example, the electronic device may include a content-aware fill frame. Before the electronic device displays the draggable box, the method further includes: when a second timer reaches a second duration, the content-aware fill frame queries whether the electronic device displays a first pop-up window. When the content-aware fill frame finds that the electronic device displays the first pop-up window, the content-aware fill frame may start a third timer. When the third timer reaches a third duration, the content-aware fill frame processes the first text content to obtain the draggable box.
[0010] When an electronic device displays a pop-up window, the user's intent corresponding to the first touch operation could be either an intention to operate on the pop-up window or a drag-and-drop intention. Therefore, when determining whether the electronic device displays the pop-up window in response to the first touch operation, a third timer and a third duration can be used to further accurately determine whether the user's intent corresponding to the first touch operation is a drag-and-drop intention. If the first touch operation neither moves nor is released when the third timer reaches the third duration, it indicates that the user's intent corresponding to the first touch operation is a drag-and-drop intention, and the electronic device obtains a drag-and-drop box and displays it to prompt the user to drag.
[0011] In one possible implementation, in response to a first touch operation on the first text content, the method further includes: in response to a down event of a first touch operation on a first view, the electronic device determines whether the view name of the first view is in a preset list. The preset list includes the view names of one or more views that support system dragging. When the electronic device determines that the view name of the first view is in the preset list, the electronic device stores the first text content in memory.
[0012] For example, when the first view receives a down event corresponding to the first touch operation, the first view passes its view name and first text content to the content recognition and filling framework of the electronic device. The content recognition and filling framework determines whether the view name of the first view is in a preset list. When the content recognition and filling framework determines that the view name of the first view is in the preset list, the content recognition and filling framework stores the first text content of the first view in memory.
[0013] In this way, when the first view is in TextView format, the first view actively reports its view name and first text content. This allows for quick creation of a drag box using the first text content when the user intent corresponding to the first touch operation is determined to be a drag-and-drop intent. The TextView format represents an implementation that inherits from Android's native text view.
[0014] In one possible implementation, when the third timer reaches its third duration, the electronic device processes the first text content to obtain a draggable box. This includes: when the third timer reaches its third duration, the electronic device determines whether the first text content exists in memory. When the electronic device determines that the first text content exists in memory, it creates the draggable box using preset configuration parameters and the first text content. The preset configuration parameters include the length and width of the draggable box, the position of the touch point on the draggable box, the shadow format of the draggable box, the shadow color of the draggable box, and the rounded corners of the draggable box.
[0015] For example, when the third timer reaches its third duration, the content recognition and filling framework of the electronic device determines whether the first text content exists in the memory. When the content recognition and filling framework determines that the first text content exists in the memory, it creates a drag-and-drop box using preset configuration parameters and the first text content.
[0016] This creates a drag-and-drop box that contains the first text content.
[0017] In one possible implementation, when the third timer reaches its third duration, the electronic device processes the first text content to obtain a draggable box. This includes: when the third timer reaches its third duration, the electronic device determines whether the first text content exists in memory. If the electronic device determines that the first text content does not exist in memory, it searches for the view corresponding to the down event of the first touch operation in the root layout of the page to which the first text content belongs, and obtains the view name of the first view. The root layout includes the storage hierarchy of the first view. The electronic device determines whether the view name of the first view is in a preset list, which includes the view names of one or more views that support system dragging. If the electronic device determines that the view name of the first view is in the preset list, it obtains the first text content of the first view. The electronic device creates the draggable box using preset configuration parameters and the first text content. The preset configuration parameters include the length and width of the draggable box, the position of the touch position on the draggable box, the shadow format of the draggable box, the shadow color of the draggable box, and the rounded corners of the draggable box.
[0018] For example, the electronic device also includes a view frame. When the third timer reaches the third duration, the electronic device processes the first text content to obtain a draggable box, including: when the third timer reaches the third duration, the content recognition and filling frame determines whether the first text content exists in memory. When the content recognition and filling frame determines that the first text content does not exist in memory, the content recognition and filling frame searches for the view corresponding to the down event of the first touch operation in the root layout of the page to which the first text content belongs, and obtains the view name of the first view. The content recognition and filling frame determines whether the view name of the first view is in a preset list. When the content recognition and filling frame determines that the view name of the first view is in the preset list, the content recognition and filling frame calls the view frame to obtain the first text content of the first view. The content recognition and filling frame uses preset configuration parameters and the first text content to create a draggable box.
[0019] In scenarios where the first view's format is not TextView but another view format, the first view cannot actively report its view name and first text content, and the electronic device cannot obtain the first view's view name and first text content from memory, the root layout can be traversed to find the control corresponding to the touch position of the first touch operation's down event and the view frame can be called to obtain the first text content of the found control, i.e., the target control.
[0020] In one possible implementation, the method further includes: the electronic device obtaining a new list; the electronic device determining whether the new list is an update to a preset list; and when the electronic device determines that the new list is a whitelist that updates the preset list, the electronic device updates the preset list with the new list.
[0021] In this way, electronic devices can obtain new lists from servers or other devices to update the preset lists on the electronic devices.
[0022] In one possible implementation, the method further includes: in response to a first touch operation moving to a first area of the electronic device's display screen, the electronic device launches a second application and displays a window of the second application in a second area of the display screen. The window of the second application includes one or more icons, each icon corresponding to a service capable of receiving the first text content. When the first touch operation moves to the position of a target icon among the one or more icons, in response to the first touch operation being lifted, the second application transmits the first text content to the service corresponding to the target icon.
[0023] This allows a second application to be launched during the first touch operation. The second application's window includes one or more icons, enabling users to easily select the target service. The target service corresponds to the service indicated by the target icon. When the first touch operation moves to the target icon within the one or more icons, in response to the touch being released, the second application transmits the first text content to the service corresponding to the target icon. This facilitates the convenient and rapid transfer of the first text content between the first application and the target service, reducing the number of steps required for the user to activate the target service and improving the user experience.
[0024] In one possible implementation, while the first touch operation is held down, in response to a second timer reaching a second duration, the electronic device displays a drag box. The drag box includes first text content and, in response to the first touch operation moving to a first area of the electronic device's display screen, the electronic device launches a second application, displaying its window in a second area of the display screen. The second application's window includes one or more icons, each corresponding to a service capable of receiving the first text content. If the first touch operation moves to a third area of the display screen, the drag box moves to the third area along with the first touch operation. In response to the first touch operation being lifted, the electronic device controls the drag box to return to its starting position. The third area does not include the second area.
[0025] This allows a second application to be launched during the first touch operation. The second application's window includes one or more icons, facilitating user selection of the target service. The target service icon corresponds to the specific service being selected. In scenarios where the first touch operation is lifted before reaching the second area, the electronic device returns the drag box to its starting position in response to the first touch operation being lifted, providing a drag-cancellation view and improving the user experience.
[0026] In one possible implementation, the second area is a sidebar on the right side of the display screen. This provides ample display space for the first application's window, making it easy for the user to view and navigate, while also facilitating dragging the drag box and selecting the target icon, thus improving the user experience.
[0027] In one possible implementation, the method further includes: an electronic device displaying a second interface with a third application, the second interface including a second view, the second view including second text content. In response to a second touch operation applied to the second text content, the electronic device starts a first timer and a second timer. If the second touch operation is held down, in response to the first timer reaching a first duration, the electronic device displays a second pop-up window around the second text content, the second pop-up window including one or more controls. If the second timer has not reached its second duration, in response to the second touch operation moving, the electronic device deactivates the second timer.
[0028] Thus, if the second touch operation moves before the second timer reaches its second duration, it indicates that the user's intention for the second touch operation is not a drag intention. Upon determining that the user's intention is not a drag intention, the electronic device closes the second timer, terminating the subsequent dragging process and reducing power consumption from invalid drags.
[0029] In one possible implementation, the method further includes: an electronic device displaying a third interface with a fourth application, the third interface including a third view, the third view including third text content. In response to a third touch operation applied to the third text content, the electronic device sets and starts a first timer and a second timer. While the third touch operation is held down, in response to the first timer reaching a first duration, the electronic device displays a third pop-up window around the third text content, the third pop-up window including one or more controls. If the second timer has not reached a second duration, in response to the third touch operation being released, the electronic device deactivates the second timer.
[0030] Thus, if the third touch operation is lifted before the second timer has reached its second duration, it indicates that the user's intention for the third touch operation is not a dragging intention. Upon determining that the user's intention is not a dragging intention, the electronic device closes the second timer, terminating the subsequent dragging process and reducing power consumption from invalid dragging.
[0031] In one possible implementation, the method further includes: an electronic device displaying a fourth interface with a fifth application, the fourth interface including a fourth view, the fourth view including fourth text content. In response to a fourth touch operation applied to the fourth text content, the electronic device starts a first timer and a second timer. While the fourth touch operation is held down, in response to the first timer reaching a first duration, the electronic device displays a fourth pop-up window around the fourth text content, the fourth pop-up window including one or more controls. While the fourth touch operation is held down, in response to the second timer reaching a second duration, the electronic device, having detected that the fourth pop-up window was displayed in response to the fourth touch operation, starts a third timer, the duration of which is the third duration. The third duration is greater than or equal to a delay duration. If the third timer has not reached the third duration, in response to the fourth touch operation moving, the electronic device stops the third timer.
[0032] Thus, if the fourth touch operation occurs before the third timer has reached its third duration, it indicates that the user's intention for the fourth touch operation is not a dragging intention. Upon determining that the user's intention is not a dragging intention, the electronic device closes the second timer, terminating the subsequent dragging process and reducing power consumption from invalid dragging.
[0033] In one possible implementation, the method further includes: an electronic device displaying a fifth interface with a sixth application, the fifth interface including a fifth view, the fifth view including fifth text content. In response to a fifth touch operation applied to the fifth text content, the electronic device starts a first timer and a second timer. While the fifth touch operation is held down, in response to the first timer reaching a first duration, the electronic device displays a fifth pop-up window around the fifth text content, the fifth pop-up window including one or more controls. While the fifth touch operation is held down, in response to the second timer reaching a second duration, the electronic device, having detected that the fifth pop-up window was displayed in response to the fifth touch operation, starts a third timer, the duration of which is a third duration. The third duration is greater than or equal to a delay duration. If the third timer has not reached the third duration, in response to the fifth touch operation being released, the electronic device closes the third timer.
[0034] Thus, if the fifth touch operation is lifted before the third timer has reached its third duration, it indicates that the user's intention for the fifth touch operation is not a dragging intention. Upon determining that the user's intention is not a dragging intention, the electronic device closes the second timer, terminating the subsequent dragging process and reducing power consumption from invalid dragging.
[0035] Secondly, embodiments of this application provide an electronic device comprising a processor and a memory. The memory stores computer-executable instructions. The processor executes the computer-executable instructions stored in the memory, causing the electronic device to perform the method as described in the first aspect.
[0036] Thirdly, embodiments of this application provide a computer-readable storage medium storing a computer program. When executed by a processor, the computer program implements the method as described in the first aspect.
[0037] Fourthly, embodiments of this application provide a computer program product, which includes a computer program that, when run, causes a computer to perform the method as described in the first aspect.
[0038] Fifthly, embodiments of this application provide a chip, the chip including a processor, the processor being configured to invoke a computer program in memory to execute the method as described in the first aspect.
[0039] It should be understood that the second to fifth aspects of this application correspond to the technical solutions of the first aspect of this application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation are similar, and will not be repeated here. Attached Figure Description
[0040] Figure 1 This is a schematic diagram of the structure of the electronic device 100 provided in the embodiments of this application;
[0041] Figure 2 A software structure block diagram of the electronic device 100 provided in the embodiments of this application;
[0042] Figure 3 This is a text drag-and-drop scenario diagram provided in an embodiment of this application;
[0043] Figure 4 A module interaction flowchart provided for an embodiment of this application;
[0044] Figure 5 This application provides a flowchart of the module interaction in a scenario where the finger moves before the second timer expires, as shown in the embodiments of this application.
[0045] Figure 6 This application provides a flowchart of the module interaction in the scenario where the finger is lifted before the second timer expires, as shown in the embodiments of this application.
[0046] Figure 7 A scene diagram showing a new window popping up around a target control provided in an embodiment of this application;
[0047] Figure 8 A flowchart illustrating the module interaction in a finger movement scenario after calling the drag-and-drop framework interface, as provided in this embodiment of the application.
[0048] Figure 9 A flowchart illustrating a module interaction process in a scenario where a finger is lifted after calling the drag-and-drop framework interface, as provided in this embodiment of the application.
[0049] Figure 10 This is an alternative module interaction flowchart for a scenario where the finger is lifted after calling the drag-and-drop framework interface, as provided in this application embodiment.
[0050] Figure 11 Another module interaction flowchart provided in this application embodiment;
[0051] Figure 12 A scene diagram showing a finger being lifted after the drag-and-drop framework interface is invoked, provided for an embodiment of this application;
[0052] Figure 13 This is a schematic diagram illustrating the whitelist saving and updating process provided in the embodiments of this application. Detailed Implementation
[0053] To facilitate a clear description of the technical solutions in the embodiments of this application, some terms and technologies involved in the embodiments of this application will be briefly introduced below:
[0054] 1. Electronic equipment
[0055] The electronic devices in this application embodiment may include handheld devices with image processing functions, vehicle-mounted devices, etc. For example, some electronic devices include: mobile phones, tablets, PDAs, laptops, mobile internet devices (MIDs), wearable devices, virtual reality (VR) devices, augmented reality (AR) devices, wireless terminals in industrial control, wireless terminals in self-driving vehicles, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, cellular phones, cordless phones, session initiation protocol (SIP) phones, wireless local loop (WLL) stations, personal digital assistants (PDAs), handheld devices with wireless communication capabilities, computing devices or other processing devices connected to a wireless modem, in-vehicle devices, wearable devices, terminal devices in 5G networks, or future evolution of public land mobile communication networks. Terminal devices in a network (PLMN), etc., are not limited to this in the embodiments of this application.
[0056] By way of example and not limitation, in this embodiment, the electronic device can also be a wearable device. Wearable devices, also known as wearable smart devices, are a general term for devices that utilize wearable technology to intelligently design and develop everyday wearables, such as hearing aids, glasses, gloves, watches, clothing, and shoes. Wearable devices are portable devices that are worn directly on the body or integrated into the user's clothing or accessories. Wearable devices are not merely hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include those that are feature-rich, large in size, and can achieve complete or partial functions without relying on a smartphone, such as smartwatches or smart glasses, as well as those that focus on a specific type of application function and require the use of other devices such as smartphones, such as various smart bracelets and smart jewelry for vital sign monitoring.
[0057] Furthermore, in this application embodiment, the electronic device can also be an electronic device in the Internet of Things (IoT) system. IoT is an important part of the future development of information technology. Its main technical feature is to connect objects to the network through communication technology, thereby realizing an intelligent network of human-machine interconnection and object-to-object interconnection.
[0058] The electronic equipment in the embodiments of this application may also be referred to as: user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal, user unit, user station, mobile station, mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication equipment, user agent, or user device, etc.
[0059] In this embodiment, the electronic device or various network devices include a hardware layer, an operating system layer running on top of the hardware layer, and an application layer running on top of the operating system layer. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and memory (also called main memory). The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux, Unix, Android, iOS, or Windows. The application layer includes applications such as browsers, address books, word processing software, and instant messaging software.
[0060] 2. Touch events
[0061] A touch event is an event generated by an electronic device when a finger touches its display screen. Touch events include touch type, touch location, and sampling point. Touch types include down, move, and up. The touch location can be the coordinates of the point where the finger contacts the display screen. The sampling point can represent the timestamp of the touch operation. Touch events include down, move, or up events. If the touch type of a touch event is down, it can be called a down event. If the touch type of a touch event is move, it can be called a move event. If the touch type of a touch event is up, it can be called an up event.
[0062] Understandably, the display screen of an electronic device can be a touchscreen.
[0063] 3. Falling event
[0064] A drop event is an event generated by an electronic device when a finger first touches its display screen. A drop event includes the touch type (down), touch location, and sampling point. The sampling point for a drop event can be the exact moment the finger first touches the display screen.
[0065] 4. Movement Events
[0066] A movement event is an event generated when a finger touches the display screen of an electronic device and remains on the screen, as the electronic device samples the touch location at a fixed sampling frequency. A movement event includes the touch type (move), the touch location, and the sampling point. While the finger remains on the screen, the electronic device generates and transmits a movement event each time it samples the touch location at the fixed sampling frequency.
[0067] Understandably, once a finger touches the display screen for the first time, whether the finger is pressed down on the screen or moved on the screen, the electronic device will continuously generate and transmit movement events at a fixed sampling frequency.
[0068] For example, the event handling framework of an electronic device can generate drop and movement events during a long press of a finger on the display screen, and pass an event to the module that needs the event for each generated event. The module that needs the event can, upon receiving a movement event, determine whether the finger's operation on the display screen is a long press or a movement operation based on a first threshold and the distance between the touch position of the movement event and the touch position of the drop event. The distance between the touch position of the movement event and the touch position of the drop event can be called an offset. For example, if the offset does not exceed the first threshold, the electronic device can determine that the finger's operation on the display screen is a long press. If the offset exceeds the first threshold, the electronic device can determine that the finger's operation on the display screen is a movement operation.
[0069] 5. Lifting Event
[0070] A lift-off event refers to the event generated by an electronic device when a finger is lifted off the screen. A lift-off event includes touch type "up", touch position, and sampling point. The sampling point of a lift-off event can be the first sampling point where the electronic device does not capture the touch position after the finger is lifted. The touch position in a lift-off event can be the touch position of the last movement event before the finger is lifted. The touch position in a lift-off event can represent the position where the finger was lifted.
[0071] 6. Some terms
[0072] In the embodiments of this application, terms such as "first" and "second" are used to distinguish identical or similar items with substantially the same function and purpose. For example, "first chip" and "second chip" are used only to distinguish different chips and do not limit their order of execution. Those skilled in the art will understand that terms such as "first" and "second" do not limit the quantity or execution order, and that "first" and "second" do not necessarily imply that they are different.
[0073] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0074] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, a--c, bc, or abc, where a, b, and c can be single or multiple.
[0075] It should be noted that the phrase "at...time" in the embodiments of this application can refer to the instant at which a certain situation occurs, or to a period of time after the occurrence of a certain situation; the embodiments of this application do not specifically limit this. Furthermore, the display interface provided in the embodiments of this application is merely an example, and the display interface may include more or less content.
[0076] To better understand the embodiments of this application, the following is combined with... Figure 1 and Figure 2 The structure of the electronic device according to the embodiments of this application will be described as follows:
[0077] Figure 1 A schematic diagram of the structure of the electronic device 100 is shown.
[0078] Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0079] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0080] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0081] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0082] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0083] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0084] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.
[0085] Figure 2 This is a software structure block diagram of the electronic device 100 according to an embodiment of this application.
[0086] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, the hardware abstraction layer, and the Linux kernel layer.
[0087] The application layer can include a series of application packages.
[0088] like Figure 2 As shown, the application package can include applications such as social networking, calendar, calling, maps, navigation, WLAN, Bluetooth, music, video, and SMS.
[0089] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0090] like Figure 2 As shown, the application framework layer may include a window management framework, a content-aware population framework, a view framework, a drag-and-drop framework, a resource manager, a notification manager, an event handling framework, etc.
[0091] A window management framework can be used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0092] The content recognition filling framework is a new module added in this application embodiment. It can be used to obtain the content of the control and use this content to create a drag box, so that the drag frame controls the drag box to move with the finger, thereby realizing the dragging of the content of the control.
[0093] A view framework can include visual controls, such as text controls that display text and image controls that display images. View frameworks are used to build applications. A display interface can consist of one or more views. Text controls and image controls are both views. A display interface can also consist of one or more controls. For example, the display interface presented on the chat page of the WeChat application can include multiple text controls and multiple image controls.
[0094] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0095] The drag-and-drop frame can be used to monitor changes in the touch position within the window management frame and control the drag-and-drop frame to move as the touch position changes.
[0096] The event handling framework is used to obtain the raw input events (including touch coordinates, timestamps of touch operations, etc.) corresponding to touch operations from the kernel layer and identify the control corresponding to the input event.
[0097] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0098] The Android runtime library consists of core libraries and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.
[0099] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0100] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0101] The system library can include multiple functional modules. For example: surface manager, multimedia library, graphics rendering library (e.g., OpenGL ES), relational database, etc.
[0102] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0103] The multimedia library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0104] The graphics rendering library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0105] Relational databases are used to store pre-defined data.
[0106] The hardware abstraction layer can include audio abstraction interfaces, Bluetooth abstraction interfaces, etc.
[0107] The Linux kernel layer is the layer between hardware and software. The kernel layer can contain drivers for displays, cameras, Bluetooth, audio, USB, Wi-Fi 1Q, etc.
[0108] The following example, using a social application activation scenario, illustrates the workflow of the software and hardware of electronic device 100.
[0109] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, etc.). The raw input event is stored in the kernel layer. The application framework layer retrieves the raw input event from the kernel layer and identifies the control corresponding to the input event. Taking a single touch operation as an example, where the corresponding control is the social application icon, the social application calls the application framework layer's interface to launch the social application.
[0110] Some electronic devices offer copy and paste functionality for content within applications. In one possible implementation, content from one application can be transferred to another in the following way:
[0111] S1. The user taps the screen of the electronic device to open an application on the electronic device, such as application A.
[0112] S2. The electronic device responds to the user's click operation by displaying the display interface of application A, which may include at least one control.
[0113] S3. The user long-presses on application A to display a control in the interface, such as control a.
[0114] S4. In response to the user's long press operation, the electronic device displays a first pop-up window, which includes a copy control.
[0115] S5. Users can click the copy control in the first pop-up box to copy the text content of control a.
[0116] S6. The user taps or swipes the screen to switch application A to the background or exit application A.
[0117] S7. The user taps the screen of the electronic device to open another application on the electronic device, such as application B.
[0118] S8. In response to the user's click operation, the electronic device displays the display interface of application B, which may include an input text box and an OK control.
[0119] S9. The user long-presses application B to display the input text box in the interface.
[0120] S9. In response to a user's long press operation, the electronic device displays a second pop-up window, which includes a paste control.
[0121] S10. Users can click the paste control in the second pop-up window.
[0122] S11. In response to the user's click operation, the electronic device pastes the text content of control a into the input text box in the display interface of application B.
[0123] S12. The user can click the "OK" control. The electronic device responds to the click operation by using the text content of control a for business processing.
[0124] In this way, the text content of control a can be transferred and processed between different applications (such as application A and application B).
[0125] However, copying the text content of control 'a' requires the user to long-press control 'a' and then tap the copy button, meaning the user needs to perform two touch operations to copy the text content of control 'a'. This operation is rather cumbersome and may reduce the user's experience of using electronic devices. Similarly, when transferring copied text content, the user also needs multiple touch operations to transfer the copied text content of control 'a' in application A to application B.
[0126] In view of this, this application provides a text drag-and-drop method. The electronic device can determine whether the user's intention to long-press the first text content of the first application is a drag-and-drop intention through a second duration. When the second duration determines that the user's long-press intention is a drag-and-drop intention, the electronic device can display a drag-and-drop box containing the first text content. This prompts the user that the copying of the first text content has been completed and can be dragged while the user holds down the long press, reducing the number of touch operations required to copy the first text content and improving the user's experience with the electronic device.
[0127] The first application can be any application on an electronic device. For example, the first application can be WeChat, QQ, a note-taking app, a music app, or a map app, etc.
[0128] The text drag-and-drop method provided in this application will be described below with reference to some embodiments.
[0129] Taking the first application as WeChat and the target page of the first application as a chat page of WeChat as an example, Figure 3 The illustration shows a text drag-and-drop scenario provided in an embodiment of this application.
[0130] Users can tap the screen of an electronic device to open the target page of the first application. The electronic device can display, for example... Figure 3 The interface shown in 'a'. For example... Figure 3The interface shown in Figure 'a' includes controls 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, control 313 (return), the text "aaa", control 314 (more), control 315 (voice), input box 316, emoticon control 317, and add control 318. Controls 301, 303, 305, 307, and 309 can all be image controls. Image controls can contain images. Controls 302, 304, 306, 308, and 310 can all be text controls. Text controls contain text content. Text content can include text and / or identifiable identifiers. Identifiable identifiers include emoticon identifiers, such as those used for emoticons. Figure 3 As shown in 'a', controls 301, 303, 305, 307, and 309 can be WeChat profile pictures. Controls 302, 304, 306, 308, and 310 can be chat content. The text "aaa" can represent a friend's nickname.
[0131] In such Figure 3 In the interface shown in Figure 'a', the user can long-press control 310. In response to the long-press operation, the electronic device can display something like... Figure 3 The interface shown in b. Figure 3 The interface shown in b can include long-press feedback 311. Figure 3 Other content displayed on the interface shown in b can be found in [reference]. Figure 3 The content of the interface shown in 'a' will not be repeated here. Long-press feedback 311 can be overlaid on the interface of the control 310 corresponding to the long-press position.
[0132] Understandably, when a user long-presses the display screen of an electronic device, the device will provide feedback. This feedback can be visual or tactile. Visual feedback can be, for example... Figure 3 The long press feedback shown in b is 311. If the long press feedback is haptic feedback, then the long press feedback is not visible.
[0133] In such Figure 3 On the interface shown in b, the user can keep their finger touching the display screen and move it. The electronic device responds to the user's movement, canceling the long-press feedback 311. The electronic device can then display something like... Figure 3 The interface shown in 'c'. Figure 3The interface shown in 'c' includes a drag box 312, but does not include long-press feedback 311. The drag box 312 is positioned at the same location as the touch point of the finger. The drag box 312 includes the text "Address is: XXXX", a drag box shadow, and rounded corners. Figure 3 For other content displayed on the interface shown in 'c', please refer to [link / reference]. Figure 3 The content of the interface shown in 'a' is not repeated here. The drag box 312 can be a response of the electronic device to the user's input. Figure 3 The long press operation shown in b on the interface is generated based on the text content of the control 310 corresponding to the long press.
[0134] It is understandable that hot zones can be set on the display screen of electronic devices. For example, a hot zone can be as follows: Figure 3 Hotspot 31 is shown in Figure c. Hotspot 31 is not visible. A hotspot can represent a preset area; when a user touches the hotspot, a second application can be launched. The second application can be used to provide an entry point for the delivery of text content.
[0135] In such Figure 3 In the interface shown in Figure c, the user can move their finger to make the drag box 312 move accordingly. When the finger moves to the hot area 31 of the electronic device's display screen, the electronic device can display something like... Figure 3 The interface shown in d is shown in the image.
[0136] like Figure 3 The interface shown as 'd' includes a drag-and-drop box 312, a page window 30 for the first application, and a sidebar 32. The sidebar 32 includes icons for the QQ application (321), music application (322), notes application (323), map application (324), sending status updates to WeChat (325), sending to WeChat friends (326), and video application (327). The drag-and-drop box 312 is located above the page window 30. The drag-and-drop box 312 can be displayed on the interface above the page window 30. See [link to page window 30] for the contents. Figure 3 The content of the interface shown in 'a' will not be described again here.
[0137] Sidebar 32 can represent the window of a second application. The window of the second application includes multiple sub-service icons. Sub-services can be any application on the electronic device, or any service provided by the application. For example, sub-services can be applications such as QQ, WeChat, Notes, Music, or Maps. Sub-services can also be services provided by the WeChat application, such as services sent to WeChat status or services provided by the WeChat application, such as services sent to WeChat friends.
[0138] Sub-service icons can be displayed in a flowing manner in the sidebar 32. Users can drag and drop the drag box 312 above the target sub-service icon, so that the target sub-service uses the text content of the drag box 312 for business processing.
[0139] For example, taking a map application as the target sub-business, in Figure 3 On the interface shown in 'd', the user can drag the drag box 312 above the map application icon 324 by moving their finger. The electronic device can display... Figure 3 The interface shown in 'e'. Figure 3 The content of the interface shown in 'e' can be found in [reference]. Figure 3 The content of the interface shown in d. Figure 3 The interface shown in e is the same as Figure 3 The difference between the interfaces shown in d and d is that... Figure 3 In the interface shown in e, the drag box 312 is located above the map application icon 324 in the sidebar 32.
[0140] exist Figure 3 On the interface shown in the image, the user can raise their finger, and the electronic device can display... Figure 3 The interface shown by f in the figure. Figure 3 The interface shown in f includes an input box 341 for the map application, a cancel control 342, a voice control 343, a return control 344, the text "Address is: XXXX" in the input box 341, a map 345, a location marker 346, a share control 347, a favorites control 348, a nearby control 349, a ride-hailing control 350, a navigation control 351, and a "Go here" control 352. The location marker 346 indicates the location of the address information "Address is: XXXX" on the map 345.
[0141] The user drags the drag box 312 above the map application icon 324. When the user lifts their finger, the second application receives the lift-off event and the text content "Address is: XXXX" from the drag box 312. The second application recognizes that the touch position of the lift-off event corresponds to the map application icon, and can determine that the target sub-service is the map application. The second application can then launch the map application and input the text content "Address is: XXXX" from the drag box 312 into the map application's input box 341, causing the electronic device to display... Figure 3 The page shown in f is so that users can... Figure 3 Continue on the page shown by f in the diagram.
[0142] For example, taking the target sub-business as the sending to WeChat friends service within the WeChat application as an example, in Figure 3On the interface shown as 'd', users can drag the drag box 312 above the "Send to WeChat Friends" icon 326 by moving their finger. The electronic device can display... Figure 3 The interface shown by 'g' in the diagram. Figure 3 The interface shown in Figure g includes a page window 30, a sidebar 32, a drag-and-drop box 308, and a long-press feedback 307. The sidebar 32 includes icons for the note-taking application 323, the image processing application 324, the WeChat status update notification 325, the WeChat friend notification 326, the video application 327, the Weibo application 328, and the photo album application 329. Figure 3 In the interface shown in g, the drag box 312 is located above the icon 326 for sending to WeChat friends in the sidebar 32.
[0143] exist Figure 3 On the interface shown in 'g', the user can raise their finger, and the electronic device can display... Figure 3 The interface shown by 'h' in the diagram. Figure 3 The interface shown in 'h' includes a close control 361, the text "Select a chat", a multi-select control 362, a search box 363, a search control 364, the text "Recently forwarded", a friend A control 365, a friend B control 366, a friend C control 367, a friend D control 368, the text "Recent chats", a create chat control 369, a friend E control 370, a group chat A control 371, a group chat B control 372, and a friend F control 373.
[0144] The user drags the drag box 312 above the "Send to WeChat Friends" icon 326. When the user lifts their finger, the second application receives the lift event and the text content "Address is: XXXX" from the drag box 312. The second application identifies the icon corresponding to the touch position of the lift event as the "Send to WeChat Friends" icon. The second application determines that the target sub-service is the "Send to WeChat Friends" service. The second application launches the WeChat application and passes the text content of the drag box 312 to the "Send to WeChat Friends" service within the WeChat application, causing the electronic device to display... Figure 3 The interface shown in h is for users to access... Figure 3 Continue operating on the interface shown by 'h'. Figure 3 On the interface shown by 'h', users can select a friend or group chat by clicking a friend control or group chat control. The content of the drag box 312 will be sent to the selected friend or group chat. A friend control is shown below. Figure 3 The "h" in the diagram refers to the friend A control (365), friend B control (366), friend C control (367), friend D control (368), friend E control (370), or friend F control (373) in the interface. Group chat controls, for example... Figure 3The h in the interface refers to either group chat A control 371 or group chat B control 372.
[0145] The text drag-and-drop method provided in this embodiment allows the electronic device to copy the text content of the target control when the user long-presses the target control (such as control 310). By displaying a drag-and-drop box, it indicates that the copying of the text content of the target control is complete and can be dragged. When the drag-and-drop box is dragged above the target sub-business icon and the user lifts it up, the second application transmits the text content of the target control to the target sub-business, so that the target sub-business can use the text content of the target control for business processing in a timely manner. The overall operation is simple and convenient, which can improve the user's experience of using the electronic device.
[0146] The above combination Figure 3 The drag-and-drop scenario shown illustrates the scenario of dragging and dropping the text content of the target control in the first application.
[0147] exist Figure 3 In the drag-and-drop scenario shown, the text control in the first application can have a preset format or a different format. A preset format is, for example, a TextView format. The text control in the first application can also have a TextView format or another view format. Other view formats are non-TextView formats. The TextView format can indicate that it inherits the implementation method of the native Android text control.
[0148] TextView text controls can actively display their text content. Other view-based text controls cannot actively display their text content. The format of a text control can be set by the developer of the application.
[0149] The following sections will explain the text drag-and-drop method in scenarios where the text control in the first application can actively report text content and the text drag-and-drop method in scenarios where the text control in the first application cannot actively report text content.
[0150] For the scenario where the text control in the first application can actively report text content, Figure 4 A flowchart illustrating a module interaction provided in an embodiment of this application is shown.
[0151] like Figure 4 As shown, the text drag-and-drop method provided in this application includes:
[0152] S100, the user opens the first application interface.
[0153] For example, a user can tap the display screen of an electronic device to open the target page of the first application.
[0154] S101. The application (APP) loads the content of each view in the target page into the view frame.
[0155] This facilitates the display of each control and its content on the target page. The target page displayed on the electronic device can be like... Figure 3 The interface shown in 'a'.
[0156] Understandably, each time a user opens a page in the first application, the application loads the content of each view within that page using the view frame. For example, if a user opens page A in the first application, the application loads the content of each view in page A using the view frame. If the user switches from page A to page B, the application loads the content of each view in page B using the view frame.
[0157] S102, The view frame passes the root layout of the target page to the content-aware fill frame.
[0158] For example, when the view frame obtains the content of each view in the target page, it can generate the root layout of the target page. The root layout may include DecorView. The view frame passes the root layout to the content-aware population frame.
[0159] Understandably, each time a user opens a page, the view frame can pass the root layout of the page the user opened to the content-aware fill frame.
[0160] Content-aware fill frameworks retrieve the root layout of the target page to locate the required text controls within it. It's understood that text controls belong to the view.
[0161] S103. The content-aware fill framework determines whether the application package name and / or page name of the target page are in the whitelist.
[0162] For example, the whitelist may include multiple application package names, multiple page names, and multiple view names that support system drag-and-drop. Optionally, the whitelist may also include the type of the control corresponding to the control name. For example, the whitelist style may be as follows:
[0163]
[0164] Wherein, com.XXX.uu is the application package name. com.XXX.mm is the application package name. com.XXX.uu.YYY is the page name. com.XXX.uu.ZZZ is the page name. com.XXX.mm.HHH is the page name. bbView is the control name. ddView is the control name. ccTextView is the control name. eeView is the control name. ffView is the control name. The control name can indicate the control's class within its respective page. type is the type. in type="text", "text" indicates text type. In type="image", "image" indicates image type.
[0165] Controls with different names can have different or the same data type. For example,<view name=“bbView”type=“text” / > This can indicate that the control named bbView is of text type, or that the control named bbView is a text control.<view name=“ddView”type=“image” / > This can indicate that the control named ddView is of image type, or that the control named ddView is an image control.<viewname=“ccTextView”type=“text” / > This can indicate that the control named ccTextView is also of text type, or that the control named ccTextView is a text control.
[0166] Different controls can have the same name or different names. For example, using... Figure 3 Taking the page name com.XXX.uu.ZZZ as an example, the control names of controls 301, 303, 305, 307, and 309 can all be ddView. The control names of controls 302, 304, 306, 308, and 310 can all be ccTextView.
[0167] Content-aware autocomplete frameworks can determine whether the application package name and / or page name of the root layout is in a whitelist. For example, based on the application package name and / or page name of the root layout, the content-aware autocomplete framework checks whether the application package name and / or page name are included in a pre-stored whitelist.
[0168] S104. Content-aware filling frame transmits the judgment result to the view frame.
[0169] For example, the judgment result can include a negative judgment result or a positive judgment result. A negative judgment result is, for example, false. A positive judgment result is, for example, true.
[0170] If neither the application package name nor the page name of the target page is in the whitelist, the content-aware fill framework can send false to the view framework. This way, when the view framework subsequently receives a drop event from a control touching the first application, it doesn't need to send the drop event to the content-aware fill framework, thus terminating the subsequent drag-and-drop process. The fact that neither the application package name nor the page name of the target page is in the whitelist indicates that the first application does not support system drag-and-drop. The fact that the first application does not support system drag-and-drop indicates that the first application is a protected application. When it is determined that neither the application package name nor the page name of the root layout is in the whitelist, subsequent drag-and-drop actions can be avoided, saving power consumption of electronic devices caused by invalid drags, and preventing the information of the protected first application from being disseminated due to arbitrary dragging by the user.
[0171] If the target page's application package name and / or page name is in the whitelist, the content-aware fill framework can transmit true to the view framework. This allows the view framework to pass a drop event to the content-aware fill framework after receiving a drop event from a control that touches the first application, thus continuing the subsequent drag-and-drop process.
[0172] S200: The event handling framework obtains the touch event when the target control is touched.
[0173] For example, the target control can be any text control on the target page. In this embodiment, the target control is still taken as... Figure 3 The following explanation uses control 310 in the interface shown in b as an example. Touch events when a target control is touched can include drop events and movement events. For example, when a user presses and holds down the target control without lifting their finger, the event handling framework can sequentially receive a drop event and at least one movement event.
[0174] S201, The event handling framework passes touch events to the window management framework.
[0175] For example, in response to a user's long press, the event handling framework sequentially passes a drop event and a move event to the window management framework.
[0176] Understandably, as long as the finger remains stationary, the event handling framework will continue to pass movement events to the window management framework.
[0177] S202, The window management framework passes touch events to the view framework.
[0178] S203. If the view frame has received the affirmative judgment result transmitted by the content-aware fill frame, the view frame transmits the touch event to the content-aware fill frame.
[0179] For example, if the view frame receives a true response from the content-aware filling frame in step S104, the view frame transmits the fall event to the content-aware transmission frame upon receiving a fall event. Similarly, the view frame transmits the move event to the content-aware transmission frame upon receiving a move event.
[0180] Optionally, if the view frame receives a false response from the content-aware fill frame in step S104, the view frame will not transmit the fall event to the content-aware fill frame upon receiving the fall event, thereby terminating the subsequent drag-and-drop process. Similarly, the view frame will not transmit the move event to the content-aware transmit frame upon receiving a move event.
[0181] S204. Content-aware fill frame responds to the fall event and sets a second timer.
[0182] For example, the second timing duration of the second timer is the sum of the system long press duration and the first extension duration of the electronic device, that is, the second timing duration = system long press duration + first extension duration. The second timer can be a message processing class handler.
[0183] The system long press duration is the duration used by the electronic device's native system to determine the long press intention. The system long press duration can be 400 milliseconds. The first extension duration can be 50 milliseconds.
[0184] The second timing duration is greater than the system long press duration. On the one hand, it can achieve compatibility between the text dragging method provided in this application embodiment and the native system logic of the electronic device. On the other hand, it can be used to determine whether the user's long press intention is a dragging intention, and it can also be used to guide further judgment of the user's long press intention.
[0185] For example, if a new window pops up at the long press position of an electronic device when the user's long press duration reaches the system's long press duration, the content recognition and filling framework can execute steps S209-S213 when the second timer reaches the second timer duration to further determine whether the user's true intention for the long press is a drag intention or an intention to operate on the new window.
[0186] If no new window pops up at the long press location on the electronic device when the user's long press duration reaches the system's long press duration, the content recognition and filling framework can determine that the user's true intention for the long press is a drag intention when the second timer reaches the second timer duration. The content recognition and filling framework does not need to further determine the user's intention for the long press and can directly execute the drag-related actions.
[0187] For example, after setting the second timer, there may be scenarios where a finger is pressed, moved, or lifted. The content recognition filling framework may receive a movement event or a lift event.
[0188] After setting the second timer, if the content recognition filling framework receives a movement event before the second timer expires (after the second timer has elapsed for a certain duration), the content recognition filling framework can determine whether the distance between the touch position of the movement event and the touch position of the fall event exceeds a second threshold. Optionally, the second threshold can be the same as or different from the first threshold.
[0189] If the distance between the touch position of the movement event and the touch position of the drop event exceeds the second threshold, it can indicate that the user's operation is a movement operation or finger movement, or that the user's operation intention is not a drag intention. In this case, the content recognition filling framework cancels the second timer to terminate subsequent drag-related actions.
[0190] If the distance between the touch position of the movement event and the touch position of the fall event does not exceed the second threshold, it can indicate that the user's operation is a long press or finger long press, or it can indicate that the user's operation intention may be a drag intention or an intention to make the electronic device pop up a new window. In this case, the content recognition filling frame will not process it.
[0191] The module interaction flowchart for the scenario where the finger moves before the second timer exceeds the second timer duration is as follows. Figure 5 As shown. For ease of understanding, Figure 5 The module interaction process shown will be explained later.
[0192] After setting the second timer, if the content-aware fill framework receives a lift event before the second timer expires (this could indicate that the user's action was a lift or finger lift, or that the user's intention was not a drag intention), the content-aware fill framework cancels the second timer to terminate subsequent drag-related steps. The process of the content-aware fill framework receiving a lift event is similar to the process of the content-aware fill framework receiving a drop event, and will not be described again here.
[0193] The module interaction flowchart for the scenario where the finger is lifted before the second timer exceeds the second timer duration is as follows. Figure 6 As shown. For ease of understanding, Figure 6 The module interaction process shown will be explained later.
[0194] When the second timer reaches the second timing duration, the content recognition filling framework executes step S209.
[0195] Optionally, if the content-aware fill framework determines, based on the move event or lift event, that the user's operation is a move operation or a lift operation, indicating that the user's operation intent is not a drag intent, before the second timer exceeds the second timer duration and the drag box is created, the content-aware fill framework can terminate the execution of subsequent drag-related steps.
[0196] Both move and lift operations indicate that the user's operation intention is not a drag intention. When the content recognition filling framework determines that the user's operation intention is not a drag intention, it cancels the second timer or terminates the execution of subsequent drag-related steps. This can also reduce the power consumption of electronic devices.
[0197] S205. Touch events are passed internally within the view frame.
[0198] For example, after receiving a fall event, the view frame causes the fall event to be propagated in the root layout of the target page based on the touch location of the event.
[0199] For example, a drop event can be passed layer by layer in the order of application → page → control.
[0200] This allows for an accurate match between the user's intent and the target control in the first application.
[0201] It is understandable that when a user long-presses a target control, the events include drop events and move events. The specific implementation of the move event's internal propagation within the view frame is similar to that of the drop event's internal propagation within the view frame, and will not be elaborated here.
[0202] Optionally, steps S203 and S205 can be executed concurrently.
[0203] S206. The target control in the view frame receives a fall event and reports its text content to the content-aware fill frame.
[0204] For example, in this embodiment, the control format of the first application is TextView format. The target control of the first application supports text content reporting. Therefore, the target control can report the entity corresponding to the target control to the content recognition and filling framework. The entity can be a package or container. The entity corresponding to the target control includes the control name of the target control, the text content of the target control, and the layout of the target control. The layout can include control height, control width, text content, number of text lines, start character of each line, end character of each line, text margins, text path, text color, and font size. The content recognition and filling framework obtains the control name of the target control, the text content of the target control, and the layout of the target control from this entity.
[0205] For example, taking the target control as Figure 3 Taking control 310 in the interface shown in b as an example, the content-aware fill framework obtains the control name, text content, and layout of the target control from the entity corresponding to the target control as follows:
[0206] android:id = "@123456".
[0207] ccTextView=textView.getClass().getSimpleName().
[0208] CharSequence=textView.getText().
[0209] int width=textView.getWidth().
[0210] int height=textView.getHeight().
[0211] int line cout=textView.getLineCout().
[0212] int selection start=textView.getSelectionStart().
[0213] int selection end=textView.getSelectionEnd().
[0214] int text size=textView.getTextSize().
[0215] int line spacing extra=textView.getLineSpacingExtra().
[0216] int current text color=textView.getCurrentTextColor().
[0217] In this context, ccTextView = textView.getClass().getSimpleName() means that the control name of the target control is obtained by using the control name retrieval method (textView.getClass().getSimpleName()).
[0218] `android:id="@123456"` means that the ID attribute of the target control is 123456. `@123456` can also be represented as `textView123456`. Each control has a unique ID attribute. The ID attribute can also indicate the control's position on the page it belongs to, or it can represent a text path.
[0219] The CharSequence address is: XXXX = textView.getText() means obtaining the text content CharSequence of the target control through the text content acquisition method (textView.getText()). This text content CharSequence is, for example, "The address is: XXXX".
[0220] int width = textView.getWidth() means obtaining the control width value width of the target control through the control width acquisition method (textView.getWidth()). This width value width is, for example, 400.
[0221] int height = textView.getHeight() means obtaining the control height value height of the target control through the control height acquisition method (textView.getHeight()). This height value height is, for example, 200.
[0222] int line cout = textView.getLineCout() means obtaining the number of lines of text line cout of the target control through the number of lines of text acquisition method (textView.getLineCout()). This number of lines line cout is, for example, 1.
[0223] int selection start = textView.getSelectionStart() means obtaining the starting character of the first line selection start of the target control through the starting character of the line acquisition method (textView.getSelectionStart()). This starting character of the first line selection start is, for example, "地".
[0224] int selection end = textView.getSelectionEnd() means obtaining the ending character of the first line selection end of the target control through the ending character of the line acquisition method (textView.getSelectionEnd()). This ending character of the first line selection end is, for example, "X".
[0225] int text size = textView.getTextSize() means obtaining the font size value text size of the target control through the font size acquisition method (textView.getTextSize()). This font size value textsize is, for example, 5.
[0226] The `int line spacing extra = textView.getLineSpacingExtra()` method retrieves the line spacing value `line spacingextra` of the target control using the `textView.getLineSpacingExtra()` method. For example, the line spacing value `line spacing extra` is 2. Line spacing is a type of text margin.
[0227] `int current text color = textView.getCurrentTextColor()` means obtaining the color value `current text color` of the target control's text using the text color acquisition method (`textView.getCurrentTextColor()`). This color value `current text color` is 100, and it contains information about the red, green, and blue components. The color value can be used to convert to other color representations (such as RGB or RGBA).
[0228] The content recognition fill framework obtains the text content reported by the target control, so that the content recognition fill framework can quickly generate a drag box using the text content.
[0229] S207. The content-aware fill framework determines whether the text reported by the target control is valid text.
[0230] For example, a content-aware fill framework can determine whether the name of a target control is in a whitelist.
[0231] If so, the content-aware fill framework determines that the reported text is valid and can store the text content and the layout of the target control in memory for subsequent drag-and-drop related steps.
[0232] If not, the content recognition fill framework determines that the reported text is invalid. The content recognition fill framework cancels the second timer, clears the obtained text content, the layout of the target control, and touch events, so as to terminate the execution of subsequent drag-related actions. In this way, the power consumption of invalid drags can be saved.
[0233] S208, The view frame responds to touch events.
[0234] For example, the view frame can set a first timer in response to a fall event, the duration of which is equal to the system long press duration.
[0235] If a view frame receives a movement event before the first timer reaches the system long press duration (or the first timer duration), the view frame determines whether the distance between the touch position of the movement event and the touch position of the drop event exceeds a first threshold. If it does, the view frame cancels the first timer. If it does not exceed the threshold, the view frame does not perform any action.
[0236] If the view frame receives a release event before the first timer reaches the system long press duration, the view frame cancels the first timer.
[0237] When the first timer reaches the system long press duration, the view frame executes the long press-related steps native to the electronic device's system. For example, the view frame might execute steps related to popping up a new window around the target control.
[0238] The view frame executes a scenario where a new window pops up around the target control, as detailed in subsequent step S210.
[0239] The steps executed by the view frame in response to touch events are the logic of the electronic device's native system. The content recognition filling framework determines that the user's long press operation is an intention to drag, using a second timer, while the view frame determines that the user's long press operation is an intention to pop up a new window, using a first timer. Furthermore, the duration of the second timer in the content recognition filling framework is longer than the duration of the first timer. This ensures that the text dragging method provided in this embodiment is compatible with the logic of the native system, and the text dragging method provided in this embodiment will not affect the execution logic of the electronic device's native system.
[0240] Optionally, S206 and S208 can be executed concurrently.
[0241] S209. When the second timer reaches the second timeout duration, the content recognition filling frame queries the window management frame to see if a new window pops up around the target control.
[0242] For example, when a user long-presses a target control for the system's long-press duration, the electronic device may or may not pop up a new window around the target control. Therefore, when the second timer reaches the second timeout duration, the content recognition filling framework needs to query the window management framework to see if a new window has popped up around the target control, in order to determine whether the user's true intention for the long-press operation is to make the electronic device pop up a new window or to drag the device, based on whether a new window has popped up.
[0243] The second timing duration is longer than the system long press duration, so that the content recognition and filling framework executes this step later than the time when the electronic device pops up a new window around the target control. This can reduce the probability of the query result of the new window popping up being inaccurate because the query time of the new window pops up is earlier than the time when the new window pops up.
[0244] S210: The window management framework determines whether a new window pops up around the target control.
[0245] For example, Figure 7 The illustration shows a scenario where an electronic device, according to an embodiment of this application, pops up a new window around a target control. When the first timer reaches the system long press duration, the electronic device can display... Figure 7 The interface shown. (As shown) Figure 7 The interface shown includes a new window 71. The new window 71 pops up around the target control. The new window 71 may include a copy control 711, a forward control 712, a favorite control 713, a multi-select control 714, a reference control 715, and a delete control 716. Other elements of this interface can be found in [reference needed]. Figure 3 The content of the interface shown in b is not described here.
[0246] After the window management framework determines that a new window has popped up around the target control, the window management framework can execute step S211.
[0247] Optionally, if the window management framework determines that no new window has popped up around the target control, it can notify the content recognition and filling framework that no new window has popped up. If the content recognition and filling framework determines that the user's long-press operation is actually a dragging intention, then the content recognition and filling framework will not execute steps S212-S213 and will directly execute step S214a. This reduces the power consumption of executing steps S212-S213 and allows for timely generation of the drag box, improving the user experience.
[0248] S211, Window management framework notification content recognition fills the framework pop-up new window.
[0249] If a new window pops up around the target control, the user's long-press action intent could be either a dragging intent or a non-dragging intent. A non-dragging intent could be that the user is interacting with the new pop-up window. Therefore, the content-aware fill framework needs to perform step S212 to further determine the user's true action intent.
[0250] S212, Content-Aware Fill Framework sets a third timer. The third timer's third timing duration is equal to the second extension duration.
[0251] The second extension duration can be the same as or different from the first extension duration.
[0252] For example, the second extension duration can be longer than the first extension duration. For instance, the second extension duration can be 100 milliseconds.
[0253] S213, when the third timer reaches the third timing duration, the content recognition filling frame determines that the user's finger has neither moved nor lifted.
[0254] For example, the third timer can be a message handling class handler.
[0255] After setting the third timer, there may be scenarios where a finger is pressed, moved, or lifted. The content recognition filling framework may receive movement events or lift events.
[0256] After setting the third timer, if the content recognition filling framework receives a movement event before the third timer exceeds the third timeout period, the content recognition filling framework can determine whether the distance between the touch position of the movement event and the touch position of the fall event exceeds the second threshold.
[0257] If the distance between the touch position of the move event and the touch position of the drop event exceeds the second threshold, it can indicate that the user's operation is a move operation, or it can indicate that the user's operation intention is not a drag intention. In this case, the content recognition filling framework cancels the third timer to terminate the execution of subsequent drag-related steps.
[0258] If the distance between the touch position of the move event and the touch position of the drop event does not exceed the second threshold, it can indicate that the user's operation is a long press operation, or it can indicate that the user's operation intention may be a drag intention or an intention to operate a new window. In this case, the content recognition filling frame will not process it.
[0259] After setting the third timer, if the content-aware fill framework receives a lift event before the third timer expires, it indicates that the user's operation is a lift operation or a finger lift, or it can also indicate that the user's operation intention is not a drag intention. In this case, the content-aware fill framework cancels the third timer to terminate the execution of subsequent drag-related steps.
[0260] When the content-aware filling framework receives a movement event as the first event after the third timer reaches its third duration, the content-aware filling framework can determine whether the distance between the touch position of the movement event and the touch position of the fall event exceeds a second threshold.
[0261] If the distance between the touch position of the move event and the touch position of the drop event exceeds the second threshold, it can indicate that the user's operation is a move operation or finger movement, or that the user's operation intention is not a drag intention or that the user's operation intention is an intention to switch windows. In this case, the content recognition filling framework will terminate the execution of subsequent drag-related steps.
[0262] If the distance between the touch position of the movement event and the touch position of the drop event does not exceed the second threshold, it can be indicated that the user's operation is a long press, or that the true intent of the long press operation is a dragging intent. In this case, the content recognition filling framework executes step S214a. A long press operation indicates that the finger neither moves nor is lifted.
[0263] When the content-aware fill framework receives a lift event as the first event after the third timer reaches its third duration, it indicates that the user's operation is a lift operation or finger lift. In this case, the content-aware fill framework will terminate the execution of subsequent drag-related steps.
[0264] Both move and lift actions indicate that the user's intention is not a drag intention. When the content recognition filling framework determines that the user's intention is not a drag intention, it cancels the third timer or terminates the execution of subsequent drag-related steps. This reduces the power consumption of the electronic device. The third timer can be used to accurately determine whether the user's long press action in the scenario where a new window pops up on the electronic device is actually a drag intention, thus improving the accuracy of user intention recognition.
[0265] It is understandable that the user's finger not moving can also mean that the user's finger has not been lifted.
[0266] Optionally, if the content-aware fill framework determines that the user's finger has moved or lifted, the content-aware fill framework can also clear the stored text content and the layout of the target control, and clear the second timer and the third timer.
[0267] S214a. Text content exists in memory, and the content recognition and filling framework retrieves the text content from memory.
[0268] Optionally, S213 and S214a can be executed concurrently.
[0269] S215. Content-Aware Fill Frame: Creates a draggable frame with shadows and rounded corners based on the text content.
[0270] For example, the content-aware fill framework may include a drag shadow builder module. The content-aware fill framework can pass text content and the layout of the target control to the drag shadow builder module. The drag shadow builder module uses the text content, the layout of the target control, and preset configuration parameters to create a drag shadow with shadows and rounded corners. The preset configuration parameters in the drag shadow builder module may include the drag shadow's length and width (out shadowsize), the finger's position on the drag shadow (out shadow touch point), the drag shadow format, the drag shadow color, and the drag shadow's rounded corners. The drag shadow created by the drag shadow builder module is as follows: Figure 3As shown in the interface shown in Figure c, the drag box 312 has the same text content "Address is: XXXX" as the target control (i.e., control 310). The number of text lines in drag box 312 is the same as that in control 310. The starting character of each line of text in drag box 312 is the same as the starting character of each line of text in control 310. The ending character of each line of text in drag box 312 is the same as that in control 310. Drag box 312 also includes a drag box shadow and rounded corners. The shadow and rounded corners of drag box 312 are as follows... Figure 3 The drag box shadow and rounded corners of drag box 312 in the interface shown in c.
[0271] In this way, after determining that the user's long-press operation is intended to drag, a drag box is generated to complete the copying of the text content of the target control. The electronic device can display the drag box to indicate to the user that the text content of the target control has been copied, which can improve the user's drag-and-drop text experience and thus improve the user's overall experience of using the electronic device.
[0272] It is understood that, since the text drag-and-drop method provided in this application embodiment does not affect the execution logic of the electronic device's native system, the text drag-and-drop method provided in this application embodiment does not affect the new window that pops up on the electronic device. For example, the new window that pops up on the electronic device will not disappear because the drag box is displayed.
[0273] S216, The content-aware fill framework calls the drag-and-drop framework's interface.
[0274] For example, the content-aware fill frame calls the drag-and-drop frame's interface and passes the acquired text content of the target control and the created drag-and-drop box to the drag-and-drop frame interface so that the drag-and-drop frame controls the drag-and-drop box to move with the finger and passes the text content of the target control to the second application when the finger moves into the window of the second application.
[0275] The text content of the target control, for example Figure 3 The text content of control 310 in the interface shown in Figure c. A drag-and-drop box, for example... Figure 3 The drag box 312 in the interface shown in c.
[0276] It is understandable that the text content of the target control is the same as the text content of the drag box.
[0277] S217. The drag-and-drop frame monitors the window management frame and controls the drag-and-drop frame to move as the finger moves.
[0278] For example, after the content recognition filling framework calls the drag-and-drop framework's interface, a scenario where a finger moves may occur. In this scenario, the drag-and-drop framework monitors the window management framework, obtains the finger's touch position in real time, and controls the drag box 312 to move with the finger.
[0279] For example, after the content-aware fill framework calls the drag-and-drop framework's interface, the electronic device can display something like... Figure 3 The interface shown in 'c'. Figure 3 In the interface shown by 'c', if the user moves their finger, the electronic device can display something like this: Figure 3 The interface shown by d in the diagram. From Figure 3 As shown in the interfaces 'c' and 'd', the position of the drag box 312 matches the touch position of the finger, enabling the drag box 312 to move as the finger moves. This enhances the user experience of the electronic device.
[0280] The flowchart of module interaction in the finger movement scenario after calling the drag-and-drop framework's interface is as follows. Figure 8 As shown. For ease of understanding, Figure 8 The module interaction process shown will be explained later.
[0281] Optionally, after the content-aware filling framework calls the drag-and-drop framework's interface, a scenario where a finger is lifted may also occur. In this scenario, the drag-and-drop framework can execute different steps depending on the lifting position. For example, if the lifting position of the finger (or the last touch position on the display) is within the sidebar, step S218 can be executed. If the lifting position of the finger is within the window of the target page, the drag-and-drop framework controls the drag box to return to the starting position. The starting position could be, for example, the location of the target control or the long-press position.
[0282] The following is a flowchart of a module interaction process in the scenario where the finger is lifted after calling the drag-and-drop framework's interface. Figure 9 As shown below. Another module interaction flowchart for the finger-lifting scenario after calling the drag-and-drop framework's interface is shown later. Figure 10 As shown. For ease of understanding, Figure 9 and Figure 10 The module interaction process shown will be explained later.
[0283] S218, The window management framework launches the second application, which in turn launches the sub-business.
[0284] For example, when a finger moves to a hotspot, the window management frame pulls up a second application, and the display shows a sidebar (or a window of the second application). The sidebar is as follows: Figure 3The sidebar 32 in the interface shown by d. Users can continue to move their finger, dragging the drag box above the target sub-business icon and lifting their finger. The second application can obtain the lift-off event and the text content of the target control from the drag frame. The second application can determine that the sub-business corresponding to the touch position of the lift-off event is the target sub-business. The second application can then launch the target sub-business and pass the text content of the target control to it, enabling the target sub-business to use the text content of the target control for business processing.
[0285] For example, such as Figure 3 As shown, in Figure 3 In the interface shown in 'c', the user can move their finger. When the finger moves into the hot zone 31 of the electronic device's display screen, the window management frame pulls up a second application, allowing the electronic device to display something like... Figure 3 The interface shown in d is as follows. The sidebar 32 can display icons of multiple sub-businesses in a flowing manner, so that when the user drags the drag box 312 above the target sub-business icon and lifts their finger, the target sub-business will use the text content of the drag box 312 to perform business processing.
[0286] For example, taking a map application as the target sub-business, in Figure 3 On the interface shown in 'd', the user moves their finger and drags the drag box 312 above the map application icon 324. The electronic device can display... Figure 3 The interface shown in 'e'.
[0287] exist Figure 3 On the interface shown in the image, the user can raise their finger, and the electronic device can display... Figure 3 The interface shown in f is as follows. When the user lifts their finger, the drag frame can determine that the touch position of the lift event is within the sidebar 32. The touch position of the lift event can represent the position where the user's finger is lifted. The drag frame passes the lift event and the text content of the drag frame 312 to the second application. The second application can recognize that the sub-service icon corresponding to the touch position of the lift event is the icon of the map application. The second application can determine that the target sub-service is the map application. The second application pulls up the map application and inputs the text content of the drag frame 312 into the input box 341 of the map application, causing the electronic device to display... Figure 3 The page shown in f is so that users can... Figure 3 Continue on the page indicated by f.
[0288] For example, taking the target sub-business as the sending to WeChat friends service within the WeChat application as an example, in Figure 3 On the interface shown in 'd', the user moves their finger and drags the drag box 312 above the "Send to WeChat Friends" icon 326. The electronic device can display... Figure 3 The interface shown in g is shown in the image.
[0289] exist Figure 3 On the interface shown in 'g', the user can raise their finger, and the electronic device can display... Figure 3 The interface is shown as 'h' in the diagram. When the user lifts their finger, the drag frame can identify the touch position of the lift event within the sidebar 32. The touch position of the lift event indicates the position where the finger is lifted. The drag frame passes the lift event and the text content of the drag frame 312 to the second application. The second application can identify that the icon corresponding to the touch position of the lift event is the icon for the "Send to WeChat Friends" service. The second application can determine that the target sub-service is the "Send to WeChat Friends" service. The second application launches the WeChat application and passes the text content of the drag frame 312 to the "Send to WeChat Friends" service, causing the electronic device to display... Figure 3 The page shown in the h symbol allows users to... Figure 3 Continue on the page indicated by 'h'. Figure 3 On the interface shown in h, users can select friends or group chats by clicking the friend control or group chat control, so that the text content of the drag box 312 can be sent to the selected friends or group chats.
[0290] The module interaction flow in the scenario where the user drags the drag box 312 above the target sub-business icon and then lifts their finger can be found in the following sections. Figure 9 Detailed description of the embodiments.
[0291] The text drag-and-drop method provided in this embodiment, in a scenario where the text control of the first application can actively report text content, reports an entity containing the control name, text content, and layout of the target control through the target control. If the reported text is determined to be valid, and the user's true intention for the long press operation is determined to be a drag intention through the second and third timers, a drag box is generated based on the valid text content and displayed. This prompts the user that the copying of the target control's text content is complete and that the user can drag it when the target control is long-pressed. The drag frame controls the drag box to move with the finger, visually realizing the dragging of the text of the target control. When the drag box is dragged above the target sub-business icon, the second application launches the target sub-business and passes the text content of the drag box (or the text content of the target control) to the target sub-business, enabling the target sub-business to use the text content of the target control for timely business processing. This achieves rapid transfer of text content between the first application and the target sub-business while maintaining compatibility between the text drag-and-drop method and the native system's logic, thereby improving the user experience of electronic devices.
[0292] The above describes the module interaction flow in the scenario where the text control in the first application can actively report text content. The following describes the module interaction flow in the scenario where the text control in the first application cannot actively report text content.
[0293] For the scenario where the text control in the first application cannot actively report text content, Figure 11 This paper illustrates another module interaction flowchart provided in an embodiment of this application.
[0294] Figure 11 and Figure 4 The difference is Figure 11 Not included Figure 4 Steps S206, S207, and S214a in the embodiment, Figure 11 It also includes steps S214b-1, S214b-2, and S214b-3. Steps S206, S207, and S214a can represent the method by which the content recognition and filling framework obtains text content in a scenario where the target control supports text content reporting. Steps S214b-1, S214b-2, and S214b-3 can represent the method by which the content recognition and filling framework obtains text content in a scenario where the target control does not support text content reporting. Figure 11 The remaining steps and Figure 4 The steps in the embodiments are similar, and will not be repeated in this embodiment.
[0295] like Figure 11 As shown, the text drag-and-drop method provided in this application includes:
[0296] S100, the user opens the first application interface.
[0297] S101. The application (APP) loads the content of each view in the target page into the view frame.
[0298] S102, The view frame passes the root layout of the target page to the content-aware fill frame.
[0299] S103. The content-aware fill framework determines whether the application package name and / or page name of the target page are in the whitelist.
[0300] S104. Content-aware filling frame transmits the judgment result to the view frame.
[0301] S200: The event handling framework obtains the touch event when the target control is touched.
[0302] S201, The event handling framework passes touch events to the window management framework.
[0303] S202, The window management framework passes touch events to the view framework.
[0304] S203. If the view frame has received the affirmative judgment result transmitted by the content-aware fill frame, the view frame transmits the touch event to the content-aware fill frame.
[0305] S204. Content-aware fill frame responds to the fall event and sets a second timer.
[0306] S205. Touch events are passed internally within the view frame.
[0307] Optionally, steps S203 and S205 can be executed concurrently.
[0308] S208, The view frame responds to touch events.
[0309] S209. When the second timer reaches the second timeout duration, the content recognition filling frame queries the window management frame to see if a new window pops up around the target control.
[0310] S210: The window management framework determines whether a new window pops up around the target control.
[0311] S211, Window management framework notification content recognition fills the framework pop-up new window.
[0312] S212, Content-Aware Fill Framework sets a third timer. The third timer's third timing duration is equal to the second extension duration.
[0313] S213, when the third timer reaches the third timing duration, the content recognition filling frame determines that the user's finger has neither moved nor lifted.
[0314] S214b-1 If there is no text content in memory, the content recognition and filling framework searches for the control corresponding to the touch position in the root layout based on the touch position of the drop event.
[0315] For example, since the target control is a control of a different view format, in step S206, when the target control receives a drop event, it cannot report its text content to the content-aware fill framework. Therefore, the text content does not exist in memory, and the content-aware fill framework cannot obtain the text content from memory. The content-aware fill framework can traverse the root layout to find the control corresponding to the touch position of the drop event and obtain the control name of the found control. The found control is the target control.
[0316] Alternatively, if there is no text content in memory, the content-aware filling framework can also traverse the root layout to find the control corresponding to the touch position of the latest received movement event.
[0317] Optionally, S213 and S214b-1 can be executed concurrently.
[0318] S214b-2, Content-Aware Fill Framework determines whether the name of the found control is in the whitelist.
[0319] For example, the content-aware fill framework can determine whether the name of the found control is in the whitelist.
[0320] If so, the content-aware fill framework executes S214b-3.
[0321] If not, the content-aware fill framework will not perform subsequent drag-and-drop related steps, and the content-aware fill framework can clear the second timer, the third timer, and the obtained events.
[0322] S214b-3, Content-Aware Fill Frame retrieves the text content of the found controls from the view frame.
[0323] For example, the content-aware fill framework controls the found controls to call the accessibility node info method (oninitialize accessibility node info). The accessibility node info method is provided by the view framework. The view framework executes the relevant steps of the accessibility node info method to obtain the text content corresponding to the found controls and the layout of the found controls. The view framework then transmits the text content corresponding to the found controls and the layout of the found controls to the content-aware fill framework.
[0324] In this way, when the target control cannot report text content to the content recognition and filling framework, the content recognition and filling framework obtains the text content of the target control corresponding to the touch position and the layout of the target control through traversal search, so as to generate a drag view and pass the text content of the target control in order to realize dragging the text content of the target control.
[0325] S215. Content-Aware Fill Frame: Creates a draggable frame with shadows and rounded corners based on the text content.
[0326] S216, The content-aware fill framework calls the drag-and-drop framework's interface.
[0327] S217. The drag-and-drop frame monitors the window management frame and controls the drag-and-drop frame to move as the finger moves.
[0328] S218, The window management framework launches the second application, which in turn launches the sub-business.
[0329] The text drag-and-drop method provided in this embodiment, in a scenario where the text control in the first application cannot actively report text content, accurately determines, through the second and third timers, that the user's true intention for a long press operation is a dragging intention. It then searches the root layout for the control corresponding to the touch position of the drop event (i.e., the target control), or searches the root layout for the control corresponding to the touch position of the most recently received movement event (i.e., the target control). When it is determined that the control name of the found control is in the whitelist, the text content and layout of the found control are obtained from the view frame to generate a drag box. The drag box is then displayed so that when the target control is long-pressed... The system prompts the user that the copying of the target control's text content is complete and allows dragging. The drag frame moves with the finger, enabling dragging of the target control's text. When the drag frame is dragged above the target sub-business icon, the second application launches the target sub-business and passes the drag frame's text content (or the target control's text content) to it. This allows the target sub-business to process the data using the target control's text content promptly. This achieves rapid text content transfer between the first application and the target sub-business while maintaining compatibility between the text dragging method and the native system's logic, thus improving the user experience of electronic devices.
[0330] To facilitate understanding, the following sections will discuss... Figure 5 , Figure 6 , Figure 8 , Figure 9 and Figure 10 Please provide an explanation.
[0331] Figure 5 This illustration shows a flowchart of the module interaction in an embodiment of this application, depicting a finger movement scenario before the second timer exceeds the second timeout duration. For example... Figure 5 As shown, the text drag-and-drop method provided in this application embodiment may further include the following steps:
[0332] S300a After step S204 and before step S209, the event handling framework receives a move event.
[0333] S301, The event handling framework passes movement events to the window management framework.
[0334] S302, The window management frame passes move events to the view frame.
[0335] S303a, The view frame passes a move event to the content-aware fill frame.
[0336] S304. The content recognition filling framework determines whether the distance between the touch position of the movement event and the touch position of the fall event is greater than the second threshold. If it is less than or equal to the second threshold, no processing is performed. If it is greater than the second threshold, the second timer is canceled.
[0337] For example, the distance between the touch position of a movement event and the touch position of a drop event can be called the movement distance. The second threshold can be 10 pixels.
[0338] If the movement distance is less than or equal to the second threshold, it indicates that the user's operation is a long press. At this time, the second timer has not yet expired, so the content recognition filling framework does not process it.
[0339] A movement distance greater than the second threshold indicates that the user's intent is something other than a drag-and-drop intent. Other intents could include switching pages. The content-aware fill framework can cancel the second timer to terminate subsequent drag-and-drop related steps. The content-aware fill framework can also clear the obtained text content and touch events.
[0340] It is understandable that, between step S204 and step S209, while the user's finger remains on the display screen and moves, the electronic device can execute the process once for each movement event generated. Figure 5 The steps are shown in the example.
[0341] Understandably, if the finger moves before the third timer expires, the module interaction flow in that scenario will be different from the previous one. Figure 5 The module interaction process shown is similar and will not be described in detail again.
[0342] The text drag-and-drop method provided in this embodiment, after the content recognition and filling framework sets a timer, before the timer expires, if the user's finger moves, the content recognition and filling framework compares the touch position of the movement event with the touch position of the drop event to obtain the movement distance. If the movement distance is less than or equal to a second threshold, it can be determined that the user's operation intention may be a dragging intention, and the content recognition and filling framework can do nothing. If the movement distance is greater than the second threshold, it can be determined that the user's operation intention is not a dragging intention, and the content recognition and filling framework can cancel the set timer to terminate the execution of subsequent drag-related actions. In this way, by comparing the movement distance with the second threshold, the user's operation intention can be accurately determined. Based on the comparison result of the movement distance and the second threshold, the electronic device does not process or terminates the execution of subsequent drag-related actions, which can reduce the power consumption of the electronic device caused by invalid dragging, thereby improving the user's experience with the electronic device.
[0343] Figure 6 This illustration shows a flowchart of the module interaction in an embodiment of this application where the finger is lifted before the second timer exceeds the second timeout duration. Figure 6 As shown, the text drag-and-drop method provided in this application embodiment may further include the following steps:
[0344] S400a After step S204 and before step S209, the event handling framework receives a lift event.
[0345] S401, The event handling framework passes the lift event to the window management framework.
[0346] S402, The window management framework passes lift events to the control framework.
[0347] S403a, The control frame passes the lift event to the content-aware fill frame.
[0348] S404, Content-Aware Fill Frame Cancels Second Timer.
[0349] If a finger is lifted before the second timer expires, it indicates that the user's intention is not to drag. The content recognition filling framework can reduce the power consumption of electronic devices caused by invalid dragging by canceling the second timer and terminating the execution of subsequent drag-related steps.
[0350] Understandably, if a finger is lifted before the third timer expires, the module interaction flow in that scenario will be different. Figure 6 The module interaction process shown is similar and will not be described in detail again.
[0351] The text drag-and-drop method provided in this embodiment allows the content recognition and filling framework to determine that the user's intention is not a drag-and-drop intention if the user lifts their finger before the timer expires after the timer is set. The content recognition and filling framework can then cancel the timer, causing the electronic device to terminate subsequent drag-and-drop steps, thereby reducing the power consumption caused by invalid dragging and improving the user experience.
[0352] Figure 8 This illustration shows a flowchart of the module interaction in a finger movement scenario after calling the drag-and-drop framework interface, as shown in an embodiment of this application. Figure 8 As shown, the text drag-and-drop method provided in this application embodiment further includes:
[0353] S300b After step S216, the event handling framework receives a movement event from the user's finger.
[0354] S301, The event handling framework passes movement events to the window management framework.
[0355] S302, The window management frame passes move events to the view frame.
[0356] S303b: The view frame passes movement events to the drag frame.
[0357] S305, Drag Frame Control: The drag frame moves as the touch position moves.
[0358] While the finger remains on the display screen and moves across it, the drag frame continuously receives movement events transmitted by the event handling frame at a fixed sampling frequency through steps S301, S302, and S303b. The drag frame can be controlled to move as the touch position moves. For the specific implementation and technical effects of the drag frame moving with the touch position, please refer to [link to relevant documentation]. Figure 4 Step S217 in the embodiment will not be repeated here.
[0359] The text drag-and-drop method provided in this embodiment, in scenarios where the finger moves after calling the drag-and-drop framework interface, controls the drag-and-drop box to move with the touch position, which can improve the user's intuitive experience of flexibly dragging and moving the drag-and-drop box. Users can flexibly move the drag-and-drop box above the icon of the target sub-service in the sidebar, so that the target sub-service can promptly use the content in the drag-and-drop box for business processing. This improves the user experience of electronic devices.
[0360] Figure 9 This illustration shows a module interaction flowchart in an embodiment of this application, depicting a scenario where a finger is lifted after the drag-and-drop framework interface has been invoked. For example... Figure 9 As shown, the text drag-and-drop method provided in this application embodiment further includes:
[0361] S400b After step S216, the event handling framework receives a lift event.
[0362] For example, after step S216, if the second application is launched, the electronic device displays a sidebar. When the user's finger moves over the target sub-service icon in the sidebar, the finger is lifted. The event handling framework receives the lift event.
[0363] S401, The event handling framework passes the lift event to the window management framework.
[0364] S402, The window management frame passes lift events to the view frame.
[0365] S403b: The view frame passes the lift event to the drag frame.
[0366] S405a: When the drag frame determines that the finger is lifted within the sidebar (or the window of the second application), the text content of the drag frame is passed to the second application.
[0367] For example, the touch position in the lift event represents the last touch position on the display (or the position where the user's finger lifted). The drag frame can determine whether the touch position of the lift event is within the sidebar. If so, the drag frame passes the lift event and the text content of the drag box to the second application. If not, the drag frame can control the drag box to return to the starting position, as detailed later. Figure 10 Step S405b in the embodiment.
[0368] S406, The second application launches the target sub-business.
[0369] For example, the finger lift position within the sidebar (or the window of the second application) may include the finger lift position being above a sub-service icon in the sidebar. The second application can identify the sub-service icon corresponding to the touch position of the lift event. The second application determines that the sub-service corresponding to the identified sub-service icon is the target sub-service. The second application pulls up the target sub-service and passes the text content of the drag box to the target sub-service. The target sub-service uses the text content of the drag box to perform business processing.
[0370] For details on the implementation of steps S405a-S406, please refer to [link / reference]. Figure 4 Step S218 in the embodiment will not be repeated here.
[0371] The text drag-and-drop method provided in this embodiment, in scenarios where the finger is lifted above the target sub-business icon after calling the drag-and-drop framework interface, can improve the accuracy of recognizing the user's operation intent by determining that the finger is lifted above the target sub-business icon and then passing the text content of the drag-and-drop box to the target sub-business. This allows the target sub-business to use the text content of the drag-and-drop box to perform business processing in a timely manner, thereby improving the user's experience with electronic devices.
[0372] Figure 10 This illustration shows a module interaction flowchart in an embodiment of this application, depicting a scenario where the finger is lifted above the target page's window after the drag-and-drop framework interface is invoked. Figure 10 As shown, the text drag-and-drop method provided in this application embodiment further includes:
[0373] S400b After step S216, the event handling framework receives a lift event.
[0374] S401, The event handling framework passes the lift event to the window management framework.
[0375] S402, The window management frame passes lift events to the view frame.
[0376] S403b: The view frame passes the lift event to the drag frame.
[0377] S405b: If the drag frame determines that the finger is lifted within the window of the application to be dragged (i.e., the first application), then control the drag frame to return to the starting position.
[0378] For example, Figure 12 The diagram illustrates a scenario where a finger is lifted after the drag-and-drop frame interface is invoked. Following step S216, if the user's finger moves to the hot area, the sidebar is pulled up, and the electronic device can display... Figure 12 The interface shown in 'a'. Figure 12 The content of the interface shown in 'a' can be found in [reference]. Figure 3 The content of the interface shown by d in the figure will not be described again here.
[0379] exist Figure 12 On the interface shown in Figure 'a', if the user lifts their finger when it is within the first application's page window 30, the electronic device can display... Figure 12 The interface shown in b is shown in the image. Figure 12 The content of the interface shown in b can be found in [reference]. Figure 3 The contents of the interface shown in 'c' will not be described again. Figure 12 The interface shown in b is the same as Figure 3 The difference between the interface shown in c is that, in Figure 12 In the interface shown in b, the position of the drag box 312 is the same as the position of the control 310.
[0380] from Figure 12 As shown in interfaces a and b, after step S216, if the user lifts their finger from above the page window 30, it means the finger is lifted within the drag-and-drop application window. The drag frame can control the drag box 312 to return to the starting position, which is the position of control 310. Figure 12 On the interface shown in Figure 'a', if the finger is lifted, it leaves the hot zone, so the sidebar disappears, and the electronic device only displays the following: Figure 12 The window of the target page shown in b.
[0381] The text drag-and-drop method provided in this embodiment, in the scenario where the finger is lifted within the window of the starting application (i.e., the first application) after calling the drag-and-drop framework interface, can determine that the user has canceled the drag by judging that the last touch position was within the window of the starting application. Then, the drag box can be controlled to return to the starting position, which can improve the user's experience of using the electronic device.
[0382] Optionally, the whitelist in this application embodiment may be built into the electronic device's system or obtained by the electronic device from a server.
[0383] Figure 13 This diagram illustrates the process of saving a whitelist on an electronic device. Figure 13As shown, the process includes:
[0384] S600, Electronic device powered on.
[0385] S601, Electronic device startup list loading service.
[0386] For example, the electronic device obtains a built-in whitelist from the system, and / or the electronic device obtains a cloud testing push whitelist from the server.
[0387] For example, the built-in whitelist may include a first whitelist identifier, a first whitelist version, and first whitelist content. The first whitelist content includes multiple application package names, multiple page names, and multiple control names that support system drag-and-drop. The cloud testing push whitelist may include a second whitelist identifier, a second whitelist version, and second whitelist content. The second whitelist content includes multiple application package names, multiple page names, and multiple control names that support system drag-and-drop.
[0388] S602. The electronic device parses the obtained whitelist.
[0389] For example, the format of the built-in whitelist can be either XML or a non-XML format. If the format of the built-in whitelist is not XML, the electronic device will convert the obtained built-in whitelist format into XML. The electronic device can then read the first whitelist identifier, the first whitelist version, and the first whitelist content from the XML-formatted built-in whitelist.
[0390] To reduce the amount of data transmitted when the server sends the cloud testing push whitelist to electronic devices, the format of the cloud testing push whitelist obtained by the electronic device can be non-XML format. Therefore, the electronic device converts the obtained cloud testing push whitelist to XML format. The electronic device can then read the second whitelist identifier, the second whitelist version, and the second whitelist content from the XML format cloud testing push whitelist.
[0391] S603. The electronic device determines whether the obtained whitelist has been updated.
[0392] For example, if the electronic device obtains the built-in whitelist and the cloud testing push whitelist in step S601, the electronic device can determine whether the cloud testing push whitelist has been updated compared to the built-in whitelist.
[0393] For example, electronic devices determine whether the first whitelist identifier and the second whitelist identifier are the same.
[0394] If they are the same, the electronic device determines whether the first whitelist version and the second whitelist version are the same.
[0395] If they are different, the electronic device determines that the cloud testing push whitelist has been updated compared to the built-in whitelist, and the electronic device can execute S604 and S605 in sequence.
[0396] If they are the same, the electronic device determines that the cloud testing push whitelist has not been updated compared to the built-in whitelist, and the electronic device can execute S605.
[0397] For example, if the electronic device obtains the built-in whitelist in step S601, the electronic device determines whether the whitelist exists in memory.
[0398] If it does not exist, the electronic device executes step S604.
[0399] If it exists, the electronic device determines whether the built-in whitelist has been updated compared to the whitelist in memory. If it has not been updated, step S605 is executed.
[0400] For example, if the electronic device obtains the cloud testing push whitelist in step S601, the electronic device determines whether the whitelist exists in memory.
[0401] If it does not exist, the electronic device executes step S604.
[0402] If it exists, the electronic device determines whether the cloud testing push whitelist has been updated compared to the whitelist in memory. If it has been updated, step S604 is executed; if it has not been updated, step S605 is executed.
[0403] It is understandable that the method used by electronic devices to determine whether the built-in whitelist has been updated compared to the whitelist in memory is similar to the method used by electronic devices to determine whether the whitelist pushed by cloud testing has been updated compared to the built-in whitelist, and will not be elaborated further.
[0404] S604. Electronic devices save the updated whitelist.
[0405] For example, an electronic device can store the updated whitelist content in memory.
[0406] Alternatively, electronic devices can also store the updated whitelist in XML format in memory.
[0407] S605, Electronic devices end the whitelist saving process.
[0408] For example, an electronic device determines whether a whitelist exists in memory.
[0409] If so, the electronic device can clear the information obtained in steps S601-S603 and end the whitelist saving process.
[0410] If not, the electronic device stores the whitelist content or XML format whitelist read in step S602 in memory, clears the information obtained in steps S601-S603, and ends the whitelist saving process.
[0411] The server can periodically update the cloud testing push whitelist stored on the server and notify the electronic devices under the server.
[0412] For example, such as Figure 13 As shown in S700-S701:
[0413] S700 servers periodically update the cloud testing push whitelist stored on the server.
[0414] S701. After completing the update of the cloud testing push whitelist, the server can send a push success broadcast to its subordinate electronic devices. The push success broadcast can be used to notify the electronic devices that the cloud testing push whitelist stored in the server has been updated. Upon receiving the push success broadcast, the electronic device can sequentially execute steps S601-S605, or sequentially execute steps S601, S602, S603, and S605.
[0415] The whitelist saving method proposed in this embodiment can enable electronic devices to receive updated whitelists in a timely manner. This allows electronic devices to drag and drop text from more third-party applications that do not support drag-and-drop functionality, thereby expanding the application scope of the text drag-and-drop method provided in this embodiment and improving the user experience of the electronic device.
[0416] As can be seen from the embodiments shown above, the text drag-and-drop method provided in this application is a system-level drag-and-drop method. Regardless of whether the application itself supports drag-and-drop, and regardless of whether the text control of the application is in TextView format, as long as the page name of the target page and the control name of the text control are in the whitelist, the text drag-and-drop method provided in this application can realize the dragging and dropping of the text content of the text control, so that the text content of the text control can be conveniently and quickly transferred between the application and sub-business, thereby improving the user's experience of using electronic devices.
[0417] This application embodiment also provides a text drag-and-drop method, the method including S801-S804:
[0418] S801. An electronic device displays a first interface of a first application, the first interface including a first view, the first view including first text content.
[0419] S802, In response to a first touch operation on the first text content, the electronic device starts a first timer and a second timer. The timing duration of the first timer is a first duration, and the timing duration of the second timer is a second duration, which is the sum of the first duration and the delay duration.
[0420] S803, while the first touch operation is held down, in response to the first timer reaching a first duration, the electronic device displays a first pop-up window around the first text content, the first pop-up window including one or more controls.
[0421] S804, while the first touch operation is held down, in response to the second timer reaching the second duration, the electronic device displays a drag box, the drag box including the first text content.
[0422] In this embodiment, the electronic device may be Figure 4 The electronic device in the embodiment, the first application may be Figure 4 The first application in the embodiment, the first interface may be Figure 4 The first view of the target page display interface in the embodiment may be... Figure 4 In the embodiment, the target control's first text content can be... Figure 4 The text content of the target control in the embodiment, the first timer can be Figure 4 The first timer in the embodiment, the second timer can be Figure 4 The second timer in the embodiment may have a first duration of [missing information]. Figure 4 The first timing duration or system long press duration in the embodiment, the second duration can be... Figure 4 The second timing duration in the embodiment can be a delay duration. Figure 4 In the embodiment, the first extended duration and the first pop-up window can be... Figure 4 The new window in the embodiment, the first pop-up window can also be Figure 7 In the embodiment, the new window 71, the first pop-up window includes controls that can be Figure 7 The controls in the new window 71 in the embodiment, the drag box can be Figure 4 In the embodiment, a drag-and-drop box can also be... Figure 3 The drag box 312 is shown in the embodiment.
[0423] It is understood that the first view in this embodiment can also be Figure 11 The target control in this embodiment. The first text content in this embodiment could also be... Figure 11 The text content of the target control in the example.
[0424] It is understandable that holding down a touch operation can be interpreted as neither moving nor lifting the touch.
[0425] For a detailed implementation of S801-S804 in this embodiment, please refer to [link / reference]. Figure 4 For a detailed implementation of steps S100-S215 in the embodiment, please refer to [link / reference]. Figure 11 The specific implementation of steps S100-S215 in this embodiment will not be repeated here. In this embodiment, the second duration can be used to determine whether the user intent corresponding to the first touch operation is a drag-and-drop intent. If the second timer reaches the second duration while the first touch operation is held down, it can be determined that the user intent corresponding to the first touch operation is a drag-and-drop intent. The electronic device can display a drag-and-drop box containing the first text content to prompt the user that the copying of the first text content has been completed and can be dragged when the first touch operation is neither lifted nor moved. This can reduce the number of operations to copy the first text content, thereby improving the user's experience with the electronic device. The second duration is the sum of the first duration and the delay duration, and it can also achieve compatibility between the display logic of the drag-and-drop box and the display logic of the pop-up window.
[0426] Optionally, embodiments of this application also provide a text drag-and-drop method that may further include S805-S806.
[0427] S805, in response to the first touch operation moving to a first area of the electronic device's display screen, the electronic device launches a second application and displays a window of the second application in a second area of the display screen. The window of the second application includes one or more icons, each icon corresponding to a service capable of receiving the first text content.
[0428] S806, the first touch operation moves to the position of the target icon among one or more icons, and in response to the first touch operation being lifted, the second application transmits the first text content to the business corresponding to the target icon.
[0429] For example, the first region can be Figure 4 The hot zone in the embodiment may be, for example, Figure 3 The invisible hot zone 31 in the embodiment can be used as a second application. Figure 4 The second application in the embodiment, the second region, for example Figure 3 In the embodiment, the area where the sidebar 32 is located includes one or more icons in the window of the second application, such as... Figure 3 In the embodiment, the icons included in the sidebar 32, and the icons in the window of the second application, correspond to the services, for example... Figure 3 Example of sub-services. The specific implementation principles and technical effects of S805-S806 are as follows: Figure 4 The specific implementation principle and technical effect of S218 in the embodiment are similar. Optionally, the first region may include the second region, and the area of the first region may be greater than or equal to the area of the second region. The first region may also be the second region.
[0430] This allows a second application to be launched during the first touch operation. The second application's window includes one or more icons, enabling users to easily select the target service. The target service is the service corresponding to the target icon. When the first touch operation moves to the target icon among the one or more icons, in response to the first touch operation being lifted, the second application transmits the first text content to the service corresponding to the target icon. This enables convenient and rapid transmission of the first text content between the first application and the target service, reducing the number of steps required for the user to activate the target service and improving the user experience.
[0431] Optionally, before the electronic device displays the drag box, the text dragging method provided in this application embodiment further includes:
[0432] When the second timer reaches the second duration, the electronic device detects that it has displayed the first pop-up window in response to the first touch operation.
[0433] The electronic device starts a third timer, and the duration of the third timer is the third duration. The third duration is greater than or equal to the delay duration.
[0434] When the third timer reaches its third duration, the electronic device processes the first text content to obtain a drag-and-drop box.
[0435] In this embodiment, the electronic device displays a first pop-up window in response to a first touch operation, and starts a third timer. The specific implementation principle of obtaining the draggable box when the third timer reaches its third duration can be found in [reference needed]. Figure 4 The specific implementation principle shown in steps S209-S215 of the embodiment can also be found in [reference needed]. Figure 11 The specific implementation principle shown in steps S209-S215 of the embodiment will not be elaborated here.
[0436] When an electronic device displays a pop-up window, the user intent corresponding to the first touch operation could be either an intention to operate on the pop-up window or a drag-and-drop intention. Therefore, when determining whether the electronic device displays the pop-up window in response to the first touch operation, a third timer and a third duration can be used to further accurately determine whether the user intent corresponding to the first touch operation is a drag-and-drop intention. If the first touch operation neither moves nor is released when the third timer reaches the third duration, it indicates that the user intent corresponding to the first touch operation is a drag-and-drop intention, and the electronic device obtains a drag-and-drop box and displays it to prompt the user to drag.
[0437] Optionally, in response to a first touch operation on the first text content, the method further includes:
[0438] In response to a down event of a first touch operation applied to the first view, the electronic device determines whether the view name of the first view is in a preset list. The preset list includes the view names of one or more views that support system dragging.
[0439] When the electronic device determines that the view name of the first view is in a preset list, the electronic device stores the first text content in memory.
[0440] In this embodiment, the view name of the first view can be... Figure 4 The target control name in the embodiment can be a preset list. Figure 4 In the embodiments, the whitelist, the preset list includes one or more view names that support system drag and drop. Figure 4 In this embodiment, the whitelist includes the names of one or more draggable controls. The specific implementation of the electronic device determining whether the view name of the first view is in the preset list, and when the electronic device determines that the view name of the first view is in the preset list, storing the first text content in memory, is similar to... Figure 4 The specific implementation of steps S206-S207 in the embodiment is similar, and will not be repeated here.
[0441] In this way, when the first view is in TextView format, the first view actively reports its view name and first text content. The electronic device receives the reported view name and first text content and stores the first text content in memory. This allows for quick creation of a drag box using the first text content when the user intent corresponding to the first touch operation is determined to be a drag intent. The TextView format represents an implementation that inherits from Android's native text view.
[0442] Optionally, when the third timer reaches the third duration, the electronic device can process the first text content according to the steps shown in S8041-S8042 to obtain a drag-and-drop box, including:
[0443] S8041. When the third timer reaches the third duration, the electronic device determines whether the first text content exists in the memory.
[0444] S8042. When the electronic device determines that the first text content exists in the memory, the electronic device creates a drag-and-drop box using preset configuration parameters and the first text content. The preset configuration parameters include the length and width of the drag-and-drop box, the position of the touch position on the drag-and-drop box, the shadow format of the drag-and-drop box, the shadow color of the drag-and-drop box, and the rounded corners of the drag-and-drop box.
[0445] The specific implementation principle and technical effects of the steps shown in S8041-S8042 are as follows: Figure 4The specific implementation principles and technical effects of steps S214a and S215 in the embodiment are similar. This achieves the creation of the drag-and-drop box, allowing the drag-and-drop box to contain the first text content.
[0446] Optionally, when the third timer reaches the third duration, the electronic device processes the first text content to obtain the drag box in a manner as shown in S8043-S8047.
[0447] S8043. When the third timer reaches the third duration, the electronic device determines whether the first text content exists in the memory.
[0448] S8044. When the electronic device determines that the first text content does not exist in memory, the electronic device searches for the view corresponding to the down event of the first touch operation in the root layout of the page to which the first text content belongs, and obtains the view name of the first view. The root layout includes the storage hierarchy of the first view. The specific implementation principle of this step is similar to... Figure 11 The specific implementation principle of S214b-1 in the embodiment is similar, and will not be repeated here.
[0449] S8045. The electronic device determines whether the view name of the first view is in a preset list, which includes the view names of one or more views that support system drag-and-drop. The specific implementation principle and technical effects of this step are... Figure 11 The specific implementation principle and technical effect of S214b-2 in the embodiment are similar, and will not be repeated here.
[0450] S8046. When the electronic device determines that the view name of the first view is in a preset list, the electronic device obtains the first text content of the first view. The specific implementation principle and technical effect of this step are as follows: Figure 11 The specific implementation principle and technical effect of S214b-3 in the embodiment are similar, and will not be repeated here.
[0451] S8047. The electronic device creates a drag-and-drop box using preset configuration parameters and first text content. The preset configuration parameters include the length and width of the drag-and-drop box, the position of the touch point on the drag-and-drop box, the shadow format of the drag-and-drop box, the shadow color of the drag-and-drop box, and the rounded corners of the drag-and-drop box. The specific implementation principle and technical effects of this step are related to... Figure 11 The specific implementation principle and technical effect of S215 in the embodiment are similar, and will not be repeated here.
[0452] In scenarios where the first view's format is not TextView but another view format, the first view cannot actively report its view name and first text content, and the electronic device cannot obtain the first view's view name and first text content from memory, the root layout can be traversed to find the control corresponding to the touch position of the first touch operation's down event and the view frame can be called to obtain the first text content of the found control, i.e., the target control.
[0453] Optionally, the electronic device may obtain a new list from a server or other device and update a preset list on the electronic device as follows: The electronic device obtains a new list. The electronic device determines whether the new list is an update to the preset list. When the electronic device determines that the new list is a whitelist that updates the preset list, the electronic device updates the preset list with the new list.
[0454] The specific implementation principle and technical effects of the preset list update in this embodiment are as follows: Figure 13 The specific implementation principle and technical effect of whitelist updating in the embodiments are similar, and will not be repeated here.
[0455] Optionally, in response to the second timer reaching the second duration, after the electronic device displays the drag box, in response to the first touch operation moving to the first area of the electronic device's display screen, the electronic device pulls up the second application and displays the window of the second application in the second area of the display screen.
[0456] The first touch operation moves the device to the third area of the display screen. The drag box moves to the third area along with the first touch operation. In response to the first touch operation being lifted, the electronic device controls the drag box to return to the starting position of the drag. The third area does not include the second area.
[0457] For example, the third region could be Figure 4 The display window of the target page in the embodiment, for example Figure 3 The page window 30 in this embodiment. In response to a first touch operation moving to a first area of the electronic device's display screen, the electronic device launches a second application, displaying the window of the second application in a second area of the display screen. The specific implementation principle and technical effects are related to... Figure 3 The implementation principles and technical effects in the corresponding embodiments are similar and will not be repeated here. The specific implementation principle and technical effects of the electronic device controlling the drag box to return to the starting position in response to the first touch operation being lifted are the same as... Figure 10 The specific implementation principles and technical effects of the embodiments are similar, and will not be repeated here.
[0458] This allows a second application to be launched during the first touch operation. The second application's window includes one or more icons, enabling users to easily select the target service. The target service is the service corresponding to the target icon. In scenarios where the first touch operation is lifted before moving to the second area, the electronic device controls the drag box to return to the starting position in response to the first touch operation being lifted, providing a drag cancellation view experience and improving the user experience.
[0459] Optionally, the second area is the sidebar on the right side of the display screen. For example, a sidebar... Figure 3 The sidebar 32 in this embodiment provides ample display space for the first application window, making it easy for users to view and search, while also facilitating dragging of the drag box and selection of target icons, thus improving the user experience.
[0460] Optionally, the text drag-and-drop method provided in this embodiment further includes S807-S810:
[0461] S807, the electronic device displays a second interface with a third application, the second interface including a second view, the second view including second text content.
[0462] S808, in response to a second touch operation on the second text content, the electronic device starts a first timer and a second timer.
[0463] S809, while the second touch operation is held down, in response to the first timer reaching a first duration, the electronic device displays a second pop-up window around the second text content, the second pop-up window including one or more controls.
[0464] S810, if the second timer has not reached the second duration, the electronic device turns off the second timer in response to the second touch operation movement.
[0465] For example, a third application could be Figure 4 In the first application of the embodiment, the second interface may be Figure 4 In the embodiment, the second view of the target page display interface can be... Figure 4 In the embodiment, the target control, the second text content can be... Figure 4 The text content of the target control in the embodiment, the second pop-up window can be Figure 4 The new window in the embodiment, the second pop-up window can also be Figure 7 In the embodiment, the new window 71, the second pop-up window includes controls that can be Figure 7 The controls in the new window 71 in the embodiment. For the specific implementation principles and technical effects of S807-S809, please refer to... Figure 4 The specific implementation principles and technical effects of S100-S208 in the embodiment. For the specific implementation principles and technical effects of S810, please refer to... Figure 5 The specific implementation principles and technical effects of the embodiments.
[0466] In this way, if the second touch operation moves before the second timer reaches its second duration, it indicates that the user's intention corresponding to the second touch operation is not a drag intention. Once it is determined that the user's intention is not a drag intention, the electronic device closes the second timer, terminating the subsequent dragging process and reducing the power consumption of invalid drags.
[0467] Optionally, the text drag-and-drop method provided in this embodiment further includes S811-S814:
[0468] S811, the electronic device displays a third interface for a fourth application, the third interface including a third view, the third view including third text content.
[0469] S812, In response to a third touch operation on third text content, the electronic device sets and starts a first timer and a second timer.
[0470] S813, while the third touch operation is held down, in response to the first timer reaching the first duration, the electronic device displays a third pop-up window around the third text content, the third pop-up window including one or more controls.
[0471] S814, if the second timer has not reached the second duration, the electronic device turns off the second timer in response to the third touch operation.
[0472] For example, the fourth application could be Figure 4 In the first application of the embodiment, the third interface may be Figure 4 In this embodiment, the third view of the target page display interface can be... Figure 4 In the embodiment, the target control, the third text content can be... Figure 4 The text content of the target control in the embodiment, the third pop-up window can be Figure 4 The new window in the embodiment, the third pop-up window, can also be Figure 7 In the embodiment, the new window 71, the third pop-up window includes controls that can be Figure 7 The controls in the new window 71 in the embodiment. For the specific implementation principles and technical effects of S811-S813, please refer to... Figure 4 The specific implementation principles and technical effects of S100-S208 in the embodiment. For the specific implementation principles and technical effects of S814, please refer to... Figure 6 The specific implementation principles and technical effects of the embodiments.
[0473] In this way, if the second timer does not reach its second duration and the third touch operation is lifted, it indicates that the user's intention corresponding to the third touch operation is not a drag intention. Upon determining that the user's intention is not a drag intention, the electronic device closes the second timer, terminating the subsequent dragging process and reducing power consumption from invalid drags.
[0474] Optionally, the text drag-and-drop method provided in this embodiment further includes S815-S819:
[0475] S815, the electronic device displays a fourth interface for a fifth application, the fourth interface including a fourth view, the fourth view including fourth text content.
[0476] S816, In response to a fourth touch operation on the fourth text content, the electronic device starts the first timer and the second timer.
[0477] S817. While the fourth touch operation is held down, in response to the first timer reaching a first duration, the electronic device displays a fourth pop-up window around the fourth text content, the fourth pop-up window including one or more controls.
[0478] S818. While the fourth touch operation is held down, in response to the second timer reaching the second duration, the electronic device detects that the fourth pop-up window was displayed in response to the fourth touch operation, and the electronic device starts the third timer. The duration of the third timer is the third duration. The third duration is greater than or equal to the delay duration.
[0479] S819. If the third timer has not reached the third duration, the electronic device turns off the third timer in response to the fourth touch operation movement.
[0480] For example, the fifth application could be Figure 4 In the first application of the embodiment, the fourth interface may be Figure 4 In the embodiment, the fourth view of the target page display interface can be... Figure 4 In the embodiment, the target control, the fourth text content can be... Figure 4 The text content of the target control in the embodiment, the fourth pop-up window can be Figure 4 The new window in the embodiment, the fourth pop-up window, can also be... Figure 7 In the embodiment, the new window 71, the fourth pop-up window, includes controls that can be... Figure 7 The controls in the new window 71 in the embodiment. For the specific implementation principles and technical effects of S815-S818, please refer to... Figure 4 The specific implementation principles and technical effects of S100-S212 in the embodiment are explained. The specific implementation principles and technical effects of S819 can be found in the specific implementation principles and technical effects of S810.
[0481] Thus, if the third timer does not reach its third duration and the fourth touch operation occurs, it indicates that the user's intention for the fourth touch operation is not a drag intention. Upon determining that the user's intention is not a drag intention, the electronic device closes the second timer, terminating the subsequent dragging process and reducing power consumption from invalid drags.
[0482] Optionally, the text drag-and-drop method provided in this embodiment further includes S820-S824:
[0483] S820, the electronic device displays a fifth interface of a sixth application, the fifth interface includes a fifth view, and the fifth view includes fifth text content.
[0484] S821, In response to a fifth touch operation on the fifth text content, the electronic device starts the first timer and the second timer.
[0485] S822, while the fifth touch operation is held down, in response to the first timer reaching the first duration, the electronic device displays a fifth pop-up window around the fifth text content, the fifth pop-up window including one or more controls.
[0486] S823. While the fifth touch operation is held down, in response to the second timer reaching the second duration, the electronic device detects that the fifth pop-up window was displayed in response to the fifth touch operation, and the electronic device starts the third timer. The duration of the third timer is the third duration. The third duration is greater than or equal to the delay duration.
[0487] S824. If the third timer has not reached its third duration, the electronic device turns off the third timer in response to the fifth touch operation being lifted.
[0488] For example, the sixth application could be Figure 4 In the first application of the embodiment, the fifth interface may be Figure 4 The fifth view of the target page display interface in the embodiment may be... Figure 4 In the embodiment, the target control, the fifth text content, can be... Figure 4 The text content of the target control in the embodiment, the fifth pop-up window can be Figure 4 The new window in the embodiment, the fifth pop-up window, can also be... Figure 7 In the embodiment, the controls included in the new window 71, the fifth pop-up window, can be... Figure 7 The controls in the new window 71 in the embodiment. For the specific implementation principles and technical effects of S820-S823, please refer to... Figure 4 The specific implementation principles and technical effects of S100-S212 in the embodiment are explained. The specific implementation principles and technical effects of S824 can be found in the specific implementation principles and technical effects of S814.
[0489] Thus, if the third timer does not reach its third duration and the fifth touch operation is lifted, it indicates that the user's intention for the fifth touch operation is not a drag intention. Upon determining that the user's intention is not a drag intention, the electronic device closes the second timer, terminating the subsequent dragging process and reducing power consumption from invalid drags.
[0490] The text drag-and-drop method provided in this application can be applied to electronic devices with communication functions. Electronic devices include terminal devices, and the specific device form of the terminal device can be referred to the above-mentioned descriptions, which will not be repeated here.
[0491] This application provides an electronic device, which includes a processor and a memory; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory, causing the electronic device to perform the above-described method.
[0492] This application provides a chip. The chip includes a processor, which is used to call a computer program in memory to execute the technical solutions in the above embodiments. Its implementation principle and technical effects are similar to those in the related embodiments described above, and will not be repeated here.
[0493] This application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, it implements the methods described above. The methods described in the above embodiments can be implemented wholly or partially by software, hardware, firmware, or any combination thereof. If implemented in software, the functionality can be stored as one or more instructions or code on or transmitted over the computer-readable medium. The computer-readable medium can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium accessible by a computer.
[0494] In one possible implementation, a computer-readable medium may include RAM, ROM, compact disc read-only memory (CD-ROM) or other optical disc storage, disk storage or other magnetic storage devices, or any other medium targeted to carry or to store the required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0495] This application provides a computer program product, which includes a computer program that, when run, causes a computer to perform the above-described method.
[0496] This application describes embodiments of methods, apparatus (systems), and computer program products according to embodiments of this application with reference to flowchart illustrations and / or block diagrams. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processing unit of the computer or other programmable data processing device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0497] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.
Claims
1. A text drag-and-drop method, characterized in that, The method includes: An electronic device displays a first interface of a first application, the first interface including a first view, the first view including first text content; In response to a first touch operation on the first text content, the electronic device starts a first timer and a second timer. The timing duration of the first timer is a first duration, and the timing duration of the second timer is a second duration. The second duration is the sum of the first duration and the delay duration. The second duration is used to determine whether the user intent corresponding to the first touch operation is a drag intent. While the first touch operation is held down, in response to the first timer reaching the first duration, the electronic device displays a first pop-up window around the first text content, the first pop-up window including one or more controls; While the first touch operation is held down, in response to the second timer reaching the second duration, the electronic device displays a drag box, the drag box including the first text content; Before the electronic device displays the drag box, the method further includes: When the second timer reaches the second duration, the electronic device queries whether the electronic device displayed the first pop-up window in response to the first touch operation; If the first pop-up window is not displayed, the electronic device processes the first text content to obtain the drag box; If the first pop-up window is displayed, the electronic device starts a third timer, the duration of which is a third duration; the third duration is greater than or equal to the delay duration; and when the third timer reaches the third duration, the electronic device processes the first text content to obtain the drag box, wherein the first pop-up window continues to be displayed on the first interface before the third timer exceeds the third duration, and the third duration is used to determine whether the user intent corresponding to the first touch operation in the scenario where the first pop-up window exists is a drag intent.
2. The method according to claim 1, characterized in that, In response to a first touch operation on the first text content, the method further includes: In response to a down event of the first touch operation applied to the first view, the electronic device determines whether the view name of the first view is in a preset list; the preset list includes the view names of one or more views that support system dragging; When the electronic device determines that the view name of the first view is in the preset list, the electronic device stores the first text content in memory.
3. The method according to claim 2, characterized in that, When the third timer reaches the third duration, the electronic device processes the first text content to obtain the drag box, including: When the third timer reaches the third duration, the electronic device determines whether the first text content exists in the memory; When the electronic device determines that the first text content exists in the memory, the electronic device uses preset configuration parameters and the first text content to create the drag box; the preset configuration parameters include the length and width of the drag box, the position of the touch position on the drag box, the shadow format of the drag box, the shadow color of the drag box, and the rounded corners of the drag box.
4. The method according to claim 1, characterized in that, When the third timer reaches the third duration, the electronic device processes the first text content to obtain the drag box, including: When the third timer reaches the third duration, the electronic device determines whether the first text content exists in the memory; When the electronic device determines that the first text content does not exist in the memory, the electronic device searches for the view corresponding to the down event of the first touch operation in the root layout of the page to which the first text content belongs, and obtains the view name of the first view; the root layout includes the storage hierarchy of the first view; The electronic device determines whether the view name of the first view is in a preset list, the preset list including the view names of one or more views that support system dragging; When the electronic device determines that the view name of the first view is in the preset list, the electronic device obtains the first text content of the first view; The electronic device uses preset configuration parameters and the first text content to create the drag box; the preset configuration parameters include the length and width of the drag box, the position of the touch position on the drag box, the shadow format of the drag box, the shadow color of the drag box, and the rounded corners of the drag box.
5. The method according to any one of claims 2-4, characterized in that, Also includes: The electronic devices received a new list; The electronic device determines whether the new list is an update to the preset list; When the electronic device determines that the new list is a whitelist that updates the preset list, the electronic device updates the preset list to the new list.
6. The method according to any one of claims 1-4, characterized in that, Also includes: In response to the first touch operation moving to a first area of the display screen of the electronic device, the electronic device launches a second application and displays a window of the second application in a second area of the display screen; The window of the second application includes one or more icons, each icon corresponding to a service that can receive the first text content; The first touch operation moves to the position of the target icon among the one or more icons, and in response to the first touch operation being lifted, the second application transmits the first text content to the service corresponding to the target icon.
7. The method according to any one of claims 1-4, characterized in that, When the first touch operation is held down, in response to the second timer reaching the second duration, the electronic device displays a drag-and-drop box. After including the first text content, the drag-and-drop box also includes: In response to the first touch operation moving to a first area of the display screen of the electronic device, the electronic device launches a second application and displays a window of the second application in a second area of the display screen; the window of the second application includes one or more icons, each of which corresponds to a service capable of receiving the first text content; The first touch operation moves to the third area of the display screen, and the drag box moves to the third area along with the first touch operation. In response to the first touch operation being lifted, the electronic device controls the drag box to return to the position where the drag started; the third area does not include the second area.
8. The method according to claim 6, characterized in that, The second area is the sidebar on the right side of the display screen.
9. The method according to any one of claims 1-4 and 8, characterized in that, Also includes: The electronic device displays a second interface of a third application, the second interface including a second view, the second view including second text content; In response to a second touch operation applied to the second text content, the electronic device starts the first timer and the second timer; While the second touch operation is held down, in response to the first timer reaching the first duration, the electronic device displays a second pop-up window around the second text content, the second pop-up window including one or more controls; If the second timer has not reached the second duration, the electronic device turns off the second timer in response to the second touch operation movement.
10. The method according to any one of claims 1-4 and 8, characterized in that, Also includes: The electronic device displays a third interface of a fourth application, the third interface including a third view, the third view including third text content; In response to a third touch operation applied to the third text content, the electronic device sets up and starts the first timer and the second timer; When the third touch operation is held down, in response to the first timer reaching the first duration, the electronic device displays a third pop-up window around the third text content, the third pop-up window including one or more controls; If the second timer has not reached the second duration, the electronic device turns off the second timer in response to the third touch operation being lifted.
11. The method according to any one of claims 1-4 and 8, characterized in that, Also includes: The electronic device displays a fourth interface of a fifth application, the fourth interface including a fourth view, and the fourth view including fourth text content; In response to a fourth touch operation on the fourth text content, the electronic device starts the first timer and the second timer; When the fourth touch operation is held down, in response to the first timer reaching the first duration, the electronic device displays a fourth pop-up window around the fourth text content, the fourth pop-up window including one or more controls; When the fourth touch operation is held down, in response to the second timer reaching the second duration, the electronic device detects that the fourth pop-up window was displayed in response to the fourth touch operation, and the electronic device starts a third timer with a duration greater than or equal to the delay duration. If the third timer has not reached the third duration, the electronic device turns off the third timer in response to the fourth touch operation movement.
12. The method according to any one of claims 1-4 and 8, characterized in that, Also includes: The electronic device displays a fifth interface of a sixth application, the fifth interface including a fifth view, and the fifth view including fifth text content; In response to a fifth touch operation applied to the fifth text content, the electronic device activates the first timer and the second timer; When the fifth touch operation is held down, in response to the first timer reaching the first duration, the electronic device displays a fifth pop-up window around the fifth text content, the fifth pop-up window including one or more controls; When the fifth touch operation is held down, in response to the second timer reaching the second duration, the electronic device detects that the fifth pop-up window was displayed in response to the fifth touch operation, and the electronic device starts a third timer with a duration greater than or equal to the delay duration. If the third timer has not reached the third duration, the electronic device turns off the third timer in response to the fifth touch operation being lifted.
13. An electronic device, characterized in that, include: Processor and memory; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the electronic device to perform the method as described in any one of claims 1-12.
14. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-12.
15. A computer program product, said computer program product storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-12.