CN113111290A - Method and device for generating UI (user interface) - Google Patents

Method and device for generating UI (user interface) Download PDF

Info

Publication number
CN113111290A
CN113111290A CN202110476815.7A CN202110476815A CN113111290A CN 113111290 A CN113111290 A CN 113111290A CN 202110476815 A CN202110476815 A CN 202110476815A CN 113111290 A CN113111290 A CN 113111290A
Authority
CN
China
Prior art keywords
template file
binary
name
xml
xml template
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
CN202110476815.7A
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.)
Beijing Fangjianghu Technology Co Ltd
Original Assignee
Beijing Fangjianghu Technology 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 Beijing Fangjianghu Technology Co Ltd filed Critical Beijing Fangjianghu Technology Co Ltd
Priority to CN202110476815.7A priority Critical patent/CN113111290A/en
Publication of CN113111290A publication Critical patent/CN113111290A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Abstract

The embodiment of the invention provides a method and a device for generating a UI (user interface), belonging to the field of mobile terminal development. The method comprises the following steps: under the condition of receiving an instruction for opening a UI, acquiring business data corresponding to the UI and the name of an XML template file; acquiring an XML template file corresponding to the name; replacing the display form of the component in the obtained XML template file with a corresponding preset display form of the component in an application program to which the UI belongs to obtain an updated XML template file; and rendering the service data on the updated XML template file to obtain the UI interface. Therefore, real-time updating, reduction of iteration period, reduction of verification and trial-and-error cost and native rendering performance are achieved.

Description

