Method and device for closing pop-up box, electronic equipment and storage medium
By listening and closing the enlarged pop-up box during the pop-up box display, the problem of abnormal pop-up box display in the prior art is solved, and the user experience is improved.
Patent Information
- Application Number
- CN202411852883.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-25
AI Technical Summary
In the prior art, when using the PopupWindow control to generate a pop-up box, setting the properties of the pop-up box disappearing in the external area can easily lead to abnormal display of the pop-up box, affecting the user experience.
When the user plays music, a music card is generated and a pop-up box with the target attribute is generated in response to the user clicking the sound source toggle button. The enlarged pop-up frame covers the music card, and monitors the touch event of the first display area during the enlarged pop-up frame display, and closes the pop-up frame.
It is realized that when the user touches the first display area where the music card is located during the display of the pop-up frame, there is no conflict event, and the pop-up frame is closed, improving the user's user experience.
Smart Images

Figure CN119883064A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of touch screens, and more specifically, to a method, device, electronic device and storage medium for closing a pop-up window in the field of touch screens. Background Art
[0002] PopupWindow is a control used to create a pop-up window in the Android system. It can be used to display any view and float on top of the current activity. It is generally used to float next to other User Interface (UI) controls.
[0003] In the prior art, after a popup window is generated using a PopupWindow control, a property that allows the popup window to disappear when an external area is clicked can be set for the popup window. If this property is set, when it is detected that a user clicks an area outside the popup window, the popup window is automatically closed.
[0004] If the property of making the pop-up box disappear when clicking the external area is set, when the user clicks the UI control again, both the property of making the pop-up box disappear when clicking the external area and the property of making the pop-up box appear when clicking the UI control will be executed. The two events conflict with each other, which may easily cause the pop-up box to display abnormally and affect the user experience. Summary of the invention
[0005] The present application provides a method, device, electronic device and storage medium for closing a pop-up window. The method can achieve that when a first display area where a music card is located is touched during the display of an expanded pop-up window, no conflict event is generated and the pop-up window is closed at the same time, thereby improving the user experience.
[0006] In a first aspect, a method for closing a pop-up window is provided, the method comprising: in a case where it is detected that a user is playing music, based on the currently playing music, generating a music card; wherein the music card includes a sound source switching button for the currently playing music; in response to the user clicking the sound source switching button, generating a pop-up window with a target attribute; wherein the target attribute is to close the pop-up window by clicking an area outside the pop-up window; based on a first display area where the music card is located, expanding the pop-up window and displaying the expanded pop-up window so that the expanded pop-up window covers the music card; during the display of the expanded pop-up window, monitoring touch events in the first display area; and closing the expanded pop-up window when a touch event is monitored.
[0007] In the above technical solution, when the user plays music, a music card including a sound source switching button is generated based on the currently playing music, and in response to the user clicking the sound source switching button, a pop-up box with the target attribute of "clicking the outer area of the pop-up box to close the pop-up box" is generated, so that the pop-up box can be closed when the user clicks the outer area of the pop-up box during the display of the pop-up box. The pop-up box is expanded to cover the music card, and the first display area where the music card is located can be changed to the inner area of the pop-up box, so that when the first display area where the music card is located is clicked, the pop-up box no longer responds to the target attribute of clicking the outer area of the pop-up box to close the pop-up box. During the display of the expanded pop-up box, the touch event in the first display area is monitored, and the pop-up box is closed based on the monitored touch event, so that the user can touch the music card area inside the pop-up box during the display of the pop-up box, especially when clicking the sound source switching button, the expanded pop-up box is closed. Avoid the occurrence of conflicting events such as clicking the sound source switching button in the card when the card area is the outer area of the pop-up box, responding to clicking the outer area of the pop-up box to close the pop-up box based on the target attribute, and responding to clicking the sound source switching button to display the pop-up box, thereby improving the user experience.
[0008] In combination with the first aspect, in some possible implementations, the method also includes: setting a target strategy for touch events, the target strategy is to call a pop-up box closing method to close the expanded pop-up box; when a touch event is detected, closing the expanded pop-up box, including: when a touch event is detected, calling a pop-up box closing method to close the expanded pop-up box.
[0009] In the above technical scheme, a target strategy for closing the pop-up box is set for the touch event of the first display area by setting a pop-up box closing method, so that during the display of the expanded pop-up box, the user touches the display area of the music card to close the expanded pop-up box based on the target strategy. That is, when the user clicks the audio source switching button again during the display of the expanded pop-up box, the pop-up box can be closed. There will be no situation where the response to the user operation is not clear enough because the music card is outside the pop-up box during the display of the pop-up box when the pop-up box does not cover the music card, and clicking the audio source switching button will respond to the target attribute of clicking the outside area of the pop-up box to close the pop-up box, and respond to clicking the music switch button again to display the pop-up box. This can improve the user experience.
[0010] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the music card also includes: at least one of a play button, a back button, and a forward button. When a touch event is monitored, the method also includes: if the touch area corresponding to the touch event is the area of any one of the play button, the back button, the forward button, and the sound source switching button, the control strategy of the button corresponding to the touch area is not executed.
[0011] In the above technical solution, during the display of the expanded pop-up window, the touch events of the play button, back button, forward button and audio source switching button area of the music card do not execute the corresponding control of the corresponding buttons, so that only one strategy is responded to for one click operation, which can bring a clearer, more predictable and easier to maintain user experience, while also reducing development complexity and potential security risks.
[0012] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, after expanding the pop-up frame based on the first display area where the music card is located and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card, the method also includes: setting the expanded pop-up frame in the first display area to a transparent state.
[0013] In the above technical solution, by setting the enlarged pop-up frame of the first display area to a transparent state, the user can clearly see the information displayed on the music card during the display of the enlarged pop-up frame.
[0014] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, a pop-up frame is expanded based on the first display area where the music card is located and the expanded pop-up frame is displayed so that the expanded pop-up frame covers the music card, including: determining the position and size of the first display area where the music card is located; based on the position and size, determining the horizontal offset and / or vertical offset of the pop-up frame; based on the horizontal offset and / or vertical offset, expanding the pop-up frame and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card.
[0015] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, after the pop-up frame is expanded and displayed based on the first display area where the music card is located so that the expanded pop-up frame covers the music card, the method also includes: displaying a list of sound sources of the currently playing music in a second display area of the expanded pop-up frame; wherein the second display area is other display areas in the expanded pop-up frame except the first display area; closing the expanded pop-up frame includes: closing the expanded pop-up frame to make the list of sound sources disappear.
[0016] In combination with the first aspect and the above-mentioned implementation methods, in some possible implementation methods, the method also includes: during the display of the expanded pop-up box, when it is detected that the user clicks on other areas outside the expanded pop-up box, closing the expanded pop-up box based on the target attributes.
[0017] In summary, when the pop-up box is displayed, the present application can change the first display area where the music card is located into the internal area of the pop-up box by expanding the pop-up box to cover the music card, so that when the first display area where the music card is located is clicked, the pop-up box no longer responds to the target attribute of clicking the outer area of the pop-up box to close the pop-up box. And the pop-up box of the first display area is set to a transparent state, so that the user can clearly see the information displayed on the music card during the display of the expanded pop-up box. For the touch event of the first display area, the target strategy of calling the pop-up box closing method to close the pop-up box is set, so that the user touches the area in the music card, especially when the user clicks the sound source switching button in the music card area, the pop-up box is closed, and the first display area where the music card is located is touched during the display of the expanded pop-up box, and the pop-up box is closed without generating conflict events, thereby improving the user experience. During the display of the expanded pop-up box, the touch events of the play button, back button, forward button and sound source switching button area in the music card do not perform the control corresponding to the corresponding button, so that only one strategy is responded to for one click operation, which can bring a clearer, more predictable and easier to maintain user experience, while also reducing development complexity and potential security risks.
[0018] In a second aspect, a device for closing a pop-up window is provided, the device comprising: a first generating module, for generating a music card based on the currently playing music when detecting that a user is playing music; wherein the music card comprises a sound source switching button for the currently playing music; a second generating module, for generating a pop-up window with a target attribute in response to a user clicking the sound source switching button; wherein the target attribute is to close the pop-up window by clicking an area outside the pop-up window; an expanding module, for expanding and displaying the pop-up window based on a first display area where the music card is located, so that the expanded pop-up window covers the music card; a monitoring module, for monitoring touch events in the first display area during the display of the expanded pop-up window; and a closing module, for closing the expanded pop-up window when a touch event is monitored.
[0019] In combination with the second aspect, in some possible implementations, the device also includes: a setting module, used to set a target strategy for touch events, the target strategy is to call a pop-up box closing method to close the expanded pop-up box; the closing module is specifically used to call the pop-up box closing method to close the expanded pop-up box when a touch event is monitored.
[0020] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the music card also includes: at least one of a play button, a back button, and a forward button, and the device also includes a control module, which is used to, when a touch event is monitored, not execute the control strategy of the button corresponding to the touch area if the touch area corresponding to the touch event is the area of any one of the play button, the back button, the forward button, and the sound source switching button.
[0021] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the setting module is also used to expand the pop-up frame in the first display area based on the music card and display the expanded pop-up frame so that the pop-up frame covers the music card, and then set the expanded pop-up frame in the first display area to a transparent state.
[0022] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the expansion module is specifically used to determine the position and size of the first display area where the music card is located; based on the position and size, determine the horizontal offset and / or vertical offset of the pop-up frame; based on the horizontal offset and / or vertical offset, expand the pop-up frame and display the expanded pop-up frame so that the expanded pop-up frame covers the music card.
[0023] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the device also includes: a display module, used to display a list of sound sources of currently playing music in the second display area of the expanded pop-up frame; wherein the second display area is other display areas in the expanded pop-up frame except the first display area; the closing module is specifically used to close the expanded pop-up frame to make the sound source list disappear.
[0024] In combination with the second aspect and the above-mentioned implementation methods, in some possible implementation methods, the closing module is also used to close the expanded pop-up box based on target attributes when it is detected that the user clicks other areas outside the expanded pop-up box during the display of the expanded pop-up box.
[0025] In a third aspect, an electronic device is provided, comprising a memory and a processor. The memory is used to store executable program code, and the processor is used to call and run the executable program code from the memory, so that the electronic device executes the method in the first aspect or any possible implementation of the first aspect.
[0026] In a fourth aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method in the first aspect or any possible implementation of the first aspect.
[0027] In a fifth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a schematic diagram of generating a pop-up window in the prior art provided in an embodiment of the present application.
[0029] Figure 2 This is an exemplary flowchart of a method for closing a pop-up window provided in an embodiment of the present application.
[0030] Figure 3 It is a schematic diagram of a music card provided in an embodiment of the present application.
[0031] Figure 4 It is a structural schematic diagram of a device for closing a pop-up window provided in an embodiment of the present application.
[0032] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] The technical solution in the present application will be described clearly and in detail below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0034] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0035] Figure 1 This is a schematic diagram of generating a pop-up window in the prior art provided in an embodiment of the present application.
[0036] For example, Figure 1 As shown, it includes area 1 and a pop-up box 1 outside area 1, area 1 includes button 1, when it is detected that button 1 is clicked, pop-up box 1 is displayed, and corresponding content is displayed in pop-up box 1.
[0037] Specifically, when the user clicks button 1 in area 1, popup 1 is generated and displayed outside area 1. When popup 1 is generated based on the PopupWindow control, the PopupWindow control is usually set to true by calling setOutsideTouchable, so that after the popup is popped up based on the PopupWindow control, the popup is closed when the user clicks the outer area of the popup. At this time, area 1 is the outer area of popup 1. When the user clicks button 1 in area 1 again, it is necessary to respond to the event of clicking the outer area to make the popup disappear, and respond to the event of clicking button 1 again to display popup 1. The two events conflict, which may easily cause abnormal display of the popup, affecting the user experience.
[0038] Based on this, the present application provides a method for closing a pop-up window to avoid the conflict between the above two events and improve the user experience.
[0039] Figure 2 1 is an exemplary flow chart of a method for closing a pop-up window provided in an embodiment of the present application. The method is applied to electronic devices, and can be specifically applied to a tablet or an in-vehicle entertainment system of a vehicle, etc.
[0040] For example, Figure 2 As shown, the method 200 includes:
[0041] Step 201, when it is detected that the user is playing music, a music card is generated based on the currently playing music;
[0042] The music card includes a button for switching the audio source of the currently playing music.
[0043] Step 202, in response to the user clicking the audio source switching button, generating a pop-up box with target attributes;
[0044] The target attribute is to close the pop-up window by clicking on the outer area of the pop-up window.
[0045] Step 203, based on the first display area where the music card is located, the pop-up frame is enlarged and the enlarged pop-up frame is displayed, so that the enlarged pop-up frame covers the music card;
[0046] Step 204, during the display of the expanded pop-up window, monitoring touch events in the first display area;
[0047] Step 205: When a touch event is detected, close the expanded pop-up window.
[0048] exist Figure 2In the illustrated embodiment, when the user plays music, a music card including a sound source switching button is generated based on the currently playing music, and in response to the user clicking the sound source switching button, a pop-up box with a target attribute of "clicking the outer area of the pop-up box to close the pop-up box" is generated, so that the pop-up box can be closed when the user clicks the outer area of the pop-up box during the display of the pop-up box. The pop-up box is expanded to cover the music card, and the first display area where the music card is located can be changed to the inner area of the pop-up box, so that when the first display area where the music card is located is clicked, the pop-up box no longer responds to the target attribute of clicking the outer area of the pop-up box to close the pop-up box. During the display of the expanded pop-up box, the touch event in the first display area is monitored, and the pop-up box is closed based on the monitored touch event, so that the user can touch the music card area inside the pop-up box during the display of the pop-up box, especially when clicking the sound source switching button, the pop-up box is closed. Avoid the occurrence of conflicting events such as clicking the sound source switching button in the card when the card area is the outer area of the pop-up box, responding to clicking the outer area of the pop-up box to close the pop-up box based on the target attribute, and responding to clicking the sound source switching button to display the pop-up box, thereby improving the user experience.
[0049] The following takes the above method applied to the vehicle's in-vehicle entertainment system as an example. Figure 2 The specific implementation method of each step in the embodiment shown is described in detail:
[0050] In step 201, the user can search and play music through the large screen of the in-vehicle entertainment system. After the in-vehicle entertainment system detects that the vehicle starts playing music, it obtains the name, singer, and album cover of the currently playing music to generate a music card for the currently playing music. And based on the sound source application that plays the currently playing music, a sound source switching button is generated.
[0051] Figure 3 It is a schematic diagram of a music card provided in an embodiment of the present application.
[0052] For example, Figure 3 As shown, a music card is generated in area 1 of the display screen 10, and the music card includes: music name, singer, album cover and button 1, button 1 is the sound source switching button, and the display screen 10 is the display screen of the large screen of the vehicle computer.
[0053] In some embodiments, button 1 may display an icon of the audio source application that is playing the currently playing music.
[0054] Specifically, the default homepage interface of the car's large screen can be integrated with an icon of a music application (i.e., a sound source application). The user can click on the icon of the music application while driving the vehicle. After the in-car entertainment system detects that the user has clicked on the icon of the music application, the interface of the car's large screen will be updated to the internal interface of the music software. The internal interface can include a search box. The user can search for the music they want to play in the search box and click on the searched music to start playing.
[0055] In some embodiments, the internal interface may also include an option for a played playlist or an option for a user-created playlist. The user can select a played playlist or a user-created playlist and click on a piece of music in the playlist to start playing the music.
[0056] In some embodiments, the generated music card is displayed on the main interface of the vehicle's large screen after the user plays music and exits the music application.
[0057] In some embodiments, the vehicle large screen may also be referred to as a central control screen. In addition to the central control screen, the vehicle may also include a co-pilot screen, a ceiling screen, and other large display screens. When the user plays music, the generated music card may be displayed on all the large screens that are turned on.
[0058] In step 202, the in-vehicle entertainment system monitors in real time whether the user clicks the audio source switching button. Specifically, after the in-vehicle entertainment system detects that the user clicks the large screen of the vehicle computer, it obtains the coordinates of the user's click position, and compares the coordinates of the click position with the coordinates of the audio source switching button to determine whether the user clicks the audio source switching button. When the coordinates of the click position are the same as the coordinates of the audio source switching button, it is determined that the user clicks the audio source switching button.
[0059] After determining that the user clicks the audio source switching button, a popup window with target attributes can be generated using PopupWindow. Among them, PopupWindow is a control used to create a popup window in the Android system, which can be used to display any view.
[0060] The target property is to close the popup by clicking the outer area of the popup. Specifically, you can set setOutsideTouchable to true for the generated popup. After implementing the PopupWindow popup, click the outer area of the popup to close the popup.
[0061] In step 203, the music card has a certain area and occupies a certain area when displayed on the large screen of the vehicle computer. The first display area is the area occupied by the music card on the large screen of the vehicle computer.
[0062] After the pop-up frame is generated, the generated pop-up frame can be expanded based on the first display area where the music card is located, and the expanded pop-up frame can be displayed on the large screen of the car computer.
[0063] It is understandable that the displayed pop-up box is usually suspended on the interface, and the expanded pop-up box can cover the music card.
[0064] In one possible implementation, a pop-up frame is expanded based on the first display area where the music card is located and the expanded pop-up frame is displayed so that the expanded pop-up frame covers the music card, including: determining the position and size of the first display area where the music card is located; determining the horizontal offset and / or vertical offset of the pop-up frame based on the position and size; expanding the pop-up frame based on the horizontal offset and / or vertical offset and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card.
[0065] Determining the position and size of the first display area where the music card is located specifically includes: establishing a coordinate axis for the display area of the large screen of the vehicle computer, and determining the coordinate range [x1, x2] of the first display area where the music card is located on the horizontal axis of the established coordinate axis, and the coordinate range [y1, y2] on the vertical axis.
[0066] For example, Figure 3 As shown, take the bottom corner of the display screen as the origin O, establish the X-axis and Y-axis to obtain the coordinate axis. Figure 3 It can be obtained that the coordinate range of the first display area on the horizontal axis X-axis is [3, 9], and the coordinate range of the first display area on the vertical axis Y-axis is [1, 4].
[0067] The process of determining the horizontal offset and / or the vertical offset includes: determining the coordinate range [x3, x4] of the generated pop-up box on the horizontal axis of the established coordinate axis and the coordinate range [y3, y4] on the vertical axis. The horizontal offset is determined based on the coordinate range [x3, x4] of the pop-up box on the horizontal axis and the coordinate range [x1, x2] of the first display area where the music card is located on the horizontal axis; the vertical offset is determined based on the coordinate range [y3, y4] of the pop-up box on the vertical axis and the coordinate range [y1, y2] of the first display area where the music card is located on the vertical axis.
[0068] Specifically, the horizontal offset includes a left offset and a right offset. When the maximum value x2 in the coordinate range of the first display area on the horizontal axis is greater than the maximum value x4 in the coordinate range of the pop-up box on the horizontal axis, x2 is subtracted from x4 to obtain the right offset. When the minimum value x1 in the coordinate range of the first display area on the horizontal axis is less than the minimum value x3 in the coordinate range of the pop-up box on the horizontal axis, x3 is subtracted from x1 to obtain the left offset. In other cases, it can be determined that there is no horizontal offset.
[0069] The vertical offset includes an upward offset and a downward offset. When the maximum value y2 in the coordinate range of the first display area on the vertical axis is greater than the maximum value y4 in the coordinate range of the pop-up box on the vertical axis, y2 is subtracted from y4 to obtain the upward offset. When the minimum value y1 in the coordinate range of the first display area on the vertical axis is less than the minimum value y3 in the coordinate range of the pop-up box on the vertical axis, y3 is subtracted from y1 to obtain the downward offset. In other cases, it can be determined that there is no vertical offset.
[0070] For example, Figure 3 As shown, the coordinate range of the pop-up box on the horizontal axis X-axis is [3, 9], and the coordinate range on the vertical axis Y-axis is [4, 9]. Based on the coordinate range of the first display area where the music card is located on the horizontal axis [3, 9] and the coordinate range of the pop-up box on the horizontal axis [3, 9], it is determined that the left offset and the right offset in the horizontal offset are both zero. Based on the coordinate range of the first display area where the music card is located on the vertical axis [1, 4] and the coordinate range of the pop-up box on the vertical axis [4, 9], it is determined that the upward offset in the vertical offset is zero and the downward offset is 3.
[0071] The pop-up box is expanded based on the horizontal offset and / or vertical offset, that is, the range of the pop-up box in the horizontal direction is increased based on the horizontal offset, and the range of the pop-up box in the vertical direction is increased based on the vertical offset. Specifically, it includes: adding the right offset to the maximum value of the coordinate range on the horizontal axis, and subtracting the left offset from the minimum value; adding the upward offset to the maximum value of the coordinate range on the vertical axis, and subtracting the downward offset from the minimum value. Based on this, the expanded pop-up box is obtained.
[0072] For example, it is determined that the left offset and the right offset in the horizontal offset are both zero, the upward offset in the vertical offset is zero, and the downward offset is 3. The step of expanding the pop-up box is specifically: subtract 3 from 4 in the coordinate range [4, 9] on the vertical axis, and obtain that the coordinate range of the expanded pop-up box on the vertical axis is [1, 9]. The expanded pop-up box is Figure 3 The area shown in the shaded part includes area 1 and area 2.
[0073] In a possible implementation, after expanding the pop-up frame based on the first display area where the music card is located and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card, the method further includes: setting the expanded pop-up frame in the first display area to a transparent state.
[0074] It is understandable that the bullet box includes a background color, and the default bullet box background color is usually white, so as to clearly display the content in the bullet box.
[0075] When the background color of the pop-up box is white, after the pop-up box covers the music card, the music card is invisible. In order to allow the user to see the music card, the background color of the pop-up box in the first display area corresponding to the music card can be set to a transparent color.
[0076] Specifically, you can set the background color of the part that needs to be transparent to transparent by calling the setBackground method.
[0077] In the above method, by setting the enlarged pop-up frame of the first display area to a transparent state, the user can clearly see the information displayed on the music card during the display of the enlarged pop-up frame.
[0078] In some embodiments, a transparent mask layer can also be set in the first display area where the music card is located to shield the touch event based on the music card response; at this time, the first display area corresponding to the card is still the area outside the pop-up box. When it is detected that the user clicks the card area, only the click on the external area is responded to, and the pop-up box strategy is closed.
[0079] In one possible implementation, after expanding the pop-up frame based on the first display area where the music card is located and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card, the method also includes: displaying a list of audio sources of the currently playing music in a second display area of the expanded pop-up frame; wherein the second display area is other display areas in the expanded pop-up frame except the first display area.
[0080] The audio source list is a list of audio source applications that are currently playing music. An audio source application refers to an application that can provide the audio source of the currently playing music.
[0081] It is understandable that for the same song currently being played, there may be multiple different audio source applications that have the audio source of the currently playing music. After the pop-up box is expanded and displayed, multiple audio source applications that have the audio source of the currently playing music can be obtained, and the multiple audio source applications are arranged in a preset list format to obtain an audio source list. Afterwards, the audio source list is displayed in the second display area of the expanded pop-up box.
[0082] For example, Figure 3 As shown, in the second display area, that is, area 2, multiple sound source applications of the sound source of the currently playing music are obtained: sound source application 1, sound source application 2, sound source application 3, etc. The multiple sound source applications, such as sound source application 1, sound source application 2, sound source application 3, etc., are arranged in a row of two to obtain a sound source list, and the sound source list is displayed in area 2.
[0083] In some embodiments, after the sound source list is displayed in the second display area of the expanded pop-up frame, the target sound source application selected by the user from the sound source list can be detected in real time, and the sound source application currently playing music can be switched to the target sound source application selected by the user.
[0084] Exemplarily, the sound source application currently playing music is sound source application 1, and it is detected that the target sound source application selected by the user from the sound source list is sound source application 2, then the sound source application currently playing music is switched from sound source application 1 to sound source application 2.
[0085] In step 204, the touch event includes: a click event, a slide event, a long press event, etc. During the display of the expanded pop-up frame, the user's touch event in the first display area of the pop-up frame is continuously monitored.
[0086] Specifically, after the pop-up window is expanded, the area that needs to monitor touch events can be defined as the pop-up window of the first display area, and a touch listener can be set for the pop-up window of the first display area. During the display of the expanded pop-up window, the touch listener continuously monitors touch events in the first display area.
[0087] In step 205, a close instruction may be set corresponding to the touch event in the first display area during display of the enlarged pop-up window. After the touch listener listens to the touch event, the enlarged pop-up window is closed based on the close instruction set corresponding to the touch event.
[0088] In one possible implementation, the method also includes: setting a target strategy for touch events, the target strategy is calling a pop-up box closing method to close the pop-up box; when a touch event is detected, closing the expanded pop-up box, including: when a touch event is detected, calling a pop-up box closing method to close the expanded pop-up box.
[0089] It can be understood that, if the pop-up window covers the music card, the first display area corresponding to the music card is the internal area of the pop-up window. At this time, clicking on the first display area corresponding to the music card will no longer close the expanded pop-up window due to the target attribute of clicking the external area to close the pop-up window set for the pop-up window.
[0090] During the display of the expanded pop-up window, if the pop-up window is to be closed for a touch event in the first display area, a target strategy for calling a pop-up window closing method to close the pop-up window can be set in advance for a touch event in the first display area during the display of the pop-up window. The pop-up window closing method can specifically be a dismiss method.
[0091] When the touch listener detects a touch event on the first display area during display of the expanded pop-up window, the dismiss method is called to close the pop-up window.
[0092] In the above method, a target strategy for closing the pop-up box is set for the touch event of the first display area by setting a pop-up box closing method, so that during the display of the expanded pop-up box, the user touches the display area of the music card to close the expanded pop-up box based on the target strategy. That is, when the user clicks the audio source switching button again during the display of the expanded pop-up box, the pop-up box can be closed. This will not cause the pop-up box to be closed in response to the target attribute of clicking the outside area of the pop-up box to close the pop-up box when the pop-up box does not cover the music card, and the music card is in the external area of the pop-up box during the display of the pop-up box, and clicking the audio source switching button will close the pop-up box in response to clicking the external area of the pop-up box to close the pop-up box, and will display the pop-up box in response to clicking the music switch button again. This can improve the user experience.
[0093] In some embodiments, closing the expanded pop-up window includes: closing the expanded pop-up window to make the audio source list disappear.
[0094] It is understandable that the audio source list is displayed in the pop-up window, so when the pop-up window is closed, the audio source list also disappears along with the pop-up window. After the audio source list disappears, the user cannot select the audio source application to switch to.
[0095] If the user wants to switch the audio source application, the user can click the audio source switch button again to display the expanded pop-up window, and click the option button of the audio source application displayed in the second display area of the pop-up window.
[0096] In one possible implementation, the music card also includes: at least one of: a play button, a back button, and a forward button. When a touch event is monitored, the method also includes: if the touch area corresponding to the touch event is the area of any one of the play button, the back button, the forward button, and the sound source switching button, the control strategy of the button corresponding to the touch area is not executed.
[0097] like Figure 3 As shown, the sound source card generates a play button 20, a back button 30 and a forward button 40 for controlling the currently playing music in the area below the music name and the singer.
[0098] The play button 20 is used to control the music to start playing or pause playing. Specifically, if the music is currently playing, the play button 20 is used to control the music to pause playing; if the music is currently paused, the play button 20 is used to control the music to start playing.
[0099] The back button 30 and the forward button 40 are used to control the switching of music or the progress of music playing. Specifically, when the user clicks the back button 30, the music being played is switched to the previous music currently being played in the music list; when the user clicks the forward button 40, the music being played is switched to the next music currently being played in the music list. When the user long presses the back button 30, the progress of the currently being played music is adjusted backward based on the long press duration; when the user long presses the forward button 40, the progress of the currently being played music is adjusted fast forward based on the long press duration.
[0100] It can be understood that during the display of the expanded pop-up box, the touch area corresponding to the user's touch event in the first display area corresponding to the music card may be the area of any one of the play button 20, the back button 30, the forward button 10 and the sound source switching button (button 1). At this time, the pop-up box covers the music card. Even if the touch area of the touch event is the area of the above-mentioned multiple buttons, the control strategy of the button corresponding to the touch area is not executed, and only the strategy of closing the pop-up box set for the touch event is executed.
[0101] If the user wants to click a button in the music card to control the currently playing music, he can click the corresponding button again after the pop-up window is closed. Specifically, after the pop-up window is closed, when it is detected that the user clicks the play button again, the currently playing music is paused; when it is detected that the user clicks the back button again, the playing music is switched to the previous music in the music list; when it is detected that the user clicks the forward button again, the playing music is switched to the next music in the music list.
[0102] In the above method, during the display of the expanded pop-up window, the touch events of the play button, back button, forward button and audio source switching button area of the music card do not execute the corresponding control of the corresponding buttons, so that only one strategy is responded to for one click operation, which can bring a clearer, more predictable and easier to maintain user experience, while also reducing development complexity and potential security risks.
[0103] In a possible implementation, the method further includes: during the display of the enlarged pop-up frame, when it is detected that the user clicks on other areas outside the enlarged pop-up frame, closing the enlarged pop-up frame based on the target attribute.
[0104] A click listener can be set for the outer area of the expanded pop-up box. During the display of the expanded pop-up box, the click listener listens for click events in the outer area of the pop-up box, and when a click event in the outer area of the pop-up box is listened to, the expanded pop-up box is closed based on the target attribute of closing the pop-up box by clicking the outer area of the pop-up box.
[0105] It is understandable that when the pop-up box includes a sound source list, the sound source list disappears when the pop-up box is closed.
[0106] In summary, when the pop-up box is displayed, the present application can change the first display area where the music card is located into the internal area of the pop-up box by expanding the pop-up box to cover the music card, so that when the first display area where the music card is located is clicked, the pop-up box no longer responds to the target attribute of clicking the outer area of the pop-up box to close the pop-up box. And the pop-up box of the first display area is set to a transparent state, so that the user can clearly see the information displayed on the music card during the display of the expanded pop-up box. For the touch event of the first display area, the target strategy of calling the pop-up box closing method to close the pop-up box is set, so that the user touches the area in the music card, especially when the user clicks the sound source switching button in the music card area, the pop-up box is closed, and the first display area where the music card is located is touched during the display of the expanded pop-up box, and the pop-up box is closed without generating conflict events, thereby improving the user experience. During the display of the expanded pop-up box, the touch events of the play button, back button, forward button and sound source switching button area in the music card do not perform the control corresponding to the corresponding button, so that only one strategy is responded to for one click operation, which can bring a clearer, more predictable and easier to maintain user experience, while also reducing development complexity and potential security risks.
[0107] Figure 4 It is a structural schematic diagram of a device for closing a pop-up window provided in an embodiment of the present application.
[0108] For example, Figure 4 As shown, the device 400 includes:
[0109] The first generating module 401 is used to generate a music card based on the currently playing music when it is detected that the user is playing music; wherein the music card includes a sound source switching button of the currently playing music;
[0110] The second generating module 402 is used to generate a pop-up box with a target attribute in response to the user clicking the audio source switching button; wherein the target attribute is to close the pop-up box by clicking the outer area of the pop-up box;
[0111] An expansion module 403 is used to expand and display the pop-up frame based on the first display area where the music card is located, so that the expanded pop-up frame covers the music card;
[0112] A monitoring module 404, configured to monitor touch events in the first display area during display of the expanded pop-up window;
[0113] The closing module 405 is used to close the expanded pop-up window when a touch event is detected.
[0114] In one possible implementation, the device also includes: a setting module, which is used to set a target strategy for touch events, and the target strategy is to call a pop-up box closing method to close the expanded pop-up box; the closing module 405 is specifically used to call the pop-up box closing method to close the expanded pop-up box when a touch event is monitored.
[0115] In one possible implementation, the music card also includes: at least one of a play button, a back button, and a forward button. The device also includes a control module, which is used to, when a touch event is monitored, not execute the control strategy of the button corresponding to the touch area if the touch area corresponding to the touch event is the area of any one of the play button, the back button, the forward button, and the sound source switching button.
[0116] In one possible implementation, the setting module is further used to, after expanding the pop-up frame in the first display area where the music card is located and displaying the expanded pop-up frame so that the pop-up frame covers the music card, set the expanded pop-up frame in the first display area to a transparent state.
[0117] In one possible implementation, the expansion module 403 is specifically used to determine the position and size of the first display area where the music card is located; based on the position and size, determine the horizontal offset and / or vertical offset of the pop-up frame; based on the horizontal offset and / or vertical offset, expand the pop-up frame and display the expanded pop-up frame so that the expanded pop-up frame covers the music card.
[0118] In one possible implementation, the device also includes: a display module, used to display a list of audio sources of currently playing music in the second display area of the expanded pop-up frame; wherein the second display area is other display areas in the expanded pop-up frame except the first display area; the closing module 405 is specifically used to close the expanded pop-up frame to make the audio source list disappear.
[0119] In a possible implementation, the closing module 405 is also used to close the enlarged pop-up box based on target attributes when it is detected that the user clicks on other areas outside the enlarged pop-up box during the display of the enlarged pop-up box.
[0120] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0121] For example, Figure 5 As shown, the electronic device 500 includes: a memory 501 and a processor 502, wherein the memory 501 stores an executable program code 5011, and the processor 502 is used to call and execute the executable program code 5011 to perform a method for closing a pop-up window.
[0122] In addition, an embodiment of the present application also protects a device, which may include a memory and a processor, wherein the memory stores an executable program code, and the processor is used to call and execute the executable program code to execute a method for closing a pop-up box provided in an embodiment of the present application.
[0123] In this embodiment, the functional modules of the device can be divided according to the above method example. For example, each functional module can be corresponded, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0124] In the case of dividing each functional module according to each function, the device may also include a first generation module, a second generation module, an expansion module, a monitoring module, a closing module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0125] It should be understood that the device provided in this embodiment is used to execute the above-mentioned method of closing a pop-up window, and thus can achieve the same effect as the above-mentioned implementation method.
[0126] In the case of an integrated unit, the device may include a processing module and a storage module. When the device is applied to an electronic device, the processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device in executing relevant program codes, etc.
[0127] The processing module may be a processor or a controller, which may implement or execute various exemplary logic blocks, modules and circuits shown in conjunction with the disclosure of the present application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module may be a memory.
[0128] In addition, the device provided in the embodiments of the present application may specifically be a chip, component or module, and the chip may include a connected processor and memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip can execute a method for closing a pop-up box provided in the above embodiment.
[0129] This embodiment also provides a computer-readable storage medium, which stores computer program code. When the computer program code runs on a computer, the computer executes the above-mentioned related method steps to implement a method for closing a pop-up window provided in the above embodiment.
[0130] This embodiment also provides a computer program product. When the computer program product runs on a computer, it enables the computer to execute the above-mentioned related steps to implement a method for closing a pop-up window provided in the above embodiment.
[0131] Among them, the device, computer-readable storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.
[0132] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0133] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0134] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for closing a pop-up window, characterized in that: The method comprises: In the case of detecting that the user is playing music, generating a music card based on the currently playing music; wherein the music card includes a sound source switching button of the currently playing music; In response to the user clicking the audio source switching button, generating a pop-up box with a target attribute; wherein the target attribute is to close the pop-up box by clicking an area outside the pop-up box; Expanding the pop-up frame based on the first display area where the music card is located and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card; During display of the enlarged pop-up window, monitoring touch events of the first display area; When the touch event is detected, the expanded pop-up window is closed.
2. The method according to claim 1, characterized in that The method further comprises: Setting a target strategy for the touch event, wherein the target strategy is to call a pop-up box closing method to close the expanded pop-up box; When the touch event is detected, closing the expanded pop-up window includes: When the touch event is detected, a pop-up box closing method is called to close the expanded pop-up box.
3. The method according to claim 1 or 2, characterized in that: The music card further includes: at least one of a play button, a back button, and a forward button. When the touch event is detected, the method further includes: If the touch area corresponding to the touch event is the area of any one of the play button, the back button, the forward button and the audio source switching button, the control strategy of the button corresponding to the touch area is not executed.
4. The method according to claim 1 or 2, characterized in that: After expanding the pop-up frame based on the first display area where the music card is located and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card, the method further includes: The enlarged bullet box in the first display area is set to a transparent state.
5. The method according to claim 1 or 2, characterized in that: The step of expanding the pop-up frame based on the first display area where the music card is located and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card includes: Determine the position and size of the first display area where the music card is located; Based on the position and size, determine a horizontal offset and / or a vertical offset of the bullet box; The pop-up frame is enlarged based on the horizontal offset and / or the vertical offset and the enlarged pop-up frame is displayed, so that the enlarged pop-up frame covers the music card.
6. The method according to claim 1 or 2, characterized in that: After expanding the pop-up frame based on the first display area where the music card is located and displaying the expanded pop-up frame so that the expanded pop-up frame covers the music card, the method further includes: Displaying the music source list of the currently playing music in the second display area of the expanded pop-up frame; wherein the second display area is the other display area of the expanded pop-up frame except the first display area; The closing of the expanded pop-up window includes: Close the expanded pop-up window to make the audio source list disappear.
7. The method according to claim 1 or 2, characterized in that: The method further comprises: During the display of the enlarged bullet box, when it is detected that the user clicks on other areas outside the enlarged bullet box, the enlarged bullet box is closed based on the target attribute.
8. A device for closing a pop-up window, characterized in that: The device comprises: A first generating module is used to generate a music card based on the currently playing music when it is detected that the user is playing music; wherein the music card includes a sound source switching button of the currently playing music; A second generating module is configured to generate a pop-up box with a target attribute in response to the user clicking the audio source switching button; wherein the target attribute is to close the pop-up box by clicking an area outside the pop-up box; An expansion module, used to expand and display the pop-up frame based on the first display area where the music card is located, so that the expanded pop-up frame covers the music card; A monitoring module, used for monitoring touch events in the first display area during display of the expanded pop-up frame; The closing module is used to close the expanded pop-up window when the touch event is detected.
9. An electronic device, characterized in that: The electronic device comprises: A memory for storing executable program codes; A processor, configured to call and run the executable program code from the memory, so that the electronic device executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 7 is implemented.