CN108427568B - User interface updating method and device - Google Patents

User interface updating method and device Download PDF

Info

Publication number
CN108427568B
CN108427568B CN201810399980.5A CN201810399980A CN108427568B CN 108427568 B CN108427568 B CN 108427568B CN 201810399980 A CN201810399980 A CN 201810399980A CN 108427568 B CN108427568 B CN 108427568B
Authority
CN
China
Prior art keywords
memory
interface
callback
memories
data
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
CN201810399980.5A
Other languages
Chinese (zh)
Other versions
CN108427568A (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 Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software 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 Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201810399980.5A priority Critical patent/CN108427568B/en
Publication of CN108427568A publication Critical patent/CN108427568A/en
Application granted granted Critical
Publication of CN108427568B publication Critical patent/CN108427568B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Abstract

The disclosure relates to a method and a device for updating a user interface, comprising the following steps: under the condition that the data object in the memory monitored by the monitor is detected to be updated, the control monitor records the path and the updating data of the data object in the memory monitored by the monitor, and takes one or more functions called in the updating process of the data object in the memory monitored by the monitor as callback functions corresponding to the data object in the memory monitored by the monitor; and under the condition that the data objects in the monitored memories in the memories are detected to be updated, triggering monitor callback operations corresponding to the data objects in the memories, wherein the monitor callback operations are used for updating the interface nodes corresponding to the data objects in the memories according to the paths and the update data of the data objects in the memories and callback functions corresponding to the data objects in the memories. A mechanism is established for the monitor to monitor updates of data objects in memory. Redundant calculation is avoided, and the code maintenance cost is reduced.

Description

User interface updating method and device
Technical Field
The present disclosure relates to the field of User Interface (UI) technologies, and in particular, to a method and an apparatus for updating a User Interface.
Background
The user interface is a medium for interaction and information exchange between the system and the user, and it enables conversion between an internal form of information and a human-acceptable form. With the development of electronic technology, user interface technology is widely applied to the electronic industry, and has become an indispensable technology for most electronic products. However, the development platforms and operating systems of the PC (personal computer) end and the mobile end are numerous at present, which increases the workload of developing and maintaining the user interface program and increases the development cost of the developer for the code.
Disclosure of Invention
In order to overcome the problems in the related art, the present disclosure provides a method and an apparatus for updating a user interface.
According to a first aspect of the embodiments of the present disclosure, there is provided a method for updating a user interface, including:
under the condition that the data object in the memory monitored by the monitor is detected to be updated, controlling the monitor to record the path and the updating data of the data object in the memory monitored by the monitor, and taking one or more functions called by the data object in the memory monitored by the monitor in the updating process as callback functions corresponding to the data object in the memory monitored by the monitor, wherein the path of the data object in the memory is the binding position of the data object in the memory in an interface template of a user interface;
and under the condition that the data objects in the monitored memories in the memories are detected to be updated, triggering monitor callback operations corresponding to the data objects in the memories, wherein the monitor callback operations are used for updating interface nodes corresponding to the data objects in the memories according to the paths and the updating data of the data objects in the memories and callback functions corresponding to the data objects in the memories.
In one possible implementation, the monitor callback operations include the following operations:
searching or creating interface nodes corresponding to the data objects in the memories in a user interface according to the paths of the data objects in the memories;
sequencing each callback function according to the path of the data object in the memory corresponding to each callback function;
and sequentially calling callback functions corresponding to the data objects in the memories according to the sequencing result so as to update the interface nodes corresponding to the data objects in the memories according to the updated data of the data objects in the memories.
In a possible implementation manner, the sorting the callback functions according to the paths of the data objects in the memory corresponding to the callback functions includes:
and sequencing the callback functions in a shallow-to-deep order according to the path depth of the data object in the memory corresponding to the callback functions.
In a possible implementation manner, the sorting the callback functions according to the paths of the data objects in the memory corresponding to the callback functions includes:
and under the condition that the path depths of the data objects in the memories corresponding to the callback functions are the same and the father nodes of the interface nodes corresponding to the callback functions are the same, sequencing the callback functions according to the sequence from small to large of the index numbers of the interface nodes corresponding to the callback functions.
In a possible implementation manner, the sorting the callback functions according to the paths of the data objects in the memory corresponding to the callback functions includes:
in the interface nodes corresponding to each callback function, if the path depths of a first interface node and a second interface node are the same, and the index number of the first interface node is smaller than the index number of the second interface node, the ranking order of the callback functions corresponding to all descendant nodes of the first interface node is prior to the ranking order of the callback functions corresponding to the second interface node and all descendant nodes of the second interface node.
According to a second aspect of the embodiments of the present disclosure, there is provided an updating apparatus of a user interface, including:
the device comprises a recording module, a judging module and a display module, wherein the recording module is used for controlling a monitor to record a path and update data of a data object in a memory monitored by the monitor under the condition that the data object in the memory monitored by the monitor is detected to be updated, and one or more functions called by the data object in the memory monitored by the monitor in the updating process are taken as callback functions corresponding to the data object in the memory monitored by the monitor, wherein the path of the data object in the memory is the binding position of the data object in the memory in an interface template of a user interface;
the triggering module is configured to trigger a monitor callback operation corresponding to a data object in each memory when it is detected that a data object in each memory being monitored in the memory is updated, where the monitor callback operation is used to update an interface node corresponding to the data object in each memory according to a path and update data of the data object in each memory and a callback function corresponding to the data object in each memory.
In one possible implementation, the triggering module includes:
the creating module is used for searching or creating interface nodes corresponding to the data objects in the memories in a user interface according to the paths of the data objects in the memories;
the sequencing module is used for sequencing each callback function according to the path of the data object in the memory corresponding to each callback function;
and the updating module is used for sequentially calling callback functions corresponding to the data objects in the memories according to the sequencing result so as to update the interface nodes corresponding to the data objects in the memories according to the updating data of the data objects in the memories.
In one possible implementation, the sorting module includes:
and the first sequencing submodule is used for sequencing the callback functions in a shallow-to-deep sequence according to the path depths of the data objects in the memory corresponding to the callback functions.
In one possible implementation, the sorting module includes:
and the second sequencing submodule is used for sequencing the plurality of callback functions according to the sequence from small to large of the index numbers of the interface nodes corresponding to the plurality of callback functions under the condition that the path depths of the data objects in the memories corresponding to the plurality of callback functions are the same and the father nodes of the interface nodes corresponding to the plurality of callback functions are the same.
In one possible implementation, the sorting module includes:
and a third sorting submodule, configured to, in the interface nodes corresponding to each callback function, if path depths of a first interface node and a second interface node are the same, and an index number of the first interface node is smaller than an index number of the second interface node, sort orders of the callback functions corresponding to all descendant nodes of the first interface node are earlier than sort orders of the callback functions corresponding to the second interface node and all descendant nodes of the second interface node.
According to another aspect of the present disclosure, there is provided an updating apparatus of a user interface, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the above method.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the above-described method.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: the method comprises the steps of recording the path and the updating data of the data object in the monitored memory by the control monitor, and taking one or more functions called in the updating process as callback functions corresponding to the data object in the monitored memory by the control monitor, thereby establishing a mechanism for monitoring the updating of the data object in the monitored memory by the monitor. The method comprises the steps of triggering monitor callback operation corresponding to the data object in each memory under the condition that the data object in each memory monitored in the memory is detected to be updated, and updating the interface node corresponding to the data object in each memory according to the path, the updating data and the callback function of the data object in the memory. Therefore, the updating of the user interface driven by the updating of the data object in the memory is realized through the callback operation of the monitor, the unnecessary calculation process and calculation time can be effectively avoided, and the development and maintenance cost of a developer to the code can be reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow chart illustrating a method for updating a user interface in accordance with an exemplary embodiment.
FIG. 2 is a flow diagram illustrating a monitor callback in a method of updating a user interface in accordance with an exemplary embodiment.
Fig. 3 is a tree diagram of interface nodes in an application example of the present disclosure.
FIG. 4 is a block diagram illustrating an apparatus for updating a user interface in accordance with an exemplary embodiment.
FIG. 5 is a block diagram illustrating an apparatus for updating a user interface in accordance with an exemplary embodiment.
FIG. 6 is a block diagram illustrating an apparatus for updating a user interface in accordance with an exemplary embodiment.
FIG. 7 is a block diagram illustrating an apparatus for updating a user interface in accordance with an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
FIG. 1 is a flow chart illustrating a method for updating a user interface in accordance with an exemplary embodiment. The method may be applied to a terminal such as a smart phone, a tablet computer, a notebook computer or a desktop computer, and is not limited herein. As shown in fig. 1, the method includes:
step 100, when it is detected that the data object in the memory monitored by the monitor is updated, controlling the monitor to record the path and the update data of the data object in the memory monitored by the monitor, and taking one or more functions called by the data object in the memory monitored by the monitor in the updating process as callback functions corresponding to the data object in the memory monitored by the monitor.
Step 101, under the condition that it is detected that the data object in each monitored memory in the memory is updated, triggering a monitor callback operation corresponding to the data object in each memory, where the monitor callback operation is used to update the interface node corresponding to the data object in each memory according to the path and update data of the data object in each memory and a callback function corresponding to the data object in each memory.
In this disclosure, the path of the data object in the memory may be represented as the location where the data object in the memory is bound in the interface template of the user interface. Generally, a data object in memory can be represented as a data entity in memory, which can be, for example, a constant, a variable, or a sub-object of a constant. The interface template of the user interface can be represented as an architecture formed by the instruction modules of the user interface. The mapping between the data objects in the memory and the interface nodes in the user interface can be realized by binding the data objects in the memory at specific positions in the interface template of the user interface.
In the present disclosure, a monitor may be composed of a piece of computer program instructions, wherein the monitor may be used at least to monitor and record the path of the data object in the memory monitored by the monitor, the data generated during the update process, and the function called during the update process. The computer program instructions may be assembly instructions, Instruction Set Architecture (ISA) instructions, machine related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages.
In this disclosure, detecting that the data object in each monitored memory in the memory completes updating may include: the computer program instruction modules that are related to the update of the data objects in the memory are detected as being completed.
As an example of this embodiment, a monitor may be preset to monitor data objects in the memory. In the event that an update is detected to occur to a data object in the monitored memory (e.g., a change in the assignment of the data object in the memory), the control monitor records the path of the data object in the memory and the update data generated during the update of the data object in the memory (e.g., the assignment before the update of the data object in the memory and the assignment after the update of the data object in the memory). And taking a function called in the node updating process (for example, the for logic called by the node in the updating process) as a callback function corresponding to the data object in the memory.
In a possible implementation manner, detecting that the data object in each monitored memory in the memory completes updating may include: the computer program instruction modules that are related to the update of the data objects in the memory are detected as being completed. The updating of the data object in the memory may include, but is not limited to, any of the following: the assignment of the data object in the memory changes, the data object in the memory is created, the data object in the memory is deleted, and the like. And under the condition that the data objects in the monitored memories in the memories are detected to be updated, triggering the monitor callback operation corresponding to the data objects in the monitored memories.
The method comprises the steps of recording the path and the updating data of the data object in the monitored memory by the control monitor, and taking one or more functions called in the updating process as callback functions corresponding to the data object in the monitored memory by the control monitor, thereby establishing a mechanism for monitoring the updating of the data object in the monitored memory by the monitor. The method comprises the steps of triggering monitor callback operation corresponding to the data object in each memory under the condition that the data object in each memory monitored in the memory is detected to be updated, and updating the interface node corresponding to the data object in each memory according to the path, the updating data and the callback function of the data object in the memory. Therefore, the updating of the user interface driven by the updating of the data object in the memory is realized through the callback operation of the monitor, so that unnecessary calculation process and calculation time can be effectively avoided, and the development and maintenance cost of a developer on the code can be reduced.
FIG. 2 is a flow diagram illustrating a monitor callback in a method of updating a user interface in accordance with an exemplary embodiment. As shown in fig. 2, the monitor callback operations include:
in step 1011, interface nodes corresponding to the data objects in each memory are searched or created in the user interface according to the paths of the data objects in each memory.
Step 1012, sorting each callback function according to the path of the data object in the memory corresponding to each callback function.
And 1013, sequentially calling callback functions corresponding to the data objects in the memories according to the sequencing result to update the interface nodes corresponding to the data objects in the memories according to the update data of the data objects in the memories.
For example, traversal search may be performed in the user interface according to the path of the data object in each memory. The lookup process may include the following operations: if the interface node which is the same as the relative path of the data object in the memory is found, binding the interface node with a callback function corresponding to the data object in the memory; if the interface node which is the same as the relative path of the data object in the memory cannot be found, an interface node which is the same as the relative path of the data object in the memory is created, and the created interface node is bound with the callback function corresponding to the data object in the memory. The callback functions corresponding to the data objects in the memories may be sorted according to the paths of the data objects in the memories corresponding to the callback functions. And sequentially calling callback functions corresponding to the data objects in the memories according to the sequencing result according to the updating data of the data objects in the memories so as to update the interface nodes corresponding to the data objects in the memories.
Because the interface nodes are created in the user interface corresponding to the path depth sequence of the data objects in the memories, the callback functions are sequenced according to the paths of the data objects in the memories, and then the callback functions corresponding to the data objects in the memories are sequentially called according to the sequencing result to update the interface nodes corresponding to the data objects in the memories according to the updated data of the data objects in the memories. In the updating process of the user interface, repeated round-trip addressing in nodes with different depths is not needed, and therefore the time for interface layout of the user interface is shortened.
As an example of this embodiment, sorting each callback function according to a path of a data object in a memory corresponding to each callback function may include: and sequencing the data objects in the memory corresponding to the callback function in the order from shallow to deep according to the path depth of the data objects in the memory corresponding to the callback function.
In the present disclosure, the callback function corresponds to the data object in the memory, and at the same time, the callback function also corresponds to the interface node, so that the callback function, the data object in the memory, and the interface node may be in a one-to-one correspondence relationship.
For example, if the callback function a corresponds to the data object a and the interface node a in the memory one to one, the callback function B corresponds to the data object B and the interface node B in the memory one to one, and the path depth of the data object B in the memory is deeper than the path depth of the data object a in the memory, the callback function a is arranged in front of the callback function B. Thus, if the operation executed by the callback function a is to delete the data object a in the memory, and the operation executed by the callback function B is to update the data object B in the memory, according to the sorting rule of the present disclosure, the callback function a is executed first, the interface node a corresponding to the data object a in the memory is deleted, and the interface node B corresponding to the data object B in the memory is correspondingly deleted, and in the subsequent process of calling the callback function B, because the interface node B bound by the callback function is detected to be deleted, the callback function B will not be executed any more. And the repeated operation of updating and then deleting the interface node B in the user interface updating process is avoided. Therefore, unnecessary calculation processes and calculation time can be effectively avoided, and development and maintenance cost of a developer on codes can be reduced. In addition, because the interface nodes are created in the user interface corresponding to the path depth sequence of the data objects in the memory, the interface nodes are sequenced and executed in the order from shallow to deep according to the path depth of the data objects in the memory corresponding to the callback function, so that the nodes with different depths do not need to be repeatedly addressed back and forth in the updating process of the user interface, and the time for the interface layout of the user interface is reduced.
As another example of this embodiment, sorting each callback function according to a path of a data object in the memory corresponding to each callback function may include: and under the condition that the path depths of the data objects in the memories corresponding to the callback functions are the same and the father nodes of the interface nodes corresponding to the callback functions are the same, sequencing the callback functions according to the sequence from small to large of the index numbers of the interface nodes corresponding to the callback functions.
Generally speaking, the order of the index numbers of the nodes can be consistent with the creation time order of the nodes, and the earlier the creation time of the interface node is, the smaller the index number of the interface node is.
For example, if the callback function a corresponds to the data object a and the interface node a in the memory one to one, the callback function B corresponds to the data object B and the interface node B in the memory one to one, and the interface node a and the interface node B have the same parent node, that is, the path depth of the data object B in the memory is the same as the path depth of the data object a in the memory, and the index number of the interface node B is greater than the index number of the interface node a, the sorting order of the callback function a is prior to the sorting order of the callback function B. Therefore, the interface nodes with smaller index numbers can be effectively guaranteed to be preferentially updated, and therefore repeated addressing back and forth among the interface nodes with different depths is not needed in the process of updating the interface nodes, and therefore the time of interface layout of the user interface is shortened.
As another example of this embodiment, sorting each callback function according to a path of a data object in a memory corresponding to the callback function includes: in the interface nodes corresponding to the plurality of callback functions, if the path depths of a first interface node and a second interface node are the same, and the index number of the first interface node is smaller than the index number of the second interface node, the ranking order of the callback functions corresponding to all descendant nodes of the first interface node is prior to the ranking order of the callback functions corresponding to the second interface node and all descendant nodes of the second interface node.
Here, the descendant node of the node may include all descendant nodes of the node, such as a child node of the node, a grandchild node of the node, and a child node, a grandchild node, etc. of the grandchild node of the node.
For example, if the callback function a corresponds to the data object a and the interface node a in the memory one to one, the callback function B corresponds to the data object B and the interface node B in the memory one to one, the callback function C corresponds to the data object C and the interface node C in the memory one to one, and the callback function D corresponds to the data object D and the interface node D in the memory one to one. If interface node a and interface node B have the same parent node, the child node of interface node a is interface node C, and the child node of interface node C is interface node D, then interface node C, D may be a descendant node of interface node a. If the index number of interface node A is less than the index number of interface node B. The order of the callback functions A, B, C and D is: callback function A, callback function C, callback function D and callback function B. Therefore, the parent node with the smaller index number and the descendant nodes thereof can be effectively guaranteed to be preferentially executed, the updating sequence of the interface nodes is in the same block, repeated round-trip addressing in nodes with different depths is not needed, and the time for the interface layout of the user interface is shortened.
In one example of an application, the following is shown in FIG. 3: there are 8 nodes (examples of interface nodes) in memory. Wherein, the depth of the node is divided into 3 layers: with depth 1 there is node 1. With depth 2 there are nodes 2, 3. With depth 3 there are nodes 4, 5, 6, 7, 8. In the updating process of the user interface, the rendering nodes are arranged from top to bottom and from left to right.
Assuming that the watchers are all bound to the data objects in the memories corresponding to the nodes 2, 3, 4, 5, 6, 7, and 8, in the process of updating the data objects in the memories corresponding to the nodes 2, 3, 4, 5, 6, 7, and 8, the monitors bound to the data objects in the corresponding memories record the paths of the data objects in the corresponding memories, the update data in the updating process, and the functions called in the updating process, and use these functions as callback functions. After determining that the nodes 2, 3, 4, 5, 6, 7, 8 complete the update, a binding is triggered at each watchdog callback (an example of a monitor callback).
Sequencing callback functions corresponding to the nodes according to the paths corresponding to the nodes, comprising the following steps: sequencing the nodes from small to large according to the depth of the corresponding nodes of the callback function; under the condition that the path depths of the data objects in the memories corresponding to the callback functions are the same and the father nodes of the interface nodes corresponding to the callback functions are the same, sequencing the callback functions according to the sequence from small to large of the index numbers of the interface nodes corresponding to the callback functions; in the interface nodes corresponding to the plurality of callback functions, if the path depths of a first interface node and a second interface node are the same, and the index number of the first interface node is smaller than the index number of the second interface node, the ranking order of the callback functions corresponding to all descendant nodes of the first interface node is prior to the ranking order of the callback functions corresponding to the second interface node and all descendant nodes of the second interface node. Thus, the watch callback processing order is: the callback function logic of the node 2 with the depth of 2 is executed, the callback function logic of the node 4 and the node 5 with the depth of 3 is executed in sequence, the callback function logic of the node 3 with the depth of 2 is executed, and then the callback function logic of the nodes 6, 7 and 8 with the depth of 3 is executed in sequence. These watchdog callback processes will reflect updates to the interface nodes in the user interface, and thus complete the update of the user interface.
This has the advantages that: the callback logic execution of the node with high depth is prevented from being earlier than that of the node with low depth. Such as: if the if logic corresponding to the node 4 is to re-assign the node 4, the for logic of the node 2 is to delete the node. Then, when executing the for logic of node 2, node 2 and its child nodes including node 4 will be deleted, and the logic execution of node 4 is unnecessary. The callback function corresponding to the node 4 is placed behind the callback function corresponding to the node 2 to be executed, so that the function which is not required to be executed is effectively prevented from being executed in advance. In addition, the parent node with a smaller index number and the descendant nodes thereof can be effectively ensured to be sequentially executed, so that the updating sequence of the interface nodes is in the same block, and repeated round-trip addressing in nodes with different depths is not needed, thereby reducing the time of interface layout of the user interface.
FIG. 4 is a block diagram illustrating an apparatus for updating a user interface in accordance with an exemplary embodiment. As shown in fig. 4, the apparatus includes:
the recording module 41 is configured to, when it is detected that a data object in the memory monitored by the monitor is updated, control the monitor to record a path and update data of the data object in the memory monitored by the monitor, and use one or more functions called by the data object in the memory monitored by the monitor in the updating process as callback functions corresponding to the data object in the memory monitored by the monitor, where the path of the data object in the memory is a position where the data object in the memory is bound in an interface template of the user interface.
A triggering module 42, configured to trigger a monitor callback operation corresponding to a data object in each memory when it is detected that a data object in each memory being monitored in the memory is updated, where the monitor callback operation is used to update an interface node corresponding to the data object in each memory according to a path and update data of the data object in each memory and a callback function corresponding to the data object in each memory.
The method comprises the steps of recording the path and the updating data of the data object in the monitored memory by the control monitor, and taking one or more functions called in the updating process as callback functions corresponding to the data object in the monitored memory by the control monitor, thereby establishing a mechanism for monitoring the updating of the data object in the monitored memory by the monitor. The method comprises the steps of triggering monitor callback operation corresponding to the data object in each memory under the condition that the data object in each memory monitored in the memory is detected to be updated, and updating the interface node corresponding to the data object in each memory according to the path of the data object in the memory, an updated data callback function and a sequencing rule. Therefore, the updating of the user interface driven by the updating of the data object in the memory is realized through the callback operation of the monitor, so that unnecessary calculation process and calculation time can be effectively avoided, and the development and maintenance cost of a developer on the code can be reduced.
FIG. 5 is a block diagram illustrating an apparatus for updating a user interface in accordance with an exemplary embodiment. For convenience of explanation, only the portions related to the present embodiment are shown in fig. 5. Components in fig. 5 that are numbered the same as those in fig. 4 have the same functions, and detailed descriptions of these components are omitted for the sake of brevity. As shown in fig. 5:
the trigger module 42 includes:
the creating module 421 is configured to search or create an interface node corresponding to the data object in each memory in a user interface according to the path of the data object in each memory.
And a sorting module 422, configured to sort each callback function according to a sorting rule.
The updating module 423 is configured to sequentially call, according to the sequencing result, callback functions corresponding to the data objects in each memory according to the update data of the data objects in each memory, so as to update the interface nodes corresponding to the data objects in each memory.
In one possible implementation, the sorting module 422 includes:
and the first sequencing submodule is used for sequencing the callback functions in a shallow-to-deep sequence according to the path depths of the data objects in the memory corresponding to the callback functions.
In one possible implementation, the sorting module 422 includes:
and the second sequencing submodule is used for sequencing the plurality of callback functions according to the sequence from small to large of the index numbers of the interface nodes corresponding to the plurality of callback functions under the condition that the path depths of the data objects in the memories corresponding to the plurality of callback functions are the same and the father nodes of the interface nodes corresponding to the plurality of callback functions are the same.
In one possible implementation, the sorting module 422 includes:
and a third sorting submodule, configured to, in the interface nodes corresponding to the plurality of callback functions, if path depths of a first interface node and a second interface node are the same, and an index number of the first interface node is smaller than an index number of the second interface node, sort orders of the callback functions corresponding to all descendant nodes of the first interface node are earlier than sort orders of the callback functions corresponding to the second interface node and all descendant nodes of the second interface node.
The method and the device can effectively ensure that the father node with smaller index number and the descendant nodes thereof are preferentially executed, so that the updating sequence of the interface nodes is in the same block, and repeated addressing back and forth in the nodes with different depths is not needed, thereby reducing the time of interface layout of the user interface.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 6 is a block diagram illustrating an apparatus for updating a user interface in accordance with an exemplary embodiment. For example, the apparatus 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 6, the apparatus 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the apparatus 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power components 806 provide power to the various components of device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the apparatus 800.
The multimedia component 808 includes a screen that provides an output interface between the device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the apparatus 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device 800. For example, the sensor assembly 814 may detect the open/closed status of the device 800, the relative positioning of components, such as a display and keypad of the device 800, the sensor assembly 814 may also detect a change in the position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration/deceleration of the device 800, and a change in the temperature of the device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communications between the apparatus 800 and other devices in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the device 800 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
FIG. 7 is a block diagram illustrating an apparatus for updating a user interface in accordance with an exemplary embodiment. For example, the apparatus 1900 may be provided as a server. Referring to fig. 7, the device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, executable by the processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The device 1900 may also include a power component 1926 configured to perform power management of the device 1900, a wired or wireless network interface 1950 configured to connect the device 1900 to a network, and an input/output (I/O) interface 1958. The device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided that includes instructions, such as the memory 1932 that includes instructions, which are executable by the processing component 1922 of the apparatus 1900 to perform the above-described method. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method for updating a user interface, comprising:
under the condition that the data object in the memory monitored by the monitor is detected to be updated, controlling the monitor to record the path and the updating data of the data object in the memory monitored by the monitor, and taking one or more functions called by the data object in the memory monitored by the monitor in the updating process as callback functions corresponding to the data object in the memory monitored by the monitor, wherein the path of the data object in the memory is the binding position of the data object in the memory in an interface template of a user interface;
under the condition that the data objects in the monitored memories in the memories are detected to be updated, triggering monitor callback operations corresponding to the data objects in the memories, wherein the monitor callback operations are used for updating interface nodes corresponding to the data objects in the memories according to the paths and the updating data of the data objects in the memories and callback functions corresponding to the data objects in the memories;
the monitor callback operations include the following operations:
searching or creating interface nodes corresponding to the data objects in the memories in a user interface according to the paths of the data objects in the memories;
sequencing each callback function according to the path of the data object in the memory corresponding to each callback function;
and sequentially calling callback functions corresponding to the data objects in the memories according to the sequencing result so as to update the interface nodes corresponding to the data objects in the memories according to the updated data of the data objects in the memories.
2. The method of claim 1, wherein sorting the callback functions according to the path of the data object in the memory corresponding to the callback functions comprises:
and sequencing the callback functions in a shallow-to-deep order according to the path depth of the data object in the memory corresponding to the callback functions.
3. The method of claim 1, wherein sorting the callback functions according to the path of the data object in the memory corresponding to the callback functions comprises:
and under the condition that the path depths of the data objects in the memories corresponding to the callback functions are the same and the father nodes of the interface nodes corresponding to the callback functions are the same, sequencing the callback functions according to the sequence from small to large of the index numbers of the interface nodes corresponding to the callback functions.
4. The method of claim 1, wherein sorting the callback functions according to the path of the data object in the memory corresponding to the callback functions comprises:
in the interface nodes corresponding to each callback function, if the path depths of a first interface node and a second interface node are the same, and the index number of the first interface node is smaller than the index number of the second interface node, the ranking order of the callback functions corresponding to all descendant nodes of the first interface node is prior to the ranking order of the callback functions corresponding to the second interface node and all descendant nodes of the second interface node.
5. An apparatus for updating a user interface, comprising:
the device comprises a recording module, a judging module and a display module, wherein the recording module is used for controlling a monitor to record a path and update data of a data object in a memory monitored by the monitor under the condition that the data object in the memory monitored by the monitor is detected to be updated, and one or more functions called by the data object in the memory monitored by the monitor in the updating process are taken as callback functions corresponding to the data object in the memory monitored by the monitor, wherein the path of the data object in the memory is the binding position of the data object in the memory in an interface template of a user interface;
the trigger module is used for triggering monitor callback operations corresponding to the data objects in the memories under the condition that the data objects in the memories to be monitored in the memories are detected to be updated, and the monitor callback operations are used for updating interface nodes corresponding to the data objects in the memories according to the paths and the updating data of the data objects in the memories and callback functions corresponding to the data objects in the memories;
the trigger module includes:
the creating module is used for searching or creating interface nodes corresponding to the data objects in the memories in a user interface according to the paths of the data objects in the memories;
the sequencing module is used for sequencing each callback function according to the path of the data object in the memory corresponding to each callback function;
and the updating module is used for sequentially calling callback functions corresponding to the data objects in the memories according to the sequencing result so as to update the interface nodes corresponding to the data objects in the memories according to the updating data of the data objects in the memories.
6. The apparatus of claim 5, wherein the ordering module comprises:
and the first sequencing submodule is used for sequencing the callback functions in a shallow-to-deep sequence according to the path depths of the data objects in the memory corresponding to the callback functions.
7. The apparatus of claim 5, wherein the ordering module comprises:
and the second sequencing submodule is used for sequencing the plurality of callback functions according to the sequence from small to large of the index numbers of the interface nodes corresponding to the plurality of callback functions under the condition that the path depths of the data objects in the memories corresponding to the plurality of callback functions are the same and the father nodes of the interface nodes corresponding to the plurality of callback functions are the same.
8. The apparatus of claim 5, wherein the ordering module comprises:
and a third sorting submodule, configured to, in the interface nodes corresponding to each callback function, if path depths of a first interface node and a second interface node are the same, and an index number of the first interface node is smaller than an index number of the second interface node, sort orders of the callback functions corresponding to all descendant nodes of the first interface node are earlier than sort orders of the callback functions corresponding to the second interface node and all descendant nodes of the second interface node.
9. An apparatus for updating a user interface, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
performing the method of any one of claims 1 to 4.
10. A non-transitory computer readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the method of any of claims 1 to 4.
CN201810399980.5A 2018-04-28 2018-04-28 User interface updating method and device Active CN108427568B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810399980.5A CN108427568B (en) 2018-04-28 2018-04-28 User interface updating method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810399980.5A CN108427568B (en) 2018-04-28 2018-04-28 User interface updating method and device

Publications (2)

Publication Number Publication Date
CN108427568A CN108427568A (en) 2018-08-21
CN108427568B true CN108427568B (en) 2021-04-27

Family

ID=63162096

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810399980.5A Active CN108427568B (en) 2018-04-28 2018-04-28 User interface updating method and device

Country Status (1)

Country Link
CN (1) CN108427568B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857579B (en) * 2019-02-15 2021-07-30 深圳市迅雷网文化有限公司 Data processing method and related device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655789A (en) * 2009-09-22 2010-02-24 用友软件股份有限公司 Method and device for realizing hot plugging of application components
CN103377059A (en) * 2012-04-23 2013-10-30 阿里巴巴集团控股有限公司 Function module dynamic loading method and device based on jQuery framework
CN103488474A (en) * 2013-09-02 2014-01-01 用友软件股份有限公司 Data object monitoring device and data object monitoring method
CN107315646A (en) * 2016-04-27 2017-11-03 北京京东尚科信息技术有限公司 Data flow control method and device between page assembly
CN107463372A (en) * 2017-07-07 2017-12-12 北京小米移动软件有限公司 The method for updating pages and device of a kind of data-driven

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101655789A (en) * 2009-09-22 2010-02-24 用友软件股份有限公司 Method and device for realizing hot plugging of application components
CN103377059A (en) * 2012-04-23 2013-10-30 阿里巴巴集团控股有限公司 Function module dynamic loading method and device based on jQuery framework
CN103488474A (en) * 2013-09-02 2014-01-01 用友软件股份有限公司 Data object monitoring device and data object monitoring method
CN107315646A (en) * 2016-04-27 2017-11-03 北京京东尚科信息技术有限公司 Data flow control method and device between page assembly
CN107463372A (en) * 2017-07-07 2017-12-12 北京小米移动软件有限公司 The method for updating pages and device of a kind of data-driven

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Callback回调技术在数字化城管部件在线更新系统中的应用;周丽娟等;《计算机与数字工程》;20111231(第6期);第157-161页 *

Also Published As

Publication number Publication date
CN108427568A (en) 2018-08-21

Similar Documents

Publication Publication Date Title
CN107423106B (en) Method and apparatus for supporting multi-frame syntax
US20170316011A1 (en) Method and apparatus for searching resource
US20160314164A1 (en) Methods and devices for sharing cloud-based business card
CN107463372B (en) Data-driven page updating method and device
CN110704053B (en) Style information processing method and device
EP3118729A1 (en) Method and device for presenting tasks
CN104951522B (en) Method and device for searching
EP2985697A1 (en) Method and device for controlling router plug-in
CN108563487B (en) User interface updating method and device
CN108427568B (en) User interface updating method and device
CN111382161A (en) State data processing method and device, electronic equipment and storage medium
CN108549570B (en) User interface updating method and device
CN109901726B (en) Candidate word generation method and device and candidate word generation device
CN107885571B (en) Display page control method and device
CN113590091A (en) Data processing method and device, electronic equipment and storage medium
CN110417987B (en) Operation response method, device, equipment and readable storage medium
CN112581102A (en) Task management method and device, electronic equipment and storage medium
CN106843860B (en) Method, device and system for adjusting display style of search box
CN111221613A (en) Program calling method and device and storage medium
CN113946346B (en) Data processing method and device, electronic equipment and storage medium
CN111625251B (en) Method and device for processing application instance
CN111767063A (en) Resource updating method, device and equipment for application program
CN109726118B (en) Application program development method and device, electronic equipment and storage medium
CN111596949B (en) Method and device for developing application program
CN111221512B (en) Function module mixed use method, electronic device and storage medium

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