Method and device for generating UI (user interface)
Technical Field
The invention relates to the field of mobile terminal development, in particular to a method and a device for generating a UI (user interface).
Background
In the field of mobile-end Android development, version iteration release is needed to update UI styles in conventional development, modification is needed in client version release iteration in common View, the period is long, and the cost of verification and trial and error is high. For example, as shown in fig. 1, broker exhibition information patterns may change often, with more frequent UI iterations, and conventional schemes require new iteration versions to be released. In many application scenarios, we want the independent View to be able to dynamically present different styles and layouts in a manner similar to HTML presentation. In addition, although the existing HTML technology can be updated in real time, native rendering performance cannot be achieved, rendering efficiency is low, and obvious delay exists.
Disclosure of Invention
It is an object of embodiments of the present invention to provide a method and apparatus for generating a UI interface that may solve, or at least partially solve, the above problems.
In order to achieve the above object, an aspect of the embodiments of the present invention provides a method for generating a UI interface, the method including: under the condition of receiving an instruction for opening a UI, acquiring business data corresponding to the UI and the name of an XML template file; acquiring an XML template file corresponding to the name; replacing the display form of the component in the obtained XML template file with a corresponding preset display form of the component in an application program to which the UI belongs to obtain an updated XML template file; and rendering the service data on the updated XML template file to obtain the UI interface.
Optionally, the obtaining the XML template file corresponding to the name includes: and based on the name, screening the XML template file corresponding to the name from one or more XML template files which are pulled from a preset XML template file library and cached in the application program or one or more XML template files which are directly pulled from the preset XML template file library.
Optionally, the obtaining the XML template file corresponding to the name includes: acquiring a binary template file corresponding to the name, wherein the binary template file is obtained by compressing and/or encrypting an XML template file; and decompressing and/or decrypting the obtained binary template file to obtain an XML template file corresponding to the name.
Optionally, the obtaining the binary template file corresponding to the name includes: based on the name, screening out the binary template file corresponding to the name from one or more binary template files which are pulled from a preset binary template file library and cached in the application program or one or more binary template files which are directly pulled from the preset binary template file library so as to obtain the binary template file corresponding to the name.
Optionally, compressing and/or encrypting the XML template file to obtain a binary template file includes: reading an XML template file in an XML format; mapping at least one of the following readings to a preset identifier: a component, an attribute of the component, and a value range of the attribute; splicing preset character strings at the head and the tail of the character strings of the mapped XML template file to obtain reinforced character strings; representing the reinforced character string in a binary stream mode to obtain a binary stream corresponding to the reinforced character string; and coding the binary stream corresponding to the reinforced character string to obtain the binary template file.
Accordingly, another aspect of the embodiments of the present invention provides an apparatus for generating a UI interface, the apparatus including: the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring business data corresponding to a UI (user interface) and the name of an XML template file under the condition of receiving an instruction for opening the UI; the second acquisition module is used for acquiring the XML template file corresponding to the name; the replacing module is used for replacing the display form of the component in the obtained XML template file with a preset display form corresponding to the component in an application program to which the UI belongs to obtain an updated XML template file; and the rendering module is used for rendering the service data on the updated XML template file to obtain the UI interface.
Optionally, the obtaining, by the second obtaining module, an XML template file corresponding to the name includes: and based on the name, screening the XML template file corresponding to the name from one or more XML template files which are pulled from a preset XML template file library and cached in the application program or one or more XML template files which are directly pulled from the preset XML template file library.
Optionally, the obtaining, by the second obtaining module, an XML template file corresponding to the name includes: acquiring a binary template file corresponding to the name, wherein the binary template file is obtained by compressing and/or encrypting an XML template file; and decompressing and/or decrypting the obtained binary template file to obtain an XML template file corresponding to the name.
Optionally, the obtaining the binary template file corresponding to the name includes: based on the name, screening out the binary template file corresponding to the name from one or more binary template files which are pulled from a preset binary template file library and cached in the application program or one or more binary template files which are directly pulled from the preset binary template file library so as to obtain the binary template file corresponding to the name.
Optionally, compressing and/or encrypting the XML template file to obtain a binary template file includes: reading an XML template file in an XML format; mapping at least one of the following readings to a preset identifier: a component, an attribute of the component, and a value range of the attribute; splicing preset character strings at the head and the tail of the character strings of the mapped XML template file to obtain reinforced character strings; representing the reinforced character string in a binary stream mode to obtain a binary stream corresponding to the reinforced character string; and coding the binary stream corresponding to the reinforced character string to obtain the binary template file.
In addition, another aspect of the embodiments of the present invention also provides a machine-readable storage medium, which stores instructions for causing a machine to execute the above-mentioned method.
In addition, another aspect of the embodiments of the present invention also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the method described above is implemented.
According to the technical scheme, the XML template file is obtained, the UI interface is obtained through rendering the service data based on the obtained XML template file, when the UI interface needs to be iterated, the UI interface can be iterated as long as the XML template file is modified, real-time updating can be achieved, the iteration of the whole application program to which the UI interface belongs is not needed, the iteration period is shortened, and the verification and trial and error costs are reduced. In addition, when a UI interface is opened, if the UI interface is iterated, the iterated UI interface can be displayed, and therefore, the iterated UI interface can be displayed when the UI interface is opened, and different styles and layouts can be dynamically displayed in a mode similar to HTML display. In addition, the display form of the component in the XML template file is replaced by the preset display form corresponding to the component in the application program to which the UI belongs, so that the UI can be generated by using the application program, a good rendering effect can be achieved, the original rendering performance can be achieved, and the rendering efficiency can be improved.
Additional features and advantages of embodiments of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the embodiments of the invention without limiting the embodiments of the invention. In the drawings:
FIG. 1 is a schematic diagram of a UI interface;
FIG. 2 is a method for generating a UI interface provided by an embodiment of the invention;
FIG. 3 is a schematic diagram of the logic for generating a UI interface provided by another embodiment of the invention; and
fig. 4 is a block diagram illustrating an apparatus for generating a UI interface according to another embodiment of the present invention.
Description of the reference numerals
1 first obtaining module 2 second obtaining module
3 replacement module 4 rendering module
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating embodiments of the invention, are given by way of illustration and explanation only, not limitation.
One aspect of embodiments of the present invention provides a method for generating a UI interface.
Fig. 2 is a flowchart of a method for generating a UI interface according to an embodiment of the present invention. As shown in fig. 2, the method includes the following.
In step S20, when an instruction to open a UI interface is received, the service data corresponding to the UI interface and the name of the XML template file are acquired. That is, when an instruction to open a certain UI interface is received, the name of the service data and the XML template file corresponding to the UI interface to be opened is obtained. The UI is a User Interface, namely a User Interface.
In step S21, an XML template file corresponding to the name is acquired. In step S20, the name of the XML template file corresponding to the UI interface to be opened is acquired, and in this step, the XML template file corresponding to the acquired name is acquired.
In step S22, replacing the display form of the component in the obtained XML template file with a preset display form corresponding to the component in the application to which the UI interface belongs, to obtain an updated XML template file. The method comprises the following steps that a display form of a certain component is preset in an application program to which a UI (user interface) belongs; in the XML template file, a certain component also has a corresponding display form; in this step, the presentation form of a certain component in the XML template file is replaced with the presentation form of the component preset in the application program. For example, a certain component in an XML template file is a "button"; the display form of the button in the XML template file is green and rectangular, and the display form preset in the application program is blue and square; the presentation form of the "button" in the XML template file "green and rectangle" is replaced with the presentation form "blue and square" set in advance in the application. It should be noted that, in this step, the number of the replaced components in the exposed form is not limited, and all the components included in the XML template file may be replaced, or some of the components in the XML template file may be replaced.
In step S23, the service data is rendered on the update XML template file to get the UI interface. After the display form of the component is replaced in step S22, a new XML template file is obtained, and the service data is rendered on the newly obtained XML template file to obtain the UI interface to be opened.
According to the technical scheme, the XML template file is obtained, the UI interface is obtained through rendering the service data based on the obtained XML template file, when the UI interface needs to be iterated, the UI interface can be iterated as long as the XML template file is modified, real-time updating can be achieved, the iteration of the whole application program to which the UI interface belongs is not needed, the iteration period is shortened, and the verification and trial and error costs are reduced. In addition, when a UI interface is opened, if the UI interface is iterated, the iterated UI interface can be displayed, and therefore, the iterated UI interface can be displayed when the UI interface is opened, and different styles and layouts can be dynamically displayed in a mode similar to HTML display. In addition, the display form of the component in the XML template file is replaced by the preset display form corresponding to the component in the application program to which the UI belongs, so that the UI can be generated by using the application program, a good rendering effect can be achieved, the original rendering performance can be achieved, and the rendering efficiency can be improved.
Optionally, in the embodiment of the present invention, obtaining the XML template file corresponding to the name may include the following. Based on the name, the name is the name of the XML template file corresponding to the UI interface to be opened, and the XML template file corresponding to the name is screened out from one or more XML template files which are pulled from a preset XML template file library and cached in the application program or are directly pulled from one or more XML template files in the preset XML template file library. Specifically, in the embodiment of the present invention, when the XML template file is screened based on the name, the XML template file may be directly pulled from the preset XML template file library and screened from the pulled XML template file; the XML template file may be further filtered from the XML template file cached in the application program, wherein the XML template file cached in the application program is pulled from a preset XML template file library. In addition, in the embodiment of the present invention, when pulling the XML template file from the preset XML template file library, the XML template file in the preset XML template file library may be screened according to the screening condition, and the XML template file meeting the screening condition is pulled. Wherein the screening conditions may include at least one of: an ID of a device in which an application to which a UI interface to be opened belongs is installed, an ID of a city in which the device is located, an application environment, a version of the application, an ID of an XML template file, a name of the XML template file, a version of the XML template file, a tag of the XML template file, a grouping of the XML template files. The screening conditions can be obtained based on the UI interface to be opened and the XML template file corresponding to the UI interface. In addition, when the XML template file is pulled from the preset XML template file library only according to the ID of the XML template file or the name of the XML template file, the pulling is performed according to the name of the XML template file or the ID of the XML template file corresponding to the UI interface to be opened, and the pulled XML file is directly the XML template file corresponding to the name. Further, the case of pulling the XML template file only according to the name of the XML template file or the ID of the XML template file is applicable to a manner of acquiring the XML template file corresponding to the name by "filtering out the XML template file corresponding to the name from the XML template files directly pulled in the preset XML template file library". In the preset XML template file library, each XML template file stores its corresponding template ID, template name, version of the template, tag of the template, template grouping, download address of the template file, and the lowest version of the application program supported by the template.
Optionally, in the embodiment of the present invention, obtaining the XML template file corresponding to the name may also include the following. Acquiring a binary template file corresponding to the name, wherein the binary template file is obtained by compressing and/or encrypting an XML template file; and decompressing and/or decrypting the obtained binary template file to obtain an XML template file corresponding to the name. The decryption can be performed by using a reverse process corresponding to an encryption algorithm, the binary file of Base64 is restored into a binary stream, and the binary stream is converted into a character string and then the characteristic character string is removed; decompression may be by calling the base64 function.
Optionally, in the embodiment of the present invention, obtaining the binary template file corresponding to the name may include the following. Based on the name, the name is the name of the XML template file corresponding to the UI interface to be opened, and the binary template file corresponding to the name is screened out from the one or more binary template files pulled from the preset binary template file library and cached in the one or more binary template files in the application program or directly pulled from the one or more binary template files in the preset binary template file library, so as to obtain the binary template file corresponding to the name. Specifically, in the embodiment of the present invention, when the binary template file is screened based on the name, the binary template file may be directly pulled from a preset binary template file library and screened from the pulled binary template file; the binary template file can be further screened from the binary template files cached in the application program, wherein the binary template files cached in the application program are pulled from a preset binary template file library. In addition, in the embodiment of the present invention, when the binary template file is pulled from the preset binary template file library, the binary template file in the preset binary template file library may be screened according to the screening condition, and the binary template file meeting the screening condition is pulled. Wherein the screening conditions may include at least one of: an ID of a device to which a UI interface to be opened belongs, an ID of a city in which the device is located, an application environment, a version of the application, an ID of a binary template file, a name of the binary template file, a version of the binary template file, a tag of the binary template file, a grouping of the binary template files. In addition, when the binary template file is pulled from the preset binary template file library only according to the ID of the binary template file or the name of the binary template file, the pulling is performed according to the name of the binary template file or the ID of the binary template file corresponding to the UI interface to be opened, and the pulled binary file is directly the binary template file corresponding to the name. In addition, the case where the binary template file is pulled only according to the name of the binary template file or the ID of the binary template file is applied to a manner of "screening the binary template file corresponding to the name from the binary template files directly pulled in the preset binary template file library" to acquire the binary template file corresponding to the name. In the preset binary template file library, each binary template file stores a template ID, a template name, a template version, a template tag, a service group, a download address of the template file, and a minimum version of an application program supported by the template. In addition, in the embodiment of the present invention, a certain binary template file and an XML template file obtained by compressing and/or encrypting have the same template ID, template name, template version, template tag, template group, download address of the template file, and minimum version of an application program supported by the template, and after obtaining these attributes of the XML template file, that is, these attributes of the binary template file corresponding to the XML template file are obtained. Therefore, when the binary template file in the preset binary template file library is screened according to the screening condition, the screening condition can be obtained based on the UI interface to be opened and the XML template file corresponding to the UI interface.
Optionally, in the embodiment of the present invention, the XML template file may be compressed and/or encrypted to obtain a binary template file according to the following content. Reading the XML template file in an XML format. Mapping at least one of the following readings to a preset identifier: the component, the attribute of the component, and the value range of the attribute. The preset identifier may be set according to specific situations, and may be a Number, a reference Ref, boolean book, a String, a symbol, or at least one of the following associated with a symbol: number, Ref, boolean, String. For example, preset numbers may be mapped to the read components and the attributes of the components, and the value range of the attributes is mapped to preset signatures, where the preset signatures include a Number, a reference Ref, boolean book, and a String, and are associated using symbols. The file size can be reduced by mapping the components and/or the attributes of the components and/or the value ranges of the attributes to the preset identifiers. For the corresponding relationship between the component and/or the attribute of the component and/or the value range of the attribute and the preset identifier, a mapping table can be preset to write the corresponding relationship, and then the preset identifier is obtained by searching the mapping table during mapping. And splicing a preset character string at the head and the tail of the character string of the mapped XML template file, wherein the preset character string can be a character string Beike, for example, so as to obtain a reinforced character string. Encryption can be achieved by splicing preset strings. And representing the reinforced character string in a binary stream mode to obtain a binary stream corresponding to the reinforced character string. And coding the binary stream corresponding to the reinforced character string to obtain a binary template file. The encoding of the binary stream corresponding to the reinforced character string may be based 64 or Base 32. In addition, in the above embodiment, after the binary code file is pulled, the reinforcement check may be performed first, and then the filtering may be performed from the pulled binary code file. And the reinforcement check is to verify whether the head and the tail of the character string corresponding to the pulled binary template file have the spliced preset character string.
FIG. 3 is a logic diagram of a method for generating a UI interface according to another embodiment of the invention.
In this embodiment, the method provided by the embodiment of the present invention may be applied to mobile-end Android development. In the embodiment of the invention, in order to pursue the extremely-good interface effect and rendering performance, the technical scheme provided by the embodiment of the invention provides a technical scheme for issuing an XML template file, and the UI interface dynamic adjustment is realized by developing the XML template file and adjusting the XML template file when the interface is updated. In the prior art, the iteration of the UI interface needs to release a new application version, and only the XML template file needs to be adjusted in the technical solution provided by the embodiment of the present invention. In addition, the technical scheme provided by the embodiment of the invention is based on issuing the XML template file, and the XML template file is compressed and encrypted in sequence before uploading, so that the method has practicability and confidentiality; and the client side performs pattern caching, decryption, decompression, analysis and rendering on the service data to obtain a UI interface. The technical scheme provided by the embodiment of the invention can achieve the following technical effects: the method has the hot updating capability of the HTML technology for real-time updating and native rendering efficiency. The technical scheme provided by the embodiment of the invention has the design points that: 1) compiling a local XML template file; 2) the client pulls the template file and caches the template file to the local; 3) mapping preset display forms of components in the client one by one; 3) and rendering the service data to obtain an interface.
A method for generating a UI interface according to an embodiment of the present invention is described below with reference to fig. 3. The main contents are as follows.
1) The written XML template file is converted into a binary template file after being compressed and encrypted, and the obtained binary template file is uploaded to a binary template management platform, namely, a preset binary template file library in the embodiment of the invention.
2) The preset display form of the component is preset in the client (i.e. the application program, the SDK side in fig. 3), where there are many components preset with the preset display form, which may be preset with the preset display form for any known component that can be used. The preset display form can be used for XML template file analysis, namely, the display form of the component included in the XML file is replaced by the corresponding preset display form of the component in the client.
The client pulls (i.e., downloads) the binary template file from the binary template management platform and downloads the pulled binary template file locally, checks whether to update or not, and the like, so as to manage the template file. The step of checking whether to update the binary template file may be to compare the version number of a certain binary template file that is pulled with the version number of a binary template file corresponding to the binary template file that is cached locally, and if the version of the binary template file that is pulled is higher than the version of the binary template file corresponding to the binary template file that is cached locally, replace the binary template file corresponding to the binary template file that is cached locally with the binary template file that is pulled, and store the binary template file with the higher version in the client. Specifically, the version numbers may be compared to compare the high and low of the versions. The binary template file which is screened out from the binary template file with the name and cached in the application program in the embodiment of the invention is the binary template file which is stored in the application program after being checked and updated. Further, the pull operation may be when the client is opened. And pulling the binary template file from the binary template management platform, namely, when the binary template management platform receives the pulling intention, screening the binary template file meeting the conditions from the stored binary template files in the screening conditions, and issuing the binary template file meeting the screening conditions to the client. The screening condition for screening the binary template file by the binary management platform, that is, the screening condition when the client pulls the binary template file from the binary management platform, for example, the screening may include at least one of: an ID of a device to which a UI interface to be opened belongs, an ID of a city in which the device is located, an application environment, a version of the application, an ID of a binary template file, a name of the binary template file, a version of the binary template file, a tag of the binary template file, a grouping of the binary template files. In addition, when the client pulls the binary template file, the latest update timestamp of the recorded binary template file can be uploaded to the binary template management platform, and the binary template management platform selects the binary template file with the update time of the template file after the received timestamp by considering the received timestamp when screening the binary template file. In addition, in the binary template management platform, each binary template file has an applicable client application version; each uploaded binary template will have a new template version number. In addition, in the binary template management platform, a plurality of different versions of binary template files may correspond to a certain name, because one name corresponds to one binary template file, but the binary template file may have a plurality of versions. When the binary template file is pulled, the highest version is screened out for a certain binary template file to pull.
3) And screening out the binary template file corresponding to the name from the binary template file locally cached in the client based on the name of the XML template file corresponding to the UI interface to be opened. And decompressing and decrypting the binary template file corresponding to the name obtained by screening to obtain the corresponding XML template file. And analyzing the XML template file, and replacing the display form of the component included in the XML template file with a corresponding preset display form preset in the client by the component so as to finish the conversion from the XML definition to the native component. And rendering the service data on the replaced XML template file to obtain a UI (user interface) so as to realize template file rendering. And the service data is the service data corresponding to the UI interface which is required to be opened.
Accordingly, another aspect of the embodiments of the present invention provides an apparatus for generating a UI interface.
Fig. 4 is a block diagram illustrating an apparatus for generating a UI interface according to another embodiment of the present invention. As shown in fig. 4, the apparatus includes a first obtaining module 1, a second obtaining module 2, a replacing module 3, and a rendering module 4. The first obtaining module 1 is used for obtaining the business data corresponding to a UI interface and the name of an XML template file under the condition of receiving an instruction for opening the UI interface; the second obtaining module 2 is used for obtaining an XML template file corresponding to the name; the replacing module 3 is used for replacing the display form of the component in the obtained XML template file with a preset display form corresponding to the component in an application program to which the UI belongs, so as to obtain an updated XML template file; the rendering module 4 is configured to render the service data on the updated XML template file to obtain the UI interface.
Optionally, in this embodiment of the present invention, the obtaining, by the second obtaining module, an XML template file corresponding to the name includes: and based on the name, screening out the XML template file corresponding to the name from one or more XML template files which are pulled from a preset XML template file library and cached in the application program or one or more XML template files which are directly pulled from the preset XML template file library.
Optionally, in this embodiment of the present invention, the obtaining, by the second obtaining module, an XML template file corresponding to the name includes: acquiring a binary template file corresponding to the name, wherein the binary template file is obtained by compressing and/or encrypting an XML template file; and decompressing and/or decrypting the obtained binary template file to obtain an XML template file corresponding to the name.
Optionally, in this embodiment of the present invention, acquiring the binary template file corresponding to the name includes: based on the name, screening out the binary template file corresponding to the name from one or more binary template files which are pulled from a preset binary template file library and cached in the application program or one or more binary template files which are directly pulled from the preset binary template file library so as to obtain the binary template file corresponding to the name.
Optionally, in an embodiment of the present invention, compressing and/or encrypting the XML template file to obtain the binary template file includes: reading an XML template file in an XML format; mapping at least one of the following readings to a preset identifier: the components, the attributes of the components and the value ranges of the attributes; splicing preset character strings at the head and the tail of the character strings of the mapped XML template file to obtain reinforced character strings; representing the reinforced character string in a binary stream mode to obtain a binary stream corresponding to the reinforced character string; and coding the binary stream corresponding to the reinforced character string to obtain a binary template file.
The specific working principle and the benefits of the apparatus for generating a UI interface provided by the embodiment of the present invention are similar to those of the method for generating a UI interface provided by the embodiment of the present invention, and will not be described herein again.
The device for generating the UI interface comprises a processor and a memory, wherein the first acquisition module, the second acquisition module, the replacement module, the rendering module and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and real-time updating, iterative period reduction, verification and trial and error cost reduction and native rendering performance are realized by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a machine-readable storage medium, on which a program is stored, and the program, when executed by a processor, implements the method for generating a UI interface described in the above embodiments.
The embodiment of the invention provides a processor, wherein the processor is used for running a program, and the method for generating the UI interface in the embodiment is executed when the program runs.
The embodiment of the invention provides electronic equipment, which comprises a processor, a memory and a program which is stored on the memory and can be operated on the processor, wherein the processor executes the program and realizes the following steps: under the condition of receiving an instruction for opening a UI, acquiring business data corresponding to the UI and the name of an XML template file; acquiring an XML template file corresponding to the name; replacing the display form of the component in the obtained XML template file with a preset display form corresponding to the component in an application program to which the UI belongs to obtain an updated XML template file; rendering the service data on the updated XML template file to obtain a UI (user interface); acquiring the XML template file corresponding to the name comprises the following steps: based on the name, screening out an XML template file corresponding to the name from one or more XML template files which are pulled from a preset XML template file library and cached in an application program or one or more XML template files which are directly pulled from the preset XML template file library; acquiring the XML template file corresponding to the name comprises the following steps: acquiring a binary template file corresponding to the name, wherein the binary template file is obtained by compressing and/or encrypting an XML template file; decompressing and/or decrypting the obtained binary template file to obtain an XML template file corresponding to the name; acquiring the binary template file corresponding to the name includes: screening out the binary template file corresponding to the name from one or more binary template files which are pulled from a preset binary template file library and cached in an application program or one or more binary template files which are directly pulled from the preset binary template file library based on the name so as to obtain the binary template file corresponding to the name; compressing and/or encrypting the XML template file to obtain a binary template file, wherein the binary template file comprises the following steps: reading an XML template file in an XML format; mapping at least one of the following readings to a preset identifier: the components, the attributes of the components and the value ranges of the attributes; splicing preset character strings at the head and the tail of the character strings of the mapped XML template file to obtain reinforced character strings; representing the reinforced character string in a binary stream mode to obtain a binary stream corresponding to the reinforced character string; and coding the binary stream corresponding to the reinforced character string to obtain a binary template file. The electronic device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: under the condition of receiving an instruction for opening a UI, acquiring business data corresponding to the UI and the name of an XML template file; acquiring an XML template file corresponding to the name; replacing the display form of the component in the obtained XML template file with a preset display form corresponding to the component in an application program to which the UI belongs to obtain an updated XML template file; rendering the service data on the updated XML template file to obtain a UI (user interface); acquiring the XML template file corresponding to the name comprises the following steps: based on the name, screening out an XML template file corresponding to the name from one or more XML template files which are pulled from a preset XML template file library and cached in an application program or one or more XML template files which are directly pulled from the preset XML template file library; acquiring the XML template file corresponding to the name comprises the following steps: acquiring a binary template file corresponding to the name, wherein the binary template file is obtained by compressing and/or encrypting an XML template file; decompressing and/or decrypting the obtained binary template file to obtain an XML template file corresponding to the name; acquiring the binary template file corresponding to the name includes: screening out the binary template file corresponding to the name from one or more binary template files which are pulled from a preset binary template file library and cached in an application program or one or more binary template files which are directly pulled from the preset binary template file library based on the name so as to obtain the binary template file corresponding to the name; compressing and/or encrypting the XML template file to obtain a binary template file, wherein the binary template file comprises the following steps: reading an XML template file in an XML format; mapping at least one of the following readings to a preset identifier: the components, the attributes of the components and the value ranges of the attributes; splicing preset character strings at the head and the tail of the character strings of the mapped XML template file to obtain reinforced character strings; representing the reinforced character string in a binary stream mode to obtain a binary stream corresponding to the reinforced character string; and coding the binary stream corresponding to the reinforced character string to obtain a binary template file.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for generating a UI interface, the method comprising:
under the condition of receiving an instruction for opening a UI, acquiring business data corresponding to the UI and the name of an XML template file;
acquiring an XML template file corresponding to the name;
replacing the display form of the component in the obtained XML template file with a corresponding preset display form of the component in an application program to which the UI belongs to obtain an updated XML template file; and
and rendering the service data on the updated XML template file to obtain the UI.
2. The method of claim 1, wherein obtaining the XML template file corresponding to the name comprises:
and based on the name, screening the XML template file corresponding to the name from one or more XML template files which are pulled from a preset XML template file library and cached in the application program or one or more XML template files which are directly pulled from the preset XML template file library.
3. The method of claim 1, wherein obtaining the XML template file corresponding to the name comprises:
acquiring a binary template file corresponding to the name, wherein the binary template file is obtained by compressing and/or encrypting an XML template file; and
and decompressing and/or decrypting the obtained binary template file to obtain an XML template file corresponding to the name.
4. The method of claim 3, wherein obtaining the binary template file corresponding to the name comprises:
based on the name, screening out the binary template file corresponding to the name from one or more binary template files which are pulled from a preset binary template file library and cached in the application program or one or more binary template files which are directly pulled from the preset binary template file library so as to obtain the binary template file corresponding to the name.
5. The method of claim 3, wherein compressing and/or encrypting the XML template file to obtain a binary template file comprises:
reading an XML template file in an XML format;
mapping at least one of the following readings to a preset identifier: a component, an attribute of the component, and a value range of the attribute;
splicing preset character strings at the head and the tail of the character strings of the mapped XML template file to obtain reinforced character strings;
representing the reinforced character string in a binary stream mode to obtain a binary stream corresponding to the reinforced character string; and
and coding the binary stream corresponding to the reinforced character string to obtain the binary template file.
6. An apparatus for generating a UI interface, the apparatus comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring business data corresponding to a UI (user interface) and the name of an XML template file under the condition of receiving an instruction for opening the UI;
the second acquisition module is used for acquiring the XML template file corresponding to the name;
the replacing module is used for replacing the display form of the component in the obtained XML template file with a preset display form corresponding to the component in an application program to which the UI belongs to obtain an updated XML template file; and
and the rendering module is used for rendering the service data on the updated XML template file to obtain the UI.
7. The apparatus according to claim 6, wherein the second obtaining module obtains the XML template file corresponding to the name by:
and based on the name, screening the XML template file corresponding to the name from one or more XML template files which are pulled from a preset XML template file library and cached in the application program or one or more XML template files which are directly pulled from the preset XML template file library.
8. The apparatus according to claim 6, wherein the second obtaining module obtains the XML template file corresponding to the name by:
acquiring a binary template file corresponding to the name, wherein the binary template file is obtained by compressing and/or encrypting an XML template file; and
and decompressing and/or decrypting the obtained binary template file to obtain an XML template file corresponding to the name.
9. A machine-readable storage medium having stored thereon instructions for causing a machine to perform the method of any one of claims 1-5.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-5 when executing the program.
CN202110476815.7A 2021-04-29 2021-04-29 Method and device for generating UI (user interface) Pending CN113111290A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110476815.7A CN113111290A (en) 2021-04-29 2021-04-29 Method and device for generating UI (user interface)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110476815.7A CN113111290A (en) 2021-04-29 2021-04-29 Method and device for generating UI (user interface)

