Floating window processing method, electronic device and computer-readable storage medium

By creating and initializing the floating window view based on global context information in the application and adding it to the current page, the problem of traditional solutions relying on user authorization and system permissions is solved, and the floating window can be displayed normally without permission application. Features that improve application availability and reliability.

CN114489898BActive Publication Date: 2024-11-29ALIBABA (CHINA) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210074495.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-21
Publication Date
2024-11-29
Estimated Expiration
2042-01-21

AI Technical Summary

Technical Problem

The traditional floating window processing solution relies on user authorization and system permissions, which makes it impossible for the application to use the floating window function normally when the permission is not obtained, especially when some mobile phone manufacturers disable the system floating window permissions by default.

Method used

The display of the floating window is achieved by creating a floating window view based on the global context information of the application, and after initializing the display configuration information, it is added to the currently displayed page, thereby avoiding dependence on the system floating window permissions.

Benefits of technology

This method can display the floating window without applying for permissions to the system floating window, ensuring the normal use of the functions related to the floating window of the application and improving the usability and reliability of the application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114489898B_ABST
    Figure CN114489898B_ABST
Patent Text Reader

Abstract

The present application provides a floating window processing method, an electronic device, and a computer-readable storage medium. The method of the present application, when information needs to be displayed through a floating window in an application, creates a floating window view according to the global context information of the application, and after initializing the display configuration information of the first floating window view, adds the created floating window view to the currently displayed page, and realizes the display of the floating window through page-level view operations, instead of realizing the function of the floating window through global Window view operations in the traditional solution, without applying for system floating window permissions, and can display the floating window when it is needed, which can ensure the normal use of the floating window-related functions of the application and improve the availability and reliability of the application.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to artificial intelligence technology, and more particularly to a floating window processing method, an electronic device, and a computer-readable storage medium. Background Art

[0002] In the process of application (Application, APP for short), it is often necessary to use the functional logic of global unified display, such as opening a small window of the live broadcast room, providing a global message entrance, publishing a unified APP announcement, etc. The above functional logic of global unified display can be achieved through a global unified floating window.

[0003] In the traditional solution of displaying floating windows on a page, the permission of the system floating window is usually registered for the application in the system configuration file (such as AndroidManifest.xml of the Android system), and the permission to display the floating window is applied to the user. After the user authorizes the application to obtain the permission of the system floating window, the application can implement the floating window function. However, whether the application can obtain the permission of the system floating window is strongly dependent on the user's authorization. If the user does not authorize, the relevant functions of the application cannot be used normally. In addition, some mobile phone manufacturers have disabled the permission of the system floating window by default, resulting in the relevant functions of the application cannot be used normally. Summary of the invention

[0004] The present application provides a floating window processing method, an electronic device, and a computer-readable storage medium.

[0005] On the one hand, the present application provides a method for processing a floating window, comprising:

[0006] In response to the need to display information through a floating window in an application, creating a first floating window view according to global context information of the application, where the global context information refers to context information whose effective scope is the application;

[0007] Initialize display configuration information of the first floating window view;

[0008] The first floating window view is added to the currently displayed first page.

[0009] On the other hand, the present application provides a floating window processing device, including:

[0010] A floating window creation module, configured to create a first floating window view in response to a need to display information through a floating window in an application program, according to global context information of the application program, wherein the global context information refers to context information having a valid scope of the application program;

[0011] A floating window initialization module, used to initialize the display configuration information of the first floating window view;

[0012] The floating window control module is used to add the first floating window view to the first page currently displayed.

[0013] In another aspect, the present application provides an electronic device, comprising:

[0014] A processor, and a memory communicatively connected to the processor;

[0015] The memory stores computer-executable instructions;

[0016] The processor executes the computer-executable instructions stored in the memory to implement the above-mentioned floating window processing method.

[0017] On the other hand, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the above-mentioned floating window processing method.

