CN108804100B - Method and device for creating interface element, storage medium and mobile terminal - Google Patents

Method and device for creating interface element, storage medium and mobile terminal Download PDF

Info

Publication number
CN108804100B
CN108804100B CN201810504133.0A CN201810504133A CN108804100B CN 108804100 B CN108804100 B CN 108804100B CN 201810504133 A CN201810504133 A CN 201810504133A CN 108804100 B CN108804100 B CN 108804100B
Authority
CN
China
Prior art keywords
interface element
preset
native language
native
predetermined
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.)
Active
Application number
CN201810504133.0A
Other languages
Chinese (zh)
Other versions
CN108804100A (en
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 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information 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 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN201810504133.0A priority Critical patent/CN108804100B/en
Publication of CN108804100A publication Critical patent/CN108804100A/en
Application granted granted Critical
Publication of CN108804100B publication Critical patent/CN108804100B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Abstract

The invention discloses a method, a device, a storage medium and a mobile terminal for creating interface elements, wherein the method comprises the following steps: the predetermined application receives a service data packet from the server, wherein the service data packet comprises: the method comprises the steps of configuring files and business logic data set through a first preset language; the preset application generates a preset resolver by packaging the native interface elements corresponding to the configuration file; analyzing the configuration file by a native language component of a preset application through a preset analyzer; the method comprises the steps that a first preset language component of a preset application carries out logic conversion on business logic data according to a native language, and the converted business logic data and a functional function index corresponding to the converted business logic data are sent to the native language component through a preset transmission channel; and the native language component calls the function sequentially through the function index according to the flow corresponding to the converted business logic data, and creates an interface element according to the function and the configuration parameters based on a reflection construction mechanism.

Description

Method and device for creating interface element, storage medium and mobile terminal
Technical Field
The present invention relates to the field of data processing, and in particular, to a method and an apparatus for creating an interface element, a storage medium, and a mobile terminal.
Background
Native (or Native) development is the most familiar Application software (APP) development model for developers. The native development can access all functions in the device, the running speed is higher, the performance is higher, excellent offline processing and storage capacity and the like can be started, the best user experience, the best user interface and the most gorgeous interaction are provided. The number of original developers is large, the development environment is mature, a plurality of open source libraries are provided for the developers to call, and various design effects can be conveniently realized. However, each time an interface (i.e., activity) is developed, native needs to register in advance, otherwise, the Activity may cause the crash of APP.
Therefore, when an interface element (i.e., view) of Activity in the APP is changed, the prior art adopts two methods, one is that the APP accesses a ReactNative framework (a development framework) on the basis of native development to perform service update iteration, and the other is that some interfaces of the APP developed by Html5 are used to implement local dynamism. The ReactNative can realize the addition of the interface and the update of the content, and the Html5 can only realize the update of the interface content.
Although prior art can both realize the change of interface element, no matter adopt above-mentioned any kind of method, all only the change of going on in the APP of native language, all need register the interface of change, appear for the user when the new version of APP is released, can't change the interface element in the APP interface under the condition of not releasing new version APP, user experience is relatively poor.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a storage medium and a mobile terminal for creating interface elements, which are used for solving the following problems in the prior art: interface elements in the APP interface cannot be changed under the condition that a new version APP is not released, and user experience is poor.
To solve the foregoing technical problem, in one aspect, an embodiment of the present invention provides a method for creating an interface element, including: the predetermined application receives a service data packet from the server, wherein the service data packet comprises: configuration files and business logic data set by a first predetermined language, wherein the first predetermined language is different from a native language of a predetermined application; the predetermined application generates a predetermined resolver by packaging the native interface elements corresponding to the configuration file; analyzing the configuration file by a native language component of a preset application through a preset analyzer, and storing the configuration parameters obtained by analysis in a preset storage space; the method comprises the steps that a first preset language component of a preset application carries out logic conversion on business logic data according to a native language, and the converted business logic data and a functional function index corresponding to the converted business logic data are sent to the native language component through a preset transmission channel; and the native language component calls the function sequentially through the function index according to the flow corresponding to the converted business logic data, and creates an interface element according to the function and the configuration parameters based on a reflection construction mechanism.
Optionally, creating an interface element according to the function and the configuration parameter based on the reflection construction mechanism includes: the native language component acquires the interface element name in the configuration parameters, and constructs an initial interface element according to a reflection construction mechanism; the native language component assigns the interface element ID of the initial interface element to a preset unique ID in the configuration parameters; and the native language component sets interface element parameters for the initial interface elements after the interface element IDs are assigned according to parameters in the configuration parameters in sequence so as to create the interface elements.
Optionally, after the native language component sequentially calls the function according to the flow corresponding to the converted service logic data through the function index, the method further includes: the native language component acquires a preset unique ID of the interface element in the configuration parameters, and determines a system ID of the interface element according to the preset unique ID; the native language component detects whether the created interface elements exist in the system ID; in the absence of a created interface element for the system ID, the native language component creates an interface element in terms of a function and configuration parameters based on the reflection construction mechanism.
Optionally, after the detecting whether the created interface element exists in the system ID by the native language component, the method further includes: and under the condition that the created interface element exists in the system ID, modifying the interface element parameter corresponding to the created interface element according to the configuration parameter so as to update the created interface element.
Optionally, after creating the interface element according to the function and the configuration parameter based on the reflection construction mechanism, the method further includes: and adding the created interface element to the parent node interface element corresponding to the interface element by the native language component so as to present the interface element in a preset interface of a preset application.
On the other hand, an embodiment of the present invention further provides an apparatus for creating an interface element, including: a receiving module, configured to receive a service data packet from a server, where the service data packet includes: configuration files and business logic data set by a first predetermined language, wherein the first predetermined language is different from a native language of a predetermined application; the analyzer generating module is used for encapsulating the native interface elements corresponding to the configuration files through a preset application to generate a preset analyzer; the analysis module is used for analyzing the configuration file through a preset analyzer in a native language component of a preset application and storing the configuration parameters obtained through analysis in a preset storage space; the processing module is used for carrying out logic conversion on the service logic data according to a native language through a first preset language component of a preset application, and sending the converted service logic data and a functional function index corresponding to the converted service logic data to the native language component through a preset transmission channel; the calling module is used for sequentially calling the function through the native language component according to the flow corresponding to the converted business logic data through the function index; and the creating module is used for creating the interface elements according to the function and the configuration parameters based on the reflection construction mechanism through the native language components.
Optionally, the creating module includes: the construction unit is used for acquiring the interface element names in the configuration parameters through the native language components and constructing initial interface elements according to a reflection construction mechanism; the first setting unit is used for assigning the interface element ID of the initial interface element to be a preset unique ID in the configuration parameters through the native language component; and the second setting unit is used for setting interface element parameters for the initial interface elements after the interface element IDs are assigned according to the parameters in the configuration parameters in sequence through the native language components so as to create the interface elements.
Optionally, the method further includes: the determining module is used for acquiring the preset unique ID of the interface element in the configuration parameters through the native language component and determining the system ID of the interface element according to the preset unique ID; the detection module is used for detecting whether the created interface elements exist in the system ID through the native language component; and the creating module is also used for creating the interface elements according to the function and the configuration parameters based on the reflection construction mechanism through the native language component under the condition that the created interface elements do not exist in the system ID.
Optionally, the creating module is further configured to, when the created interface element exists in the system ID, modify an interface element parameter corresponding to the created interface element according to the configuration parameter, so as to update the created interface element.
Optionally, the method further includes: and the adding module is used for adding the created interface elements into the parent node interface elements corresponding to the interface elements through the native language components so as to present the interface elements in a preset interface of a preset application.
On the other hand, an embodiment of the present invention further provides a storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the steps of the method for creating an interface element.
On the other hand, an embodiment of the present invention further provides a mobile terminal, which at least includes a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the method for creating an interface element when executing the computer program on the memory.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that a preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, this embodiment can receive the service data package at any time to combine this predetermined resolver that generates through encapsulating native interface element to realize dynamic establishment interface element, need not wait until releasing the APP of new version and just can change interface element, user experience is better, also is more suitable for commercial popularization, has solved prior art's following problem: interface elements in the APP interface cannot be changed under the condition that a new version APP is not released, and user experience is poor.
Drawings
FIG. 1 is a flow chart of a method of creating an interface element in a first embodiment of the invention;
FIG. 2 is a flow chart of a method of creating an interface element in a second embodiment of the invention;
FIG. 3 is a flow chart of a method of creating an interface element in a third embodiment of the invention;
FIG. 4 is a flow chart of a method of creating an interface element in a fourth embodiment of the invention;
FIG. 5 is a schematic diagram of an apparatus for creating interface elements according to a fifth embodiment of the present invention;
FIG. 6 is a schematic structural diagram of an apparatus for creating an interface element according to a sixth embodiment of the present invention;
FIG. 7 is a schematic structural diagram of an apparatus for creating an interface element according to a seventh embodiment of the present invention;
FIG. 8 is a schematic structural diagram of an apparatus for creating an interface element according to an eighth embodiment of the present invention;
FIG. 9 is a schematic diagram illustrating the interaction between the Native side and the JS side of the DU framework in the embodiment of the present invention;
FIG. 10 is a diagram illustrating the relationship between the predefined parser, the native interface element, and the XML file according to an embodiment of the present invention.
Detailed Description
In order to solve the following problems in the prior art: interface elements in the APP interface cannot be changed under the condition that a new version of APP is not released, and user experience is poor; the invention provides a method, a device, a storage medium and a mobile terminal for creating an interface element, which are described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
The first embodiment of the present invention provides a method for creating an interface element, the flow of the method is shown in fig. 1, and the method includes steps S101 to S105:
s101, receiving a service data packet from a server by a predetermined application, wherein the service data packet comprises: configuration files and business logic data set by a first predetermined language, wherein the first predetermined language is different from a native language of a predetermined application;
in order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet at the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically issued by the server, so that the dynamically issued service data packet is received by the dynamic update framework, which enables the predetermined application to implement dynamic update, and therefore, the data included in the service data packet should include data written in a language capable of being dynamically issued. Because the configuration file is usually written by using XML and does not have dynamic issuing capability, when setting, the first predetermined language is required to be a language that can be dynamically issued, for example: javaScript.
When the predetermined application receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
S102, encapsulating the native interface elements corresponding to the configuration files by the predetermined application to generate a predetermined resolver;
the predetermined application encapsulates the native interface elements corresponding to the configuration file to generate a predetermined parser, wherein the predetermined parser is adapted to the dynamic update framework, so that the predetermined parser can parse the configuration file dynamically acquired from the server;
wherein the native interface element is generated by version upgrade of the predetermined application.
S103, analyzing the configuration file by a native language component of the preset application through a preset analyzer, and storing the configuration parameters obtained through analysis in a preset storage space.
After receiving the service data packet, the predetermined application may analyze the configuration file in the service data packet through the predetermined analyzer, so as to obtain the configuration parameters of the interface element. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information that can construct the interface element, including at least a name, a set of attributes, a child node, a parent node, a preset unique ID, a system ID, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
And S104, the first preset language component of the preset application carries out logic conversion on the service logic data according to the native language, and sends the converted service logic data and the functional function index corresponding to the converted service logic data to the native language component through a preset transmission channel.
Since the business logic data is written in the first predetermined language, the business logic data cannot be identified when the native language component identifies the business logic data, and therefore, after the first predetermined language component receives the business data packet, the business logic data is logically converted according to the native language, so that the native language component can be informed of the corresponding converted business logic, and the native language component can also identify the business logic data.
And S105, sequentially calling the function by the native language component according to the flow corresponding to the converted service logic data through the function index, and creating an interface element according to the function and the configuration parameter based on a reflection construction mechanism.
When the function is called, the corresponding configuration parameters can be obtained according to the function corresponding to the function, and then the required interface elements are created step by step according to the configuration parameters according to a reflection construction mechanism. The process of creating the interface element may be to update an existing interface element to create the interface element, or may be to create a non-existing interface element.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that a preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, the embodiment can receive the service data packet at any time, and realize dynamic interface element creation by combining the predetermined parser generated by packaging the native interface element, the interface element can be changed without waiting for releasing the APP of the new version, so that the user experience is better, and the method is more suitable for commercial popularization.
The second embodiment of the present invention provides a method for creating an interface element, the flow of the method is shown in fig. 2, and the method includes steps S201 to S208:
s201, receiving, by a predetermined application, a service data packet from a server, where the service data packet includes: configuration files and business logic data set by a first predetermined language, and the first predetermined language is different from a native language of a predetermined application;
in order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet on the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically issued by the server, and the predetermined dynamic update framework can receive the dynamically issued service data packet, so that the included data includes data written in a language capable of being dynamically issued. Because the configuration file is usually written by using XML and does not have dynamic delivery capability, the first predetermined language is required to be a language that can be dynamically delivered during setting, for example, javaScript.
When the predetermined application receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
S202, the predetermined application packages the native interface elements corresponding to the configuration file to generate a predetermined resolver;
the predetermined application encapsulates the native interface elements corresponding to the configuration file to generate a predetermined parser, wherein the predetermined parser is adapted to the dynamic update framework, so that the predetermined parser can parse the configuration file dynamically acquired from the server;
wherein the native interface element is generated by the predetermined application through version upgrade.
S203, analyzing the configuration file by a native language component of the preset application through a preset analyzer, and storing the configuration parameters obtained by analysis in a preset storage space;
after receiving the service data packet, the predetermined application can analyze the configuration file in the service data packet through the predetermined analyzer, and then obtain the configuration parameters of the interface element. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information capable of constructing interface elements, for example, at least including names, attribute sets, child nodes, parent nodes, preset unique IDs, system IDs, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
S204, a first preset language component of the preset application carries out logic conversion on the service logic data according to the native language, and sends the converted service logic data and the functional function index corresponding to the converted service logic data to the native language component through a preset transmission channel;
since the business logic data is written in the first predetermined language, the business logic data cannot be identified when the native language component identifies the business logic data, and therefore, after the first predetermined language component receives the business data packet, the business logic data is logically converted according to the native language, so that the native language component can be informed of the corresponding converted business logic, and the native language component can also identify the business logic data.
S205, the native language component calls the function through the function index according to the flow corresponding to the converted business logic data in sequence;
s206, the native language component acquires the interface element names in the configuration parameters, and constructs initial interface elements according to a reflection construction mechanism;
the initial interface element is equivalent to building an interface element according to only one name, but the specific type of the interface element is not known.
S207, assigning the interface element ID of the initial interface element to be a preset unique ID in the configuration parameters by the native language component;
when the preset unique ID is assigned to the initial interface element, the initial interface element has an identification number, and a search basis is provided for subsequently created interface elements.
And S208, setting interface element parameters for the initial interface element after the interface element ID is assigned by the native language component according to the parameters in the configuration parameters in sequence to create the interface element.
S206 to S208 are processes for creating interface elements according to the function and configuration parameters based on the reflection construction mechanism.
In the above process, after the service logic data is subjected to logic conversion, the native language component of the native language program can identify the service logic, and further can call the corresponding function according to the logic to realize the function of creating the interface element. The process of creating the interface element may be to update an existing interface element to create the interface element, or may be to create a non-existing interface element.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that a preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, the embodiment can receive the service data packet at any time, and realize dynamic interface element creation by combining the predetermined parser generated by the encapsulated native interface element, the interface element can be changed without waiting for releasing a new version of APP, the user experience is better, and the method is also suitable for commercial popularization.
A third embodiment of the present invention provides a method for creating an interface element, where the flow of the method is shown in fig. 3, and the method includes steps S301 to S309:
s301, receiving a service data packet from a server by a predetermined application, wherein the service data packet comprises: configuration files and business logic data set by a first predetermined language, and the first predetermined language is different from a native language of a predetermined application;
in order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet on the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically issued by the server, and the predetermined dynamic update framework can receive the dynamically issued service data packet, so that the included data includes data written in a language capable of being dynamically issued. Because the configuration file is usually written by using XML and does not have dynamic delivery capability, the first predetermined language is required to be a language that can be dynamically delivered during setting, for example, javaScript.
When the predetermined application receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
S302, packaging the native interface elements corresponding to the configuration file by the predetermined application to generate a predetermined analyzer;
the preset application encapsulates the native interface elements corresponding to the configuration files to generate a preset parser, wherein the preset parser is adapted to the dynamic update framework, so that the preset parser can parse the configuration files dynamically acquired from the server;
s303, analyzing the configuration file by a native language component of the preset application through a preset analyzer, and storing the configuration parameters obtained by analysis in a preset storage space;
after receiving the service data packet, the predetermined application can analyze the configuration file in the service data packet through the predetermined analyzer, and then obtain the configuration parameters of the interface element. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information capable of constructing interface elements, for example, at least including names, attribute sets, child nodes, parent nodes, preset unique IDs, system IDs, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
S304, a first preset language component of the preset application carries out logic conversion on the service logic data according to a native language, and sends the converted service logic data and a functional function index corresponding to the converted service logic data to the native language component through a preset transmission channel;
since the business logic data is written in the first predetermined language, the business logic data cannot be identified when the native language component identifies the business logic data, and therefore, after the first predetermined language component receives the business data packet, the business logic data is logically converted according to the native language, so that the native language component can be informed of the corresponding converted business logic, and the native language component can also identify the business logic data.
S305, the native language component calls the function through the function index according to the flow corresponding to the converted business logic data.
S306, the native language component acquires a preset unique ID of the interface element in the configuration parameters, and determines a system ID of the interface element according to the preset unique ID;
s307, the native language component detects whether the created interface element exists in the system ID. If not, S307 is executed, otherwise, S308 is executed. The process determines whether an already created interface element corresponding to the system ID exists in the predetermined application. The process of detecting whether the created interface elements exist or not through the system ID can execute the system flow more quickly, and the operation process is quicker;
s308, under the condition that the system ID does not have the created interface elements, the native language component creates the interface elements according to the function and the configuration parameters based on the reflection construction mechanism;
s309, under the condition that the created interface element exists in the system ID, modifying the interface element parameter corresponding to the created interface element according to the configuration parameter so as to update the created interface element.
When the above process is implemented, after the service logic data is subjected to logic conversion, the native language component can identify the service logic, and then the function of creating the interface element can be realized by calling the corresponding function according to the logic.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that the preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, the embodiment can receive the service data packet at any time, and realize dynamic interface element creation by combining the predetermined parser generated by packaging the native interface element, the interface element can be changed without waiting for releasing the APP of the new version, so that the user experience is better, and the method is more suitable for commercial popularization.
A fourth embodiment of the present invention provides a method for creating an interface element, where the flow of the method is shown in fig. 4, and the method includes steps S401 to S406:
s401, receiving a service data packet from a server by a predetermined application, wherein the service data packet comprises: configuration files and business logic data set by a first predetermined language, and the first predetermined language is different from a native language of a predetermined application;
in order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet on the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically issued by the server, and the predetermined dynamic update framework can receive the dynamically issued service data packet, so that the included data includes data written in a language capable of being dynamically issued. Because the configuration file is usually written by using XML and does not have dynamic delivery capability, the first predetermined language is required to be a language that can be dynamically delivered during setting, for example, javaScript.
When the predetermined application receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
S402, packaging the native interface elements corresponding to the configuration files by the predetermined application to generate a predetermined analyzer;
the predetermined application encapsulates the native interface elements corresponding to the configuration file to generate a predetermined parser, wherein the predetermined parser is adapted to the dynamic update framework, so that the predetermined parser can parse the configuration file dynamically acquired from the server;
s403, analyzing the configuration file by a native language component of the preset application through a preset analyzer, and storing the configuration parameters obtained through analysis in a preset storage space;
after receiving the service data packet, the predetermined application may analyze the configuration file in the service data packet through the predetermined analyzer, so as to obtain the configuration parameters of the interface element. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information capable of constructing interface elements, for example, at least including names, attribute sets, child nodes, parent nodes, preset unique IDs, system IDs, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
S404, a first preset language component of the preset application carries out logic conversion on the service logic data according to a native language, and sends the converted service logic data and a functional function index corresponding to the converted service logic data to the native language component through a preset transmission channel;
because the business logic data is written through the first predetermined language, the business logic data cannot be identified when the native language component identifies the business logic data, and therefore, after the first predetermined language component receives the business data packet, the business logic data is logically converted according to the native language, so that the native language component can be informed of the corresponding converted business logic, and the native language component can also identify the business logic data.
S405, the native language component calls a function through a function index according to the flow corresponding to the converted business logic data in sequence, and creates an interface element according to the function and the configuration parameter based on a reflection construction mechanism;
when the function is called, the corresponding configuration parameters can be obtained according to the function corresponding to the function, and then the required interface elements are created step by step according to the configuration parameters according to a reflection construction mechanism. The process of creating the interface element may be to update an existing interface element to create the interface element, or may be to create a non-existing interface element.
S406, the native language component adds the created interface element to the parent node interface element corresponding to the interface element so as to present the interface element in a preset interface of a preset application.
By this point, the interface element creation is complete, can be presented on the interface and can be used normally.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that a preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, the embodiment can receive the service data packet at any time, and realize dynamic interface element creation by combining the predetermined parser generated by the encapsulated native interface element, the interface element can be changed without waiting for releasing a new version of APP, the user experience is better, and the method is also suitable for commercial popularization.
A fifth embodiment of the present invention provides an apparatus for creating an interface element, the apparatus having a structure schematically shown in fig. 5, and including:
a receiving module 10, configured to receive a service data packet from a server, where the service data packet includes: configuration files and business logic data set by a first predetermined language, and the first predetermined language is different from a native language of a predetermined application; the parser generation module 101 is configured to encapsulate, by using a predetermined application, a native interface element corresponding to the configuration file, and generate a predetermined parser; the analysis module 20 is coupled with the receiving module 10, and is configured to analyze the configuration file through a predetermined analyzer in a native language component of a predetermined application, and store the configuration parameters obtained through analysis in a preset storage space; the processing module 30 is coupled to the parsing module 20, and configured to perform logic conversion on the service logic data according to a native language through a first predetermined language component of a predetermined application, and send the converted service logic data and a function index corresponding to the converted service logic data to the native language component through a predetermined transmission channel; the calling module 40 is coupled with the processing module 30 and is used for sequentially calling the function through the native language component according to the flow corresponding to the converted service logic data through the function index; and a creating module 50, coupled to the calling module 40, for creating the interface element according to the function and the configuration parameter based on the reflection construction mechanism through the native language component.
In order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet at the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically delivered, and therefore, the included data should include data written in a language capable of being dynamically delivered. Because the configuration file is usually written by using XML and does not have dynamic delivery capability, the first predetermined language is required to be a language that can be dynamically delivered during setting, for example, javaScript.
When the receiving module 10 receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
And the predetermined parser in the native language component is generated by encapsulating the native interface element into adaptation with the dynamic updating framework by the predetermined application. After receiving the service data packet, the parsing module 20 may parse the data through the parser, and further obtain the configuration parameters of the interface element. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information capable of constructing interface elements, for example, at least including names, attribute sets, child nodes, parent nodes, preset unique IDs, system IDs, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
Since the service logic data is written in the first predetermined language, when the native language component recognizes the service logic data, the service logic data cannot be recognized, and therefore, after the first predetermined language component receives the service data packet, the processing module 30 performs logic conversion on the service logic data according to the native language through the first predetermined language component, so as to inform the native language component of the corresponding converted service logic, and enable the native language component to recognize the converted service logic data.
After the business logic data is logically converted, the native language component may identify the converted business logic, and the calling module 40 may call a corresponding function according to the logic, so that the creating module 50 implements the function of creating the interface element. In specific implementation, the function related to each flow is called according to logic, and when the function is called, the corresponding configuration parameters can be obtained according to the function corresponding to the function, and then the required interface elements are created step by step according to the configuration parameters according to a reflection construction mechanism. The process of creating the interface element may be to update an existing interface element to create the interface element, or may be to create a non-existing interface element.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that the preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, the embodiment can receive the service data packet at any time, and realize dynamic interface element creation by combining the predetermined parser generated by the encapsulated native interface element, the interface element can be changed without waiting for releasing a new version of APP, the user experience is better, and the method is also suitable for commercial popularization.
A sixth embodiment of the present invention provides an apparatus for creating an interface element, the apparatus having a structure schematically shown in fig. 6, and including:
a receiving module 10, configured to receive a service data packet from a server, where the service data packet includes: configuration files and business logic data set by a first predetermined language, wherein the first predetermined language is different from a native language of a predetermined application; the parser generation module 101 is configured to encapsulate, by using a predetermined application, a native interface element corresponding to the configuration file, and generate a predetermined parser; the analysis module 20 is coupled with the receiving module 10, and is configured to analyze the configuration file through a predetermined analyzer in a native language component of a predetermined application, and store the configuration parameters obtained through analysis in a preset storage space; the processing module 30 is coupled to the parsing module 20, and configured to perform logic conversion on the service logic data according to a native language through a first predetermined language component of a predetermined application, and send the converted service logic data and a function index corresponding to the converted service logic data to the native language component through a predetermined transmission channel; a calling module 40, coupled to the processing module 30, for sequentially calling the function through the native language component according to the flow corresponding to the converted service logic data through the function index; a creating module 50, coupled to the calling module 40, for creating interface elements according to the function and the configuration parameters based on the reflection construction mechanism through the native language components; wherein the creating module 50 comprises: the constructing unit 501 is configured to obtain interface element names in the configuration parameters through the native language component, and construct an initial interface element according to a reflection constructing mechanism; the first setting unit 502 is coupled to the constructing unit 501, and is configured to assign an interface element ID of the initial interface element to a preset unique ID in the configuration parameters through the native language component; and a second setting unit 503, coupled to the first setting unit 502, configured to set, by using the native language component, interface element parameters for the initial interface element after the interface element ID is assigned according to parameters in the configuration parameters in sequence, so as to create the interface element.
In order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet on the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically issued, and therefore, the included data should include data written in a language capable of being dynamically issued. Because the configuration file is usually written by using XML and does not have dynamic delivery capability, the first predetermined language is required to be a language that can be dynamically delivered during setting, for example, javaScript.
When the receiving module 10 receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
And the predetermined parser in the native language component is generated by encapsulating the native interface element into adaptation with the dynamic updating framework by the predetermined application. After receiving the service data packet, the parsing module 20 may parse the data through the parser, so as to obtain the configuration parameters of the interface element. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information capable of constructing interface elements, for example, at least including names, attribute sets, child nodes, parent nodes, preset unique IDs, system IDs, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
Since the service logic data is written in the first predetermined language, when the native language component recognizes the service logic data, the service logic data cannot be recognized, and therefore, after the first predetermined language component receives the service data packet, the processing module 30 performs logic conversion on the service logic data according to the native language through the first predetermined language component, so as to inform the native language component of the corresponding converted service logic, and thus the native language component can also recognize the converted service logic data.
After the business logic data is logically converted, the native language component may identify the converted business logic, and the calling module 40 may call a corresponding function according to the logic, so that the creating module 50 implements the function of creating the interface element. In specific implementation, the function related to each flow is called according to logic, and when the function is called, the corresponding configuration parameters can be obtained according to the function corresponding to the function, and then the required interface elements are created step by step according to the configuration parameters according to a reflection construction mechanism. The process of creating the interface element may be to update an existing interface element to create the interface element, or may be to create a non-existing interface element.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that the preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, the embodiment can receive the service data packet at any time, and realize dynamic interface element creation by combining the predetermined parser generated by the encapsulated native interface element, the interface element can be changed without waiting for releasing a new version of APP, the user experience is better, and the method is also suitable for commercial popularization.
A seventh embodiment of the present invention provides an apparatus for creating an interface element, the apparatus having a structure schematically shown in fig. 7, including:
a receiving module 10, configured to receive a service data packet from a server, where the service data packet includes: configuration files and business logic data set by a first predetermined language, wherein the first predetermined language is different from a native language of a predetermined application; the parser generation module 101 is configured to encapsulate, by using a predetermined application, a native interface element corresponding to the configuration file, and generate a predetermined parser; the parsing module 20 is coupled with the receiving module 10, and is configured to parse the configuration file through a predetermined parser in a native language component of a predetermined application, and store the configuration parameters obtained through parsing in a preset storage space; the processing module 30 is coupled to the parsing module 20, and is configured to perform logic conversion on the service logic data according to a native language through a first predetermined language component of a predetermined application, and send the converted service logic data and a function index corresponding to the service logic data to the native language component through a predetermined transmission channel; the calling module 40 is coupled with the processing module 30 and is used for calling the function through the native language component according to the flow corresponding to the service logic data in sequence through the function index; a determining module 60, coupled to the invoking module 40, configured to obtain a preset unique ID of the interface element in the configuration parameters through the native language component, and determine a system ID of the interface element according to the preset unique ID; a detecting module 70, coupled to the determining module 60, for detecting whether there is an interface element created by the system ID through the native language component; a creating module 50, coupled to the detecting module 70, for creating, by the native language component, the interface element according to the function and the configuration parameter based on the reflection construction mechanism in case that the created interface element does not exist in the system ID; and the interface element updating module is also used for modifying the interface element parameters corresponding to the created interface elements according to the configuration parameters to update the created interface elements under the condition that the created interface elements exist in the system ID.
In order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet on the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically issued, and therefore, the included data should include data written in a language capable of being dynamically issued. Because the configuration file is usually written by using XML and does not have dynamic delivery capability, the first predetermined language is required to be a language that can be dynamically delivered during setting, for example, javaScript.
When the receiving module 10 receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
And the predetermined parser in the native language component is generated by encapsulating the native interface element into adaptation with the dynamic updating framework by the predetermined application. After receiving the service data packet, the parsing module 20 may parse the data through the parser, so as to obtain the configuration parameters of the interface element. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information that can construct the interface element, including at least a name, a set of attributes, a child node, a parent node, a preset unique ID, a system ID, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
Since the service logic data is written in the first predetermined language, when the native language component recognizes the service logic data, the service logic data cannot be recognized, and therefore, after the first predetermined language component receives the service data packet, the processing module 30 performs logic conversion on the service logic data according to the native language through the first predetermined language component, so that the converted service logic can be notified to the native language component, and the native language component can also recognize the service logic data.
After the business logic data is logically converted, the native language component may identify the business logic after the conversion, and the calling module 40 may call a corresponding function according to the logic, so that the creating module 50 implements the function of creating the interface element. In specific implementation, the function related to each flow is called according to logic, and when the function is called, the corresponding configuration parameters can be obtained according to the function corresponding to the function, and then the required interface elements are created step by step according to the configuration parameters according to a reflection construction mechanism. The process of creating the interface element may be a process of creating an interface element by updating an existing interface element, or a process of creating a nonexistent interface element.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that a preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, the embodiment can receive the service data packet at any time, and realize dynamic interface element creation by combining the predetermined parser generated by the encapsulated native interface element, the interface element can be changed without waiting for releasing a new version of APP, the user experience is better, and the method is also suitable for commercial popularization.
An eighth embodiment of the present invention provides an apparatus for creating an interface element, a structural schematic of which is shown in fig. 8, including:
a receiving module 10, configured to receive a service data packet from a server, where the service data packet includes: configuration files and business logic data set by a first predetermined language, wherein the first predetermined language is different from a native language of a predetermined application; the parser generation module 101 is configured to encapsulate, by using a predetermined application, a native interface element corresponding to the configuration file, and generate a predetermined parser; the parsing module 20 is coupled with the receiving module 10, and is configured to parse the configuration file through a predetermined parser in a native language component of a predetermined application, and store the configuration parameters obtained through parsing in a preset storage space; the processing module 30 is coupled to the parsing module 20, and is configured to perform logic conversion on the service logic data according to a native language through a first predetermined language component of a predetermined application, and send the converted service logic data and a function index corresponding to the service logic data to the native language component through a predetermined transmission channel; a calling module 40, coupled to the processing module 30, for sequentially calling the function through the native language component according to the flow corresponding to the service logic data through the function index; a creating module 50, coupled to the calling module 40, for creating interface elements according to the function and the configuration parameters based on the reflection construction mechanism through the native language component; and an adding module 80, coupled to the creating module 50, for adding the created interface element to the parent node interface element corresponding to the interface element through the native language component to present the interface element in a predetermined interface of a predetermined application.
In order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet at the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically issued, and therefore, the included data should include data written in a language capable of being dynamically issued. Since the configuration file is usually written in XML and does not have dynamic delivery capability, the first predetermined language is required to be a language that can be dynamically delivered, for example, javaScript, when setting.
When the receiving module 10 receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
And the predetermined parser in the native language component is generated by encapsulating the native interface element into adaptation with the dynamic updating framework by the predetermined application. After receiving the service data packet, the parsing module 20 may parse the data through the parser, so as to obtain the configuration parameters of the interface element. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information that can construct the interface element, including at least a name, a set of attributes, a child node, a parent node, a preset unique ID, a system ID, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
Since the service logic data is written in the first predetermined language, when the native language component recognizes the service logic data, the service logic data cannot be recognized, and therefore, after the first predetermined language component receives the service data packet, the processing module 30 performs logic conversion on the service logic data according to the native language through the first predetermined language component, so as to inform the native language component of the corresponding converted service logic, and enable the native language component to recognize the converted service logic data.
After the business logic data is logically converted, the native language component can identify the business logic, and the calling module 40 can call a corresponding function according to the logic, so that the creating module 50 realizes the function of creating the interface element. In specific implementation, the function related to each flow is called according to logic, and when the function is called, the corresponding configuration parameters can be obtained according to the function corresponding to the function, and then the required interface elements are created step by step according to the configuration parameters according to a reflection construction mechanism. The process of creating the interface element may be to update an existing interface element to create the interface element, or may be to create a non-existing interface element.
In the embodiment of the invention, the predetermined application analyzes the service logic data dynamically acquired from the server through the predetermined analyzer generated by the encapsulated native interface element, and combines the configuration file dynamically acquired from the server to realize the creation of the interface element through a reflection construction mechanism, and simultaneously, the interface updating of the predetermined application is completed by combining the native interface element of the predetermined application, so that a user can have the experience effect of a native system, and the interface elements are selected in more types when the predetermined application is dynamically updated. The first preset language is a language different from the native language and can be dynamically issued, so that a preset application can receive a service data packet containing service logic data and a configuration file at any time, and further can combine the packaged native interface element to generate a preset parser at any time, and the interface element is created through a reflection construction mechanism by using the service logic data and the configuration parameter in the service data packet.
In addition, the embodiment can receive the service data packet at any time, and realize dynamic interface element creation by combining the predetermined parser generated by the encapsulated native interface element, the interface element can be changed without waiting for releasing a new version of APP, the user experience is better, and the method is also suitable for commercial popularization.
A ninth embodiment of the present invention provides a storage medium storing a computer program, where the computer program implements the following steps when executed by a processor, and those skilled in the art can write corresponding program codes according to the following steps.
S11, receiving a service data packet from a server by a predetermined application, wherein the service data packet comprises: configuration files and business logic data set by a first predetermined language, wherein the first predetermined language is different from a native language of a predetermined application;
s13, analyzing the configuration file by a native language component of the preset application through a preset analyzer, and storing the configuration parameters obtained by analysis in a preset storage space;
s14, a first preset language component of the preset application carries out logic conversion on the service logic data according to a native language, and sends the converted service logic data and a functional function index corresponding to the converted service logic data to the native language component through a preset transmission channel;
s15, the native language component calls the function through the function index in sequence according to the flow corresponding to the converted business logic data;
and S16, creating interface elements according to the function and the configuration parameters based on the reflection construction mechanism.
In order to automatically change the interface elements of the interface in the predetermined application, the embodiment of the invention sets a service data packet on the server side and sends the service data packet to the predetermined application. In specific implementation, the service data packet needs to be dynamically issued by the server, and the predetermined dynamic update framework can receive the dynamically issued service data packet, so that the included data includes data written in a language capable of being dynamically issued. Since the configuration file is usually written in XML and does not have dynamic delivery capability, the first predetermined language is required to be a language that can be dynamically delivered, for example, javaScript, when setting.
When the predetermined application receives the service data packet, the service logic data and the configuration file in the service data packet can be utilized.
And the predetermined parser in the native language component is generated by encapsulating the native interface element into adaptation with the dynamic updating framework by the predetermined application. After receiving the service data packet, the data can be analyzed, and then the configuration parameters of the interface elements are obtained. When the configuration parameters are obtained, all the obtained parameters are not used immediately, but the parameters are placed in a container, that is, stored in a preset storage space, which may exist as a class object instance at the time of program setting.
The parsed configuration parameters are generally all information capable of constructing interface elements, for example, at least including names, attribute sets, child nodes, parent nodes, preset unique IDs, system IDs, and the like. When a developer sets a program, a function index that can generate an interface element is also included in a configuration file, so that the interface element can be created more conveniently.
Since the business logic data is written in the first predetermined language, the business logic data cannot be identified when the native language component identifies the business logic data, and therefore, after the first predetermined language component receives the business data packet, the business logic data is logically converted according to the native language, so that the native language component can be informed of the corresponding business logic, and the native language component can also identify the converted business logic data.
After the business logic data is subjected to logic conversion, the native language component can identify the business logic after the conversion, and further can call a corresponding function according to the logic to realize the function of creating the interface element. The process of creating the interface element may be to update an existing interface element to create the interface element, or may be to create a non-existing interface element.
When the computer program is executed by the processor to create the interface element according to the function and the configuration parameter based on the reflection construction mechanism, the following steps are specifically realized: the native language component acquires the interface element name in the configuration parameters, and constructs an initial interface element according to a reflection construction mechanism; the native language component assigns the interface element ID of the initial interface element to a preset unique ID in the configuration parameters; and the native language component sets interface element parameters for the initial interface elements after the interface element ID is assigned according to the parameters in the configuration parameters in sequence so as to create the interface elements.
After the computer program is executed by the processor and the native language assembly sequentially calls the function through the function index according to the flow corresponding to the business logic data, the processor also executes the following steps: the native language component acquires a preset unique ID of the interface element in the configuration parameters, and determines a system ID of the interface element according to the preset unique ID; the native language component detects whether the created interface elements exist in the system ID; in the absence of a created interface element for the system ID, the native language component creates an interface element in terms of a function and configuration parameters based on the reflection construction mechanism.
The computer program, after the step of the native language component detecting whether the created interface element exists in the system ID is executed by the processor, further executes the following steps by the processor: and under the condition that the created interface element exists in the system ID, modifying the interface element parameter corresponding to the created interface element according to the configuration parameter so as to update the created interface element.
The computer program, after being executed by the processor for creating the interface element according to the function and the configuration parameter based on the reflection construction mechanism, is further executed by the processor for: and adding the created interface element to the parent node interface element corresponding to the interface element by the native language component so as to present the interface element in a preset interface of a preset application.
The above process is described with reference to a specific example involved in the programming process, but the above embodiment is not limited thereto.
In the prior art, it is a difficult problem to update contents (interface elements) in Activity without updating application versions, and it is difficult to dynamically increase Activity using native development, so that when an Activity is dynamically increased using a DU framework, elements of an interface are controlled.
The embodiment of the invention adopts a DU framework which is a thermal update framework similar to the real-Native, and the real-Native sends all the requests in JS (abbreviation of JavaScript). The DU framework is also designed similarly, and fig. 9 is a schematic diagram of interaction between the Native side and the JS side in the DU framework. According to fig. 9, the DU framework implements JS and Native communication by a set of protocols, so as to control component interaction of Native (corresponding to the Native language component described above) by JS (corresponding to the first predetermined language component described above). Wherein the protocol comprises: protocol, JS is only used for logical control, and the method relates to View (namely interface element) presentation and Native. In the implementation process of View, the embodiment of the present invention writes the interface layout into XML (equivalent to the configuration file), then sets the path of the XML file (equivalent to the configuration file) in an onCreate method (a function) in Activity, analyzes the content of the XML file in the onCreate method to generate View, and then adds the View into the following layout View of Activity. Also we use similar methods to implement the production and addition of View, but during the implementation, due to the difference between DU framework and native nature. The present embodiment differs from native in many of the solutions that involve the conversion of a complete set of custom configuration files into View.
(1) And loading the XML of the layout file.
In the Android native development process, only id generated by a res/layout directory launch XML file in an R file is required to be transmitted to an onCreate method as a parameter. However, in the DU framework, the XML file cannot be quickly searched under the asset directory by using the R file with id as an index. Therefore, when the native Activity is started, the path address of the XML file cached in the asset directory after the server is dynamic is transmitted, and the notification is to transmit the path of the activity.js file corresponding to the start of the Activity to the native Activity, so that the Activity processed by the interface and the business logic is the same as the native Activity.
(2) The XML file maps out View.
The process of mapping View by the XML file is also designed to be Android-like and native. A document layout XML method (a function corresponding to a program) of a layout parser class (a segment of program) designed in this embodiment finds a file where a transmitted XML file path is located, and parses the XML file by using a predetermined parser Proxy obtained by encapsulating a native interface element, so as to parse View in each XML file. Wherein the corresponding predetermined parser Proxy has the same ID as the XML file. In addition, in the parsing process, a template viewvo class object instance (corresponding to a preset storage space) is generated from the contents in the entire XML file to store the configuration parameters in the XML file. And traversing all View nodes in the template Viewvo class object example generated in the XML file in a recursive mode, so as to facilitate the operation of the service logic on the interface elements later.
Wherein the predetermined parser Proxy is generated by encapsulating the native interface element by the predetermined application performing the dynamic update.
FIG. 10 is a diagram illustrating the relationship between a predefined parser, a native interface element, and an XML file. As shown in fig. 10, the predetermined application generates a corresponding predetermined parser Proxy by encapsulating the native interface element to adapt the DU framework, and the predetermined parser Proxy parses an XML file having the same ID as the predetermined parser Proxy to obtain a corresponding VIEW.
And in Android native development, all the views are operated by finding views of the same id node of the View tree according to the id generated in the R file. The present embodiment also has similar id convenience when designing view operation to facilitate view operation. When the Proxy parser of the previous step parses out a node, a self-increment id value is constructed from 0x30000000 and is given to the ViewId attribute in the current template viewvo class object instance. Thus, each View can be operated according to the correspondence between the id of the View and the template Viewvo class object instances of all the views.
Information for each View we store in the template Viewvo class object instance, so the next step is to construct all views. And constructing a corresponding View through reflection of the name attribute value stored in the template ViewVo class object instance, and then assigning a ViewId to the id of the View. And next, analyzing the attribute labels and the corresponding values in all the template ViewVo class object instances, and assigning the attribute labels and the corresponding values to all the attributes corresponding to the View. And finally, creating a Proxy class (namely, a Proxy class which is a program and can present the finally constructed View on an interface) corresponding to the View, wherein the corresponding relation of the Proxy class and the View class is declared in an XML file, so that a corresponding Proxy class instance object can be obtained according to the name attribute value reflection of a template View vo class object instance and assigned to the baseProxy attribute of the template View vo class object instance, the baseProxy attribute is bound with the View, and all attribute analysis and assignment of the View can be inherited in a Proxy layer according to the hierarchy inherited by the View. Each time a View constructs, we add to the root View of the View, the root View that is currently and initially passed is Activity's contentView. Thus, all declared View elements of the entire interface XML document are exposed in Activity.
Finally, in order to find the corresponding View according to the viewIdString (character string), the viewIdString is used as a key (key value), and the corresponding template ViewVo class object instance is used as a value (index value) to be stored in a Map (set) of the current Activity instance.
(3) The JS end operates all View elements produced by Native.
When the JS end develops, the ID corresponding to the View is not known, so that the method can be mapped with the original View only according to the ViewIdString corresponding to the View in the XML file interface of the current Activity. In the embodiment, the Protocol can utilize the ViewIdString cached currently in the native Activity as the key to take the corresponding template ViewVo class object instance as the data set Map stored by the value, all information of the corresponding View is obtained from the data set Map, and then the method of the View is called in a reflection mode according to the parameter name and the parameter list transmitted by the JS end.
In this embodiment, by using the implementation method for converting the custom configuration file in the DU framework into the system view file, the performance experience of the developed application product can have an effect similar to that of the native application, and the Android developer can quickly access the current project and become proficient in developing new requirements.
In implementation, the storage medium may be disposed in the mobile terminal, and may exist as all or part of the mobile terminal memory, and those skilled in the art may set the storage medium according to actual needs.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-only memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and various media capable of storing program codes. Optionally, in this embodiment, the processor executes the method steps described in the above embodiments according to the program code stored in the storage medium. Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again. It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
Although the preferred embodiments of the present invention have been disclosed for illustrative purposes, those skilled in the art will appreciate that various modifications, additions and substitutions are possible, and the scope of the invention should not be limited to the embodiments described above.

Claims (12)

1. A method of creating an interface element, comprising:
the method comprises the following steps that a predetermined application receives a service data packet from a server, wherein the service data packet comprises: a configuration file and business logic data set by a first predetermined language, and the first predetermined language is different from a native language of the predetermined application;
the predetermined application generates a predetermined parser by encapsulating the native interface elements corresponding to the configuration file;
the native language component of the preset application analyzes the configuration file through the preset analyzer and stores the configuration parameters obtained through analysis in a preset storage space;
the first preset language component of the preset application carries out logic conversion on the service logic data according to a native language, and sends the converted service logic data and the functional function index corresponding to the converted service logic data to the native language component through a preset transmission channel;
and the native language component calls a function sequentially according to the flow corresponding to the converted service logic data through a function index, and creates the interface element according to the function and the configuration parameter based on a reflection construction mechanism.
2. The method of claim 1, wherein creating the interface element in accordance with the functional function and the configuration parameters based on a reflection construction mechanism comprises:
the native language component acquires the interface element names in the configuration parameters and constructs initial interface elements according to a reflection construction mechanism;
assigning the interface element ID of the initial interface element to a preset unique ID in the configuration parameters by the native language component;
and the native language component sets interface element parameters for the initial interface elements after interface element ID assignment according to parameters in the configuration parameters in sequence so as to create the interface elements.
3. The method of claim 1, wherein the native language component calls the function sequentially according to the flow corresponding to the converted business logic data through the function index, and further comprising:
the native language component acquires a preset unique ID of the interface element in the configuration parameters, and determines a system ID of the interface element according to the preset unique ID;
the native language component detects whether the system ID has an interface element that has been created;
in the absence of a created interface element for the system ID, the native language component creates the interface element in accordance with the functional function and the configuration parameters based on a reflection construction mechanism.
4. The method of claim 3, wherein after the native language component detects whether the system ID has an interface element created, further comprising:
and under the condition that the created interface element exists in the system ID, modifying the interface element parameter corresponding to the created interface element according to the configuration parameter so as to update the created interface element.
5. The method of any of claims 1 to 4, after creating the interface element in accordance with the functional function and the configuration parameters based on a reflection construction mechanism, further comprising:
and the native language component adds the created interface element to a parent node interface element corresponding to the interface element so as to present the interface element in a preset interface of the preset application.
6. An apparatus for creating an interface element, comprising:
a receiving module, configured to receive a service data packet from a server, where the service data packet includes: configuration files and business logic data set by a first predetermined language, wherein the first predetermined language is different from a native language of a predetermined application;
the resolver generation module is used for encapsulating the native interface elements corresponding to the configuration files through the predetermined application to generate a predetermined resolver;
the analysis module is used for analyzing the configuration file through the preset analyzer in the native language component of the preset application and storing the configuration parameters obtained through analysis in a preset storage space;
the processing module is used for performing logic conversion on the service logic data according to a native language through a first predetermined language component of the predetermined application, and sending the converted service logic data and a function index corresponding to the converted service logic data to the native language component through a predetermined transmission channel;
the calling module is used for sequentially calling the function through the native language component according to the flow corresponding to the converted business logic data through the function index;
and the creating module is used for creating the interface element according to the function and the configuration parameters based on a reflection construction mechanism through the native language component.
7. The apparatus of claim 6, wherein the creation module comprises:
the construction unit is used for acquiring the interface element names in the configuration parameters through the native language components and constructing initial interface elements according to a reflection construction mechanism;
the first setting unit is used for assigning the interface element ID of the initial interface element to be a preset unique ID in the configuration parameters through the native language component;
and the second setting unit is used for setting interface element parameters for the initial interface elements after interface element IDs are assigned according to parameters in the configuration parameters in sequence through the native language components so as to create the interface elements.
8. The apparatus of claim 6, further comprising:
the determining module is used for acquiring a preset unique ID of the interface element in the configuration parameters through the native language component and determining a system ID of the interface element according to the preset unique ID;
the detection module is used for detecting whether the created interface elements exist in the system ID through the native language component;
the creating module is further configured to create, by the native language component, the interface element according to the function and the configuration parameter based on a reflection construction mechanism in a case where the system ID does not have the created interface element.
9. The apparatus of claim 8,
the creating module is further configured to modify, according to the configuration parameter, an interface element parameter corresponding to the created interface element to update the created interface element when the created interface element exists in the system ID.
10. The apparatus of any of claims 6 to 9, further comprising:
and the adding module is used for adding the created interface elements into parent node interface elements corresponding to the interface elements through the native language components so as to present the interface elements in a preset interface of the preset application.
11. A storage medium storing a computer program, characterized in that the computer program, when being executed by a processor, carries out the steps of the method of creating an interface element according to any one of claims 1 to 5.
12. A mobile terminal comprising at least a memory, a processor, said memory having stored thereon a computer program, characterized in that the processor, when executing the computer program on the memory, is adapted to carry out the steps of the method of creating an interface element according to any of claims 1 to 5.
CN201810504133.0A 2018-05-23 2018-05-23 Method and device for creating interface element, storage medium and mobile terminal Active CN108804100B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810504133.0A CN108804100B (en) 2018-05-23 2018-05-23 Method and device for creating interface element, storage medium and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810504133.0A CN108804100B (en) 2018-05-23 2018-05-23 Method and device for creating interface element, storage medium and mobile terminal

Publications (2)

Publication Number Publication Date
CN108804100A CN108804100A (en) 2018-11-13
CN108804100B true CN108804100B (en) 2022-11-04

Family

ID=64091537

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810504133.0A Active CN108804100B (en) 2018-05-23 2018-05-23 Method and device for creating interface element, storage medium and mobile terminal

Country Status (1)

Country Link
CN (1) CN108804100B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783559B (en) * 2018-12-30 2021-05-07 北京房江湖科技有限公司 Method and device for acquiring real estate transaction data, electronic equipment and storage medium
CN110389754B (en) * 2019-06-18 2023-12-15 北京奇艺世纪科技有限公司 Service processing method, system, server, terminal, electronic equipment and storage medium
CN112527422B (en) * 2019-09-17 2024-03-22 腾讯科技(深圳)有限公司 View updating method, device, equipment and storage medium
CN113986380B (en) * 2021-10-27 2024-02-06 北京百度网讯科技有限公司 Data processing method, device and system, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354014A (en) * 2014-08-18 2016-02-24 阿里巴巴集团控股有限公司 Application interface rendering display method and apparatus
CN106686200A (en) * 2015-11-09 2017-05-17 五八同城信息技术有限公司 Mobile application program updating method, mobile terminal and updating system
CN107391169A (en) * 2017-06-09 2017-11-24 口碑控股有限公司 The dynamic updating method and device of the Android page

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354014A (en) * 2014-08-18 2016-02-24 阿里巴巴集团控股有限公司 Application interface rendering display method and apparatus
CN106686200A (en) * 2015-11-09 2017-05-17 五八同城信息技术有限公司 Mobile application program updating method, mobile terminal and updating system
CN107391169A (en) * 2017-06-09 2017-11-24 口碑控股有限公司 The dynamic updating method and device of the Android page

Also Published As

Publication number Publication date
CN108804100A (en) 2018-11-13

Similar Documents

Publication Publication Date Title
CN108804100B (en) Method and device for creating interface element, storage medium and mobile terminal
US7526771B2 (en) Method and apparatus for configuring an application while the application is running
CN110324169B (en) Interface management method and device
CN106569880B (en) Method and system for dynamically sharing resources between Android applications
US11595299B2 (en) System and method of suppressing inbound payload to an integration flow of an orchestration based application integration
CN113141405B (en) Service access method, middleware system, electronic device, and storage medium
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
CN111026634A (en) Interface automation test system, method, device and storage medium
CN112769706B (en) Componentized routing method and system
CN112235357A (en) Cross-platform application development system
CN107977260B (en) Task submitting method and device
CN108365976B (en) Network service optimization method and device
CN117112122A (en) Cluster deployment method and device
CN115086166A (en) Computing system, container network configuration method, and storage medium
CN114706616A (en) Applet construction method and device
CN111651169B (en) Block chain intelligent contract operation method and system based on web container
CN111736844B (en) Database cloud service standard interface and implementation method
CN113179269A (en) Internet of things-based protocol data analysis method, system, medium, and program product
CN112596787A (en) System and method for adaptively releasing application program in different environments
WO2023083071A1 (en) View interaction method and apparatus, electronic device, and computer readable medium
CN108804101B (en) Method and device for creating interface element, storage medium and mobile terminal
CN110719303B (en) Containerization NRF method and system
CN112910956A (en) Resource creating method and device and electronic equipment
CN112714148A (en) Interface configuration method, device, equipment and medium
US20040216140A1 (en) Method and system for accessing system operations through an interface layer

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
GR01 Patent grant
GR01 Patent grant