CN117519877A - Rendering method and device of quick application card, storage medium and electronic equipment - Google Patents

Rendering method and device of quick application card, storage medium and electronic equipment Download PDF

Info

Publication number
CN117519877A
CN117519877A CN202311526874.6A CN202311526874A CN117519877A CN 117519877 A CN117519877 A CN 117519877A CN 202311526874 A CN202311526874 A CN 202311526874A CN 117519877 A CN117519877 A CN 117519877A
Authority
CN
China
Prior art keywords
interface
card
data
rendering
application card
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311526874.6A
Other languages
Chinese (zh)
Inventor
杨享武
李莉筠
张迎春
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202311526874.6A priority Critical patent/CN117519877A/en
Publication of CN117519877A publication Critical patent/CN117519877A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a rendering method and device of a quick application card, a storage medium and electronic equipment. The method comprises the following steps: acquiring a declarative interface description file corresponding to the express application card, wherein the declarative interface description file comprises interface layout information and interface data; analyzing the declarative interface description file to obtain interface layout information and interface data; generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data; and executing the rendering instruction, constructing a view tree, and obtaining a card interface of the quick application card. The method and the device can realize rendering of the card interface of the quick application card.

Description

Rendering method and device of quick application card, storage medium and electronic equipment
Technical Field
The application belongs to the technical field of electronics, and particularly relates to a rendering method and device of a quick application card, a computer readable storage medium and electronic equipment.
Background
The fast application is a novel application form based on a mobile phone hardware platform, and is developed by using a front-end technology stack and rendered in a native manner. The quick application is packaged into a lightweight rpk package during construction, and can be quickly issued and used without installation. The quick application card is a lightweight card type quick application, supports rendering of a card interface of the quick application in other original applications, and is mainly used for displaying information and realizing light interaction. In order to realize the rendering of the card interface of the quick application card, a method for rendering the card interface of the quick application card needs to be provided.
Disclosure of Invention
The embodiment of the application provides a rendering method and device of a quick application card, a storage medium and electronic equipment, and a card interface for rendering the quick application card can be realized.
In a first aspect, an embodiment of the present application provides a method for rendering a quick application card, including:
acquiring a declarative interface description file corresponding to a quick application card, wherein the declarative interface description file comprises interface layout information and interface data;
analyzing the declarative interface description file to obtain the interface layout information and the interface data;
generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data;
and executing the rendering instruction, constructing the view tree, and obtaining a card interface of the quick application card.
In a second aspect, an embodiment of the present application provides a rendering device for a fast application card, including:
the file acquisition module is used for acquiring a declarative interface description file corresponding to the express application card, wherein the declarative interface description file comprises interface layout information and interface data;
the file analysis module is used for analyzing the declarative interface description file to obtain the interface layout information and the interface data;
The instruction generation module is used for generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data;
and the interface rendering module is used for executing the rendering instruction, constructing the view tree and obtaining a card interface of the quick application card.
In a third aspect, embodiments of the present application provide a computer-readable storage medium having stored thereon a computer program that, when executed on a computer, causes the computer to perform the method for rendering a quick application card provided by embodiments of the present application.
In a fourth aspect, an embodiment of the present application further provides an electronic device, including a memory, and a processor, where the processor is configured to execute the rendering method of the quick application card provided in the embodiment of the present application by calling a computer program stored in the memory.
In the embodiment of the application, the declarative interface description file corresponding to the express application card is obtained, wherein the declarative interface description file comprises interface layout information and interface data; analyzing the declarative interface description file to obtain the interface layout information and the interface data; generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data; and executing the rendering instruction, constructing the view tree, and obtaining a card interface of the quick application card, so that the card interface of the quick application card can be rendered.
Drawings
The technical solution of the present application and the advantageous effects thereof will be made apparent from the following detailed description of the specific embodiments of the present application with reference to the accompanying drawings.
Fig. 1 is a first flowchart of a rendering method of a quick application card according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a view tree provided in an embodiment of the present application.
Fig. 3 is a second flowchart of a rendering method of a quick application card according to an embodiment of the present application.
Fig. 4 is a schematic structural diagram of a rendering device for a fast application card according to an embodiment of the present application.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
It should be noted that the terms "first," "second," and "third," etc. in this application are used to distinguish between different objects and are not used to describe a particular order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or modules is not limited to the particular steps or modules listed and certain embodiments may include additional steps or modules not listed or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
The embodiment of the application provides a rendering method of a quick application card, a rendering device of the quick application card, a storage medium and electronic equipment. The execution subject of the rendering method of the fast application card may be the rendering device of the fast application card provided in the embodiment of the present application, or an electronic device integrated with the rendering device of the fast application card, where the rendering device of the fast application card may be implemented in a hardware or software manner. The electronic device may be a smart phone, a tablet computer, a palm computer, a notebook computer, or the like, which is configured with a processor and has rendering capability of a fast application card.
Referring to fig. 1, fig. 1 is a first flowchart of a method for rendering a quick application card according to an embodiment of the present application, where the flowchart may include:
In 101, a declarative interface description file corresponding to a quick application card is obtained, where the declarative interface description file includes interface layout information and interface data.
The fast application is a novel application form based on a mobile phone hardware platform, and is developed by using a front-end technology stack and rendered in a native manner. The quick application is packaged into a lightweight rpk package during construction, and can be quickly issued and used without installation.
The quick application card is a lightweight card type quick application, supports rendering of a card interface of the quick application in other original applications, and is mainly used for displaying information and realizing light interaction. That is, the quick application card is also one type of quick application, and therefore, the quick application card is also packaged into rpk packages at the time of construction.
The quick application card is widely applied to scenes such as a negative one-screen, a desktop, an intelligent short message, global search, a voice assistant, a screen-locking magazine and the like, and the native application of the quick application card is loaded in the running environment of the quick application card, namely the host application of the card.
In the related art, when packaging rpk packages, the ux file corresponding to the quick application card is compiled into the js format interface file, and then packaged into rpk packages together with other resource files, such as a manifest file, a picture resource, and the like. When the fast application card engine renders the card interface of the fast application card, the file in js format is obtained from the rpk packet corresponding to the fast application card, the js thread is created to run the js engine, and a js frame is used to cooperate with the js engine to analyze creatBody, addElement rendering instructions from the file in js format and send the rendering instructions to the java layer. After receiving the rendering instruction, the java layer can execute the rendering instruction and construct a view tree (view tree) to obtain a card interface of the quick application card, so that the card interface of the quick application card is rendered on a screen.
In the related art, the java layer must rely on jsframe to send the rendering instruction, so that the rendering interface must be started after the jsframe runs and parses the js format file, and the problem of slower rendering of the fast application card is caused by longer jsframe running and parsing time of the js format file.
Wherein the view tree represents a layout nesting relationship between controls on the display interface. FIG. 2 shows a schematic View of the structure of a View tree, with the root node and nodes with children being referred to as ViewGroup and leaf nodes being referred to as View.
Taking android equipment as an example, when the equipment draws and renders a current display interface, firstly, the interface UI is analyzed into a view tree, and the content of the view tree is in the form of a node tree. View nodes have properties that reflect the size and position of the control on the screen, while various relationships (e.g., parent, child, peer) exist between the View nodes. The parent-child relationship represents a layout nesting relationship among the controls on the display interface, and the peer relationship represents that the layout among the controls is a parallel relationship. Thus, a complete View tree reflects the layout hierarchy information of the current display interface.
For the fast application template card with the heavy display and light interaction, no complex page change and interaction effect are generated, and a static interface layout and dynamic content filling are used as main materials, so that in the embodiment, when the fast application card with the characteristics is constructed, a declarative interface description file in json format, which comprises static interface description and dynamic content, namely interface layout information and interface data, is generated. Because the structure of the declarative interface description file is fixed, the quick application card engine can directly analyze the declarative interface description file to obtain a rendering instruction, a js thread is not required to be created, and the js frame work is matched with the js engine to dynamically analyze the rendering instruction.
In this embodiment, when constructing a quick application card with the above features, a developer will construct a ux file corresponding to the quick application card first, which is different from a ux file corresponding to a traditional quick application card, in that the ux file corresponding to the quick application card reduces a script portion and increases a data event portion, and a template portion and a style portion are consistent with the ux file corresponding to the traditional quick application card, that is, the ux file corresponding to the quick application card is composed of a template portion, a style portion and a data event 3 portion.
It should be noted that, whether the quick application card has the above features can be determined by a developer, so that when the developer determines that the quick application card has the above features, the developer can directly construct the ux file corresponding to the quick application card, and compile the ux file into the json format declaration interface description file through a corresponding tool.
The template part is used for describing interface structure information of the quick application card, namely the interface structure information to be compiled, such as a label language of a type HTML, a combination basic component, a custom component and an event, and the interface structure of the quick application card is constructed. The style part is used for describing interface style information of the quick application card, namely interface style information to be compiled, such as component styles of a description template, and determining how the component application is displayed. The data event part is used for describing interface data of the quick application card, namely interface data to be compiled, such as responsive data and responsive callback events.
Wherein the data portion includes two fields, data and actions. Stored in the data field is responsive data, such as content displayed on a card interface of the quick application card, such as text, pictures, etc., links on the card interface of the quick application card that can trigger a jump, etc. When the data change in the data field triggers the card interface of the fast application card to re-render, the host application is supported to update the data by loading url and the fast application card is supported to refresh the data by requesting. and the actions field stores a response event callback method, is responsible for processing response logic, and comprises response event types, such as a route jump type, a jump route address field, a support deep format, a carried parameter field and the like.
After the ux file corresponding to the fast application card is obtained, compiling the ux file corresponding to the fast application card into a json format declarative interface description file.
Specifically, the interface structure information to be compiled can be compiled into the interface structure information in the declarative interface description file, the interface style information to be compiled into the interface style information in the declarative interface description file, and the interface data to be compiled into the interface data in the declarative interface description file, so as to obtain the declarative interface description file in json format.
In some embodiments of the present application, the declarative interface description file in json format includes a template field, a styles field, and a data field. The template field is used for describing interface structure information in a json-format declarative interface description file. The style field is used to describe interface style information in a declarative interface description file in json format. The data field is used to describe interface data in a declarative interface description file in json format.
Specifically, when compiling a ux file corresponding to a fast application card into a json format declarative interface description file, compiling the content of a template part in the ux file into a json object, and storing the json object under a template field in the json format declarative interface description file; compiling the content of the style field in the ux file into a json object, and storing the json object under the style field in the declarative interface description file in the json format; compiling a data event part in the ux file into a json object, wherein the json object comprises two parts of data and actions, and the part of data is directly stored under a data field in a json-format declaration-interface description file after verification to obtain the json-format declaration-interface description file.
In an alternative embodiment, when compiling the interface structure information to be compiled in the ux file into the interface structure information in the declarative interface description file, the interface structure information to be compiled in the ux file may be compiled into the interface structure information of the abstract syntax tree structure in the declarative interface description file.
For example, when compiling the content of the template field in the ux file into the json object in the json format declarative interface description file, the content of the template field in the ux file may be compiled into the json object of the abstract syntax tree structure, and stored under the template field in the json format declarative interface description file.
The content of the template field includes the name of each interface component, the type of each interface component, such as "div" type, "text" type, etc., the relationship between each interface component, such as parent-child relationship, peer relationship, etc., the event supported by the corresponding interface component, etc. The contents of the styles field include the interface style of each interface component, such as the width, height, etc. of the interface component. The content of the data field includes the content that the corresponding interface component needs to display, such as text, pictures, etc., corresponding links, etc.
In some embodiments of the present application, the ux file corresponding to the flash application light card may be compiled by hap-tool to generate a declarative interface description file.
In some embodiments of the present application, after the declarative interface description file is obtained, the declarative interface description file and other resource files, such as a picture resource, a manifest file, etc., may be signed to generate a rpk file corresponding to the quick application card.
In this embodiment, when the card interface of the quick application card needs to be displayed, the declarative interface description file corresponding to the quick application card may be obtained from the rpk file corresponding to the quick application card.
In some embodiments of the present application, since the declarative interface description file in json format corresponding to the light card is only constructed when a fast application card (hereinafter referred to as a light card) having a static interface layout and dynamic content filling features is constructed, in order to distinguish the light card from other fast application cards, a type field is added in card information of a manifest file corresponding to the fast application card when the fast application card is constructed, and is used for specifying whether the type of the fast application card is a light card or other fast application card. Based on the method, before the declarative interface description file corresponding to the quick application card is acquired, the card type of the quick application card can be determined; and if the card type is the preset type, acquiring a declarative interface description file corresponding to the express application card. The preset type may be a light card.
Specifically, a manifest file corresponding to the quick application card may be obtained, the type field is parsed from the manifest file, and the card type of the quick application card is determined according to the content of the type field. For example, if the card type of the quick application card is determined to be a light card by the content of the type field, the declarative interface description file corresponding to the quick application card may be obtained, and step 202 may be executed. If the type of the card of the quick application card is determined to be other quick application cards according to the content of the type field, the card interface of the quick application card can be rendered according to the mode of rendering the card interface of the quick application card in the related technology.
In 102, the declarative interface description file is parsed to obtain interface layout information and interface data.
For example, by analyzing the declarative interface description file, interface structure information, interface style information and interface data included in the interface layout information can be obtained.
For example, by analyzing the json-format declarative interface description file, the contents of the template field and the style field are analyzed, so that interface layout information, such as the relationship between interface components, such as father-son relationship, peer relationship, etc., component style, etc., can be obtained, and data fields are analyzed, so that interface data, such as which characters are displayed, which pictures are displayed, which links are clicked, etc., can be obtained.
At 103, rendering instructions for constructing the view tree are generated based on the interface layout information and the interface data.
For example, after the template field, the styles field, and the data field are parsed, the name of each interface component, the type of each interface component, the relationship between each interface component, the events supported by the corresponding interface component, and the like can be determined based on the content of the template field, the interface style of each interface component is determined according to the content of the styles field, and the content required to be displayed by the corresponding interface component, the corresponding link, and the like are determined according to the content of the data field, so that the corresponding rendering instruction is generated.
For example, for a parsed interface component, if it is determined that it has no parent node, proving that it is a root node, a createBody rendering instruction is generated, if it is determined that it has a parent node and also has a child node, an addElement rendering instruction is generated, and if it is determined that it has a parent node and has no child node, a createFinish rendering instruction is generated.
At 104, a rendering instruction is executed, and a view tree is constructed, so as to obtain a card interface of the quick application card.
For example, the generated rendering instructions may be sequentially sent to the rendering thread, and the rendering thread builds the view tree by executing the rendering instructions through a manager that executes the rendering instructions, such as a rendereractionmanager.
It can be understood that by executing the createBody rendering instruction, a root node of the view tree can be obtained, by executing the addElement rendering instruction, an intermediate node of the view tree can be obtained, and by executing the createfish rendering instruction, a leaf node of the view tree can be obtained, so as to form the view tree, thereby finally rendering the card interface of the quick application card onto a screen, such as an application interface loaded onto a host application, such as a negative one-screen.
In an alternative embodiment, before generating the rendering instruction for constructing the view tree according to the interface layout information and the interface data, the first update data input by the host application may be further acquired; updating the interface data according to the first updating data to obtain first updated interface data; and generating a rendering instruction for constructing the view tree according to the interface layout information and the first updated interface data when generating the rendering instruction for constructing the view tree according to the interface layout information and the interface data.
In this embodiment, when the host application loads the quick application card, a load link url needs to be input, where url is generally configured by an operation and issued through a server, and is used to specify the quick application card to be loaded, for example: hap/(widget/com. Nearest. Quick. Center/Cardsdata=xxx).
Where "hap:// widget/" is the protocol header followed by the package name of the quick application card "(com nearest. Quick app. Center)" +path of the quick application card "/Cards", "? "thereafter carrying parameters that are passed to the quick application card. Through the loading link, the fast application card engine can acquire first updating data transmitted by the host application, and perform merge operation on the first updating data and the interface data in the declarative interface description file so as to update the interface data in the declarative interface description file.
For example, the interface data of the declarative interface description file corresponding to a fast application card includes a picture M and a text A1, and the first updated data obtained by the fast application card engine through the loading link is a text A2, so that the first updated interface data includes the picture M and the text A2.
When the first updated interface data is obtained, the rendering instruction for constructing the view tree may be generated according to the interface layout information and the first updated interface data in the same manner as the aforementioned "generating the rendering instruction for constructing the view tree according to the interface layout information and the interface data", and according to the interface layout information and the first updated interface data in the same manner as the aforementioned "generating the rendering instruction for constructing the view tree according to the interface layout information and the interface data".
In an optional embodiment, after executing the rendering instruction and constructing the view tree to obtain the card interface of the quick application card, the refresh duration of the card interface may also be determined; if the refresh duration reaches the preset duration, pulling second update data from the appointed link; updating the interface data according to the second updating data to obtain second updated interface data; generating an updated rendering instruction for constructing an updated view tree according to the interface layout information and the second updated interface data; and executing the updated rendering instruction, and constructing an updated view tree to obtain an updated card interface of the quick application card.
It should be noted that, the quick application card engine will pull the second update data from the designated link with a set frequency, and update the card interface of the quick application card after the pulling, so as to realize the data refresh of the card interface of the quick application card.
Wherein the set frequency and the specified link may be specified in a manifest file. For example, a refresh duration field may be added to the manifest file, through which the frequency is set. The value of the refresh duration field can be set by a developer of the express application card, and the express application operation aspect can provide a minimum value management and control according to the card type of the express application card. A dataFetchUrl field may be added to the manifest file to specify a data pull link, typically an http/https network link or a content link provided by a local content provider, to obtain second update data from a server or other native application. Only 1 update is performed during a refresh duration period. That is, the preset duration is a refresh duration time period. For example, assuming that the refresh duration of one quick application card is set to 10 minutes, the preset duration may be determined to be 10 minutes.
The refresh duration is the difference between the current time and the time at which the data was last refreshed on the card interface of the fast application card. It should be noted that, the loading time of the card interface of the quick application card is also the time when the card interface of the quick application card refreshes data for the first time.
For example, assuming that the preset duration is 10 minutes, the time for refreshing the data last time on the card interface of the quick application card is 2023, 11, 13, 12 and 0 minutes, if the current time is 2023, 11, 13, 12 and 5 minutes, the refresh duration can be determined to be 5 minutes, and the preset duration is not reached, then the second update data does not need to be pulled from the designated link to update the card interface of the quick application card; if the current time is 2023, 11, 13, 12 minutes, then the refresh time period may be determined to be 10 minutes, and the preset time period is reached, then the second update data may be pulled from the specified link to update the card interface of the flash application card. When the card interface of the quick application card is updated, if the refresh time length reaches the preset time length, new update data can be continuously pulled to update the card interface of the quick application card, so that the cycle is performed.
In an alternative embodiment, to avoid frequent access to the network, the card interface of the quick application card is updated if and only if the quick application card is exposed. That is, even if the refresh duration has reached the preset duration, the card interface of the quick application card is not updated temporarily, and the card interface of the quick application card is updated again at the next time of the exposure of the quick application card.
For example, assuming that the preset duration is 10 minutes, the time for refreshing the data last time on the card interface of the quick application card is 2023, 11, 13, 12 and 0 minutes, and the user slides out of the negative screen at 2023, 11, 13, 12 and 5 minutes, at which time the quick application card is in a hidden state, i.e. not in an exposed state, then if the user does not slide into the negative screen at 2023, 11, 13, 12 and 10 minutes and later, the user does not need to pull the second update data to update the card interface of the quick application card. Assuming that the user slides into the negative screen 15 minutes at the time of day 12 of 11 and 13 of 2023, the quick application card is exposed again, that is, the quick application card is in an exposed state, at this time, it may be determined that the refresh duration has already reached the preset duration, and then the second update data may be pulled to update the card interface of the quick application card.
After the second update data is obtained, the interface data may be updated according to the second update data in the same manner as the foregoing "updating the interface data according to the first update data to obtain the first updated interface data", to obtain the second updated interface data ". When the second updated interface data is obtained, the updated rendering instruction for constructing the updated view tree may be generated according to the interface layout information and the second updated interface data in the same manner as the aforementioned "generating the rendering instruction for constructing the view tree according to the interface layout information and the interface data", and according to the interface layout information and the second updated interface data in the same manner as the aforementioned "generating the rendering instruction for constructing the view tree according to the interface layout information and the interface data". After the updated rendering instruction is obtained, the updated rendering instruction can be executed in the same manner as the "execute rendering instruction, build view tree, and obtain the card interface of the fast application card", and build updated view tree, so as to obtain the updated card interface of the fast application card.
In this embodiment, by acquiring a declarative interface description file corresponding to a quick application card, the declarative interface description file includes interface layout information and interface data; analyzing the declarative interface description file to obtain interface layout information and interface data; generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data; executing the rendering instruction, constructing a view tree, obtaining a card interface of the quick application card, and rendering the card interface of the quick application card.
Furthermore, the rendering instruction can be directly resolved without creating js threads to run js engines or using js frame frames to cooperate with js engines, so that the rendering time of the quick application card can be shortened.
Furthermore, a developer uses DSL consistent with the fast application card when accessing the light card, and on the premise of not needing additional learning cost, the developer can package the light card into the json format by configuring the card type as json (json identification card type is the light card) at the manifest, thereby greatly improving the performance of the card.
As shown in fig. 3, in the embodiment of the present application, when the card interface of the quick application card is loaded, the quick application card engine obtains the rpk package corresponding to the quick application card. After acquiring the rpk package, the quick application card engine acquires the manifest file from the rpk package and parses the manifest file to determine the card type of the quick application card.
If the card type is a preset type, namely a light card type, the fast application card engine acquires a json format declaration interface description file from the rpk packet, and analyzes the json format declaration interface description file to generate a rendering instruction. And then, the quick application card engine also creates a rendering thread, and the rendering thread executes the rendering instruction to construct a view tree so as to complete the rendering of the card interface of the quick application card.
If the card type is not the preset type, the quick application engine acquires the js file from the rpk packet, creates a js thread, runs the js engine through the js thread, and uses the js frame to cooperate with the js engine to analyze the rendering instruction from the js format file. And then, the quick application card engine also creates a rendering thread, and the rendering thread executes the rendering instruction to construct a view tree so as to complete the rendering of the card interface of the quick application card.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a rendering device of a quick application card according to an embodiment of the present application. The fast application card rendering apparatus 200 includes: a file acquisition module 201, a file analysis module 202, an instruction generation module 203 and an interface rendering module 204.
The file obtaining module 201 is configured to obtain a declarative interface description file corresponding to the quick application card, where the declarative interface description file includes interface layout information and interface data.
And the file analysis module 202 is configured to analyze the declarative interface description file to obtain the interface layout information and the interface data.
The instruction generating module 203 is configured to generate a rendering instruction for constructing a view tree according to the interface layout information and the interface data.
And the interface rendering module 204 is configured to execute the rendering instruction, construct the view tree, and obtain a card interface of the quick application card.
In an alternative embodiment, the file format of the declarative interface description file is json format.
In an optional embodiment, the interface layout information includes interface structure information and interface style information, and the rendering device 200 of the quick application card may further include a file compiling module, where the file compiling module may be used to: acquiring a ux file corresponding to the quick application card, wherein the ux file comprises interface structure information to be compiled, interface style information to be compiled and interface data to be compiled; compiling the interface structure information to be compiled into the interface structure information, compiling the interface style information to be compiled into the interface style information, and compiling the interface data to be compiled into the interface data to obtain the json format declarative interface description file.
In an alternative embodiment, the file compilation module may be configured to: and compiling the interface structure information to be compiled into the interface structure information of the abstract syntax tree structure.
In an alternative embodiment, the rendering device 200 of the quick application card may further include a data update module, where the data update module may be configured to: acquiring first update data transmitted by a host application; updating the interface data according to the updated data to obtain first updated interface data;
the instruction generation module 203 may be configured to: and generating a rendering instruction for constructing a view tree according to the interface layout information and the first updated interface data.
In an alternative embodiment, the data update module may be configured to: determining the refreshing time of the card interface; if the refresh duration reaches the preset duration, pulling second update data from the appointed link; updating the interface data according to the second updating data to obtain second updated interface data;
the instruction generation module 203 may be configured to: generating an updated rendering instruction for constructing an updated view tree according to the interface layout information and the second updated interface data;
Interface rendering module 204 may be used to: and executing the updated rendering instruction, and constructing an updated view tree to obtain an updated card interface of the quick application card.
In an alternative embodiment, the file acquisition module 201 may be configured to: determining the card type of the express application card; and if the card type is the preset type, acquiring a declarative interface description file corresponding to the express application card.
The present embodiment provides a computer-readable storage medium having a computer program stored thereon, which when executed on a computer, causes the computer to perform the rendering method of the quick application card as provided by the present embodiment.
The embodiment of the application also provides electronic equipment, which comprises a memory and a processor, wherein the processor is used for executing the rendering method of the quick application card provided by the embodiment by calling the computer program stored in the memory.
For example, the electronic device may be a mobile terminal such as a tablet computer or a smart phone. Referring to fig. 5, fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
The electronic device 300 may include a processor 301, memory 302, and the like. Those skilled in the art will appreciate that the electronic device structure shown in fig. 5 is not limiting of the electronic device and may include more or fewer components than shown, or may combine certain components, or may be arranged in different components, such as the electronic device 300 may also include a screen.
The processor 301 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing application programs stored in the memory 302 and calling data stored in the memory 302, thereby performing overall monitoring of the electronic device.
Memory 302 may be used to store applications and data. The memory 302 stores application programs including executable code. Applications may constitute various functional modules. The processor 301 executes various functional applications and data processing by running application programs stored in the memory 302.
In this embodiment, the processor 301 in the electronic device loads executable codes corresponding to the processes of one or more application programs into the memory 302 according to the following instructions, and the processor 301 executes the application programs stored in the memory 302, so as to implement:
acquiring a declarative interface description file corresponding to a quick application card, wherein the declarative interface description file comprises interface layout information and interface data;
analyzing the declarative interface description file to obtain the interface layout information and the interface data;
Generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data;
and executing the rendering instruction, constructing the view tree, and obtaining a card interface of the quick application card.
In an alternative embodiment, the file format of the declarative interface description file is json format.
In an optional embodiment, the interface layout information includes interface structure information and interface style information, and before the processor 301 executes the declarative interface description file corresponding to the acquired express application card, the method may further be executed: acquiring a ux file corresponding to the quick application card, wherein the ux file comprises interface structure information to be compiled, interface style information to be compiled and interface data to be compiled; compiling the interface structure information to be compiled into the interface structure information, compiling the interface style information to be compiled into the interface style information, and compiling the interface data to be compiled into the interface data to obtain the json format declarative interface description file.
In an alternative embodiment, when the processor 301 executes the compiling of the interface structure information to be compiled into the interface structure information, the method may be performed: and compiling the interface structure information to be compiled into the interface structure information of the abstract syntax tree structure.
In an alternative embodiment, before the processor 301 executes the rendering instruction for building a view tree according to the interface layout information and the interface data, the method may further execute: acquiring first update data transmitted by a host application; updating the interface data according to the updated data to obtain first updated interface data; when the processor 301 executes the rendering instruction for constructing the view tree according to the interface layout information and the interface data, the method may be executed: and generating a rendering instruction for constructing a view tree according to the interface layout information and the first updated interface data.
In an alternative embodiment, after the processor 301 executes the rendering instruction to construct the view tree to obtain the card interface of the quick application card, the method may further be executed: determining the refreshing time of the card interface; if the refresh duration reaches the preset duration, pulling second update data from the appointed link; updating the interface data according to the second updating data to obtain second updated interface data; generating an updated rendering instruction for constructing an updated view tree according to the interface layout information and the second updated interface data; and executing the updated rendering instruction, and constructing an updated view tree to obtain an updated card interface of the quick application card.
In an alternative embodiment, before the processor 301 executes the declarative interface description file corresponding to the acquired express application card, the method may further be executed: determining the card type of the express application card; when the processor 301 executes the declarative interface description file corresponding to the acquired express application card, the method may be executed: and if the card type is the preset type, acquiring a declarative interface description file corresponding to the express application card.
In the foregoing embodiments, the descriptions of the embodiments are focused on, and for those portions of an embodiment that are not described in detail, reference may be made to the foregoing detailed description of the rendering method for the quick application card, which is not repeated herein.
The rendering device of the quick application card provided in the embodiment of the present application and the rendering method of the quick application card in the foregoing embodiments belong to the same concept, and any method provided in the embodiment of the rendering method of the quick application card may be run on the rendering device of the quick application card, and detailed implementation processes of the method are shown in the embodiment of the rendering method of the quick application card, which is not described herein again.
It should be noted that, for the rendering method of the application card of the embodiment of the present application, it will be understood by those skilled in the art that all or part of the flow of the rendering method of the application card of the embodiment of the present application may be implemented by controlling related hardware by a computer program, where the computer program may be stored in a computer readable storage medium, such as a memory, and executed by at least one processor, and the execution may include the flow of the embodiment of the rendering method of the application card. The computer readable storage medium may be a magnetic disk, an optical disk, a Read Only Memory (ROM), a random access Memory (RAM, random Access Memory), etc.
It will be appreciated that in the specific embodiments of the present application, related data such as application usage behavior data, logs, etc. are related to user information, and when the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of related data is required to comply with related laws and regulations and standards of related countries and regions.
For the rendering device of the quick application card in the embodiment of the application, each functional module of the rendering device may be integrated in one processing chip, or each module may exist separately and physically, or two or more modules may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules, if implemented as software functional modules and sold or used as a stand-alone product, may also be stored on a computer readable storage medium such as read-only memory, magnetic or optical disk, etc.
The foregoing describes in detail a rendering method, apparatus, storage medium and electronic device for a fast application card provided in the embodiments of the present application, and specific examples are applied to describe the principles and embodiments of the present application, where the descriptions of the foregoing embodiments are only used to help understand the method and core ideas of the present application; meanwhile, as those skilled in the art will vary in the specific embodiments and application scope according to the ideas of the present application, the contents of the present specification should not be construed as limiting the present application in summary.