[0018] The floating window processing method, electronic device and computer-readable storage medium provided by the present application, when information needs to be displayed through a floating window in an application, a floating window view is created according to the global context information of the application, and after the display configuration information of the first floating window view is initialized, the created floating window view is added to the currently displayed page, and the floating window is displayed through page-level view operations to replace the traditional solution of implementing the floating window function through global Window view operations. There is no need to apply for system floating window permissions, and the floating window can be displayed when it is needed, which can ensure the normal use of the floating window-related functions of the application and improve the availability and reliability of the application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0020] Figure 1 An example flow chart of a floating window display of a traditional floating window processing solution provided in this application;

[0021] Figure 2 A flow chart of a method for processing a floating window provided in an embodiment of the present application;

[0022] Figure 3 A flow chart of a method for processing a floating window provided in another embodiment of the present application;

[0023] Figure 4A flow chart of a method for processing a floating window provided in another embodiment of the present application;

[0024] Figure 5 A schematic diagram of the structure of a floating window processing device provided in one embodiment of the present application;

[0025] Figure 6 A schematic diagram of the structure of an electronic device provided in an exemplary embodiment of the present application.

[0026] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0027] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0028] First, the terms involved in this application are explained:

[0029] Floating window: A view window that floats above the page during APP development.

[0030] Permission application: To protect users, the Android system adds a block to APP developers for calling sensitive APIs (APPlication Programming Interface). Developers need to apply to users, and users decide whether to authorize developers to call sensitive APIs.

[0031] In addition, the terms "first", "second", "third", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. In the description of the following embodiments, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.

[0032] The floating window processing method provided in this application is applied to applications that require a globally unified floating window to implement globally unified display functional logic. In the application, a globally unified floating window is used to implement functions such as opening a small window of a live broadcast room, providing a global message entrance, and publishing APP unified announcements.

[0033] In the traditional solution of displaying floating windows on a page, the permission of the system floating window is usually registered for the application in the system configuration file (such as AndroidManifest.xml of the Android system), and the permission to display the floating window is applied to the user. After the user authorizes the application to obtain the permission of the system floating window, the application can implement the floating window function. However, whether the application can obtain the permission of the system floating window is strongly dependent on the user's authorization. If the user does not authorize, the relevant functions of the application cannot be used normally. In addition, some mobile phone manufacturers have disabled the permission of the system floating window by default, resulting in the relevant functions of the application cannot be used normally.

[0034] For example, an example process of floating window display of a traditional floating window processing solution is as follows: Figure 1 As shown, when it is necessary to display a floating window, it is determined whether the system floating window permission is registered in the application. If the system floating window permission is not registered, the floating window cannot be displayed; if the system floating window permission is registered, it is necessary to obtain the user's authorization to allow the floating window to be displayed. If the user's authorization is obtained, the floating window is displayed; if the user's authorization is not obtained, the floating window cannot be displayed.

[0035] In order to ensure that the application can display the floating window normally, one solution is to create and maintain the floating window by performing unified processing in the system base class (such as BaseActivity in the Android system). However, the base class needs to be aware of the pages that the floating window depends on in advance, and control the display or hiding of the floating window for the pages that the floating window depends on, or provide logic for dynamically replacing the floating window. Each page that the floating window depends on needs to create the same floating window view, resulting in unnecessary memory usage. At the same time, the status data inside multiple floating window views needs to be maintained separately, which makes the logic complicated.

[0036] In addition, the floating window processing method provided in the present application can be applied to applications developed based on the Android system or other systems. For ease of understanding, the following is an illustrative explanation using an application based on the Android system as an example. Those skilled in the art should understand that extending the solution of this embodiment to new solutions generated in applications developed based on other types of systems is also within the scope of the present application.

[0037] The floating window processing method provided in the present application creates a floating window view according to the global context information of the application when information needs to be displayed through the floating window in the application, and adds the created floating window view to the currently displayed page. The floating window is displayed through the view operation at the Activity level, and there is no need to apply for the system floating window permission. The floating window can be displayed when it is needed, which can ensure the normal use of the floating window related functions of the application and improve the availability and reliability of the application.

