CN117348992A - Popup window display method and device and electronic equipment - Google Patents

Popup window display method and device and electronic equipment Download PDF

Info

Publication number
CN117348992A
CN117348992A CN202311261345.8A CN202311261345A CN117348992A CN 117348992 A CN117348992 A CN 117348992A CN 202311261345 A CN202311261345 A CN 202311261345A CN 117348992 A CN117348992 A CN 117348992A
Authority
CN
China
Prior art keywords
popup
window
display
popup window
strategy
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311261345.8A
Other languages
Chinese (zh)
Inventor
张鑫
修怀忠
叶松林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Thalys Automobile Co ltd
Original Assignee
Thalys Automobile Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Thalys Automobile Co ltd filed Critical Thalys Automobile Co ltd
Priority to CN202311261345.8A priority Critical patent/CN117348992A/en
Publication of CN117348992A publication Critical patent/CN117348992A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application provides a popup window display method, a popup window display device and electronic equipment, corresponding popup window data classes and popup window policy interfaces are defined, popup window content data are included in the popup window data classes, popup window display realization policies corresponding to popup window identifiers are defined in the popup window policy interfaces, popup window requests are sent when the popup window needs to be displayed, the popup window requests are added into a popup window request queue created in advance, the popup window requests are taken out from the popup window request queue, then corresponding popup windows are generated according to the popup window content data corresponding to the popup window identifiers, display of popup windows generated by realizing the popup window display realization policies corresponding to the popup window identifiers is invoked in the pre-created popup window display method, and display of the popup window corresponding popup window is realized based on the popup window policy interfaces, so that all popup window tasks can be independently executed, logic execution is simple and clear, and disorder is not easy to occur.

Description

