Disclosure of Invention
The invention discloses a method, a system and a terminal device for providing a user interface, which can save time and resource consumption caused by repeated creation/destruction of the interface.
Additional features and advantages of the invention will be set forth in the detailed description which follows, or may be learned by practice of the invention.
According to an aspect of the present invention, a method for providing a user interface for an application program of a terminal device is disclosed, including:
creating a plurality of user interface components;
caching the plurality of user interface components into a memory;
retrieving the cached plurality of user interface components;
providing a user interface with the plurality of user interface components according to a screen state.
According to an embodiment of the present invention, the screen state includes a landscape state or a portrait state.
According to an embodiment of the invention, said creating a plurality of user interface components comprises: the plurality of user interface components are pre-created upon startup of the application.
According to an embodiment of the invention, said creating a plurality of user interface components comprises: creating the plurality of user interface components when the plurality of user interface components are first used.
According to an embodiment of the present invention, the providing of the user interface using the plurality of user interface components according to the screen status includes: different user interface components are laid out to the same interface or different user interface components are laid out to different interfaces according to the screen state.
According to an embodiment of the present invention, the method for providing a user interface further includes: destroying the plurality of user interface components upon exit of the application.
According to an embodiment of the invention, the method further comprises laying out the content to be displayed in the user interface component.
According to an embodiment of the present invention, the laying out the content to be displayed in the user interface component includes: and laying out the contents to be displayed in the user interface component in an adaptive layout mode. For example, element width and height in a component are not written as fixed values, and an anchor layout is used as a layout mode.
According to a second aspect of the present invention, there is disclosed a system for providing a user interface, comprising:
a user interface component manager, said user interface component manager comprising
A creation module that creates a plurality of user interface components;
the cache module caches the plurality of user interface components in a memory;
and the extraction module extracts the cached plurality of user interface components.
According to an embodiment of the present invention, the system for providing a user interface further includes: an interface providing module for providing a user interface by using the plurality of user interface components according to the screen state.
According to a third aspect of the present invention, a terminal device is disclosed, comprising:
a processor;
a memory storing instructions for the processor to control:
creating a plurality of user interface components;
caching the plurality of user interface components into a memory;
retrieving the cached plurality of user interface components;
providing a user interface with the plurality of user interface components according to a screen state.
According to some embodiments of the present invention, due to the existence of the user interface component caching mechanism, time consumption caused by repeated creation and destruction of the user interface component can be saved to a certain extent, so that response time of the user interface is shortened, and better user experience is provided.
According to some embodiments of the invention, the cached multiple user interface components can be utilized to provide the user interface according to the screen state of the terminal device, so that the layout efficiency and flexibility are improved, and the user experience is improved.
According to some embodiments of the invention, visual elements are arranged in the user interface components according to the characteristics of the horizontal screen and the vertical screen of the equipment, different user interface components are arranged on the same interface during the horizontal screen, and different user interface components are arranged on different interfaces during the vertical screen, so that the reusability and flexibility of a program can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, steps, and so forth. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the invention.
Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
According to the scheme for providing the user interface, all the visual components are modularized and are managed uniformly through the user interface component manager, and when developers develop different development devices (mobile phones or flat panels), the user interface components are extracted through the user interface component manager and are combined on the same interface or different interfaces. Under the background, user interface components are dynamically recombined differently according to the orientation of the equipment, so that the layout efficiency and flexibility of the user interface are improved, and better user experience is achieved. In addition, due to the existence of the component cache mechanism, the invention saves the time and resource consumption caused by repeatedly creating and destroying the interface component, shortens the response time and also improves the user experience.
Fig. 1 illustrates a flowchart of a method of providing a user interface according to an example embodiment of the present invention. The method can be used for application programs of terminal equipment. The terminal device may be a mobile phone, a tablet computer, etc., but the invention is not limited thereto.
As shown in FIG. 1, at S102, a plurality of user interface components are created. For example, modular user interface components may be provided.
According to one embodiment, an application may create a user interface element manager at startup that provides user interface element pre-creation, destruction functionality to control the life cycle of the user interface element. Developers modularize each visual component and uniformly manage the visual components through the user interface component manager.
According to some embodiments, the creation of the user interface element by the user interface element manager may be performed at different occasions according to the specific situation. For example, the user interface component manager pre-creates the user interface components to be used after the application is launched. If not created in advance, it may be created at the time of first use. The specific different creation opportunities and procedures will be detailed later.
According to an embodiment of the invention, the user interface component comprises basic visual elements, such as menus, lists, content areas, etc., into which the content to be displayed is laid out.
According to one embodiment of the invention, the content to be displayed is laid out in the user interface component in an adaptive layout mode. For example, the element widths and heights in a component are not written to fixed values, for example, with an anchor layout as the layout.
At S104, the created plurality of user interface elements are cached in the memory.
According to some embodiments, after the user interface component is created, the user interface component manager can cache the created user interface component in the memory so as to directly extract the user interface component from the cache when the user interface component is used again, so that time consumption caused by repeated creation and destruction of the user interface component can be saved to a certain extent, response time of the user interface is shortened, and better user experience is provided.
According to an embodiment of the present invention, the first-time use of the component is cached as a default mode, and the user may choose not to cache.
At S106, the user interface component is extracted from the cache, and can be obtained according to the component id or the component name.
At S108, a user interface is provided using the plurality of user interface components according to a screen state of the terminal device.
For example, the extracted components are re-laid out in a combined manner into the currently displayed user interface according to the current landscape or portrait orientation of the device, using the display characteristics of the device when landscape and portrait are displayed, as will be exemplarily described below.
According to one embodiment of the invention, different user interface components are laid out to the same interface when the screen is panned.
According to another embodiment of the present invention, different user interface components are laid out to different interfaces while erecting the screen.
The component manager may destroy cached user interface components one by one upon exit of the application.
The following illustrates the process of creating a user interface element at different times, as the case may be, using the user interface element manager.
FIG. 2 illustrates a process of creating a user interface component according to an example embodiment of the invention.
As shown in FIG. 2, at S202, an application may create a user interface component manager at startup. The manager may provide user interface component pre-creation, destruction, etc. functionality to control the life cycle of the user interface component. Developers can modularize each visual component and uniformly manage the visual components through the user interface component manager.
At S204, after the application is started, the user interface element manager may create and cache the used user interface elements in the memory in advance, even if some user interface elements are not used for the time being.
At S206, the user interface component is extracted from the cache.
At S208, a user interface is provided using the plurality of user interface components according to the screen state of the terminal device, as described above.
FIG. 3 illustrates a process of creating a user interface component according to another example embodiment of the present invention.
As shown in FIG. 3, at S302, the application may create a user interface component manager at startup, as previously described.
At S304, a user interface component is created when the user interface component is first used. According to one embodiment, if the user interface element is not pre-created by the user interface element manager after the application is launched, it may be created and cached in memory at the time of first use.
At S306, when used again, the user interface element is retrieved directly from the cache.
At S308, a user interface is provided using the plurality of user interface components according to the screen state of the terminal device, as described above.
FIG. 4 illustrates a block diagram of a system for providing a user interface according to an example embodiment of the present invention.
The system for providing a user interface may be used in a mobile phone, a tablet computer, a digital broadcast terminal, a messaging device, a personal digital assistant, etc.
As shown in fig. 4, a system 400 for providing a user interface may include a user interface component manager 402. User interface component manager 402 may be used to manage user interface components 404.
According to an embodiment, the user interface component manager 402 may include a creation module 4022, a caching module 4024, and an extraction module 4026.
The creation module 4022 may create a plurality of user interface components 404. And each visual component is modularized and is uniformly managed through a user interface component manager. Creating user interface components can be performed at different times, depending on the particular situation. For example, the user interface component manager pre-creates the user interface components to be used after the application is launched. If not created in advance, it may be created at the time of first use.
The caching module 4024 is configured to cache the plurality of user interface components in a memory. When the application is started, a user interface component is pre-created in advance and cached in a memory; if not, the data is created when the data is used for the first time and cached in the memory.
The extraction module 4026 is configured to extract the plurality of cached user interface components, for example, according to a component id or a component name. For example, when the interface component is used again, the fetch module 4026 may fetch the user interface component directly from the cache without having to recreate it.
The user interface component 404 may include a base visual element. As previously mentioned, the content that needs to be displayed can be laid out into the component. The layout can adopt an adaptive layout mode. For example, element widths and heights in a component are not written as fixed values, with, for example, an anchor layout as a layout style. The creation and destruction of the components are controlled by a component manager, when the application is started, the component manager pre-creates user interface components in advance, if the user interface components are not pre-created, the user interface components are created and cached in a memory when the user interface components are used for the first time, when the user interface components are used again, the user interface components are directly extracted from the cache, and when the application exits, the user interface components cached are destroyed one by the component manager;
the system 400 may also include an interface providing module 406 for providing a user interface using the plurality of user interface components 404 based on the screen state of the terminal device. The interface providing module 406 is used for providing a user interaction interface. According to one embodiment, as described above with reference to the foregoing description, different user interface components may be laid out to the same interface when the device is landscape and different user interface components may be laid out to different interfaces when the device is portrait.
Fig. 5A and 5B illustrate a schematic diagram of providing a news app interface according to an exemplary embodiment of the present invention, employing a method according to the present invention.
Referring to fig. 5A and 5B, a plurality of user interface components, such as a news listing user interface component and a news details user interface component, may be created at the time of startup of the news app. These user interface components may also be created on first use if they are not created at app start-up. The content to be displayed can be laid out in the user interface component in an adaptive layout manner.
According to an example embodiment of the present invention, a news app may create a user interface element manager when it is started, which may provide user interface element pre-creation, destruction functions to control the life cycle of the user interface element.
After creating interface components such as a news listing user interface component and a news detail user interface component, the user interface component manager may cache the created user interface components to a memory so as to be directly retrieved when necessary, and may provide a user interface using the retrieved user interface components according to a screen status of the terminal device.
As shown in fig. 5A, the news app interface provision module may layout the news listing user interface component and the news details user interface component into the same interface while the device is being panned.
Referring to fig. 5A, when the screen is scrolled, the news listing user interface components and the news detail user interface components 1 to N are laid out in the same user interface in a combined manner, where the news listing user interface component entries 1 to N correspond to the news detail user interface components 1 to N one to one.
As shown in fig. 5B, when the device is up, the news app interface provision module may layout the news listing user interface component into a single interface and display the news detail user interface component into another interface. When the user clicks on a news listing user interface component entry, then a jump is made to the details interface.
Referring to fig. 5B, when the screen is erected, the news listing user interface components are laid out to a single interface, the detail page component 1(.. N) is displayed to another interface 1(.. N), and when the user clicks on the news listing user interface component entry 1(.. N), the user jumps to the detail interface 1(.. N).
When the terminal device changes from a landscape screen to a portrait screen or from a portrait screen to a landscape screen, it is not necessary to destroy the related components that have been created and to recreate new related components. As described above, according to the scheme of the present invention, when the screen state changes, the news app interface providing module may re-provide one or more user interfaces using the created news listing user interface component and the news detail user interface component, so as to shorten the response time of the user interfaces and provide a better user experience.
Fig. 6 illustrates a terminal device according to an example embodiment of the present invention.
As shown in fig. 6, the terminal device 600 may include a processor 610, a memory 620. In addition, according to an embodiment, the terminal device may also include a transmitter and a receiver.
The processor 610 may call instructions stored in the memory 620 to control related operations, such as controlling the transmitter and the receiver to transmit and receive signals.
According to an embodiment, the memory 620 stores instructions for the processor 610 to control: creating a plurality of user interface components; caching the plurality of user interface components into a memory; retrieving the cached plurality of user interface components; providing a user interface with the plurality of user interface components according to a screen state. The processor 610 may call instructions stored in the memory 620 to control related operations. It will be readily appreciated that the memory 620 may also store instructions for the processor 610 to control other operations according to embodiments of the present invention, which will not be described in detail herein.
Those skilled in the art will readily appreciate from the foregoing detailed description that the systems and methods according to embodiments of the present invention have one or more of the following advantages.
According to some embodiments of the present invention, the user interface is provided using the cached user interface component according to the screen state of the terminal device. For example, visual elements are arranged in the user interface components, different user interface components are arranged on the same interface in the horizontal screen mode, and different user interface components are arranged on different interfaces in the vertical screen mode, so that reusability and flexibility of a program can be improved.
According to other embodiments of the present invention, due to the existence of the user interface component caching mechanism, time consumption caused by repeated creation and destruction of the user interface component can be saved to a certain extent, so that response time of the user interface is shortened, and better user experience is provided.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.