[0038] Furthermore, the floating window processing method provided by the present application maintains a static global variable to store the floating window view currently displayed by the application, and only maintains a static floating window view, which can reduce the memory occupation of unnecessary floating window view storage; and, by monitoring page switching events, automatically starting the processing of extracting the currently displayed floating window view from the previous page and adding it to the switched page after the page switch occurs, so that the floating window view continues to be displayed on the switched page. In this way, only the underlying developers need to develop program codes for monitoring page switching events and extracting the currently displayed floating window view from the previous page and adding it to the switched page. There is no need for APP developers to manually develop program codes for different pages to extract the floating window view from the previous page and add it to the next page when switching pages. This can reduce the complexity of application development and improve the efficiency of application development.

[0039] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0040] Figure 2 A flow chart of a floating window processing method provided for an embodiment of the present application. The floating window processing method provided in this embodiment can be specifically applied to an electronic device with an application having a floating window display function, and the electronic device can be a terminal device such as a smart phone, a tablet computer, or a server corresponding to the application, etc. In other embodiments, the electronic device can also be implemented using other devices, which is not specifically limited in this embodiment.

[0041] like Figure 2 As shown, the specific steps of this method are as follows:

[0042] Step S201: In response to the need to display information through a floating window in an application, a first floating window view is created according to global context information of the application, where the global context information refers to context information whose effective scope is the application.

[0043] In actual applications, when information needs to be displayed through a floating window in an application can be determined based on the functional requirements of the application.

[0044] Exemplarily, when a user performs an operation of publishing a notification message on a client of an application, the client sends a request to the application to display the notification message through a floating window. In response to the request to display information through a floating window, a first floating window view is created, and the first floating window view is used to display the notification message.

[0045] Exemplarily, when a floating window needs to be opened in an application to play a video stream, the application creates a first floating window view, and the first floating window view is used to play the video stream.

[0046] For example, in an application with a live broadcast function, a small live broadcast window can be implemented using floating window technology. When the small live broadcast window needs to be opened, a first floating window view is created, and the first floating window view is used to play the live video stream.

[0047] In this embodiment, considering that the life cycle of the globally unified floating window is longer than the life cycle of the page, when creating a floating window view, the global context information of the application is used to create the floating window view, instead of conventionally using the page context information to create the floating window view. This can avoid memory leaks when switching pages and improve the reliability of the application.

[0048] Step S202: Initialize display configuration information of the first floating window view.

[0049] After the first floating window view is created, the display configuration information of the first floating window view is initialized, wherein the display configuration information includes the content information to be displayed by the floating window view, and the style, layout and other parameter information of the floating window view.

[0050] Exemplarily, the parameter information of the floating window view may include display position, window size, background color, etc.

[0051] Step S203: Add the first floating window view to the first page currently displayed.

[0052] After the display configuration information of the first floating window view is initialized, the first floating window view is added to the currently displayed first page to realize the display of the floating window.

[0053] In this embodiment, when it is necessary to display information through a floating window in an application, a floating window view is created according to the global context information of the application, and after initializing the display configuration information of the first floating window view, the created floating window view is added to the currently displayed page, and the floating window is displayed through page-level view operations to replace the traditional solution of implementing the floating window function through global Window view operations. There is no need to apply for system floating window permissions, and the floating window can be displayed when it is needed, which can ensure the normal use of the floating window-related functions of the application and improve the availability and reliability of the application.

[0054] Figure 3 A flowchart of a method for processing a floating window provided in another embodiment of the present application. Figure 2 On the basis of the corresponding embodiment, in this embodiment, the information of the floating window view currently displayed in the application is stored as the only global floating window view in the application.

[0055] In order to distinguish the newly created floating window view from the floating window view already displayed in the application, the first floating window view refers to the newly created floating window view, and the second floating window view refers to the floating window view currently displayed in the application, that is, the stored floating window view information.

[0056] Before adding the newly created first floating window view to the currently displayed page, if there is a second floating window view being displayed in the application, and the second floating window view is not the same view as the first floating window view, then after removing the second floating window view from the first page, the first floating window view is added to the currently displayed first page to display the newly created first floating window view.

[0057] like Figure 3 As shown, the specific steps of this method are as follows:

[0058] Step S301: In response to the need to display information through a floating window in an application, a first floating window view is created according to global context information of the application.