Claims (10)

1. A method for rendering a quick application card, comprising:
acquiring a declarative interface description file corresponding to a quick application card, wherein the declarative interface description file comprises interface layout information and interface data;
analyzing the declarative interface description file to obtain the interface layout information and the interface data;
generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data;
and executing the rendering instruction, constructing the view tree, and obtaining a card interface of the quick application card.
2. The method for rendering the quick application card according to claim 1, wherein the file format of the declarative interface description file is json format.
3. The method for rendering the quick application card according to claim 2, wherein the interface layout information includes interface structure information and interface style information, and further includes, before the step of obtaining the declarative interface description file corresponding to the quick application card:
acquiring a ux file corresponding to the quick application card, wherein the ux file comprises interface structure information to be compiled, interface style information to be compiled and interface data to be compiled;
Compiling the interface structure information to be compiled into the interface structure information, compiling the interface style information to be compiled into the interface style information, and compiling the interface data to be compiled into the interface data to obtain the json format declarative interface description file.
4. A method of rendering a quick application card according to claim 3, wherein compiling the interface structure information to be compiled into the interface structure information comprises:
and compiling the interface structure information to be compiled into the interface structure information of the abstract syntax tree structure.
5. The method according to any one of claims 1 to 4, wherein before generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data, the method further comprises:
acquiring first update data transmitted by a host application;
updating the interface data according to the updated data to obtain first updated interface data;
the generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data includes:
and generating a rendering instruction for constructing a view tree according to the interface layout information and the first updated interface data.
6. The method for rendering a fast application card according to any one of claims 1 to 4, wherein after executing the rendering instruction and constructing the view tree to obtain a card interface of the fast application card, further comprises:
determining the refreshing time of the card interface;
if the refresh duration reaches the preset duration, pulling second update data from the appointed link;
updating the interface data according to the second updating data to obtain second updated interface data;
generating an updated rendering instruction for constructing an updated view tree according to the interface layout information and the second updated interface data;
and executing the updated rendering instruction, and constructing an updated view tree to obtain an updated card interface of the quick application card.
7. The method for rendering a fast application card according to any one of claims 1 to 4, wherein before the step of obtaining the declarative interface description file corresponding to the fast application card, the method further comprises:
determining the card type of the express application card;
the acquiring the declarative interface description file corresponding to the express application card comprises the following steps:
and if the card type is the preset type, acquiring a declarative interface description file corresponding to the express application card.
8. A rendering device for a quick application card, comprising:
the file acquisition module is used for acquiring a declarative interface description file corresponding to the express application card, wherein the declarative interface description file comprises interface layout information and interface data;
the file analysis module is used for analyzing the declarative interface description file to obtain the interface layout information and the interface data;
the instruction generation module is used for generating a rendering instruction for constructing a view tree according to the interface layout information and the interface data;
and the interface rendering module is used for executing the rendering instruction, constructing the view tree and obtaining a card interface of the quick application card.
9. A computer-readable storage medium, in which a computer program is stored which, when run on a computer, causes the computer to perform the method of rendering a quick application card according to any one of claims 1 to 7.
10. An electronic device comprising a processor and a memory, wherein the memory has stored therein a computer program, and wherein the processor is configured to execute the method of rendering a flash application card according to any one of claims 1 to 7 by calling the computer program stored in the memory.
CN202311526874.6A 2023-11-15 2023-11-15 Rendering method and device of quick application card, storage medium and electronic equipment Pending CN117519877A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311526874.6A CN117519877A (en) 2023-11-15 2023-11-15 Rendering method and device of quick application card, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311526874.6A CN117519877A (en) 2023-11-15 2023-11-15 Rendering method and device of quick application card, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN117519877A true CN117519877A (en) 2024-02-06