Publications (1)

Publication Number Publication Date
CN113111290A true CN113111290A (en) 2021-07-13

Family

ID=76720558

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110476815.7A Pending CN113111290A (en) 2021-04-29 2021-04-29 Method and device for generating UI (user interface)

Country Status (1)

Country Link
CN (1) CN113111290A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106503003A (en) * 2015-09-06 2017-03-15 阿里巴巴集团控股有限公司 A kind of compression of expandable mark language XML document, decompressing method and device
CN107861722A (en) * 2017-11-22 2018-03-30 北京酷我科技有限公司 A kind of method of dynamic modification UI layouts on iOS
CN110825373A (en) * 2019-10-10 2020-02-21 上海上湖信息技术有限公司 Dynamic method and device for mobile terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106503003A (en) * 2015-09-06 2017-03-15 阿里巴巴集团控股有限公司 A kind of compression of expandable mark language XML document, decompressing method and device
CN107861722A (en) * 2017-11-22 2018-03-30 北京酷我科技有限公司 A kind of method of dynamic modification UI layouts on iOS
CN110825373A (en) * 2019-10-10 2020-02-21 上海上湖信息技术有限公司 Dynamic method and device for mobile terminal

Similar Documents

Publication Publication Date Title
CN108279932B (en) Method and device for dynamically configuring user interface of mobile terminal
CN110825362A (en) Low-code application software development system and method
CN113076096B (en) Desktop application program development method, device, equipment and storage medium
CN106250158A (en) The layout method of a kind of client end interface, device and mobile device
CN111176717B (en) Method and device for generating installation package and electronic equipment
CN107239309B (en) Patch generation method and device, updating method, electronic device and storage medium
US20070038670A1 (en) Context sensitive media and information
CN116149747A (en) Interface arrangement method, device, electronic equipment and computer readable storage medium
CN115878092A (en) Code generation method, device and medium based on micro-service architecture
US20170322792A1 (en) Updating of operating system images
CN110727482A (en) Interface updating method and device
CN113010180A (en) Firmware generation method, system, device and medium
CN113111290A (en) Method and device for generating UI (user interface)
CN110825373A (en) Dynamic method and device for mobile terminal
CN113485746B (en) Method and device for generating application program interface document
CN111367512B (en) Method and device for creating Android library module dependency relationship in application development
CN110633083A (en) Code file processing method and device, electronic equipment and computer readable medium
CN109933355A (en) Application program updating method and device
CN104539697B (en) A kind of client, server and the method for making Android mobile application
CN109117133B (en) Menu configuration method and device, electronic equipment and readable storage medium
CN113157308A (en) Software packaging method, device and system
CN112579117A (en) Data upgrading method and device
CN117234466B (en) Enterprise management software development method, system, equipment and storage medium
CN113722538B (en) Interface dynamic rendering method and device
CN117724688A (en) Plug-in modeling management method and system supporting multi-scene code engineering generation

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