[0059] The global context information refers to the context information whose effective scope is the application program.

[0060] In actual applications, when information needs to be displayed through a floating window in an application can be determined based on the functional requirements of the application.

[0061] Exemplarily, when a user performs an operation of publishing a notification message on a client of an application, the client sends a request to the application to display the notification message through a floating window. In response to the request to display information through a floating window, a first floating window view is created, and the first floating window view is used to display the notification message.

[0062] Exemplarily, when a floating window needs to be opened in an application to play a video stream, the application creates a first floating window view, and the first floating window view is used to play the video stream.

[0063] For example, in an application with a live broadcast function, a small live broadcast window can be implemented using floating window technology. When the small live broadcast window needs to be opened, a first floating window view is created, and the first floating window view is used to play the live video stream.

[0064] In this embodiment, considering that the life cycle of the globally unified floating window is longer than the life cycle of the page, when creating a floating window view, the global context information of the application is used to create the floating window view, instead of conventionally using the page context information to create the floating window view. This can avoid memory leaks when switching pages and improve the reliability of the application.

[0065] For example, taking an application based on the Android system as an example, the following code can be used to create a first floating window view according to the global context information of the application:

[0066] TextView floatView=new TextView(this.getApplicationContext());

[0067] Among them, floatView is the newly created floating window view, new TextView() is the function used to create a floating window view in the Android system, and this.getApplicationContext() is used to obtain the global context information of the current page, that is, the global context.

[0068] Step S302: Initialize display configuration information of the first floating window view.

[0069] After the first floating window view is created, the display configuration information of the first floating window view is initialized, wherein the display configuration information includes the content information to be displayed by the floating window view, and the style, layout and other parameter information of the floating window view.

[0070] Exemplarily, the parameter information of the floating window view may include display position, window size, background color, etc.

[0071] Optionally, the display processing of the floating window can be encapsulated into a specified method and provided externally. APP developers can quickly implement the floating window display capability by calling the specified method. There is no need for APP developers to manually rewrite the floating window display processing logic for different pages multiple times, which can improve the development efficiency of the application.

[0072] For example, taking an application based on the Android system as an example, the creation, initialization and display of the floating window view can be achieved through the following code:

[0073]

[0074]

[0075] Step S303: Determine whether there is a second floating window view according to the information of the second floating window view currently displayed in the stored application.

[0076] In this embodiment, the information of the floating window view currently displayed in the application is stored as the only global floating window view in the application.

[0077] After completing the initialization of the display configuration information of the first floating window view, before adding the first floating window view to the currently displayed page, obtain the information of the second floating window view currently displayed in the stored application; determine whether there is a second floating window view being displayed in the application based on the information of the second floating window view currently displayed in the stored application.

[0078] If it is determined that there is a second floating window view, and it is determined that the second floating window view is not the same view as the first floating window view, step S304 must be executed first to remove the second floating window view from the first page, and then step S305 must be executed to add the newly created first floating window view to the first page to achieve the replacement display of the floating window view.

[0079] If it is determined that the second floating window view does not exist, step S305 is directly executed to add the newly created first floating window view to the first page to display the newly created floating window view.

[0080] If it is determined that there is a second floating window view, and it is determined that the second floating window view and the first floating window view are the same view, it means that the first floating window view (that is, the second floating window view) is currently being displayed, and there is no need to repeatedly add the first floating window view, so the subsequent floating window display processing is not performed.

[0081] Optionally, a global static variable may be used to store information about the second floating window view currently displayed in the application. If the global static variable is empty, it is determined that there is no second floating window view. If the global static variable is not empty, it is determined that there is a second floating window view.

[0082] Furthermore, when the floating window view displayed in the application sends a transformation, the stored information of the second floating window view currently displayed in the application is updated, so that the stored information of the floating window view is the information of the second floating window view currently displayed in the application.

[0083] Step S304: according to the information of the second floating window view currently displayed in the stored application, if the second floating window view exists and the second floating window view is not the same view as the first floating window view, the second floating window view is removed from the first page.