Family

ID=89758226

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311526874.6A Pending CN117519877A (en) 2023-11-15 2023-11-15 Rendering method and device of quick application card, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117519877A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117724823A (en) * 2024-02-07 2024-03-19 之江实验室 Task execution method of multi-model workflow description based on declarative semantics

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117724823A (en) * 2024-02-07 2024-03-19 之江实验室 Task execution method of multi-model workflow description based on declarative semantics

Similar Documents

Publication Publication Date Title
WO2018228211A1 (en) Application conversion method, apparatus and device
JP6629848B2 (en) Page processing for mobile applications
WO2018082562A1 (en) Method and device for compiling page data and rendering page, and storage medium
US20160342576A1 (en) Filtered stylesheets
CN111273898A (en) Web front-end code automatic construction method, system and storage medium
US8413128B2 (en) Asynchronous load of source dependencies
US8615750B1 (en) Optimizing application compiling
Hales HTML5 and JavaScript Web Apps: Bridging the gap between the web and the mobile web
CN106997298A (en) A kind of application resource acquisition methods and device
CN117519877A (en) Rendering method and device of quick application card, storage medium and electronic equipment
CN113419729B (en) Front-end page building method, device, equipment and storage medium based on componentization
CN111026634A (en) Interface automation test system, method, device and storage medium
CN112114890A (en) Method, device and equipment for processing small program and storage medium
CN113010827A (en) Page rendering method and device, electronic equipment and storage medium
CN112835809A (en) Test data setting method, device, equipment and medium based on browser
CN110727429B (en) Front-end page generation method, device and equipment
US10789751B2 (en) Method and apparatus for implementing animation in client application and animation script framework
CN114706616A (en) Applet construction method and device
CN114217789A (en) Function component expansion method, device, equipment, storage medium and program product
CN112965716B (en) Page processing method and device, electronic equipment and readable storage medium
CN113094138A (en) Interface display method and device, electronic equipment and storage medium
CN111679828A (en) Data processing method and device, electronic equipment and storage medium
CN112068879A (en) Method and device for constructing client application development framework based on configuration
CN113641594B (en) Cross-terminal automatic testing method and related device
CN112799670B (en) Method and system for unified multi-terminal logic development

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