Interface switching method, device and electronic equipment
By preconfiguring the corresponding interface set in the interface switching controller, using these interfaces to realize different states of the interface, the problem of low code reuse rate in the prior art is solved, and the effect of seamless animation and code reuse during interface switching is achieved.
Patent Information
- Application Number
- CN202210138457.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-15
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2042-02-15
AI Technical Summary
When switching between two full-screen interfaces, the prior art requires writing a large amount of repeated code to achieve seamless animation connection, resulting in a low code reuse rate.
By preconfiguring the corresponding interface sets of different interfaces in the interface switching controller, these interfaces are used to realize different states of the interface, including switching, entry, creation and other states, so that the corresponding interface is called during interface switching to achieve seamless connection of animations.
When switching to the target interface, the animation of the switched interface is first played, and then the animation of the target interface is played, thereby achieving seamless connection of playback animations, reducing the amount of repeated code writing and improving code reuse rate.
Smart Images

Figure CN114489911B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of interface display, and more specifically, to an interface switching method, device and electronic equipment. Background Art
[0002] Currently, when switching between two full-screen interfaces, it is necessary to ensure that the animation is seamless when switching back and forth.
[0003] In order to achieve seamless switching to the target interface to be switched to when playing the switched interface, the code of the switched interface is generally added to the code corresponding to the target interface to be switched to, so that when switching to the target interface, the animation of the switched interface is played first, and then the animation of the target interface is played, thereby achieving seamless connection of the animation playback.
[0004] When the above method is adopted, corresponding codes need to be added for each pair of target interface and switched interface, and thus a large amount of repeated codes need to be written, resulting in a low code reuse rate. Summary of the invention
[0005] In view of this, the present invention provides an interface switching method, device and electronic device to solve the problem of low code reuse rate.
[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0007] An interface switching method is applied to an interface switching controller, wherein the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to realize different interface states of the interface;
[0008] The interface switching method comprises:
[0009] During the process of playing the switched interface on the current interface, determining whether an interface switching instruction is received;
[0010] If received, calling the switching interface in the interface set corresponding to the switched interface to play the switching animation corresponding to the switched interface on the current interface;
[0011] Determine whether the target interface to be switched to exists;
[0012] If it does not exist, call the creation interface in the interface set corresponding to the target interface to create the target interface, and after determining that the target interface is successfully created, call the entry interface in the interface set corresponding to the target interface to play the entry animation corresponding to the target interface on the current interface.
[0013] Optionally, calling a switching interface in an interface set corresponding to the switched interface includes:
[0014] The first interface manager corresponding to the switched interface is controlled to call a switching interface in an interface set corresponding to the switched interface.
[0015] Optionally, after calling a switching interface in the interface set corresponding to the switched interface to play a switching animation corresponding to the switched interface on the current interface, the method further includes:
[0016] After determining that the switching animation is finished playing, controlling the first interface manager to call an exit interface in the interface set corresponding to the switched interface, so as to stop displaying the switched interface on the current interface;
[0017] A deletion instruction is sent to the first interface manager, so that the first interface manager deletes the switched interface and the first interface manager.
[0018] Optionally, calling a creation interface in an interface set corresponding to the target interface to create the target interface includes:
[0019] A second interface manager corresponding to the target interface is created, and the second interface manager is controlled to call a creation interface in an interface set corresponding to the target interface to create the target interface.
[0020] Optionally, when it is determined that the target interface to be switched to exists, the method further includes:
[0021] The second interface manager is controlled to call a recovery interface in the interface set corresponding to the target interface to enter the target interface again.
[0022] Optionally, after calling the entry interface in the interface set corresponding to the target interface to play the entry animation corresponding to the target interface on the current interface, the method further includes:
[0023] The second interface manager is controlled to call a normal display interface in the interface set corresponding to the target interface, so as to continuously display the target interface on the current interface.
[0024] An interface switching device is applied to an interface switching controller, wherein the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to realize different interface states of the interface;
[0025] The interface switching device comprises:
[0026] The command judgment module is used to judge whether an interface switching command is received during the process of playing the switched interface on the current interface;
[0027] A first interface calling module is used for calling the switching interface in the interface set corresponding to the switched interface if received, so as to play the switching animation corresponding to the switched interface on the current interface;
[0028] A determination module is used to determine whether the target interface to be switched to exists;
[0029] The second interface calling module is used to call the creation interface in the interface set corresponding to the target interface to create the target interface if it does not exist, and after determining that the target interface has been successfully created, call the entry interface in the interface set corresponding to the target interface to play the entry animation corresponding to the target interface on the current interface.
[0030] Optionally, the first interface calling module is specifically used to:
[0031] The first interface manager corresponding to the switched interface is controlled to call a switching interface in an interface set corresponding to the switched interface.
[0032] Optionally, it also includes:
[0033] A third interface calling module is used to control the first interface manager to call the exit interface in the interface set corresponding to the switched interface after determining that the switching animation is finished playing, so as to stop displaying the switched interface on the current interface;
[0034] The instruction sending module is used to send a deletion instruction to the first interface manager, so that the first interface manager deletes the switched interface and the first interface manager.
[0035] An electronic device comprising: a memory and a processor;
[0036] Wherein, the memory is used to store programs;
[0037] The processor calls the program and is used to execute the above-mentioned interface switching method.
[0038] Compared with the prior art, the present invention has the following beneficial effects:
[0039] The present invention provides an interface switching method, device and electronic device, wherein the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to realize different interface states of the interface, so that in the process of playing the switched interface in the current interface, if an interface switching instruction is received, the switching interface in the interface set corresponding to the switched interface is first called to play the switching animation corresponding to the switched interface in the current interface. When the target interface to be switched to does not exist, the creation interface in the interface set corresponding to the target interface is called to create the target interface, and the entry interface in the interface set corresponding to the target interface is called to play the entry animation corresponding to the target interface in the current interface, so that when switching to the target interface, the animation of the switched interface is played first, and then the animation of the target interface is played, so as to realize the seamless connection of the animation. In addition, in the present invention, only the interface sets of different interfaces need to be configured to realize the interface switching of different interfaces, and compared with the method of adding corresponding codes for each pair of target interface and switched interface, the amount of repeated code writing is reduced and the code reuse rate is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0041] Figure 1 A method flow chart of an interface switching method provided by an embodiment of the present invention;
[0042] Figure 2 A method flow chart of another interface switching method provided by an embodiment of the present invention;
[0043] Figure 3 A schematic diagram of the structure of an interface switching device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] In order to achieve seamless switching to the target interface to be switched to when playing the switched interface, the code of the switched interface is generally added to the code corresponding to the target interface to be switched to, so that when switching to the target interface, the animation of the switched interface is played first, and then the animation of the target interface is played, thereby achieving seamless connection of the animation playback.
[0046] If the code of interface 1 is written on interface 2, after entering interface 2, the animation of interface 1 is played first and then the animation of interface 2. In this case, the code only supports switching from interface 1 to interface 2 and cannot be reused to switch other interfaces.
[0047] When the above method is adopted, corresponding codes need to be added for each pair of target interface and switched interface, and thus a large amount of repeated codes need to be written, resulting in a low code reuse rate.
[0048] In order to solve this technical problem, the inventor has designed a set of interfaces after research, and realized the switching of interfaces by calling different interfaces. Specifically, the present invention provides an interface switching method, device and electronic device, wherein the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to realize different interface states of the interface, so that in the process of playing the switched interface on the current interface, if an interface switching instruction is received, the switching interface in the interface set corresponding to the switched interface is first called to play the switching animation corresponding to the switched interface on the current interface. When the target interface to be switched to does not exist, the creation interface in the interface set corresponding to the target interface is called to create the target interface, and the entry interface in the interface set corresponding to the target interface is called to play the entry animation corresponding to the target interface on the current interface, so that when switching to the target interface, the animation of the switched interface is played first, and then the animation of the target interface is played, so as to realize the seamless connection of the animation. In addition, in the present invention, only the interface sets of different interfaces need to be configured to realize the interface switching of different interfaces, which is compared with the method of adding corresponding codes for each pair of target interface and switched interface, and reduces the amount of repeated code writing and improves the code reuse rate.
[0049] Based on the above content, an embodiment of the present invention provides an interface switching method, which is applied to an interface switching controller. The interface switching controller can be a controller, a server, etc.
[0050] The interface switching controller is pre-configured with an interface set corresponding to different interfaces, and different interfaces in the interface set are used to implement different interface states of the interface.
[0051] Specifically, the present invention divides the "life" of the interface into six states: "create", "enter", "normal display", "restore", "switch", and "exit" by adding an interface switching controller (MgrStageChange). The six states correspond to six interfaces and state end events. The actions to be performed in each stage can be placed in the corresponding interface to achieve different interface states of the interface. The six interfaces constitute the interface set in the present invention.
[0052] The definitions of each state in this embodiment are as follows:
[0053] “Creation”: This state is the initialization stage of the interface;
[0054] "Enter": After the "Create" state and before the "Normal Display" state, it indicates that the interface creation is complete. It is mainly used to make some preparations for formally entering the interface, such as refreshing the interface, playing the entry animation, etc.
[0055] "Restore": Switch to the existing interface and directly enter the "Restore" state. It can be regarded as a different state of the same stage as the "Enter" state, mainly used to distinguish between normal creation and restoration of the interface;
[0056] “Normal display”: When the interface “enters / restores” is completed, the interface is displayed normally;
[0057] "Switch": When you switch from interface 1 to interface 2, interface 1 enters the "Switch" state, in which you can play the interface exit animation or clean up the interface logic;
[0058] "Exit": This state is after the "Switch" state, indicating that the interface has been switched. It is mainly used to destroy the interface.
[0059] Among them, "enter" and "restore" can be regarded as two states of the same stage. "Enter" means that this interface has not been created before and it is the first time to enter. "Restore" means that this interface has been created before and this time it is just restoring the interface. The purpose of splitting into two states is to facilitate the corresponding different usage scenarios during the re-development process.
[0060] In another implementation of the present invention, the interface switching controller may also configure an interface manager (stage). The interface switching controller (MgrStageChange) always exists to manage the switching logic and status of multiple interface managers (stage).
[0061] Interface manager (stage): Each full-screen interface (view) has a corresponding interface manager (stage), which is used to manage the creation and display of the interface (view) and its various states.
[0062] When the interface is created, the interface manager (stage) enters the "create" state and calls the "create" interface, completes the logic processing in the interface, and sends the "create" state end event to the interface switching controller.
[0063] The "Create" state ends. If the interface already exists, it enters the "Restore" state. Otherwise, it enters the "Enter" state and calls the corresponding interface to complete the logical processing in the interface and send the "Restore" / "Enter" state end event.
[0064] The "Resume" / "Enter" state ends, the "Normal Display" state is entered and the "Normal Display" interface is called, the logic processing in the interface is completed, and the "Normal Display" state end event is sent.
[0065] When you need to exit this interface and display other interfaces, enter the "Switch" state and call the "Switch" interface, complete the logical processing in the interface, and send the "Switch" state end event.
[0066] The "Switch" state ends and enters the "Exit" state, and the interface is destroyed.
[0067] It should be noted that the order of the above 6 states is fixed, and each state needs to be executed in sequence according to the above state order. A certain order cannot be skipped. When the previous stage of the interface has not ended, the next order cannot be entered.
[0068] In addition, the above-mentioned six interfaces are provided for each interface, and the interface switching controller can call different interfaces by controlling the interface manager of the interface to realize different states of the interface.
[0069] The actions performed by interfaces of different interfaces may be different. For example, the "Create" interface can create different interface contents, and the "Switch" interface can play different switching animations.
[0070] Through the above interface settings, when interface 1 switches to interface 2, the design creates interface 2 when entering the "switch" state of interface 1. The exit animation of interface 1 is played in the interface corresponding to the switch state of interface 1, and the entry animation is played in the interface corresponding to the entry state of interface 2. Before interface 1 enters the exit state, it exists at the same time as interface 2, so that the two interfaces can achieve seamless switching better.
[0071] Reference Figure 1 , the interface switching method may include:
[0072] S11, determine whether an interface switching instruction is received; if so, execute step S12.
[0073] Specifically, during the process of playing the switched interface on the current interface, it is determined whether an interface switching instruction is received, wherein the interface switching instruction may be satisfied with the interface jump condition or be triggered by the user.
[0074] Meeting the interface jump condition means that the current interface has been played and the next interface needs to be displayed.
[0075] User trigger means that the user clicks a button, which needs to jump to another interface. For example, when the user is playing a game, if he clicks the button to start a new game, he needs to jump to the interface of the new game.
[0076] If an interface switching instruction is received, an interface jump needs to be performed. In this embodiment, the currently displayed interface is called the switched interface, and the interface to be switched to is called the target interface.
[0077] S12: calling a switching interface in the interface set corresponding to the switched interface to play a switching animation corresponding to the switched interface on the current interface.
[0078] Specifically, the interface switching controller may control the first interface manager corresponding to the switched interface to call a switching interface in the interface set corresponding to the switched interface.
[0079] The interface switching controller may send a start switching state instruction to the first interface manager corresponding to the switched interface. Then, the first interface manager calls the switching interface in the interface set corresponding to the switched interface, and plays the switching animation corresponding to the switched interface through the switching interface. The content of the played switching animation may be pre-configured.
[0080] It should be noted that the duration of the switching animation corresponding to the switched interface played through the switching interface is generally greater than the creation time of the target interface, so that after the switching animation is played, the target interface is successfully created, avoiding the problem that the switching animation is played but the target interface is not created, resulting in unsmooth switching.
[0081] After the switched interface finishes playing the switching animation, the first interface manager returns the switching state end event to the interface switching controller. At this time, the interface switching controller determines that the switching animation is completed. Thereafter, the interface switching controller controls the first interface manager to call the exit interface in the interface set corresponding to the switched interface to stop displaying the switched interface in the current interface.
[0082] Specifically, the interface switching controller sends a start exit state instruction to the first interface manager, and the first interface manager calls the exit interface in the interface set corresponding to the switched interface, so that the current interface stops displaying the switched interface, and then returns the exit state end event to the interface switching controller.
[0083] Thereafter, in order to prevent the switched interface from occupying memory, the switched interface may be deleted, and the first interface manager corresponding to the switched interface may also be deleted.
[0084] Then, the interface switching controller sends a deletion instruction to the first interface manager, so that the first interface manager deletes the switched interface and the first interface manager.
[0085] Specifically, the sent deletion instruction may be an interface destruction management instruction. After receiving the instruction, the first interface manager destroys the switched interface and performs self-destruction, and then returns destruction completion information to the interface switching controller.
[0086] That is, after calling the switching interface in the interface set corresponding to the switched interface to play the switching animation corresponding to the switched interface on the current interface, the method further includes:
[0087] After determining that the switching animation is finished playing, controlling the first interface manager to call an exit interface in the interface set corresponding to the switched interface, so as to stop displaying the switched interface on the current interface;
[0088] A deletion instruction is sent to the first interface manager, so that the first interface manager deletes the switched interface and the first interface manager.
[0089] S13, determine whether the target interface to be switched to exists; if so, execute step S14.
[0090] Specifically, the target interface to be switched to may not exist, that is, the target interface needs to be created. In addition, the target interface to be switched to may also exist, such as the target interface exists in the background of the interface switching controller, and at this time, the target interface does not need to be created again, and only the target interface needs to be restored.
[0091] In this embodiment, generally when an interface manager of an interface exists, the interface manager will create the interface. Then, whether the target interface exists can be determined by whether the second interface manager corresponding to the target interface exists.
[0092] S14. Call a creation interface in an interface set corresponding to the target interface to create the target interface, and after determining that the target interface is successfully created, call an entry interface in an interface set corresponding to the target interface to play an entry animation corresponding to the target interface on the current interface.
[0093] Specifically, since the target interface to be switched to does not exist, the second interface manager corresponding to the target interface does not exist either. At this time, the interface switching controller first creates the second interface manager corresponding to the target interface, and then controls the second interface manager to call the creation interface in the interface set corresponding to the target interface to create the target interface.
[0094] Specifically, the interface switching controller sends a start creation state instruction to the second interface manager corresponding to the target interface, and the second interface manager creates the target interface and returns a creation state end event to the interface switching controller. At this point, the interface switching controller determines that the target interface has been successfully created.
[0095] Then, the interface switching controller sends the start entry state to the second interface manager, and the second interface manager calls the entry interface in the interface set corresponding to the target interface to play the entry animation corresponding to the target interface on the current interface. After the entry animation is played, the entry state end event is returned to the interface switching controller.
[0096] After that, the target interface enters the "state" and needs to enter the "normal display" state. At this time, the interface switching controller controls the second interface manager to call the normal display interface in the interface set corresponding to the target interface to continuously display the target interface on the current interface.
[0097] Specifically, the interface switching controller sends a start normal state instruction to the second interface manager, and the second interface manager calls the normal display interface in the interface set corresponding to the target interface to continuously display the target interface on the current interface.
[0098] For the specific interface calling process, please refer to the above corresponding instructions.
[0099] In another implementation of the present invention, when it is determined that the target interface to be switched to exists, the method further includes: controlling the second interface manager to call a recovery interface in the interface set corresponding to the target interface to enter the target interface again.
[0100] Specifically, if the target interface to be switched to exists, there is no need to create the interface again, only to restore it. At this time, the interface switching controller controls the second interface manager to call the recovery interface in the interface set corresponding to the target interface to enter the target interface again.
[0101] For the specific interface calling process, please refer to the above corresponding instructions.
[0102] In order for those skilled in the art to understand the present invention more clearly, Figure 2 , which is described in detail. Among them, interface 1 is the switched interface, and interface 2 is the target interface.
[0103] When switching from interface 1 to interface 2, the interface switching controller notifies the first interface manager to start the "switching" state. The interface switching controller creates a second interface manager and notifies the second interface manager to start the "creating" state. After the second interface manager completes the "creating" state, it starts the "entering" state.
[0104] Interface 1 plays the switching animation in the "Switch" state, and interface 2 plays the entry animation in the "Enter" state.
[0105] After the interface 1 and interface 2 states are completed, enter the next state of the interface.
[0106] After the "first interface manager exits" state is completed, the interface switching controller destroys the first interface manager and interface 1.
[0107] From the time when the first interface manager starts the "switching" state to the "exit" state, interface 1 and interface 2 always exist at the same time, thus achieving seamless switching.
[0108] It should be noted that the interface managers corresponding to interface 1 and interface 2 are executed independently, and each state is continuously executed according to the state sequence of the interface.
[0109] In this embodiment, the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to realize different interface states of the interface, so that when the current interface is playing the switched interface, if an interface switching instruction is received, the switching interface in the interface set corresponding to the switched interface is first called to play the switching animation corresponding to the switched interface in the current interface. When the target interface to be switched to does not exist, the creation interface in the interface set corresponding to the target interface is called to create the target interface, and the entry interface in the interface set corresponding to the target interface is called to play the entry animation corresponding to the target interface in the current interface, so that when switching to the target interface, the animation of the switched interface is played first, and then the animation of the target interface is played, so as to achieve seamless connection of the animation playback. In the present invention, it is only necessary to configure interface sets of different interfaces. When switching between different interfaces, it is only necessary to call the corresponding interface to realize the interface switching of different interfaces. Compared with the method of adding corresponding code for each pair of target interface and switched interface (the code of interface 1 is written on interface 2, which is only applicable to switching from interface 1 to interface 2. When interface 1 is switched to interface 3, the code needs to be repeated again), the amount of repeated code writing is reduced and the code reuse rate is improved.
[0110] In addition, the present invention adds an interface switching controller (MgrStageChange) and an interface manager (stage) to achieve the simultaneous existence of two full-screen interfaces during switching, thereby achieving seamless switching.
[0111] Based on the above-mentioned embodiment of the interface switching method, another embodiment of the present invention provides an interface switching device, which is applied to an interface switching controller, wherein the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to realize different interface states of the interface;
[0112] Reference Figure 3 , the interface switching device comprises:
[0113] The instruction judgment module 11 is used to judge whether an interface switching instruction is received during the process of playing the switched interface on the current interface;
[0114] The first interface calling module 12 is used for calling the switching interface in the interface set corresponding to the switched interface, so as to play the switching animation corresponding to the switched interface on the current interface, if received;
[0115] A determination module 13 is used to determine whether the target interface to be switched to exists;
[0116] The second interface calling module 14 is used to call the creation interface in the interface set corresponding to the target interface to create the target interface if it does not exist, and after determining that the target interface is successfully created, call the entry interface in the interface set corresponding to the target interface to play the entry animation corresponding to the target interface on the current interface.
[0117] Further, the first interface calling module is specifically used for:
[0118] The first interface manager corresponding to the switched interface is controlled to call a switching interface in an interface set corresponding to the switched interface.
[0119] Furthermore, it also includes:
[0120] A third interface calling module is used to control the first interface manager to call the exit interface in the interface set corresponding to the switched interface after determining that the switching animation is finished playing, so as to stop displaying the switched interface on the current interface;
[0121] The instruction sending module is used to send a deletion instruction to the first interface manager, so that the first interface manager deletes the switched interface and the first interface manager.
[0122] Further, the second interface calling module 14 is used to call the creation interface in the interface set corresponding to the target interface to create the target interface, specifically for:
[0123] A second interface manager corresponding to the target interface is created, and the second interface manager is controlled to call a creation interface in an interface set corresponding to the target interface to create the target interface.
[0124] Furthermore, it also includes:
[0125] The fourth interface calling module is used to control the second interface manager to call the recovery interface in the interface set corresponding to the target interface to enter the target interface again when it is determined that the target interface to be switched to exists.
[0126] Furthermore, it also includes:
[0127] The fifth interface calling module is used to control the second interface manager to call the normal display interface in the interface set corresponding to the target interface, so as to continuously display the target interface on the current interface.
[0128] In this embodiment, the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to realize different interface states of the interface, so that when the current interface is playing the switched interface, if an interface switching instruction is received, the switching interface in the interface set corresponding to the switched interface is first called to play the switching animation corresponding to the switched interface in the current interface. When the target interface to be switched to does not exist, the creation interface in the interface set corresponding to the target interface is called to create the target interface, and the entry interface in the interface set corresponding to the target interface is called to play the entry animation corresponding to the target interface in the current interface, so that when switching to the target interface, the animation of the switched interface is played first, and then the animation of the target interface is played, so as to achieve seamless connection of the animation playback. In the present invention, it is only necessary to configure interface sets of different interfaces. When switching between different interfaces, it is only necessary to call the corresponding interface to realize the interface switching of different interfaces. Compared with the method of adding corresponding code for each pair of target interface and switched interface (the code of interface 1 is written on interface 2, which is only applicable to switching from interface 1 to interface 2. When interface 1 is switched to interface 3, the code needs to be repeated again), the amount of repeated code writing is reduced and the code reuse rate is improved.
[0129] It should be noted that for the specific implementation process of each module in the embodiment of the present invention, please refer to the corresponding description in the above embodiment, which will not be repeated here.
[0130] Based on the above-mentioned embodiments of the interface switching method and device, another embodiment of the present invention provides an electronic device, including: a memory and a processor;
[0131] Wherein, the memory is used to store programs;
[0132] The processor calls the program and is used to execute the above-mentioned interface switching method.
[0133] The electronic device in this embodiment may be the above-mentioned interface switching controller. For the specific interface switching method, please refer to the above-mentioned corresponding description.
[0134] In this embodiment, the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to realize different interface states of the interface, so that when the current interface is playing the switched interface, if an interface switching instruction is received, the switching interface in the interface set corresponding to the switched interface is first called to play the switching animation corresponding to the switched interface in the current interface. When the target interface to be switched to does not exist, the creation interface in the interface set corresponding to the target interface is called to create the target interface, and the entry interface in the interface set corresponding to the target interface is called to play the entry animation corresponding to the target interface in the current interface, so that when switching to the target interface, the animation of the switched interface is played first, and then the animation of the target interface is played, so as to achieve seamless connection of the animation playback. In the present invention, it is only necessary to configure interface sets of different interfaces. When switching between different interfaces, it is only necessary to call the corresponding interface to realize the interface switching of different interfaces. Compared with the method of adding corresponding code for each pair of target interface and switched interface (the code of interface 1 is written on interface 2, which is only applicable to switching from interface 1 to interface 2. When interface 1 is switched to interface 3, the code needs to be repeated again), the amount of repeated code writing is reduced and the code reuse rate is improved.
[0135] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An interface switching method, characterized in that: Applied to an interface switching controller, the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to implement different interface states of the interface; The interface switching method comprises: During the process of playing the switched interface on the current interface, determining whether an interface switching instruction is received; If received, calling the switching interface in the interface set corresponding to the switched interface to play the switching animation corresponding to the switched interface on the current interface; Determine whether the target interface to be switched to exists; If it does not exist, then call the creation interface in the interface set corresponding to the target interface to create the target interface, and after determining that the target interface is successfully created, call the entry interface in the interface set corresponding to the target interface to play the entry animation corresponding to the target interface on the current interface; The step of calling a creation interface in an interface set corresponding to the target interface to create the target interface includes: Creating a second interface manager corresponding to the target interface, and controlling the second interface manager to call a creation interface in an interface set corresponding to the target interface to create the target interface; wherein the duration of the switching animation corresponding to the switched interface played through the switching interface is greater than the creation duration of the target interface; When it is determined that the target interface to be switched to exists, the second interface manager is controlled to call a recovery interface in the interface set corresponding to the target interface to enter the target interface again.
2. The interface switching method according to claim 1, characterized in that: Calling a switching interface in an interface set corresponding to the switched interface includes: The first interface manager corresponding to the switched interface is controlled to call a switching interface in an interface set corresponding to the switched interface.
3. The interface switching method according to claim 2, characterized in that: After calling the switching interface in the interface set corresponding to the switched interface to play the switching animation corresponding to the switched interface on the current interface, the method further includes: After determining that the switching animation is finished playing, controlling the first interface manager to call an exit interface in the interface set corresponding to the switched interface, so as to stop displaying the switched interface on the current interface; A deletion instruction is sent to the first interface manager, so that the first interface manager deletes the switched interface and the first interface manager.
4. The interface switching method according to claim 1, characterized in that: After calling the entry interface in the interface set corresponding to the target interface to play the entry animation corresponding to the target interface on the current interface, the method further includes: The second interface manager is controlled to call a normal display interface in the interface set corresponding to the target interface, so as to continuously display the target interface on the current interface.
5. An interface switching device, characterized in that: Applied to an interface switching controller, the interface switching controller is pre-configured with interface sets corresponding to different interfaces, and different interfaces in the interface set are used to implement different interface states of the interface; The interface switching device comprises: The command judgment module is used to judge whether an interface switching command is received during the process of playing the switched interface on the current interface; A first interface calling module is used for calling the switching interface in the interface set corresponding to the switched interface if received, so as to play the switching animation corresponding to the switched interface on the current interface; A determination module is used to determine whether the target interface to be switched to exists; The second interface calling module is used to call the creation interface in the interface set corresponding to the target interface to create the target interface if it does not exist, and after determining that the target interface is successfully created, call the entry interface in the interface set corresponding to the target interface to play the entry animation corresponding to the target interface on the current interface; When the second interface calling module is used to call the creation interface in the interface set corresponding to the target interface to create the target interface, it is specifically used to: create a second interface manager corresponding to the target interface, and control the second interface manager to call the creation interface in the interface set corresponding to the target interface to create the target interface; wherein the duration of the switching animation corresponding to the switched interface played through the switching interface is greater than the creation duration of the target interface; The fourth interface calling module is used to control the second interface manager to call the recovery interface in the interface set corresponding to the target interface to enter the target interface again when it is determined that the target interface to be switched to exists.
6. The interface switching device according to claim 5, characterized in that: The first interface calling module is specifically used for: The first interface manager corresponding to the switched interface is controlled to call a switching interface in an interface set corresponding to the switched interface.
7. The interface switching device according to claim 6, characterized in that: Also includes: A third interface calling module is used to control the first interface manager to call the exit interface in the interface set corresponding to the switched interface after determining that the switching animation is finished playing, so as to stop displaying the switched interface on the current interface; The instruction sending module is used to send a deletion instruction to the first interface manager, so that the first interface manager deletes the switched interface and the first interface manager.
8. An electronic device, characterized in that: include: Memory and processor; Wherein, the memory is used to store programs; The processor calls the program and is used to execute the interface switching method as described in any one of claims 1-4.
Citation Information
Patent Citations
Page switching method and device, electronic device and storage medium
CN109669755A