[0084] If it is determined that there is a second floating window view, and it is determined that the second floating window view is not the same view as the first floating window view, then in this step, the second floating window view is first removed from the first page, and then step S305 is executed to add the newly created first floating window view to the first page to realize the replacement display of the floating window view.

[0085] Optionally, in this step, removing the second floating window view from the first page can be implemented in the following manner:

[0086] Determine the parent control of the second floating window view; remove the second floating window view from the parent control.

[0087] Step S305: Add the first floating window view to the first page currently displayed.

[0088] In this step, the first floating window view is added to the currently displayed first page by calling a general API provided by the system for adding a view to a page.

[0089] For example, taking an application based on the Android system as an example, the following code can be used to add the first floating window view floatView to the currently displayed first page activity:

[0090] activity.addContentView(currentFloatView=floatView,layoutParams);

[0091] Among them, layoutParams is the display configuration information of the first floating window view floatView.

[0092] Optionally, if the display configuration information of the first floating window view is empty, the first floating window view may be displayed using the default display configuration information, wherein the default display configuration information of the floating window may be set and adjusted according to the actual application scenario and requirements of the application, and is not specifically limited here.

[0093] In this embodiment, in order to avoid memory leaks, the floating window view is required to use the global context information of the application. Optionally, before adding the first floating window view to the currently displayed first page, it can be verified whether the context information of the first floating window view is the global context information; if the context information of the first floating window view is not the global context information, an abnormal prompt information is output to improve the robustness and reliability of the application.

[0094] In an optional implementation, by monitoring page switching events, the process of automatically cutting out the currently displayed floating window view from the previous page and adding it to the switched page is started after the page switch occurs, so that the floating window view continues to be displayed on the switched page. In this way, only the underlying developers need to develop program code for monitoring page switching events and cutting out the currently displayed floating window view from the previous page and adding it to the switched page. There is no need for APP developers to manually develop program code for different pages to cut out the floating window view from the previous page and add it to the next page when switching pages. This can reduce the complexity of application development and improve the efficiency of application development.

[0095] like Figure 4 As shown, the floating window processing method provided in this embodiment may also include the following steps:

[0096] Step S401: Detect a page switching event.

[0097] In this embodiment, page switching events occurring in the application program can be detected in real time.

[0098] Exemplarily, it can be achieved by real-time detection of page switching operations in the application, or by monitoring page entry events in the application, or by other methods of discovering page switching behaviors, which are not specifically limited here.

[0099] Optionally, this step can be implemented in the following ways:

[0100] Listen for page entry events; when a page entry event is listened for, determine that a page switch event is detected, determine the newly entered page, and use the newly entered page as the switched page.

[0101] Exemplarily, by using registerActivityLifecycleCallbacks of Application to monitor page (activity) switching events, it is possible to monitor page switching events.

[0102] Step S402: In response to detecting a page switching event, determine the second page where the second floating window view is located according to the stored information of the second floating window view.

[0103] After detecting a page switching event, the stored information of the second floating window view is obtained, and according to the stored information of the second floating window view, the second page displayed by the second floating window view currently being displayed in the application can be determined.

[0104] After determining that the second floating window view currently displayed in the application is displayed on the second page, by comparing the second page with the page after the page switching, it can be determined whether the page after the page switching is the second page.

[0105] If the page after switching is not the second page, by executing steps S403-S404, the second floating window view is cut out from the second page and displayed on the page after switching.

[0106] If the page after switching is the second page, the page after switching displays the second floating window view, and there may be repeated display of the floating window view, and no subsequent processing is performed.

[0107] Step S403: If the page after page switching is not the second page, remove the second floating window view from the second page.

[0108] If it is determined that the page after switching is not the second page, then in this step the second floating window view is first removed from the displayed second page, and then step S404 is executed to add the second floating window view to the page after switching.

[0109] Optionally, this step can be implemented in the following ways:

[0110] Determine the parent control of any floating window view; remove any floating window view from the parent control.

[0111] Step S404: Add the second floating window view to the switched page.

[0112] In this step, the second floating window view is added to the switched page by calling a general API provided by the system for adding a view to a page.

[0113] For example, taking an application based on the Android system as an example, the second floating window view floatView2 can be added to the switched page activity1 through the following code:

