CN115309470B - Method, device, equipment and storage medium for loading widget - Google Patents

Method, device, equipment and storage medium for loading widget Download PDF

Info

Publication number
CN115309470B
CN115309470B CN202210820930.6A CN202210820930A CN115309470B CN 115309470 B CN115309470 B CN 115309470B CN 202210820930 A CN202210820930 A CN 202210820930A CN 115309470 B CN115309470 B CN 115309470B
Authority
CN
China
Prior art keywords
widget
interaction
displayed
rendering result
determining
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
CN202210820930.6A
Other languages
Chinese (zh)
Other versions
CN115309470A (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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202210820930.6A priority Critical patent/CN115309470B/en
Publication of CN115309470A publication Critical patent/CN115309470A/en
Priority to PCT/CN2023/075396 priority patent/WO2024011899A1/en
Application granted granted Critical
Publication of CN115309470B publication Critical patent/CN115309470B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • 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/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The disclosure provides a method, a device, equipment and a storage medium for loading a widget, relates to the technical field of computers, and particularly relates to the technical field of clients. The specific implementation scheme is as follows: acquiring code data, layout information and style resources corresponding to a target widget; determining a rendering result and interaction response information corresponding to the rendering result according to the code data, the layout information and the style resource; converting the rendering result into a target form matched with the terminal equipment to obtain an object to be displayed; according to the interaction response information, determining interaction configuration data corresponding to the object to be displayed; and loading the target widget according to the object to be displayed and the interaction configuration data. The present disclosure also provides a program product.

Description

Method, device, equipment and storage medium for loading widget
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to the field of client technologies.
Background
In recent years, with the development of the internet, the popularity of smart devices such as smart phones and tablet computers is also increasing. A user may obtain various services through an Application (APP) in the smart device. Widgets (widgets) are an application plug-in that can be used to display various types of information of an application, such as weather, news, pictures, etc. Widgets may be presented in a desktop, application interface, or website page. The Widget can have the effects of improving the efficiency of acquiring value information by the user, meeting the requirements of the user on desktop beautification, optimizing the user retention and the like. Thus, many applications push the Widget function.
Disclosure of Invention
The present disclosure provides a method, apparatus, device, storage medium, and program product for loading widgets.
According to an aspect of the present disclosure, there is provided a method for loading a widget, including: acquiring code data, layout information and style resources corresponding to a target widget; determining a rendering result and interaction response information corresponding to the rendering result according to the code data, the layout information and the style resource; converting the rendering result into a target form matched with terminal equipment to obtain an object to be displayed; according to the interaction response information, determining interaction configuration data corresponding to the object to be displayed; and loading the target widget according to the object to be displayed and the interaction configuration data.
According to another aspect of the present disclosure, there is provided a loading device of a widget, including: the acquisition module is used for acquiring code data, layout information and style resources corresponding to the target widget; the first determining module is used for determining a rendering result and interaction response information corresponding to the rendering result according to the code data, the layout information and the style resource; the conversion module is used for converting the rendering result into a target form matched with the terminal equipment to obtain an object to be displayed; the second determining module is used for determining interaction configuration data corresponding to the object to be displayed according to the interaction response information; and the loading module is used for loading the target widget according to the object to be displayed and the interaction configuration data.
Another aspect of the present disclosure provides an electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods shown in the embodiments of the present disclosure.
According to another aspect of the disclosed embodiments, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the methods shown in the disclosed embodiments.
According to another aspect of the disclosed embodiments, there is provided a computer program product comprising a computer program/instruction, characterized in that the computer program/instruction, when executed by a processor, implements the steps of the method shown in the disclosed embodiments.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 schematically illustrates an exemplary system architecture to which the method and apparatus for loading widgets may be applied according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a method of loading widgets according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a flow chart of a method of rendering results and interactive response information according to an embodiment of the disclosure;
FIG. 4 schematically illustrates a schematic diagram of the loading of a widget according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow chart of a method of loading widgets according to another embodiment of the present disclosure;
FIG. 6 schematically illustrates a block diagram of a loading device of a widget according to another embodiment of the present disclosure; and
FIG. 7 schematically illustrates a block diagram of an example electronic device that may be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The system architecture of the method and apparatus for loading a widget provided in the present disclosure will be described below with reference to fig. 1.
FIG. 1 schematically illustrates an exemplary system architecture 100 in which the methods and apparatus for loading widgets may be applied according to embodiments of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which embodiments of the present disclosure may be applied to assist those skilled in the art in understanding the technical content of the present disclosure, but does not mean that embodiments of the present disclosure may not be used in other devices, systems, environments, or scenarios.
As shown in fig. 1, a system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
The server 105 may be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of large management difficulty and weak service expansibility in the traditional physical hosts and VPS service (Virtual Private Server or VPS for short). The server 105 may also be a server of a distributed system or a server that incorporates a blockchain.
According to embodiments of the present disclosure, the terminal device 101, 102, 103 may send a widget loading request to the server 105. The server 105, in response to receiving a widget loading request from a terminal device, may acquire code data, layout information, and style resources corresponding to the widget loading request. The code data, layout information and style resources are then transmitted to the terminal devices 101, 102, 103. The terminal devices 101, 102, 103 may load the corresponding widgets according to the code data, the layout information, and the style resources.
However, it is possible that the terminal devices 101, 102, 103 are each based on a different operating system, wherein the operating system may comprise Android, harmonyOS, iOS or the like, for example. The widgets supported by different operating systems are not identical. Therefore, the related art needs to develop corresponding widgets for different operating systems, and the development threshold and the development cost are high.
Based on this, according to the embodiment of the present disclosure, when receiving the widget loading request from the terminal device, the server 105 parses the target widget for which the widget loading request is directed. Code data, layout information, and style resources corresponding to the target widget may then be acquired. The code data, layout information and style resources are then transmitted to the terminal device. The terminal device may determine a rendering result and interactive response information corresponding to the rendering result according to the code data, the layout information, and the style resource. And then converting the rendering result into a target form matched with the terminal equipment to obtain the object to be displayed. And determining interaction configuration data corresponding to the object to be displayed according to the interaction response information. The target widget may then be loaded according to the object to be presented and the interaction configuration data.
The code data, layout information and style resources corresponding to the target widget are converted into the object to be displayed and interactive configuration data which can be adapted to the terminal equipment, so that the target widget can be compatible with different operating systems. Repeated development is not needed, and development threshold and development cost are reduced.
Related art the development of widgets directly in an application through an operating system API (Application Programming Interface ) requires the application to be updated when the widget is updated.
According to the embodiment of the disclosure, the server is used for controlling the code data, the layout information and the style resource issued to the terminal equipment, so that the terminal equipment can generate the corresponding widget according to the code data, the layout information and the style resource, the widget can be updated without updating an application program, and the widget can be dynamically updated at any time.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
In the technical scheme of the disclosure, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing, applying and the like of the personal information of the user all conform to the regulations of related laws and regulations, necessary security measures are adopted, and the public order harmony is not violated.
In the technical scheme of the disclosure, the authorization or consent of the user is obtained before the personal information of the user is obtained or acquired.
The method of loading the widget provided by the present disclosure will be described below with reference to fig. 2.
Fig. 2 schematically illustrates a flow chart of a method of loading widgets according to an embodiment of the disclosure.
As shown in FIG. 2, the method 200 for loading the widget includes operations S210-S250. The widget loading method 200 may be performed by the terminal device shown above, for example.
In operation S210, code data, layout information, and style resources corresponding to a target widget are acquired.
According to embodiments of the present disclosure, a Widget (Widget) is an application plug-in that may be used to display various types of information of an application, such as weather, news, pictures, etc. The widget may be presented in a desktop, application interface, or website page. The target widget is a widget that the terminal device intends to load.
According to embodiments of the present disclosure, code data may be used to implement business logic corresponding to the widgets. The code data may include, for example, code developed by a scripting language such as JavaScript. Layout information may be used to describe the layout of the widgets. The layout information may include, for example, an HTML (HyperText Markup Language ) file or the like. The style resource may be used, for example, to describe the style of the widget, and may include, for example, CSS (Cascading Style Sheets, style cascading sheets), pictures, and the like.
According to the embodiment of the present disclosure, the terminal device may acquire, for example, code data, layout information, and style resources corresponding to the target widget from the server.
Then, in operation S220, a rendering result and interactive response information corresponding to the rendering result are determined according to the code data, the layout information, and the style resource.
According to the embodiment of the disclosure, for example, rendering can be performed according to layout information and style resources, and an original widget is obtained as a rendering result. The interactive response information may be used to describe interactive response functions possessed by the rendered original widget. The interactive response information may include, for example, a web page DOM (document object model) tree, a structured native view tree, and the like.
By way of example, taking layout information as HTML and style resources as CSS as examples, a widget in a web page form may be rendered according to the HTML and the CSS, and the widget may be obtained as a rendering result.
In operation S230, the rendering result is converted into a target form matched with the terminal device, so as to obtain an object to be displayed.
According to an embodiment of the present disclosure, the terminal device is a terminal device that needs to load a widget. Since the terminal device may be based on different types of operating systems, some terminal devices may not support direct loading of the original widget due to operating system compatibility issues. Based on the method, the rendering result can be converted into a target form matched with the terminal equipment, and the object to be displayed is obtained.
According to embodiments of the present disclosure, the target form may be determined according to the operating system type of the terminal device. The target forms may include, for example, pictures, text, lists, and the like.
In operation S240, interaction configuration data corresponding to the object to be displayed is determined according to the interaction response information.
According to embodiments of the present disclosure, interaction configuration data may be used to describe interaction response functions corresponding to objects to be presented.
In operation S250, the target widget is loaded according to the object to be displayed and the interactive configuration data.
According to the embodiment of the disclosure, the terminal device may display the object to be displayed in the widget display area, for example. And then, setting an interactive response function for the widget display area according to the interactive configuration data, thereby realizing the loading of the target widget.
In this embodiment, for example, a display container may be provided in the widget display area, and an object to be displayed may be added to the display container to be displayed. The display container may include, for example, a view component. The View component may include, for example, a View component in an Android system, a UIView component in an iOS system, and the like.
The operating system of the terminal device limits the types of view components that can be used in the widget presentation area and therefore requires conversion of the rendering results into a target form that matches the terminal device. For example, for systems such as Android, harmonyOS and iOS, the view component (WebView) for exposing web pages is not allowed to be used in the widget exposure area. Therefore, the widget in the web page form cannot be displayed in the widget display area, so that the rendering result in the web page form can be converted into a form which can be supported by an operating system such as a picture in the embodiment.
According to the embodiment of the disclosure, aiming at terminal equipment based on different operating systems, code data, layout information and style resources of a target widget are converted into the object to be displayed and interactive configuration data which can be adapted to the terminal equipment, and then the target widget is loaded according to the object to be displayed and the interactive configuration data, so that the terminal equipment of different operating systems can be supported, corresponding widgets do not need to be respectively developed aiming at different operating systems, and development thresholds and development cost are reduced.
In addition, according to the embodiment of the disclosure, the server is used for controlling the code data, the layout information and the style resource issued to the terminal equipment, so that the terminal equipment generates the corresponding widget according to the code data, the layout information and the style resource, the widget can be updated without updating an application program, and the widget can be dynamically updated at any time.
According to the embodiment of the disclosure, a user may trigger a widget adding operation through the terminal device, and the adding operation may be used to add the widget to a desktop of the terminal device. The user may then set the services provided by the widget by manually specifying the services provided by the widget, or may be automatically operated by the application. The services may include, for example, presenting examination information, presenting weather information, presenting lottery information, and the like. And then storing the mapping relation among the widget identifier, abstract information and service identifiers of the corresponding services. The summary information of the widget may include, for example, width, height, page address where the content data is acquired, theme color, update interval, configuration page address, and the like. For example, in this embodiment, corresponding summary information may be set for each widget in advance according to actual needs.
According to the embodiment of the disclosure, when the widget is loaded, the terminal equipment can query the corresponding service identification and summary information according to the identification information of the widget and send a request to the corresponding server according to the service identification and summary information so as to acquire the content data of the widget. And then generating a rendering result according to the layout information, the style resource and the content data. And loading the widget based on the rendering result. The content data may include, for example, data displayed in the widget, such as examination information, weather information, lottery information, news information, and the like. And then generating a rendering result according to the layout information, the style resource and the content data.
According to the embodiment of the disclosure, when the widget needs to be refreshed, the terminal equipment can query the corresponding service identifier and summary information according to the identifier information of the widget and send a request to the corresponding server according to the service identifier and the summary information so as to acquire new content data. And then generating a new rendering result according to the layout information, the style resource and the new content data. The widget is then updated based on the new rendering results. The refreshing of the widget can be triggered periodically according to user configuration or automation, or can be triggered by setting an alarm clock by an application program.
According to the embodiment of the disclosure, all widget services supported by each application program can be managed in a cloud aggregation mode, for example. When the cloud receives a content acquisition request from the terminal device, the latest content data specified by the parameters can be issued to the terminal device according to the parameters in the request. The parameters may include, for example, service information such as city information, examination type, etc.
For example, a plurality of servers may be disposed in the cloud, and each widget service may have a corresponding server module for providing content data for the widget.
The method of determining rendering results and interactive response information provided by the present disclosure will be described below with reference to fig. 3.
Fig. 3 schematically illustrates a flowchart of a method of rendering results and interactive response information according to an embodiment of the present disclosure.
As shown in fig. 3, the method 320 of rendering results and interactive response information includes generating an original page according to layout information and style resources in operation S321.
According to embodiments of the present disclosure, an original page of an original widget may be generated, for example, according to layout information and style resources.
In operation S322, the code data is executed, resulting in an execution result.
According to the embodiment of the disclosure, the data which needs to be dynamically generated in the original widget can be generated by executing the code data as an execution result. For example, some elements in the original widget require dynamic calculation of element sizes, based on which the element sizes of these elements can be generated as execution results by executing code data.
According to another embodiment of the present disclosure, the content data in the external server may also be acquired as the execution result by executing the code data. For example, weather information in the original widget is required to be displayed, based on which the weather information can be acquired from the server as a result of execution by executing the code data.
In operation S323, a target page is generated as a rendering result according to the execution result and the original page.
According to the embodiment of the disclosure, the target page can be obtained according to the fact that dynamically generated data and/or content data from an external server can be added into the original page.
For example, the dynamically generated element size may be substituted for the corresponding element size in the original page to obtain the target page.
For another example, weather information from an external server may be added to a corresponding location in the original page to obtain the target page.
According to embodiments of the present disclosure, a target page may include at least one interactive element. The interactive element has an interactive response function, and can trigger a corresponding response event in response to the interactive operation. Wherein the interactive elements may include, for example, buttons, text, pictures, and the like. The interaction may include, for example, clicking, long pressing, etc. The response event may include, for example, jumping a corresponding application interface or web page, executing program instructions opened by the target application through the interface, and so forth.
In operation S324, an interactive response code corresponding to at least one interactive element in the code data is determined as interactive response information.
According to embodiments of the present disclosure, an interaction response code corresponding to an interaction element may be used to indicate which interactions the interaction element will respond to, and what the corresponding response event is.
According to an embodiment of the present disclosure, after determining the interaction response information, for example, an element region corresponding to at least one interaction element in the object to be displayed may be determined. And then determining the interaction configuration data of each element area according to the interaction response information.
Correspondingly, according to the embodiment of the disclosure, after receiving the interaction configuration data, the terminal device may divide the widget display area into at least one sub-display area according to at least one element area indicated by the interaction configuration data. At least one sub-presentation area corresponds one-to-one with at least one element area. A view component is disposed in each of the at least one sub-display section. And then configuring an interactive response function for the view component corresponding to each element area according to the interactive configuration data of each element area.
According to another embodiment of the disclosure, the terminal device may also set a main view component in the widget display area, where the main view component includes at least one sub-view component, and the at least one sub-view component corresponds to the at least one element area one to one. And then configuring an interactive response function for the sub-view component corresponding to each element area according to the interactive configuration data of each element area.
The method of loading the widgets shown above is further described with reference to FIG. 4 in conjunction with the exemplary embodiment. Those skilled in the art will appreciate that the following example embodiments are merely for the understanding of the present disclosure, and the present disclosure is not limited thereto.
Illustratively, in this embodiment, the code data of the widget includes JavaScript data, the layout information of the widget includes HTML, and the style resource of the widget includes CSS.
Fig. 4 schematically illustrates a schematic diagram of the loading of a widget according to an embodiment of the present disclosure.
In fig. 4, it is shown that the terminal device may load and render a page of the widget according to HTML and CSS based on a browser technology, resulting in a rendering result r1 and interactive response information t1. The rendering result r1 may then be processed as a picture as the object p1 to be presented. For example, a screenshot may be performed on a page of a widget to obtain a picture. The form of the picture can be supported by a main stream operating system such as Android, harmonyOS, iOS.
Illustratively, in the present embodiment, the rendering result r1 includes a vehicle detection button 41, a travel policy button 42, a vehicle service place button 43, a news bulletin field 44, a city field 45, and other elements. Wherein the vehicle detection button 41, when clicked, invokes a vehicle detection applet. The travel policy button 42, when clicked, brings up a travel policy search results page. The vehicle service map page is invoked when the vehicle service ground button 43 is clicked. News bulletin field 44, when clicked, brings up a local news bulletin page. The city bar 45, when clicked, brings up the city switching settings page. Other elements call up the search results page when clicked.
Based on this, p1 may be divided into multiple grid regions, each of which may respond individually to interaction events, which may support, but are not limited to, invoking host application pages, other application pages, and triggering other custom instructions. Then, in p1, the area t11 corresponding to the vehicle detection button 41, the area t12 corresponding to the travel policy button 42, the area t13 corresponding to the vehicle service place button 43, the area t14 corresponding to the news bulletin board 44, and the area t15 corresponding to the city board 45 can be specified. The other elements correspond to other regions than the regions t11, t12, t13, t14, t15.
Then, the interactive response information t1 is determined based on the interactive response codes of the vehicle detection button 41, the travel policy button 42, the vehicle service place button 43, the news broadcast field 44, and the city field 45.
After receiving the object to be displayed p1 and the interaction configuration data t1, the terminal device can display the object to be displayed p1 in a widget display area, and then divide the widget display area into t11, t12, t13, t14, t15 and other areas according to the element area indicated by the interaction configuration data t1. And configures an interactive response function for each region. For example, the area t11 when clicked invokes a vehicle detection applet. Region t12, when clicked, brings up a travel policy search results page. The area t13, when clicked, brings up the vehicle service map page. The local news page is invoked when region t14 is clicked. The region t15, when clicked, brings up the city switching setting page. The widget brings up a search results page when other regions of the presentation area than regions t11, t12, t13, t14, t15 are clicked.
According to another embodiment of the present disclosure, a layout template file supporting presentation of pictures may be set in advance according to APIs of various operating systems, for example. The layout template file may be published with the application. The picture content displayed in the layout template file supports arbitrary settings. Based on this, the rendering result may be converted into at least one picture. And then determining the object to be displayed according to the template file and at least one picture corresponding to the terminal equipment. For example, the rendering result may be converted into a picture and then set in a layout template file, so as to obtain the object to be displayed. In particular, for pictures with a longer height and beyond the widget display area, a list view assembly may be disposed in the widget display area, and then the pictures may be divided according to the size of the widget display area and placed in the list view assembly in a longitudinal arrangement to support the pictures.
The method of loading the widget shown above is further described below in connection with specific embodiments. Those skilled in the art will appreciate that the following example embodiments are merely for the understanding of the present disclosure, and the present disclosure is not limited thereto.
In this embodiment, it is assumed that Widget instances w1 and w2 exist on a mobile phone of a user, where w1 is that after a user triggers a Widget adding operation on a page p1 in an application program, the user adds the Widget to a desktop and automatically configures the Widget to use a service s1, and a content correlation exists between the page p1 and the service s 1. w2 is manually added on the desktop by a user and is manually selected as a service s2, s2 is one of the services supported by the server corresponding to the application program, and the services supported by the server can be newly added at any time so as to realize expansion.
For example, in this embodiment, the terminal device may be configured with information as shown in table 1 in the Widget configuration storage module in advance.
When the operating system or the application program triggers the refresh of the Widget instance w1 or the user manually triggers the refresh of the Widget instance w1, the terminal device may query the server module s1 corresponding to the unique identifier i1 of w1 from the Widget configuration storage module, and initiate a Widget content acquisition request to s 1. s1 returns the Widget content c1, wherein c1 contains code data, layout information, style resources and the like written by dynamic scripting language.
The terminal device may parse and execute the code data contained in c1, and output the rendering result r1 and the interaction response information t1 in combination with layout information, style resources, and the like.
Then, the terminal device may convert r1 into a content form supported by the terminal device, where the content form is, for example, a picture, and the content supported by the terminal device is presented in a desktop Widget display container corresponding to the w1 instance.
In addition, the terminal device may convert t1 into an interaction configuration form supported by the terminal device. For example, the overall Widget region may be divided into sequentially numbered gridded sub-regions, each sub-region configured with an independent interaction response using a sub-view of a grid type view control, using a grid type view control. Alternatively, several independent views may be used, arranged in a grid, each with an independent interaction response configured.
Through the steps, the user can see the Widget rendering content generated after dynamic logic processing, and can click on the area on the Widget to trigger the specific interactive response of the area. The interactive response may support, among other things, invoking host application pages, other application pages, and triggering other custom instructions. In this embodiment, rendering content and interactive response information are both supported for dynamic modification with arbitrary program logic.
When the operating system or the application program triggers the refresh of the Widget instance w2 or the user manually triggers the refresh of the Widget instance w2, the terminal equipment queries a server module s2 corresponding to the unique identifier i2 of the w2 from the Widget configuration storage module, initiates a Widget content acquisition request to the s2, and returns the Widget content c2, wherein c2 contains code data, layout information, style resources and the like written in a dynamic script language.
The terminal device can analyze and execute the business logic codes contained in c2, and output the layout rendering result r2 and the interaction response information t2 by combining layout information, style resources and the like.
The terminal device may then convert r2 into a content format supported by the terminal device, such as a picture, and render the content supported by the terminal device in a desktop Widget display container corresponding to the w2 instance.
In addition, the terminal device can convert t2 into an interaction configuration form supported by the terminal device. For example, the overall Widget region may be divided into sequentially numbered gridded sub-regions, each sub-region configured with an independent interaction response using a sub-view of a grid type view control, using a grid type view control. Alternatively, several independent views may be used, arranged in a grid, each with an independent interaction response configured.
Through the steps, the user can see the Widget rendering content generated after dynamic logic processing, and can click on the area on the Widget to trigger the specific interactive response of the area. The interactive response may support, among other things, invoking host application pages, other application pages, and triggering other custom instructions. In this embodiment, rendering content and interactive response information are both supported for dynamic modification with arbitrary program logic.
When the Widget instance w1 needs to be upgraded, s1 returns updated Widget content c11 to the terminal equipment when receiving the Widget content acquisition request, wherein c11 contains upgraded code data, layout information, style resources and the like.
And rendering according to c11 by the terminal equipment, wherein the follow-up flow is the same as the above. Thus, the user can see the upgraded widget. The same applies when the interactive response information needs to be updated.
When a new Widget service class s3 needs to be added to the application, the developer may submit the service class s3 to the server. The activation usage modes of s3 may include, for example: when the page related to the s3 content is accessed in the application program, a button for automatically adding and configuring the Widget corresponding to the s3 service can be provided, and after clicking the button, the user newly generates a Widget instance w3 on the desktop and provides the s3 service.
After the user manually adds the Widget instance w3 on the desktop, a configuration service list may be displayed to the user, where the configuration service list includes s3 services, and the user may manually select s3 to set w3 to use s3 services.
Fig. 5 schematically illustrates a flow chart of a method of loading widgets according to another embodiment of the present disclosure.
As shown in fig. 5, the loading method 500 of the widget includes the server acquiring code data, layout information and style resources of an original widget in operation S510.
Then, the server determines a rendering result and interactive response information corresponding to the rendering result according to the code data, the layout information, and the style resource in operation S520.
According to the embodiments of the present disclosure, for example, reference may be made to the above for a specific method for determining the rendering result and the interaction response information corresponding to the rendering result, and the description is not repeated again.
In operation S530, the server converts the rendering result into a target form matched with the terminal device, and obtains an object to be displayed.
The specific method for converting the rendering result into the target form matched with the terminal device according to the embodiment of the present disclosure may refer to the above, and will not be described again.
In operation S540, the server determines interaction configuration data corresponding to the object to be displayed according to the interaction response information.
According to the embodiments of the present disclosure, a specific method for determining interaction configuration data corresponding to an object to be displayed may refer to the above, and will not be described again.
In operation S550, the server transmits the object to be displayed and the interactive configuration data to the terminal device.
In operation S560, the terminal device receives the object to be presented and the interactive configuration data from the server.
In operation S570, the terminal device loads the target widget according to the object to be displayed and the interactive configuration data.
According to the embodiments of the present disclosure, a specific method for loading the target widget according to the object to be displayed and the interaction configuration data may refer to the above, and will not be described again.
The compatibility problem exists in the operating system and/or browser of part of the terminal equipment, so that rendering results and interactive response information cannot be generated according to the code data, the layout information and the style resources.
According to the embodiment of the disclosure, the server executes the operations of determining the rendering result and the interactive response information and converting the rendering result and the interactive response information into the objects to be displayed and the interactive configuration data matched with the terminal equipment, so that the compatibility problem of the operating systems and/or the browsers of different terminal equipment can be avoided.
And the terminal equipment executes the operations of determining the rendering result and the interaction response information and converting the rendering result and the interaction response information into the object to be displayed and the interaction configuration data matched with the terminal equipment, so that the calculation pressure of the server can be reduced. In addition, the terminal equipment can acquire the unique parameter information, and determine rendering results and/or interactive response information according to the parameter information, so that richer functions can be realized in the widget. For example, the terminal device may acquire its own geographic location parameter, then determine content data matching the geographic location parameter, and add the content data to the rendering result, so that the content data matching the geographic location where the terminal device is located may be displayed in the widget.
The loading device of the widget provided in the present disclosure will be described below with reference to fig. 6.
Fig. 6 schematically illustrates a block diagram of a loading device of a widget according to an embodiment of the present disclosure.
As shown in fig. 6, the widget loading device 600 includes an acquisition module 610, a first determination module 620, a conversion module 630, and a second determination module 640.
And the acquiring module 610 is configured to acquire code data, layout information and style resources corresponding to the target widget.
The first determining module 620 is configured to determine a rendering result and interactive response information corresponding to the rendering result according to the code data, the layout information and the style resource.
And the conversion module 630 is configured to convert the rendering result into a target form matched with the terminal device, so as to obtain an object to be displayed.
And the second determining module 640 is configured to determine interaction configuration data corresponding to the object to be displayed according to the interaction response information.
And the loading module 650 is used for loading the target widget according to the object to be displayed and the interaction configuration data.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 7 schematically illustrates a block diagram of an example electronic device 700 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 7, the apparatus 700 includes a computing unit 701 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 702 or a computer program loaded from a storage unit 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 may also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Various components in device 700 are connected to I/O interface 705, including: an input unit 706 such as a keyboard, a mouse, etc.; an output unit 707 such as various types of displays, speakers, and the like; a storage unit 708 such as a magnetic disk, an optical disk, or the like; and a communication unit 709 such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The computing unit 701 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 701 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the respective methods and processes described above, for example, a loading method of a widget. For example, in some embodiments, the method of loading the widget may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 700 via ROM 702 and/or communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the loading method of the widget described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform the method of loading the widgets by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above can be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (9)

1. A method for loading widgets executed by a terminal device, comprising:
acquiring code data, layout information and style resources corresponding to a target widget;
determining a rendering result and interaction response information corresponding to the rendering result according to the code data, the layout information and the style resource;
converting the rendering result into a target form matched with the terminal equipment to obtain an object to be displayed;
according to the interaction response information, determining interaction configuration data corresponding to the object to be displayed; and
dividing a widget display area for displaying the object to be displayed into at least one element area corresponding to the at least one interaction element according to the at least one interaction element indicated by the interaction configuration data to load the target widget,
Wherein the determining a rendering result and interactive response information corresponding to the rendering result according to the code data, the layout information and the style resource includes:
generating an original page according to the layout information and the style resource;
executing the code data to obtain an execution result;
generating a target page as the rendering result according to the execution result and the original page, wherein the target page comprises at least one interaction element; and
and determining an interaction response code corresponding to the at least one interaction element in the code data as the interaction response information.
2. The method of claim 1, wherein the determining, according to the interaction response information, interaction configuration data corresponding to the object to be displayed includes:
determining at least one element area corresponding to the at least one interactive element in the object to be displayed; and
and determining interaction configuration data of each element area in the at least one element area according to the interaction response information.
3. The method according to claim 1 or 2, wherein the converting the rendering result into a target form matched with a terminal device, to obtain an object to be displayed, includes:
Converting the rendering result into at least one picture; and
and determining the object to be displayed according to the layout template file corresponding to the terminal equipment and the at least one picture.
4. The method of claim 2, wherein the loading the target widget according to the object to be presented and the interaction configuration data comprises:
displaying the object to be displayed in a widget display area; and
and setting an interactive response function for the widget display area according to the interactive configuration data.
5. The method of claim 4, wherein the setting an interactive response function for the widget presentation area according to the interactive configuration data comprises:
dividing the widget display area into at least one sub-display area according to the at least one element area;
providing a view component in each of the at least one sub-display section; and
and configuring an interactive response function for the view component corresponding to each element area according to the interactive configuration data of each element area.
6. The method of claim 4, wherein the setting an interactive response function for the widget presentation area according to the interactive configuration data comprises:
A main view component is arranged in the widget display area, wherein the main view component comprises at least one sub-view component, and the at least one sub-view component corresponds to the at least one element area one by one; and
and configuring an interactive response function for the sub-view component corresponding to each element area according to the interactive configuration data of each element area.
7. A loading device of a widget provided in a terminal device, comprising:
the acquisition module is used for acquiring code data, layout information and style resources corresponding to the target widget;
the first determining module is used for determining a rendering result and interaction response information corresponding to the rendering result according to the code data, the layout information and the style resource;
the conversion module is used for converting the rendering result into a target form matched with the terminal equipment to obtain an object to be displayed;
the second determining module is used for determining interaction configuration data corresponding to the object to be displayed according to the interaction response information; and
a loading module, configured to divide a widget display area for displaying the object to be displayed into at least one element area corresponding to the at least one interaction element according to the at least one interaction element indicated by the interaction configuration data, so as to load a target widget,
Wherein the determining a rendering result and interactive response information corresponding to the rendering result according to the code data, the layout information and the style resource includes:
generating an original page according to the layout information and the style resource;
executing the code data to obtain an execution result;
generating a target page as the rendering result according to the execution result and the original page, wherein the target page comprises at least one interaction element; and
and determining an interaction response code corresponding to the at least one interaction element in the code data as the interaction response information.
8. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
9. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-6.
CN202210820930.6A 2022-07-13 2022-07-13 Method, device, equipment and storage medium for loading widget Active CN115309470B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210820930.6A CN115309470B (en) 2022-07-13 2022-07-13 Method, device, equipment and storage medium for loading widget
PCT/CN2023/075396 WO2024011899A1 (en) 2022-07-13 2023-02-10 Widget loading method and apparatus, device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210820930.6A CN115309470B (en) 2022-07-13 2022-07-13 Method, device, equipment and storage medium for loading widget

Publications (2)

Publication Number Publication Date
CN115309470A CN115309470A (en) 2022-11-08
CN115309470B true CN115309470B (en) 2023-07-28

Family

ID=83857378

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210820930.6A Active CN115309470B (en) 2022-07-13 2022-07-13 Method, device, equipment and storage medium for loading widget

Country Status (2)

Country Link
CN (1) CN115309470B (en)
WO (1) WO2024011899A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115309470B (en) * 2022-07-13 2023-07-28 百度在线网络技术(北京)有限公司 Method, device, equipment and storage medium for loading widget
CN116074435A (en) * 2022-12-23 2023-05-05 深圳前海百递网络有限公司 Method and device for updating small component, electronic equipment and computer storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220176A (en) * 2021-04-13 2021-08-06 Oppo广东移动通信有限公司 Display method and device based on widget, electronic equipment and readable storage medium
CN113268305A (en) * 2021-06-01 2021-08-17 中兴通讯股份有限公司 Display method and device of widget, terminal and computer readable storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101866283B (en) * 2009-04-14 2013-03-27 华为技术有限公司 Widget transplanting method and device
CN103605527A (en) * 2013-12-06 2014-02-26 普元信息技术股份有限公司 System and method for realizing cloud computing application interface integration and unified style display
CN106886435A (en) * 2017-01-04 2017-06-23 乐视控股(北京)有限公司 The loading method and device of widget
US10268460B2 (en) * 2017-01-25 2019-04-23 Walmart Apollo, Llc Systems, method, and non-transitory computer-readable storage media for generating code for displaying a webpage
CN112395027B (en) * 2019-08-14 2024-04-19 腾讯科技(深圳)有限公司 Widget interface generation method and device, storage medium and electronic equipment
CN113127091B (en) * 2021-03-17 2024-06-04 北京达佳互联信息技术有限公司 Method, device, equipment, storage medium and program product for showing widget
CN115309470B (en) * 2022-07-13 2023-07-28 百度在线网络技术(北京)有限公司 Method, device, equipment and storage medium for loading widget

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220176A (en) * 2021-04-13 2021-08-06 Oppo广东移动通信有限公司 Display method and device based on widget, electronic equipment and readable storage medium
CN113268305A (en) * 2021-06-01 2021-08-17 中兴通讯股份有限公司 Display method and device of widget, terminal and computer readable storage medium

Also Published As

Publication number Publication date
CN115309470A (en) 2022-11-08
WO2024011899A1 (en) 2024-01-18

Similar Documents

Publication Publication Date Title
US11144711B2 (en) Webpage rendering method, device, electronic apparatus and storage medium
US10877826B2 (en) Message processing method and apparatus, storage medium, and computer device
CN109683998B (en) Internationalization realization method, device and system
CN106991154B (en) Webpage rendering method and device, terminal and server
WO2018077085A1 (en) Application processing method, device and storage medium
CN115309470B (en) Method, device, equipment and storage medium for loading widget
EP3822828A2 (en) Method, apparatus, device and storage medium for determining page theme and computer program product
CN113010827B (en) Page rendering method and device, electronic equipment and storage medium
US10951486B2 (en) Terminal device, UI expansion method, and UI expansion program
CN109582317B (en) Method and apparatus for debugging hosted applications
CN111079048A (en) Page loading method and device
CN112395027A (en) Widget interface generation method and device, storage medium and electronic equipment
CN114218890A (en) Page rendering method and device, electronic equipment and storage medium
CN113660504A (en) Message display method and device, electronic equipment and storage medium
US11438403B2 (en) Page presentation method and system, computer system, and computer readable medium
CN114035865B (en) Method, device and equipment for starting small program and storage medium
CN112395535B (en) Lazy loading method and apparatus for picture, medium and electronic device
CN113342450A (en) Page processing method and device, electronic equipment and computer readable medium
CN112947918A (en) Data display method and device
CN108268298B (en) Desktop icon generation method and device, storage medium and electronic equipment
CN110309454B (en) Interface display method, device, equipment and storage medium
CN112966201B (en) Object processing method, device, electronic equipment and storage medium
CN114090118A (en) Method, device and equipment for starting small program and storage medium
US11874890B2 (en) Multi-entry point navigation for user interfaces
CN108268297B (en) Application interface display method and device, storage medium and electronic equipment

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