Popup window display method and device and electronic equipment
Technical Field
The application relates to the technical field of popup window display, in particular to a popup window display method and device and electronic equipment.
Background
Within an App there are typically a variety of portlets, such as user protocol portlets, version update portlets, campaign introduction portlets, teenager mode portlets, advertisement portlets, etc. When a plurality of popup windows are required to be displayed in sequence, the problem that popup window tasks are disordered to execute is easy to occur.
Disclosure of Invention
An embodiment of the present application is directed to providing a pop-up window display method, apparatus, and electronic device, so as to solve the above technical problems.
In one aspect, a popup window display method is provided, the method including:
creating a corresponding popup data class aiming at a popup, wherein the popup data class comprises popup identifications and popup content data of the popup;
defining a popup strategy interface; a popup window display realization strategy corresponding to the popup window identification is defined in the popup window strategy interface;
calling a pre-created popup request sending method to send popup requests to a pre-created popup request queue; the popup request comprises a popup identifier of the popup;
and after the popup request is taken out from the popup request queue by calling a pre-created popup request taking-out method, generating a corresponding popup according to the popup content data corresponding to the popup identifier, and calling the popup display implementation strategy corresponding to the popup identifier in the popup strategy interface to realize the display of the generated popup according to the popup display strategy.
In one embodiment, the popup data class further includes a popup type of the popup, and the popup request includes the popup type; the defining a popup policy interface includes:
defining a popup policy interface corresponding to the popup type; a popup window display implementation strategy corresponding to a plurality of different popup window identifiers is defined in the popup window strategy interface, and popup windows corresponding to the different popup window identifiers belong to the same popup window type;
the calling the popup policy interface comprises the following steps:
and calling the corresponding popup policy interface according to the popup type in the popup request.
In one embodiment, the generating a corresponding popup according to the popup content data corresponding to the popup identifier includes:
invoking a pre-established popup window acquisition method to acquire context parameters, and returning the popup window type and the popup window identifier in the popup window request to the corresponding popup window policy interface according to the popup window type;
and in the popup obtaining method, corresponding popups are generated and returned through the context parameters and the popup content data corresponding to the popup identification.
In one embodiment, the popup window display implementation policy includes a determination policy for determining whether the popup window needs to be displayed, and a display policy for displaying the popup window after determining that the popup window needs to be displayed;
before the corresponding popup is generated and returned through the context parameters and the popup content data corresponding to the popup identification in the popup acquisition method, the method comprises the following steps:
invoking the judgment strategy corresponding to the popup mark in the corresponding popup strategy interface in the pre-established popup display method to determine that the popup is required to be displayed;
invoking the display of the popup generated by implementing the popup display implementation strategy corresponding to the popup identifier in the corresponding popup strategy interface in the pre-created popup display method, including:
and invoking the display strategy corresponding to the popup mark in the corresponding popup strategy interface in the pre-created popup display method to realize the display of the generated popup.
In one embodiment, the pop-up display method is run on a main thread, and the pop-up request sending method and the pop-up request fetching method are run on sub-threads of the main thread.
In one embodiment, before invoking the display of the popup generated by the popup implementation policy implementation corresponding to the popup identifier in the corresponding popup policy interface in a pre-created popup display method, the method includes:
determining that there is no currently displayed popup window and/or determining that the current top active component is in a visible state.
In one embodiment, the determining that there is no currently popup window being displayed includes:
if the value of the preset first indicating variable is a first preset value, determining that the currently displayed popup window does not exist; the first indication variable is a variable for indicating whether a currently displayed popup exists or not, and the first preset value is used for indicating that the currently displayed popup does not exist;
the method further comprises the steps of:
when the popup window display realization strategy corresponding to the popup window identification in the corresponding popup window strategy interface is called in a pre-created popup window display method to realize the display of the popup window generated by the popup window, setting the value of the first indicating variable to be a second preset value; the second preset value is used for indicating that a popup window which is being displayed exists currently.
In one embodiment, the determining that the current top active component is in a visible state includes:
if the value of the preset second indicating variable is a third preset value, determining that the current top movable assembly is in a visible state; the second indicating variable is a variable for indicating whether the current top movable component is in a visible state, and the third preset value is used for indicating that the current top movable component is in a visible state;
the method further comprises the steps of:
and when the popup window generated by realizing the popup window display realization strategy corresponding to the popup window identification in the corresponding popup window strategy interface is called in the pre-created popup window display method, keeping the value of the second indication variable to be the third preset value.
In another aspect, there is provided a popup window display device comprising:
the system comprises a creation module, a display module and a display module, wherein the creation module is used for creating a corresponding popup data class aiming at a popup, and the popup data class comprises popup identifications and popup content data of the popup;
the definition module is used for defining a popup policy interface; a popup window display realization strategy corresponding to the popup window identification is defined in the popup window strategy interface;
The first calling module is used for calling a pre-created popup request sending method to send popup requests to a pre-created popup request queue; the popup request comprises a popup identifier of the popup;
and the second calling module is used for generating a corresponding popup according to the popup content data corresponding to the popup identifier after the popup request is taken out from the popup request queue by calling a pre-created popup request taking-out method, and calling the popup display realization strategy corresponding to the popup identifier in the popup strategy interface to realize the display of the generated popup according to the popup content data.
In another aspect, an electronic device is provided that includes a processor and a memory having a computer program stored therein, the processor executing the computer program to implement any of the methods described above.
According to the popup window display method, the popup window data class corresponding to popup window creation is established, popup window content data and popup window identification of popup windows are included in the popup window data class, popup window policy interfaces are defined, popup window display implementation policies corresponding to the popup window identification are defined in the popup window policy interfaces, a popup window request sending method is called to send popup window requests, the popup window requests contain popup window identifications of the popup windows, a pre-established popup window request adding method is called to add the popup window requests to a pre-established popup window request queue, after a popup window request taking-out method is called to take out popup window requests from the popup window request queue, corresponding popup window content data corresponding to the popup window identification are generated, display of popup windows corresponding to the popup window identification implementation policies in the pre-established popup window policy interfaces is called, the popup window policy interfaces is achieved, the popup window corresponding to achieve display of popup window implementation policies, the popup window implementation corresponding to popup window implementation policies are achieved according to the popup window display interfaces in the pre-established, the popup window policy interfaces is enabled to be automatically matched, the popup window request implementation policies are achieved according to the popup window display interfaces, the popup window implementation policies in the popup window request implementation queue can be executed according to the popup window implementation requests can be executed in a clear order, and the popup window request can be executed independently, and the popup window display request can be achieved.
Drawings
Fig. 1 is a flow chart of a pop-up window display method according to an embodiment of the present disclosure;
fig. 2 is a flow chart of a pop-up window display method according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a pop-up window display method device according to a second embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device according to a third embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Embodiment one:
currently, various popup windows are usually required to be displayed in an App, most of the methods are to provide a popup window display method in a basic class of an Activity component, in the method, if-else is directly used for judging which popup window is displayed, and then the popup window display method is called in a specific Activity component so as to display the popup window. When the popup window is fewer, the popup window is realized in the mode, but when the requirement is iterated slowly and the popup window is more and more, the judgment logic is more and more complex, so the following problems exist:
Code readability is poor and those who are unfamiliar with business cannot understand these logics well;
when the pop-up window is increased or decreased or the display condition is changed, the logic is required to be changed greatly, and the bug is easy to be caused;
if-else judgment is carried out once every time of popup window, and the performance is affected.
In view of this, the embodiment of the application provides a new popup window display method, which can automatically match a corresponding popup window policy interface according to popup window requests, complete display of a corresponding popup window according to a popup window display implementation policy in the popup window policy interface, and implement display of a corresponding popup window based on the popup window policy interface, so that each popup window task can be independently executed, the code logic is simple and clear, and is not easy to be confused.
The popup display method provided by the embodiment of the application can be executed by a popup display device, and the popup display device can be integrated in electronic equipment. The electronic device may be a terminal or a server. That is, the popup window display method provided in the embodiment of the present application may be executed by a terminal, or may be executed by a server terminal. The terminal may be a smart phone, a tablet computer, a notebook computer, a personal computer (Personal Computer, PC), a smart home, a wearable electronic device, a VR/AR device, a vehicle-mounted computer, or the like. The server may be an interworking server or a background server among a plurality of heterogeneous systems, may be an independent physical server, may be a server cluster or a distributed system formed by a plurality of physical servers, and may be a cloud server for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, basic cloud computing services such as big data and an artificial intelligence platform, and the like.
The flowchart of the popup window display method in the embodiment of the present application may be shown in fig. 1, and the corresponding flowchart of the popup window display method may be shown in fig. 2. The method specifically comprises the following steps:
s11: and creating a corresponding popup data class aiming at the popup, wherein the popup data class comprises popup identifications and popup content data of the popup.
S12: defining a popup strategy interface; and a popup window display realization strategy corresponding to the popup window identification is defined in the popup window strategy interface.
S13: calling a pre-created popup request sending method to send popup requests to a pre-created popup request queue; the popup request comprises a popup identifier of the popup.
S14: and after the popup request is taken out from the popup request queue by calling a pre-created popup request taking-out method, generating a corresponding popup according to popup content data corresponding to the popup identifier, and calling a popup display realization strategy corresponding to the popup identifier in a corresponding popup strategy interface in the pre-created popup display method to realize the display of the generated popup.
The steps described above are described in detail below.
In this embodiment of the present application, a corresponding popup data class may be created for each popup, for example, a popup data class corresponding to a certain popup is defined as a globalialog bean. Each popup data class contains popup identification and popup content data of the corresponding popup, that is, each popup data class is configured with an identification field and a content data field, which are respectively used for storing the popup identification and the popup content data of the corresponding popup. It will be appreciated that in some other embodiments, other fields may be configured in the popup data class for storing other types of data, which may be specific to the actual application scenario and actual service.
The popup window identifier in the embodiment of the application refers to an identity identifier of a popup window, and each popup window can be distinguished according to the popup window identifier. Popup content data refers to data related to popup specific content, which is typically related to a specific service.
For step S12, in a first optional embodiment, the corresponding bay policy interfaces may be defined based on each bay identifier, that is, each bay has its corresponding bay policy interface, and then when a certain bay needs to be displayed, only the bay identifier of the bay needs to be matched to the corresponding bay policy interface, and then the display of the bay is realized based on the bay display implementation policy in the bay policy interface.
In a second alternative embodiment, only one popup policy interface may be defined, where popup display implementation policies corresponding to different popup identifiers are defined in the popup policy interface.
In a third optional embodiment, the popup data class corresponding to each popup may further include a popup type of the popup, where the popup type may be used to indicate a service type to which the popup belongs, for example, to indicate whether the popup is a user protocol popup, a version update popup, an active introduction popup, or the like. In this embodiment, the corresponding popup policy interfaces may be defined for each popup type, and the popup display implementation policies corresponding to the plurality of different popup identifiers may be defined in the same popup policy interface, that is, the corresponding popup display implementation policies may be defined for the plurality of different popups in the same popup policy interface, where the plurality of different popups belong to the same popup type. Correspondingly, the popup request also contains the popup type of the popup to be displayed, and when the popup policy interface corresponding to the popup is called, the corresponding popup policy interface can be called based on the popup type in the popup request.
In the embodiment, the popup window display implementation strategies of the popups of the same type are defined in the same popup window strategy interface, so that subsequent calling is facilitated, and in practical application, when the popup window display implementation strategy of a certain popup window needs to be changed, the popup window display implementation strategies of the popup window of the same type are generally meant to be adaptively adjusted.
In this embodiment of the present application, a popup policy interface may be defined as iglobal dialog, where a popup display implementation policy corresponding to a popup identifier of a popup is defined in the popup policy interface. In one embodiment, the popup display implementation policy includes a determination policy for determining whether the popup needs to be displayed, and a display policy for displaying the popup after determining that the popup needs to be displayed. It can be understood that the judging policy and the displaying policy are basically a judging method handleDialog and a displaying method showDialog defined in the popup policy interface, where the judging method handleDialog may include parameters in popup data class for judging whether to display a corresponding popup according to a specific service, and the displaying method showDialog may include parameters in popup data class for displaying corresponding content according to a specific service. In another embodiment, the popup window display implementation policy may only include a display policy for displaying a corresponding popup window, and in this embodiment, after a certain popup window policy interface is invoked, the display policy corresponding to the popup window in the popup window policy interface may be directly utilized to implement the display of the corresponding popup window, that is, in this embodiment, once the popup window policy interface is invoked in a pre-created popup window display method, the corresponding popup window is necessarily displayed.
In step S13, when it is determined that the preset popup request sending condition is currently met, a pre-created popup request sending method may be called to send a popup request, where the popup request includes a popup identifier of a popup to be displayed. It can be understood that a developer can preset a corresponding popup request sending condition for each popup, and when the popup request sending condition of a certain popup is met, a popup request for the popup is sent.
In this embodiment of the present application, a pop request to be displayed may be sent through a pop request sending method sendDialogRequest, where the pop request sending method should at least include a pop identifier of the pop, and may, for example, include contents of each parameter in a pop data class of the pop, that is, may include pop content data and a pop type in addition to the pop identifier.
It should be noted that, in the embodiment of the present application, a global popup window management may be predefined, for example, the defined global popup window management may be a globalilogmanager, and the global popup window management is used to manage display of popups.
Specifically, the global popup management single instance includes a popup request sending method, a popup request queue, a popup request adding method, a popup request taking-out method and a popup display method.
For example, a queue type variable dialogQueue for storing popup requests, that is, a popup request queue, may be defined, where the popup request queue is used for storing popup requests, and the queue is characterized by first-in first-out, and meets the requirement of popup, and the previous popup is preferentially displayed.
For example, the global popup management case may further include a popup acquisition method, for example, the popup acquisition method may be defined as getDialog, where generating a corresponding popup according to popup content data corresponding to the popup identifier includes:
the method comprises the following substeps: calling a pre-established popup window acquisition method to acquire context parameters, popup window types and popup window identifiers in popup window requests, and returning to corresponding popup window strategy interfaces according to the popup window types;
sub-step two: and generating and returning the corresponding popup through the context parameters and the popup content data corresponding to the popup identification in the popup acquisition method.
In the first sub-step, a corresponding popup policy interface can be obtained through a popup obtaining method, so in step S14, the popup display implementation policy corresponding to the popup identifier in the popup policy interface can be invoked in a pre-created popup display method to implement display of the generated popup.
When the popup request includes parameters of the popup data type, in the first substep, popup content data corresponding to the popup identifier may be obtained, so in the second substep, a corresponding popup may be created and returned directly according to the obtained popup content data and the context parameters. If the popup request does not contain popup content data corresponding to the popup identifier, the popup content data corresponding to the popup identifier can be acquired from the corresponding popup data class.
For step S14, in an alternative embodiment, after the corresponding popup window is generated, the popup window generated by implementing the popup window display implementation policy corresponding to the popup window identifier in the corresponding popup window policy interface may be invoked in the pre-created popup window display method. Specifically, after the corresponding popup window is generated, a judgment strategy corresponding to the popup window identifier in a corresponding popup window strategy interface is called in a pre-created popup window display method, after the popup window is determined to be required to be displayed, a corresponding display strategy is called to realize the display of the generated popup window, and if the popup window is determined not to be required to be displayed through the judgment strategy, the corresponding display strategy is not required to be called.
For step S14, in another alternative embodiment, after determining that the corresponding popup window needs to be displayed through the judgment policy, the corresponding popup window may be regenerated, and then the corresponding reality policy is called to implement the display of the generated popup window. That is, before the second substep, the method further includes: and invoking the judgment strategy corresponding to the popup mark in the corresponding popup strategy interface in the pre-established popup display method to determine that the popup is required to be displayed. And after the sub-step II, invoking a display strategy corresponding to the popup mark in a corresponding popup strategy interface in a pre-created popup display method to realize the display of the generated popup. In this embodiment, after determining that the popup window needs to be displayed, the corresponding popup window is generated, so that the operation resource waste caused by that the popup window is not displayed after the popup window is generated is avoided.
The popup display method in the embodiment of the present application may be run on a main thread, and in order to avoid ANR caused by blocking of a group thread, the popup request adding method and the popup request taking method may be run on a sub-thread of the main thread. Specifically, a protocol Cheng Zuoyong domain variable scope may be defined such that the add, fetch, and fetch of a pop request all run on a child thread.
Before invoking the display of the popup generated by the popup realization policy realization corresponding to the popup identifier in the corresponding popup policy interface in the pre-created popup display method, the method may further include:
determining that there is no currently displayed popup window and/or determining that the current top active component is in a visible state.
In an embodiment of the present application, a first indicating variable and/or a second indicating variable may be defined, where the first indicating variable is a variable for indicating whether there is currently a popup window being displayed, and the second indicating variable is a variable for indicating whether the current top active component is in a visible state.
In this embodiment, determining that there is no currently displayed popup window includes: if the value of the preset first indicating variable is a first preset value, determining that the currently displayed popup window does not exist.
At this time, when the popup window generated by the popup window display implementation strategy implementation corresponding to the popup window identifier is called in the pre-created popup window display method, the value of the first indicating variable needs to be set to a second preset value; the second preset value is used for indicating that a popup window which is being displayed exists currently.
For example, the first indicator variable may be isShowing, which indicates that there is no currently displayed popup if the value of isShowing is false, and indicates that there is currently displayed popup if the value of isShowing is true.
In this embodiment, determining that the current top active component is in a visible state includes: and if the value of the preset second indicating variable is determined to be a third preset value, determining that the current top movable component is in a visible state. The third preset value is used for indicating that the current top movable assembly is in a visible state; of course, a fourth preset value may also be set for indicating that the current top movable element is in an invisible state.
After determining that the current top movable component is in a visible state, executing the step of calling the popup window display generated by realizing the popup window display realization strategy corresponding to the popup window identification in the corresponding popup window strategy interface in the pre-created popup window display method, and keeping the value of the second indication variable to be the third preset value in the process.
For example, if the value of the second indicator variable is true, it indicates that the current top active component is in a visible state, and if the value of the second indicator variable is false, it indicates that the current top active component is in an invisible state.
It should be noted that, in the embodiment of the present application, the first indicator variable, the second indicator variable, the first preset value, the second preset value, the third preset value, and the fourth preset value may be flexibly set by a developer. Also, in other embodiments, it may be determined by other means whether there is currently a pop-up window being displayed and whether the current top movable element is in a visible state.
Preferably, after determining that there is no currently displayed popup window and determining that the current top active component is in a visible state, invoking a popup window display implementation policy corresponding to the popup window identifier in a corresponding popup window policy interface in a pre-created popup window display method to implement display of the popup window generated by the implementation policy.
If it is determined that there is no currently displayed popup window and it is determined that the current top movable component is in a visible state, it is indicated that a basic condition for displaying the popup window is currently satisfied, at this time, display of the popup window generated by implementation of the popup window display implementation policy corresponding to the popup window identifier in the corresponding popup window policy interface may be invoked in a pre-created popup window display method, and in this process, it is required to set a value of the first indicating variable to a third preset value and keep the value of the second indicating variable unchanged as the second preset value; the third preset value is used for indicating that a popup window which is being displayed exists currently.
The pop request fetching method in the embodiment of the present application may be a loop method loop, where the loop method may start a dead loop in a sub-thread to continuously run the following logic:
firstly judging whether the current top movable assembly is in a visible state or not, judging whether a popup window which is being displayed is present or not, if the top movable assembly is in the visible state and no popup window which is being displayed is present, calling a pre-established popup window acquisition method to acquire a popup window policy interface IGlobalDialog, calling a judgment policy in the popup window policy interface IGlobalDialog to judge whether the corresponding popup window is required to be displayed, if so, setting the value of a first indicating variable to a third preset value, and calling a display policy in the popup window policy interface IGlobalDialog to realize the display of the popup window.
The global popup management single instance in the embodiment of the present application may further include a popup closing method, for example, a method disssdialog after popup closing may be defined, and the method is used to set a value of a first indicating variable to the first preset value after popup closing.
In practical application, when global popup management single-instance globalpialogmanager is initialized, a loop method loop can be called, namely a popup request taking method searches popup requests, and when popup needs to be displayed, a popup request sending method and a popup request adding method are called to add requests into a popup request queue. The loop method loop automatically finds the popup window request and displays the corresponding popup window.
According to the popup window display method, the readability of codes can be improved, the display logic of each popup window is configured in the popup window strategy interface, whether the logic of each popup window is displayed or not is subjected to class removal processing by a specific popup window, the popup window is abstract, decoupling is achieved, no redundant if-else judgment is achieved, the maintainability of codes is improved, when the popup window needing to be displayed is newly added, the popup window can be popped up only by adding a popup window request into a popup window request queue, no additional logic is needed, the App performance is improved, only one judgment is needed to be executed for each popup window, the display efficiency is improved, the display of the popup window is managed by using a message queue idea, and the display of the popup window is independent of the outside of a page and does not need to be uniform judgment logic.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described above may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with at least a part of the sub-steps or stages of other steps or other steps.
Embodiment two:
based on the same inventive concept, an embodiment of the present application provides a pop-up window display device, as shown in fig. 3, including:
the creating module 301 is configured to create a corresponding popup data class for a popup, where the popup data class includes a popup identifier and popup content data of the popup;
a definition module 302, configured to create a corresponding popup policy interface for the popup; a popup window display realization strategy corresponding to the popup window identification is defined in the popup window strategy interface;
a first calling module 303, configured to call a pre-created popup request sending method to send a popup request to a pre-created popup request queue; the popup request comprises a popup identifier of the popup;
and the second calling module 304 is configured to generate a corresponding popup according to the popup content data corresponding to the popup identifier after the popup request is taken out from the popup request queue by calling a pre-created popup request taking method, and call, in a pre-created popup policy interface, display of the popup generated by implementing the popup display implementation policy corresponding to the popup identifier.
Further, the popup data class further includes a popup type of the popup, and the popup request includes the popup type; the definition module 302 is configured to define a popup policy interface corresponding to the popup type; a popup window display implementation strategy corresponding to a plurality of different popup window identifiers is defined in the popup window strategy interface, and popup windows corresponding to the different popup window identifiers belong to the same popup window type; the second invoking module 304 is configured to invoke the corresponding popup policy interface according to the popup type in the popup request.
Further, the second calling module 304 is configured to call a pre-created popup window acquiring method to acquire a context parameter, and the popup window type and the popup window identifier in the popup window request, and return the corresponding popup window policy interface according to the popup window type; and in the popup obtaining method, corresponding popups are generated and returned through the context parameters and the popup content data corresponding to the popup identification.
Further, the popup window display implementation policy includes a judging policy for judging whether the popup window needs to be displayed, and a display policy for displaying the popup window after judging that the popup window needs to be displayed; the second invoking module 304 is configured to invoke, in the pre-created popup policy interface, the judgment policy corresponding to the popup identifier to determine that the popup needs to be displayed before the corresponding popup is generated and returned by the context parameter and the popup content data corresponding to the popup identifier in the popup obtaining method, and invoke, in the pre-created popup policy interface, the display policy corresponding to the popup identifier to implement the display of the generated popup after the corresponding popup is generated and returned by the context parameter and the popup content data corresponding to the popup identifier in the popup obtaining method.
Further, the popup display method operates on a main thread, and the popup request sending method and the popup request taking method operate on sub-threads of the main thread.
Further, the second invoking module 304 is configured to invoke, in a pre-created popup policy interface, the popup display implementation policy corresponding to the popup identifier to implement the generated display of the popup after determining that there is no popup currently being displayed and/or determining that the current top active component is in a visible state
Further, if the value of the preset first indicating variable is determined to be a first preset value, determining that no popup window exists currently; the first indication variable is a variable for indicating whether a currently displayed popup exists or not, and the first preset value is used for indicating that the currently displayed popup does not exist; the second invoking module 304 is configured to invoke, in a pre-created popup window display method, display of the popup window generated by the popup window display implementation policy implementation corresponding to the popup window identifier in a corresponding popup window policy interface, and set a value of the first indicating variable to a second preset value; the second preset value is used for indicating that a popup window which is being displayed exists currently.
Further, if the value of the preset second indicating variable is determined to be a third preset value, determining that the current top movable component is in a visible state; the second indicating variable is a variable for indicating whether the current top movable component is in a visible state, and the third preset value is used for indicating that the current top movable component is in a visible state; and the second invoking module 304 is configured to invoke, in a pre-created popup window display method, the popup window corresponding to the popup window identifier in the corresponding popup window policy interface, and when the popup window generated by implementing the popup window display implementation policy is displayed, keep the value of the second instruction variable as the third preset value.
It should be noted that, for simplicity of description, the content described in the above embodiment is not repeated in this embodiment.
Embodiment four:
based on the same inventive concept, embodiments of the present application provide an electronic device 400. The electronic device 400 includes a processor 401 and a memory 402, where the memory 402 stores a computer program, and the processor 401 and the memory 402 implement communication through a communication bus, and the processor 401 executes the computer program to implement each step of the method in the first embodiment, which is not described herein.
It will be appreciated that the configuration shown in fig. 4 is merely illustrative, and that the electronic device may also include more or fewer components than shown in fig. 4, or have a different configuration than shown in fig. 4.
The processor 401 may be an integrated circuit chip having signal processing capabilities. The processor 401 may be a general-purpose processor including a Central Processing Unit (CPU), a Network Processor (NP), etc.; but may also be a Digital Signal Processor (DSP), application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. Which may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Memory 402 may include, but is not limited to, random Access Memory (RAM), read Only Memory (ROM), programmable Read Only Memory (PROM), erasable read only memory (EPROM), electrically erasable read only memory (EEPROM), and the like.
The present embodiment also provides a computer readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a usb disk, an SD card, an MMC card, etc., in which one or more programs for implementing the above steps are stored, and the one or more programs may be executed by the one or more processors 401 to implement the steps of the method in the first embodiment, which is not described herein again.
It should be noted that, the illustrations provided in the present embodiment merely illustrate the basic concept of the present invention by way of illustration, and only the components related to the present invention are shown in the drawings and are not drawn according to the number, shape and size of the components in actual implementation, and the form, number and proportion of the components in actual implementation may be arbitrarily changed, and the layout of the components may be more complex. The structures, proportions, sizes, etc. shown in the drawings attached hereto are for illustration purposes only and are not intended to limit the scope of the invention, which is defined by the claims, but rather by the claims. Also, the terms such as "upper," "lower," "left," "right," "middle," and "a" and the like recited in the present specification are merely for descriptive purposes and are not intended to limit the scope of the invention, but are intended to provide relative positional changes or modifications without materially altering the technical context in which the invention may be practiced.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A pop-up display method, the method comprising:
creating a corresponding popup data class aiming at a popup, wherein the popup data class comprises popup identifications and popup content data of the popup;
defining a popup strategy interface; a popup window display realization strategy corresponding to the popup window identification is defined in the popup window strategy interface;
calling a pre-created popup request sending method to send popup requests to a pre-created popup request queue; the popup request comprises a popup identifier of the popup;
And after the popup request is taken out from the popup request queue by calling a pre-created popup request taking-out method, generating a corresponding popup according to the popup content data corresponding to the popup identifier, and calling the popup display implementation strategy corresponding to the popup identifier in the popup strategy interface to realize the display of the generated popup according to the popup display strategy.
2. The method for displaying popup according to claim 1, wherein the popup data class further includes a popup type of the popup, and the popup request includes the popup type; the defining a popup policy interface includes:
defining a popup policy interface corresponding to the popup type; a popup window display implementation strategy corresponding to a plurality of different popup window identifiers is defined in the popup window strategy interface, and popup windows corresponding to the different popup window identifiers belong to the same popup window type;
the calling the popup policy interface comprises the following steps:
and calling the corresponding popup policy interface according to the popup type in the popup request.
3. The method for displaying a popup window according to claim 2, wherein the generating a corresponding popup window according to the popup window content data corresponding to the popup window identifier comprises:
Invoking a pre-established popup window acquisition method to acquire context parameters, and returning the popup window type and the popup window identifier in the popup window request to the corresponding popup window policy interface according to the popup window type;
and in the popup obtaining method, corresponding popups are generated and returned through the context parameters and the popup content data corresponding to the popup identification.
4. The popup display method of claim 3, wherein the popup display implementation policy includes a determination policy for determining whether the popup needs to be displayed, and a display policy for displaying the popup after determining that the popup needs to be displayed;
before the corresponding popup is generated and returned through the context parameters and the popup content data corresponding to the popup identification in the popup acquisition method, the method comprises the following steps:
invoking the judgment strategy corresponding to the popup mark in the corresponding popup strategy interface in the pre-established popup display method to determine that the popup is required to be displayed;
invoking the display of the popup generated by implementing the popup display implementation strategy corresponding to the popup identifier in the corresponding popup strategy interface in the pre-created popup display method, including:
And invoking the display strategy corresponding to the popup mark in the corresponding popup strategy interface in the pre-created popup display method to realize the display of the generated popup.
5. The popup display method of any one of claims 1-4, wherein the popup display method operates on a main thread, and the popup request sending method and the popup request retrieving method operate on sub-threads of the main thread.
6. The method of any one of claims 1-4, wherein before invoking the display of the popup generated by the popup implementation policy implementation corresponding to the popup identification in the corresponding popup policy interface in the pre-created popup display method, the method comprises:
determining that there is no currently displayed popup window and/or determining that the current top active component is in a visible state.
7. The method of popup display in accordance with claim 6, wherein said determining that there is no popup currently being displayed comprises:
if the value of the preset first indicating variable is a first preset value, determining that the currently displayed popup window does not exist; the first indication variable is a variable for indicating whether a currently displayed popup exists or not, and the first preset value is used for indicating that the currently displayed popup does not exist;
The method further comprises the steps of:
when the popup window display realization strategy corresponding to the popup window identification in the corresponding popup window strategy interface is called in a pre-created popup window display method to realize the display of the popup window generated by the popup window, setting the value of the first indicating variable to be a second preset value; the second preset value is used for indicating that a popup window which is being displayed exists currently.
8. The popup display method in accordance with claim 6 wherein the determining that the current top active component is in a visible state comprises:
if the value of the preset second indicating variable is a third preset value, determining that the current top movable assembly is in a visible state; the second indicating variable is a variable for indicating whether the current top movable component is in a visible state, and the third preset value is used for indicating that the current top movable component is in a visible state;
the method further comprises the steps of:
and when the popup window generated by realizing the popup window display realization strategy corresponding to the popup window identification in the corresponding popup window strategy interface is called in the pre-created popup window display method, keeping the value of the second indication variable to be the third preset value.
9. A pop-up window display device, the device comprising:
the system comprises a creation module, a display module and a display module, wherein the creation module is used for creating a corresponding popup data class aiming at a popup, and the popup data class comprises popup identifications and popup content data of the popup;
the definition module is used for defining a popup policy interface; a popup window display realization strategy corresponding to the popup window identification is defined in the popup window strategy interface;
the first calling module is used for calling a pre-created popup request sending method to send popup requests to a pre-created popup request queue; the popup request comprises a popup identifier of the popup;
and the second calling module is used for generating a corresponding popup according to the popup content data corresponding to the popup identifier after the popup request is taken out from the popup request queue by calling a pre-created popup request taking-out method, and calling the popup display realization strategy corresponding to the popup identifier in the popup strategy interface to realize the display of the generated popup according to the popup content data.
10. An electronic device comprising a processor and a memory, the memory having stored therein a computer program, the processor executing the computer program to implement the method of any of claims 1-8.
CN202311261345.8A 2023-09-27 2023-09-27 Popup window display method and device and electronic equipment Pending CN117348992A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311261345.8A CN117348992A (en) 2023-09-27 2023-09-27 Popup window display method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311261345.8A CN117348992A (en) 2023-09-27 2023-09-27 Popup window display method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117348992A true CN117348992A (en) 2024-01-05