[0114] activity1.addContentView(currentFloatView=floatView2,layoutParams2);

[0115] Among them, layoutParams2 is the display configuration information of the second floating window view floatView2.

[0116] Optionally, if the display configuration information of the second floating window view is empty, the default display configuration information can be used to display the second floating window view. The default display configuration information of the floating window can be set and adjusted according to the actual application scenario and requirements of the application, and is not specifically limited here.

[0117] In this embodiment, in order to avoid memory leaks, the floating window view is required to use the global context information of the application. Optionally, before adding the second floating window view to the switched page, it can be verified whether the context information of the second floating window view is the global context information; if the context information of the second floating window view is not the global context information, an abnormal prompt information is output to improve the robustness and reliability of the application.

[0118] In this embodiment, by monitoring page switching events, the process of automatically cutting out the currently displayed floating window view from the previous page and adding it to the switched page is started after the page switch occurs, so that the floating window view continues to be displayed on the switched page. In this way, only the underlying developers need to develop program codes for monitoring page switching events and cutting out the currently displayed floating window view from the previous page and adding it to the switched page. There is no need for APP developers to manually develop program codes for cutting out the floating window view from the previous page and adding it to the next page when switching pages for different pages. This can reduce the complexity of application development and improve the efficiency of application development.

[0119] For example, in this solution, by listening to the page switching event, after the page switching occurs, the process of automatically cutting out the currently displayed floating window view from the previous page and adding it to the switched page is started, so that the floating window view continues to be on the switched page. The core code logic is as follows:

[0120]

[0121]

[0122] Among them, by encapsulating the display of the floating window into a show method, providing a show method to the outside world can quickly realize the processing capability of the floating window, making the application API more simplified. The show method can be implemented using the following code:

[0123]

[0124]

[0125] Among them, the method cancel() that removes the floating window view currentFloatView being displayed from the page where it is located can be implemented using the following code:

[0126]

[0127]

[0128] The getAttachActivityOfFloatView() method is used to obtain the page (Activity) to be displayed in the floating window view. The getAttachActivityOfFloatView() method can be implemented using the following code:

[0129]

[0130] Among them, getActivity() is used to obtain the current page, which can be implemented using the following code:

[0131]

[0132] The floating window processing solution provided in this application combines the three key technical points of creating a floating window view of the global context, monitoring the Activity life cycle, and using the general API provided by the system to add views to the page, so as to achieve the ability to directly display the floating window without applying for permission.

[0133] Figure 5 The structure diagram of the floating window processing device provided in one embodiment of the present application is shown in FIG. The floating window processing device provided in the embodiment of the present application can execute the processing flow provided in the floating window processing method embodiment. Figure 5 As shown, the floating window processing device 50 includes: a floating window creation module 501, a floating window initialization module 502 and a floating window control module 503.

[0134] Specifically, the floating window creation module 501 is used to create a first floating window view in response to the need to display information through a floating window in an application program according to global context information of the application program, where the global context information refers to context information whose effective scope is the application program.

[0135] The floating window initialization module 502 is used to initialize the display configuration information of the first floating window view.

[0136] The floating window control module 503 is used to add a first floating window view to the first page currently displayed.

[0137] Optionally, information of a second floating window view currently displayed in the application is stored, and the floating window control module is also used to: before adding the first floating window view to the currently displayed page, if a second floating window view exists and the second floating window view is not the same view as the first floating window view, remove the second floating window view from the first page.

[0138] Optionally, the floating window control module is further used for:

[0139] Detecting a page switching event; in response to detecting a page switching event, determining the second page where the second floating window view is located based on the stored information of the second floating window view; if the page after the page switch is not the second page, removing the second floating window view from the second page, and adding the second floating window view to the page after the switch.

[0140] Optionally, the floating window control module is further used for:

[0141] Listen for page entry events; when a page entry event is listened for, determine that a page switch event is detected, determine the newly entered page, and use the newly entered page as the switched page.

[0142] Optionally, the floating window control module is further used for:

[0143] Before adding the first floating window view to the currently displayed first page, verify whether the context information of the first floating window view is global context information; if the context information of the first floating window view is not global context information, output abnormal prompt information.

[0144] Optionally, the floating window control module is used to determine a parent control of any floating window view when removing any floating window view from any page; and remove any floating window view from the parent control.

[0145] Optionally, a global static variable is used to store information of the second floating window view currently displayed in the application.

[0146] The floating window control module is also used for:

[0147] If the global static variable is empty, it is determined that the second floating window view does not exist; if the global static variable is not empty, it is determined that the second floating window view exists.

[0148] The device provided in the embodiments of the present application can be specifically used to execute the method embodiments provided in any of the above method embodiments, and the specific functions and effects will not be repeated here.

[0149] Figure 6 This is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present application. Figure 6As shown, the electronic device 60 includes: a processor 601, and a memory 602 communicatively connected to the processor 601, and the memory 602 stores computer-executable instructions.

[0150] Among them, the processor executes the computer execution instructions stored in the memory to implement the floating window processing method provided by any of the above method embodiments, and the specific functions and technical effects that can be achieved are not repeated here.

[0151] An embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the floating window processing method provided by any of the above method embodiments.

[0152] An embodiment of the present application also provides a computer program product, which includes: a computer program, which is stored in a readable storage medium, and at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the floating window processing method provided by any of the above method embodiments.

[0153] In the several 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 units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, 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.

[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0155] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0156] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0157] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0158] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0159] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for processing a floating window, characterized in that: include: In response to the need to display information through a floating window in the application, a first floating window view is created according to global context information of the application, where the global context information refers to context information whose effective scope is the application, and the application does not need to apply for system floating window permission; Initialize display configuration information of the first floating window view; Adding the first floating window view to the currently displayed first page; Before adding the first floating window view to the currently displayed first page, the method further includes: Verifying whether the context information of the first floating window view is global context information; If the context information of the first floating window view is not global context information, outputting abnormal prompt information; The method further comprises: Detect page switching events; In response to detecting a page switching event, determining a second page where the second floating window view is located according to the stored information of the second floating window view; If the page after page switching is not the second page, the second floating window view is removed from the second page, and the second floating window view is added to the page after switching.

2. The method according to claim 1, characterized in that Storing information of a second floating window view currently displayed in the application, before adding the first floating window view to the currently displayed page, further comprising: If the second floating window view exists, and the second floating window view is not the same view as the first floating window view, the second floating window view is removed from the first page.

3. The method according to claim 1, characterized in that The event of detecting page switching includes: Listen for page entry events; When a page entry event is monitored, it is determined that a page switching event is detected, a newly entered page is determined, and the newly entered page is used as a switched page.

4. The method according to claim 1 or 2, characterized in that: Remove any floating window view from any page, including: Determine the parent control of any floating window view; Remove any floating window view from the parent control.

5. The method according to claim 1 or 2, characterized in that: Also includes: Use global static variables to store information about the second floating window view currently displayed in the application. If the global static variable is empty, it is determined that the second floating window view does not exist; If the global static variable is not empty, it is determined that the second floating window view exists.

6. A floating window processing device, characterized in that: include: A floating window creation module, configured to create a first floating window view in response to a need to display information through a floating window in an application program, according to global context information of the application program, wherein the global context information refers to context information whose effective range is the application program, and the application program does not need to apply for a system floating window permission; A floating window initialization module, used to initialize the display configuration information of the first floating window view; A floating window control module, used to add the first floating window view to the currently displayed first page; The floating window control module is further used to verify whether the context information of the first floating window view is global context information before adding the first floating window view to the currently displayed first page; If the context information of the first floating window view is not global context information, outputting abnormal prompt information; The floating window control module is also used to detect page switching events; In response to detecting a page switching event, determining a second page where the second floating window view is located according to the stored information of the second floating window view; If the page after page switching is not the second page, the second floating window view is removed from the second page, and the second floating window view is added to the page after switching.

7. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.

Citation Information

Patent Citations

  • Managing method of android application interface

    CN105630461A

  • Display method of floating window view and related device

    CN109933401A

  • Global floating window implementation method and device, terminal and storage medium

    CN112612468A