Popup window life cycle monitoring method, electronic equipment and vehicle
By initializing the life cycle class in the pop-up window object and associated with the system interface, the problem of lack of life cycle callback management in the pop-up window is solved, and the life cycle monitoring of the pop-up window object is realized, reducing the development and maintenance costs.
Patent Information
- Application Number
- CN202411915805.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-22
AI Technical Summary
The current pop-up window lacks life cycle callback management, which makes the outside world unable to perceive the life cycle changes of pop-up windows. It is necessary to maintain pop-up windows and pop-up window fragments at the same time, increasing the development and maintenance costs.
By initializing the life cycle class in the pop-up window object, associating the life cycle class with the system interface, the system interface subscribes to the life cycle class, and sending life cycle change prompt information to the system interface in response to the life cycle changes of the pop-up window object.
The life cycle monitoring of pop-up window objects is realized, without the need to maintain pop-up windows and pop-up window fragments at the same time, reducing development and maintenance costs.
Smart Images

Figure CN119862061A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to a pop-up window life cycle monitoring method, electronic equipment and vehicle. Background Art
[0002] The pop-up window (dialog) in the native Android system is a special window. When applied to the graphical user interface, it can be used to display information to the user in the user interface or to obtain user input response when necessary.
[0003] The current pop-up window lacks lifecycle callback management. When in use, the outside world cannot perceive the changes in the life cycle of the pop-up window. At this time, the pop-up window fragment (D ial ogFragment) will be maintained at the same time to determine the life cycle of the pop-up window, but it will result in the need to maintain both the pop-up window and the pop-up window fragment, resulting in increased development and maintenance costs. Summary of the invention
[0004] In view of this, the purpose of the present disclosure is to propose a pop-up window life cycle monitoring method, electronic device and vehicle, so as to solve the current problem that in order to determine the life cycle of a pop-up window, two types of pop-up windows and pop-up window fragments need to be maintained at the same time, resulting in increased development and maintenance costs.
[0005] Based on the above purpose, the first aspect of the present disclosure provides a pop-up window life cycle monitoring method, the method comprising:
[0006] After receiving the pop-up window creation instruction sent by the system interface, a pop-up window object is created, and a life cycle class is initialized in the pop-up window object;
[0007] Associating the life cycle class with the system interface so that the system interface subscribes to the life cycle class;
[0008] In response to the life cycle change of the pop-up window object, the pop-up window object sends life cycle change prompt information to the system interface through the life cycle class, wherein the life cycle change prompt information is used to prompt that the life cycle of the pop-up window object has changed.
[0009] Based on the same inventive concept, the second aspect of the present disclosure proposes a pop-up window life cycle monitoring device, comprising:
[0010] The instruction receiving module is configured to create a pop-up window object after receiving the pop-up window creation instruction sent by the system interface, and initialize the life cycle class in the pop-up window object;
[0011] a subscription module configured to associate the life cycle class with the system interface so that the system interface subscribes to the life cycle class;
[0012] The prompt module is configured to respond to the life cycle change of the pop-up window object, and the pop-up window object sends life cycle change prompt information to the system interface through the life cycle class, wherein the life cycle change prompt information is used to prompt that the life cycle of the pop-up window object has changed.
[0013] Based on the same inventive concept, the third aspect of the present disclosure proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the pop-up window life cycle monitoring method as described above when executing the computer program.
[0014] Based on the same inventive concept, the fourth aspect of the present disclosure proposes a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute the pop-up window life cycle monitoring method as described above.
[0015] Based on the same inventive concept, the fifth aspect of the present disclosure provides a vehicle, including the pop-up window life cycle monitoring device described in the second aspect or the electronic device described in the third aspect or the storage medium described in the fourth aspect.
[0016] From the above, it can be seen that the present disclosure proposes a pop-up window life cycle monitoring method, electronic device and vehicle. After receiving the pop-up window creation instruction sent by the system interface, a pop-up window object is created, a life cycle class is initialized in the pop-up window object, and the life cycle class is associated with the system interface. By modifying the pop-up window object and adding the life cycle class therein, the system interface subscribes to the life cycle class, so that when the life cycle of the pop-up window object changes later, the system interface can be notified, so that the outside world can perceive the life cycle of the current pop-up window object. In response to the life cycle change of the pop-up window object, the pop-up window object sends life cycle change prompt information to the system interface through the life cycle class to prompt the system interface that the life cycle of the pop-up window object has changed. The life cycle monitoring can be achieved only by modifying the pop-up window object, and there is no need to maintain both the pop-up window and the pop-up window fragment at the same time, which reduces the development and maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 A flowchart of a method for monitoring a pop-up window life cycle according to an embodiment of the present disclosure;
[0019] Figure 2 This is a timing diagram corresponding to a pop-up window life cycle monitoring method according to another embodiment of the present disclosure;
[0020] Figure 3 Another timing diagram corresponding to a pop-up window life cycle monitoring method according to another embodiment of the present disclosure;
[0021] Figure 4 It is a structural block diagram of a pop-up window life cycle monitoring device according to an embodiment of the present disclosure;
[0022] Figure 5 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0024] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0025] The terms used in this disclosure are explained as follows:
[0026] Dialog: A dialog box is a small window that prompts the user to make a decision or enter additional information. It usually does not fill the entire screen and is used for some additional interactions. The Dialog class is the base class of the dialog box.
[0027] DialogFragment: Pop-up window fragment, DialogFragment is a special fragment subclass dedicated to creating and hosting dialog boxes, which can automatically restore the dialog box state when the configuration changes.
[0028] The pop-up window (dialog) in the native Android system is a special window. When applied to the graphical user interface, it can be used to display information to the user in the user interface, or to obtain user input response when necessary.
[0029] Currently, the official website provides two types of function containers, namely, pop-up window (Dialog) and pop-up window fragment (DialogFragment), but both have corresponding shortcomings in actual development. The disadvantage of Dialog is the lack of lifecycle callback management. When using it, the outside world cannot perceive the Dialog lifecycle. Resources need to be released manually, which is easy to cause memory leaks. The decoupling ability is weak, and there is no concise code template when writing complex business.
[0030] The disadvantage of DialogFragment is that it strongly depends on FragmentManager. DialogFragment cannot be used in background service pop-ups. After the onSaveInstanceState method of Activity, the show method is called, and the following exception is thrown: Can not perform this action after onSaveInstanceState. Click the button multiple times quickly to display the DialogFragment pop-up box (java.lang.IllegalStateException: Fragment already added: XXDialogFragment).
[0031] The current pop-up window lacks lifecycle callback management. When in use, the outside world cannot perceive changes in the lifecycle of the pop-up window. At this time, the pop-up window fragment (DialogFragment) will be maintained at the same time to determine the lifecycle of the pop-up window, but it will result in the need to maintain both the pop-up window and the pop-up window fragment, resulting in increased development and maintenance costs.
[0032] Based on the above description, this embodiment proposes a pop-up window life cycle monitoring method, such as Figure 1 As shown, the method includes:
[0033] Step 101, after receiving a pop-up window creation instruction sent by a system interface, a pop-up window object is created, and a life cycle class is initialized in the pop-up window object.
[0034] Step 102: Associating the lifecycle class with the system interface so that the system interface subscribes to the lifecycle class.
[0035] Step 103, in response to the life cycle change of the pop-up window object, the pop-up window object sends life cycle change prompt information to the system interface through the life cycle class, wherein the life cycle change prompt information is used to prompt that the life cycle of the pop-up window object has changed.
[0036] In specific implementation, after receiving the pop-up window creation instruction sent by the system interface, a pop-up window object is created, and a life cycle class is initialized in the pop-up window object, wherein the life cycle class is used to receive event information of changes in the life cycle of the pop-up window object when the life cycle of the pop-up window object changes.
[0037] The pop-up window life cycle monitoring method described in this embodiment is applied to the display controller. In this embodiment, the system interface is the Android system interface. The Android system interface sends a pop-up window creation instruction to the display controller. After the interface on the display controller side receives the pop-up window creation instruction, it creates a pop-up window object.
[0038] The initialized life cycle class is associated with the system interface so that the system interface subscribes to the life cycle class. When the pop-up window object detects that its own life cycle has changed, the pop-up window object sends a life cycle change prompt message to the system interface subscribed to the life cycle class through the initialized life cycle class to prompt the system interface that the life cycle of the pop-up window object it is concerned about has changed.
[0039] In this embodiment, after the pop-up window object sends lifecycle change prompt information to the system interface subscribed to the lifecycle class through the initialized lifecycle class, the system interface subscribes to the lifecycle change prompt information through the management interface. Specifically, the management interface is the LifecycleObserver interface.
[0040] Through the above scheme, after receiving the pop-up window creation instruction sent by the system interface, a pop-up window object is created, a life cycle class is initialized in the pop-up window object, and the life cycle class is associated with the system interface. By modifying the pop-up window object and adding the life cycle class therein, the system interface subscribes to the life cycle class, and it can be realized that when the life cycle of the pop-up window object changes later, the system interface is notified, so that the outside world can perceive the life cycle of the current pop-up window object. In response to the life cycle change of the pop-up window object, the pop-up window object sends life cycle change prompt information to the system interface through the life cycle class to prompt the system interface that the life cycle of the pop-up window object has changed. The life cycle monitoring can be realized only by modifying the pop-up window object, and there is no need to maintain both the pop-up window and the pop-up window fragment at the same time, which reduces the development and maintenance costs.
[0041] In some embodiments, step 101 specifically includes:
[0042] Step 1011, initializing a life cycle management class in the pop-up window object, constructing a life cycle class in the life cycle management class, and sending a registration object to the life cycle management class;
[0043] Step 1012, after receiving the registration object, the lifecycle management class sends a management object to the pop-up window object;
[0044] Step 1013: the pop-up window object receives the management object, and the life cycle class initialization is completed.
[0045] In the specific implementation, a life cycle management class is constructed in the pop-up window object, and the life cycle management class is initialized. After the life cycle management class is initialized, a life cycle class is constructed in the life cycle management class, and the life cycle class sends a registration object to the life cycle management class. Among them, the registration object provides a single point of control, and the registration object is used to declare, allocate and initialize state variables. Then, after the subsequent life cycle management class receives the registration object, the class name and parameters required to initialize the life cycle class can be obtained.
[0046] After receiving the registration object, the life cycle management class determines the class name and parameters required to initialize the life cycle class, and provides the corresponding class name and parameters for the life cycle class. And sends a management object to the pop-up window object, and the management object is an object corresponding to the life cycle management class, that is, each life cycle management class has a corresponding management object.
[0047] When the pop-up window object receives the management object, the life cycle class is initialized. When the life cycle of the subsequent pop-up window object changes, the information about the life cycle change can be sent to the corresponding life cycle management class according to the management object, and then the life cycle management class informs the life cycle class. Because the system interface subscribes to the life cycle class, the life cycle class can notify the system interface of the information about the life cycle change of the pop-up window object, so that the outside world can perceive the life cycle change of the current pop-up window object.
[0048] In this embodiment, the lifecycle management class is the Lifecycleowner class, the lifecycle class is the lifecycle class, the registration object is the registration object, and the management object is the owner object.
[0049] Through the above scheme, a life cycle management class bound to the pop-up window object is constructed, and the life cycle class is initialized in the life cycle management class, so that when the life cycle of the pop-up window object changes later, it is distributed to the corresponding life cycle class through the life cycle management class, and then the life cycle class sends the prompt information to the system interface.
[0050] In some embodiments, step 103 specifically includes:
[0051] Step 1031, in response to the life cycle change of the pop-up window object, the pop-up window object sends life cycle change data to the life cycle management class corresponding to the management object;
[0052] Step 1032, the lifecycle management class receives the lifecycle change data, generates and sends a lifecycle change event to the lifecycle class;
[0053] Step 1033: The lifecycle class receives the lifecycle change event and sends lifecycle change prompt information to the system interface.
[0054] In specific implementation, during the process of initializing the life cycle class, the life cycle management class sends a management object to the pop-up window object. Therefore, when the pop-up window object detects that there is a change in its own life cycle, the pop-up window object determines the life cycle management class corresponding to the management object based on the received management object. Then, the pop-up window object sends life cycle change data to the corresponding life cycle class, wherein the life cycle change data is used to indicate that the life cycle of the pop-up window object has changed.
[0055] Because the lifecycle class is constructed in the lifecycle management class, when the lifecycle management class receives the lifecycle change data sent by the pop-up window object, it generates a lifecycle event and sends the lifecycle event to the lifecycle class so that the lifecycle class can know the lifecycle changes sent by the pop-up window object.
[0056] After the life cycle initialization is completed, the system interface subscribes to the life cycle class. When the life cycle class receives the life cycle event, the life cycle class sends the life cycle change prompt information to the system interface to prompt the system interface that the life cycle of the pop-up window object has changed, so that the life cycle change of the current pop-up window object can be perceived.
[0057] Through the above scheme, when the life cycle of the pop-up window object changes, through data communication between the pop-up window object, the life cycle management class and the life cycle class, the system interface can be informed of the corresponding life cycle changes through the life cycle class.
[0058] In some embodiments, after step 101, the method further includes:
[0059] Step 10A, constructing a view storage class in the pop-up window object, and sending a storage object to the pop-up window object;
[0060] Step 10B: the pop-up window object receives the storage object, the view storage class is initialized, and the view storage class subscribes to the life cycle class.
[0061] During specific implementation, after initializing the life cycle class in the pop-up window object, a view storage class is constructed in the pop-up window object, and the view storage class sends a storage object to the pop-up window object, where the storage object is an object corresponding to the view storage class, that is, each view storage class has a corresponding storage object, so that the view storage class corresponding to the storage object can be determined subsequently based on the storage object.
[0062] After the pop-up window object receives the storage object, it indicates that the view storage class initialization is completed. The view storage class provides a cleanup method, namely, the clear() method.
[0063] After the view storage class is initialized, the view storage class subscribes to the life cycle class, so that the subsequent pop-up window object detects the end of its own life cycle and sends the end of life cycle information to the life cycle class. The life cycle class notifies the view storage class, and then the view storage class cleans up the resources occupied by the pop-up window object through the cleanup method.
[0064] In this embodiment, the view storage class is the viewmodelstore class, and the storage object is the store object.
[0065] Through the above scheme, by constructing a view storage class in the pop-up window object, and the view storage class subscribes to the life cycle class, the subsequent pop-up window object detects the end of its own life cycle and notifies the life cycle class. The life cycle class then notifies the view storage class, and then the view storage class cleans up the resources occupied by the pop-up window object.
[0066] In some embodiments, after step 10A, the method further includes:
[0067] Step A, initializing a view creation class in the pop-up window object, and the pop-up window object sending the storage object to the view creation class;
[0068] Step B, after receiving the storage object, the view creation class creates a view class corresponding to the storage object and sends a view object instance to the view creation class;
[0069] Step C, the view creation class receives the view object instance and sends the view object to the pop-up window object;
[0070] Step D: Determine that the pop-up window object receives the view object and that the view class is constructed so that when the pop-up window object receives the service, the view class is used to decouple the service.
[0071] In specific implementation, after the view storage class sends the storage object to the pop-up window object, the view creation class is initialized in the pop-up window object. Then, after the pop-up window object receives the storage object, the pop-up window object sends the storage object to the view creation class so that the view creation class can create the view class according to the storage object.
[0072] After receiving the storage object, the view creation class creates a view class corresponding to the storage object. After the view class is created, it returns the view object instance to the view creation class. After receiving the view object instance, the view creation class converts the view object instance into a view object and sends the view object to the pop-up window object.
[0073] When the pop-up window object receives the view object, the view class is constructed. When the pop-up window object receives the business, the business is decoupled using the view class. Decoupling refers to reducing the dependencies between different parts of the business so that each part of the business can be developed, maintained and evolved relatively independently. The main goal of decoupling is to reduce the tight coupling between components to improve the flexibility, maintainability and scalability of the system.
[0074] In this embodiment, the view creation class is the viewmodelprovider class, and the view class is the viewmodel class.
[0075] Through the above scheme, a view class is created in the pop-up window object, and after the pop-up window object receives the business, the view class is used to decouple the business to reduce the dependency between modules, improve the independence, reusability and portability of the system, and solve the problem of weak decoupling capability of the current pop-up window object.
[0076] In some embodiments, after step 10B, the method further includes:
[0077] Step 10a, in response to the end of the life cycle of the pop-up window object, the pop-up window object sends life cycle end data to the view storage class through the life cycle class;
[0078] Step 10b: The view storage class receives lifecycle end data and releases resource data occupied by the pop-up window object.
[0079] In specific implementation, when the pop-up window object detects the end of its own life cycle, the pop-up window object sends life cycle end data to the life cycle management class. After receiving the life cycle end data, the life cycle management class forwards the life cycle end data to the life cycle class. After receiving the life cycle end data, the life cycle class forwards the life cycle end data to the view storage class.
[0080] After the view storage class receives the life cycle end data, it is determined that the life cycle of the pop-up window object has ended, and the view storage class releases the resource data occupied by the pop-up window object.
[0081] Through the above scheme, when the life cycle of the pop-up window object ends, the life cycle end data can be sent to the created view storage class through the life cycle class, and then the view storage class releases the resource data occupied by the pop-up window object, realizing automatic cleanup and release of resources.
[0082] In some embodiments, step 10b further includes:
[0083] Step 10c, constructing a view class in the pop-up window object;
[0084] Step 10d: in response to the view class being constructed, the view storage class sends a resource cleanup prompt to the view class, wherein the resource cleanup prompt is prompt information for prompting the view class to clean up resources.
[0085] During specific implementation, a view class is constructed in the pop-up window object, and the construction process of the view class specifically includes:
[0086] After the view storage class sends the storage object to the pop-up window object, the view creation class is initialized in the pop-up window object. After the pop-up window object receives the storage object, the pop-up window object sends the storage object to the view creation class so that the view creation class can create a view class according to the storage object.
[0087] After receiving the storage object, the view creation class creates a view class corresponding to the storage object. After the view class is created, the view object instance is returned to the view creation class. After receiving the view object instance, the view creation class converts the view object instance into a view object and sends the view object to the pop-up window object. When the pop-up window object receives the view object, the view class construction is completed.
[0088] After the view class is constructed, if the life cycle of the pop-up window object ends, the pop-up window object sends life cycle end data to the view storage class through the life cycle class.
[0089] The view storage class receives the life cycle end data and releases the resource data occupied by the pop-up window object. At the same time, the view storage class sends a resource cleanup prompt to the view class, and then the view class cleans up the resource occupation corresponding to its own pop-up window object after receiving the resource cleanup prompt.
[0090] In this embodiment, the clear() function is called in the view class to clean up and recycle resources.
[0091] Through the above solution, after the view storage class receives the life cycle end data, it can clean up resources. At the same time, the view storage class can also send the life cycle end data to the view class, and then the view class can also clean up resources, which is more complete for the cleanup of resources occupied by the pop-up window object.
[0092] In some embodiments, after step 101, the method further includes:
[0093] Step a, initializing a data storage class in the view class, and the life cycle class subscribing to the data storage class;
[0094] Step b, in response to a change in the stored data in the data storage class, sending a data update prompt to the life cycle class;
[0095] Step c: the lifecycle class receives the data update prompt, sends the update data to the system interface, and the system interface renders the update data.
[0096] In specific implementation, the data storage class is initialized in the view class, and the life cycle class subscribes to the data storage class. When the stored data in the data storage class changes, a data update prompt is sent to the life cycle class, wherein the data update prompt contains the update data required for the update.
[0097] After receiving the data update prompt, the life cycle class indicates that the data needs to be updated, so the update data contained in the data update prompt is sent to the system interface. After receiving the update data, the system interface renders the update data.
[0098] In this embodiment, the data storage class is the Android Livedata class. The Livedata class is used as a data source to drive the page component. Since the declaration of Dialog has a declaration cycle management mechanism, LiveData can be used to further optimize performance. When the Dialog is blocked or invisible, even if the data source returns, the Dialog will not be notified to bind the page data and the page view. Instead, the data and the page view will be bound after the latest data is sent when the Dialog becomes visible.
[0099] Based on the same inventive concept, another embodiment of the present disclosure provides a method for monitoring the life cycle of a pop-up window. The timing diagram corresponding to the method is as follows: Figure 2 As shown, including:
[0100] The system interface creates a dialog object through the init method, initializes the Lifecycleowner class through the init method in the dialog object, constructs the lifecycle class through the init method in the Lifecycleowner class, and sends a registry object to the Lifecycleowner class;
[0101] After receiving the registration object, the Lifecycleowner class sends the owner object to the dialog object;
[0102] The dialog object receives the owner object, and the lifecycle class initialization is completed.
[0103] The lifecycle class is associated with the system interface so that the system interface subscribes to the lifecycle class.
[0104] In response to the lifecycle change of the dialog object, the dialog object sends lifecycle change data to the Lifecycleowner class corresponding to the owner object;
[0105] The Lifecycleowner class receives the lifecycle change data, generates and sends a lifecycle change event to the Lifecycle class;
[0106] The lifecycle class receives the lifecycle change event and sends lifecycle change prompt information to the system interface.
[0107] Based on the same inventive concept, another embodiment of the present disclosure provides a method for monitoring the life cycle of a pop-up window. The timing diagram corresponding to the method is as follows: Figure 3 As shown, including:
[0108] Create a dialog object, initialize the Lifecycleowner class through the init method in the dialog object, construct the lifecycle class through the init method in the Lifecycleowner class, and send a registry object to the Lifecycleowner class;
[0109] After receiving the registration object, the Lifecycleowner class sends the owner object to the dialog object;
[0110] The dialog object receives the owner object, and the lifecycle class initialization is completed.
[0111] In the dialog object, the viewmodelstore class is constructed using the init method, and the store object is sent to the dialog object.
[0112] The dialog object receives the store object, the viewmodelstore class is initialized, and the viewmodelstore class subscribes to the lifecycle class.
[0113] Initialize the ViewModelProvider class in the Dialog object, and the Dialog object sends the Store object to the ViewModelProvider class;
[0114] After receiving the store object, the viewmodelprovider class creates a viewmodel class corresponding to the store object and sends a viewmodel view object instance to the viewmodelprovider class;
[0115] The viewmodelprovider class receives the viewmodel view object instance and sends the viewmodel object to the dialog object;
[0116] It is determined that the dialog object receives the viewmodel object and the viewmodel class is constructed so that when the dialog object receives the service, the viewmodel class is used to decouple the service.
[0117] In response to the end of the life cycle of the dialog object, the dialog object sends life cycle end data to the viewmodelstore class through the life cycle class;
[0118] The viewmodelstore class receives the lifecycle end data and releases the resource data occupied by the dialog object.
[0119] Construct a viewmodel class in the dialog object;
[0120] In response to the completion of the construction of the viewmodel class, the viewmodelstore class sends a resource cleanup prompt to the viewmodel class, wherein the resource cleanup prompt is prompt information for prompting the viewmodel class to clean up resources.
[0121] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0122] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0123] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a pop-up window life cycle monitoring device.
[0124] refer to Figure 4, Figure 4 The pop-up window life cycle monitoring device of the embodiment includes:
[0125] The instruction receiving module 401 is configured to create a pop-up window object after receiving a pop-up window creation instruction sent by the system interface, and initialize a life cycle class in the pop-up window object;
[0126] A subscription module 402, configured to associate the life cycle class with the system interface so that the system interface subscribes to the life cycle class;
[0127] The prompt module 403 is configured to respond to the life cycle change of the pop-up window object. The pop-up window object sends life cycle change prompt information to the system interface through the life cycle class, wherein the life cycle change prompt information is used to prompt that the life cycle of the pop-up window object has changed.
[0128] In some embodiments, the instruction receiving module 401 is specifically configured to:
[0129] Initializing a life cycle management class in the pop-up window object, constructing a life cycle class in the life cycle management class, and sending a registration object to the life cycle management class;
[0130] After receiving the registration object, the lifecycle management class sends a management object to the pop-up window object;
[0131] The pop-up window object receives the management object, and the life cycle class initialization is completed.
[0132] In some embodiments, the prompt module 403 is specifically configured to:
[0133] In response to a lifecycle change of the pop-up window object, the pop-up window object sends lifecycle change data to the lifecycle management class corresponding to the management object;
[0134] The lifecycle management class receives the lifecycle change data, generates and sends a lifecycle change event to the lifecycle class;
[0135] The life cycle class receives the life cycle change event and sends life cycle change prompt information to the system interface.
[0136] In some embodiments, the device further includes a view storage module, and the view storage module is specifically configured to:
[0137] Constructing a view storage class in the pop-up window object, and sending a storage object to the pop-up window object;
[0138] The pop-up window object receives the storage object, the view storage class is initialized, and the view storage class subscribes to the life cycle class.
[0139] In some embodiments, the view storage module is further configured to:
[0140] Initializing a view creation class in the pop-up window object, and the pop-up window object sending the storage object to the view creation class;
[0141] After receiving the storage object, the view creation class creates a view class corresponding to the storage object and sends a view object instance to the view creation class;
[0142] The view creation class receives the view object instance and sends the view object to the pop-up window object;
[0143] It is determined that the pop-up window object receives the view object and the view class is constructed, so that when the pop-up window object receives the service, the view class is used to decouple the service.
[0144] In some embodiments, the view storage module is further configured to:
[0145] In response to the end of the life cycle of the pop-up window object, the pop-up window object sends life cycle end data to the view storage class through the life cycle class;
[0146] The view storage class receives the life cycle end data and releases the resource data occupied by the pop-up window object.
[0147] In some embodiments, the view storage module is further configured to:
[0148] Constructing a view class in the pop-up window object;
[0149] In response to the view class being constructed, the view storage class sends a resource cleanup prompt to the view class, wherein the resource cleanup prompt is prompt information for prompting the view class to clean up resources.
[0150] In some embodiments, the device further includes an update module, and the update module is specifically configured to:
[0151] Initialize a data storage class in the view class, and subscribe the life cycle class to the data storage class;
[0152] In response to a change in the stored data in the data storage class, sending a data update prompt to the life cycle class;
[0153] The life cycle class receives the data update prompt, sends the update data to the system interface, and the system interface renders the update data.
[0154] For the convenience of description, the above device is described by dividing it into various modules according to its functions. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0155] The device of the above embodiment is used to implement the corresponding pop-up window life cycle monitoring method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0156] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the pop-up window life cycle monitoring method described in any of the above embodiments is implemented.
[0157] Figure 5 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0158] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0159] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0160] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0161] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0162] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0163] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0164] The electronic device of the above embodiment is used to implement the corresponding pop-up window life cycle monitoring method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0165] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the pop-up window life cycle monitoring method described in any of the above embodiments.
[0166] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0167] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the pop-up window life cycle monitoring method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0168] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides a vehicle, including the pop-up window life cycle monitoring device in the above-mentioned embodiments, the electronic device in the above-mentioned embodiments, and the computer-readable storage medium in the above-mentioned embodiments, and the vehicle equipment implements the pop-up window life cycle monitoring method described in any of the above embodiments.
[0169] The vehicle of the above-mentioned embodiment is used to implement the pop-up window life cycle monitoring method described in any of the above-mentioned embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0170] It is understandable that before using the technical solutions of each embodiment of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0171] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0172] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0173] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0174] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Based on the concept of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0175] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present disclosure difficult to understand, the known power / ground connections to the integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present disclosure difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure will be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it is apparent to those skilled in the art that the embodiments of the present disclosure can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0176] Although the present disclosure has been described in conjunction with specific embodiments of the present disclosure, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0177] The embodiments of the present disclosure are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A method for monitoring the life cycle of a pop-up window, characterized in that: include: After receiving the pop-up window creation instruction sent by the system interface, a pop-up window object is created, and a life cycle class is initialized in the pop-up window object; Associating the life cycle class with the system interface so that the system interface subscribes to the life cycle class; In response to the life cycle change of the pop-up window object, the pop-up window object sends life cycle change prompt information to the system interface through the life cycle class, wherein the life cycle change prompt information is used to prompt that the life cycle of the pop-up window object has changed.
2. The method according to claim 1, characterized in that Initializing the life cycle class in the pop-up window object includes: Initializing a life cycle management class in the pop-up window object, constructing a life cycle class in the life cycle management class, and sending a registration object to the life cycle management class; After receiving the registration object, the lifecycle management class sends a management object to the pop-up window object; The pop-up window object receives the management object, and the life cycle class initialization is completed.
3. The method according to claim 2, characterized in that In response to the life cycle change of the pop-up window object, the pop-up window object sends life cycle change prompt information to the system interface through the life cycle class, including: In response to a lifecycle change of the pop-up window object, the pop-up window object sends lifecycle change data to the lifecycle management class corresponding to the management object; The lifecycle management class receives the lifecycle change data, generates and sends a lifecycle change event to the lifecycle class; The life cycle class receives the life cycle change event and sends life cycle change prompt information to the system interface.
4. The method according to claim 1, characterized in that: After initializing the life cycle class in the pop-up window object, it also includes: Constructing a view storage class in the pop-up window object, and sending a storage object to the pop-up window object; The pop-up window object receives the storage object, the view storage class is initialized, and the view storage class subscribes to the life cycle class.
5. The method according to claim 4, characterized in that After the pop-up window object receives the storage object, the method further includes: Initializing a view creation class in the pop-up window object, and the pop-up window object sending the storage object to the view creation class; After receiving the storage object, the view creation class creates a view class corresponding to the storage object and sends a view object instance to the view creation class; The view creation class receives the view object instance and sends the view object to the pop-up window object; It is determined that the pop-up window object receives the view object and the view class is constructed, so that when the pop-up window object receives the service, the view class is used to decouple the service.
6. The method according to claim 4, characterized in that After the view storage class subscribes to the life cycle class, it also includes: In response to the end of the life cycle of the pop-up window object, the pop-up window object sends life cycle end data to the view storage class through the life cycle class; The view storage class receives the life cycle end data and releases the resource data occupied by the pop-up window object.
7. The method according to claim 6, characterized in that After the view storage class receives the lifecycle end data, the method further includes: Constructing a view class in the pop-up window object; In response to the view class being constructed, the view storage class sends a resource cleanup prompt to the view class, wherein the resource cleanup prompt is prompt information for prompting the view class to clean up resources.
8. The method according to claim 1, characterized in that After initializing the life cycle class in the pop-up window object, it also includes: Initialize a data storage class in the view class, and subscribe the life cycle class to the data storage class; In response to a change in the stored data in the data storage class, sending a data update prompt to the life cycle class; The life cycle class receives the data update prompt, sends the update data to the system interface, and the system interface renders the update data.
9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 8 is implemented.
10. A vehicle, characterized in that: The vehicle includes the electronic device according to claim 9.