Family

ID=89355039

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311261345.8A Pending CN117348992A (en) 2023-09-27 2023-09-27 Popup window display method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117348992A (en)

Similar Documents

Publication Publication Date Title
CN111049878B (en) Method, device, electronic device and storage medium for visualizing micro-service call chain
CN112766907A (en) Service data processing method and device and server
CN110764913B (en) Data calculation method based on rule calling, client and readable storage medium
CN110825499B (en) Method and device for realizing security isolation based on unified container cloud platform
CN113377348A (en) Task adjustment method applied to task engine, related device and storage medium
CN114531477B (en) Method and device for configuring functional components, computer equipment and storage medium
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
US20240007346A1 (en) Method and Apparatus for Monitoring Application Service, Electronic Device, and Readable Storage Medium
CN111694677A (en) Message queue management method, device, terminal and computer-readable storage medium
CN109359092B (en) File management method, desktop display method, device, terminal and medium
CN113051503A (en) Browser page rendering method and device, electronic equipment and storage medium
CN110704131B (en) Method and device for calling native application by HTML5 application
CN109561134B (en) Electronic device, distributed cluster service distribution method and storage medium
CN110324722B (en) Method, device, equipment and storage medium for acquiring data in live broadcast room
CN117348992A (en) Popup window display method and device and electronic equipment
CN112528189B (en) Data-based component packaging method and device, computer equipment and storage medium
CN114356516A (en) Resource scheduling method, related device, equipment and storage medium
CN114723394A (en) Credit granting flow configuration method based on artificial intelligence and related equipment
CN111142735B (en) Software page creating method and device, terminal equipment and storage medium
CN113626222A (en) Message processing method and device, computer equipment and storage medium
CN107577422B (en) Photo storage method and device based on double-domain space
CN112817813B (en) Data collection method, device and equipment based on reaction hops
US20210373991A1 (en) Automated alert augmentation for deployments of software-defined storage
CN112817573B (en) Method, apparatus, computer system, and medium for building a streaming computing application
CN116827770A (en) Intelligent acceleration equipment management method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination