CN112800362A - Interface view delay loading method and device - Google Patents

Interface view delay loading method and device Download PDF

Info

Publication number
CN112800362A
CN112800362A CN202110155778.XA CN202110155778A CN112800362A CN 112800362 A CN112800362 A CN 112800362A CN 202110155778 A CN202110155778 A CN 202110155778A CN 112800362 A CN112800362 A CN 112800362A
Authority
CN
China
Prior art keywords
view
interface
layout
layout file
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110155778.XA
Other languages
Chinese (zh)
Inventor
郭欢欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bigo Technology Singapore Pte Ltd
Original Assignee
Bigo Technology Singapore Pte 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 Bigo Technology Singapore Pte Ltd filed Critical Bigo Technology Singapore Pte Ltd
Priority to CN202110155778.XA priority Critical patent/CN112800362A/en
Publication of CN112800362A publication Critical patent/CN112800362A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • 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/451Execution arrangements for user interfaces

Abstract

The embodiment of the application discloses a method and a device for delayed loading of an interface view. According to the technical scheme provided by the embodiment of the application, the constraint layout of the flat view hierarchy structure is used as the root test chart group of the interface, so that the view layout file is analyzed more efficiently during operation, more constraint rules can be provided, various complex layout effects are realized, and the development efficiency is improved; the traceable views with small memory occupation are used for occupying space in the constraint layout, and layout parameters of view layout files in the constraint layout are set on the traceable views, so that the dependency relationship between the hierarchical structure information of each traceable view in the constraint layout and each traceable view can be determined, and the analysis cost is low; the view layout file of the view is analyzed through the source tracing view, the view metadata can be placed at the corresponding position, the view is subjected to delay loading as required according to the dependency relationship among the views, the program operation fluency is greatly improved, the layout coupling of complex interfaces is reduced, and the development iteration cost is reduced.

Description

Interface view delay loading method and device
Technical Field
The embodiment of the application relates to the technical field of application program development, in particular to a method and a device for delayed loading of an interface view, computer equipment and a storage medium.
Background
In android, layouts are used to define interface structures in an application. All elements in the layout are built using a hierarchy of views and view group objects. Layout can be declared specifically in two ways, one is to declare interface elements in XML (extensible markup language), and android provides concise XML vocabularies corresponding to the view class and subclasses thereof, such as vocabularies for view and layout; the second is to instantiate layout elements at runtime, and programmatically create view objects and view group objects. Each view object implements a nested class that extends the view group layout parameters. The attribute types contained in this sub-category will define the size and position for each sub-view of the set of views as needed. When compiling an application, the system will compile each XML layout file into a view resource. The layout resources in the in-loaded application code are implemented in the activity.
For a complex android interface, some view elements are displayed without entering the interface, and are displayed when the touch time of a relevant user or the program state change is received, so that two implementation modes are generally available. One is that all statements are set in the layout file with their visibility set to hidden or invisible first, and then set to visible again when the condition is satisfied. The disadvantage of this approach is that although the view settings are invisible, a large number of view objects and layout property objects are created when the layout is loaded, and for a more complex interface, more objects are created, which affects the program execution performance, and more seriously causes interface stumbling, which affects the user experience. Secondly, the view element is instantiated during the operation, a layout parameter object is created, and the view element is added into the interface. The defect of this method is that in order to ensure the hierarchy of the view elements, the insertion positions of the view elements and the attributes of the layout parameters need to be calculated in real time according to the layout state of the current interface, so as to avoid the situation that the view elements are blocked or the layout parameters are wrong. And when the dynamic addition of new view elements is subsequently resumed, the existing view elements also need to be adjusted according to the situation. For complex interfaces, code logic is difficult to write, and program modification and maintenance are difficult when the subsequent interface design is changed.
Disclosure of Invention
The embodiment of the application provides an interface view delayed loading method and device, computer equipment and a storage medium, so that view elements are delayed and loaded, program operation smoothness is guaranteed, and multi-service scene expansion is supported.
In a first aspect, an embodiment of the present application provides an interface view delay loading method, including:
loading an interface view layout file corresponding to an interface to be displayed, wherein the interface view layout file takes constraint layout as a root view group, a plurality of traceability views are formed in the root view group of the interface view layout file, each traceability view respectively has layout parameters and hierarchical structure information, and dependency relationships are formed among the traceability views;
analyzing the interface view layout file to obtain interface view metadata, wherein the interface view metadata comprise view layout files of views included in an interface to be displayed, and the view layout files comprise attribute parameters and dependency relationships among the views; each tracing view corresponds to a view layout file; the layout parameter of the tracing view is used for indicating the corresponding view layout file;
when view trigger information is received, responding to the view trigger information based on the corresponding view layout file.
In a second aspect, an embodiment of the present application provides an interface view delay loading apparatus, including:
a file loading module: the interface view layout file is used for loading an interface view layout file corresponding to an interface to be displayed, the interface view layout file takes constraint layout as a root view group, a plurality of source tracing views are formed in the root view group of the interface view layout file, each source tracing view is provided with layout parameters, and a dependency relationship is formed among the source tracing views;
a file analysis module: the interface view layout file is used for analyzing the interface view layout file to obtain interface view metadata, the interface view metadata comprise view layout files of views included in an interface to be displayed, and the view layout files comprise attribute parameters and hierarchical structure information among the views; each tracing view corresponds to a view layout file; the layout parameter of the tracing view is used for indicating the corresponding view layout file;
the view loading module: and the view layout file is used for loading the corresponding view layout file when the view trigger information is received.
In a third aspect, an embodiment of the present application provides a computer device, including: a memory and one or more processors;
the memory for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement an interface view latency loading method as described in the first aspect.
In a fourth aspect, embodiments of the present application provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform an interface view latency loading method according to the first aspect.
According to the embodiment of the application, the constraint layout of the flat view hierarchical structure is used as the root trial graph group of the interface, so that the view layout file is analyzed more efficiently during operation, more constraint rules can be provided, various complex layout effects are realized, and the development efficiency is improved; the traceable views with small memory occupation are used for occupying space in the constraint layout, the layout parameters of the view layout files in the constraint layout are set on the traceable views, the dependency relationship between the hierarchical structure information of each traceable view in the constraint layout and each traceable view can be determined, and the analysis cost and the creation cost are low; the view layout file of the view is analyzed through the source tracing view, the view metadata can be placed at the corresponding position, the view is subjected to delay loading according to the requirement according to the dependency relationship among the views, the program operation fluency is greatly improved, the layout coupling of complex interfaces is reduced, the development iteration cost is reduced, and the expansion of various service scenes is supported.
Drawings
Fig. 1 is a flowchart of an interface view delay loading method according to an embodiment of the present application;
fig. 2 is a flowchart of another interface view delay loading method according to an embodiment of the present application;
fig. 3 is a flowchart of another interface view delay loader method according to an embodiment of the present application;
fig. 4 is a flowchart of another interface view delay loading method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an interface view delay loading apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, specific embodiments of the present application will be described in detail with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some but not all of the relevant portions of the present application are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The embodiment of the application provides an interface view delayed loading method and device, computer equipment and a storage medium. According to the embodiment of the application, the constraint layout of the flat view hierarchical structure is used as the root trial graph group of the interface, so that the view layout file is analyzed more efficiently during operation, more constraint rules can be provided, various complex layout effects are realized, and the development efficiency is improved; the traceable views with small memory occupation are used for occupying space in the constraint layout, the layout parameters of the view layout files in the constraint layout are set on the traceable views, the dependency relationship between the hierarchical structure information of each traceable view in the constraint layout and each traceable view can be determined, and the analysis cost and the creation cost are low; the view layout file of the view is analyzed through the source tracing view, the view metadata can be placed at the corresponding position, the view is subjected to delay loading according to the requirement according to the dependency relationship among the views, the program operation fluency is greatly improved, the layout coupling of complex interfaces is reduced, the development iteration cost is reduced, and the expansion of various service scenes is supported.
The following are detailed below.
Fig. 1 is a flowchart of an interface view delay loading method according to an embodiment of the present application, where the interface view delay loading method according to the embodiment of the present application may be executed by an interface view delay loading apparatus, and the interface view delay loading apparatus may be implemented by hardware and/or software and integrated in a computer device.
The following description will be given by taking an example in which an interface view delay loading apparatus executes an interface view delay loading method. Referring to fig. 1, the interface view delay loading method includes:
101: and loading an interface view layout file corresponding to the interface to be displayed.
The interface view layout file is a file generated by describing interface view information of an interface to be displayed in a structured language in advance. The developer can create the interface view layout file in advance according to the business needs and the structured language specification. In an embodiment of the present application, the structured language to which the interface view layout file is applied may be XML (extensible markup language). The interface view information of the interface to be displayed may correspond to one or more interface view layout files, that is, may correspond to one or more views, and the number of views may be set according to business requirements.
The interface view layout file in this embodiment takes constraint layout as a root view group. Constrained layouts are large layouts that use a flat view hierarchy to create a complex, i.e., non-nested, set of views. All views in the constraint layout are laid out according to the relation between the peer view and the parent view, and the analysis of the layout file is more efficient during operation. In the constraint layout, a plurality of traceback views are formed, and the traceback views occupy the place in the constraint layout. Each tracing view is provided with layout parameters and hierarchical structure information, and a dependency relationship is formed among all the tracing views. The traceable view is initially an invisible view with a size of 0 in the embodiment, so that the layout parameters of the constraint layout are set on the traceable view, and the hierarchical structure information of each traceable view in the constraint layout and the mutual dependency relationship between each traceable view can be determined. The memory occupation of the source tracing view object is small, so that the analyzing and creating cost is lower.
In the embodiment of the application, the interface view layout file corresponding to the interface to be displayed may be specifically determined according to the corresponding relationship between the interface and the interface view layout file. The layout parameters may include attribute parameters such as background color, foreground color, font color, text font, font size, font type, and the like. The hierarchical structure information includes a peer structure relationship and a parent-child structure relationship.
The source tracing view may be specifically expressed in a view stub manner in the embodiment of the present application, and in other examples, the source tracing view may also be a fragment view, and the attribute information and the dependency relationship of the view may be acquired through the source tracing view.
102: and analyzing the interface view layout file to obtain interface view metadata.
The interface view primitive data comprises a view layout file of views contained in an interface to be displayed, and the view layout file comprises attribute parameters and dependency relations among the views. Each tracing view corresponds to a view layout file, and the layout parameters of the tracing view are used for indicating the corresponding view layout file.
The embodiment is applied to an android system, and the required hardware environment is hardware equipment supporting the android system. An example of an applicable hardware device is an android mobile terminal. Illustratively, layout loading may be applied to complex interfaces in android mobile terminals. For example, a forum application applied to an android mobile terminal loads an interface view layout file of each application in the android mobile terminal, including the interface view layout file of the forum application. In an initial display interface of an android mobile terminal, only the most initial view of the application program for symbolizing the identity of the application program and playing a role in representation is often displayed, and various complex view relationships in the application program are not loaded. When a user enters an interface, perhaps the interface of the initial origin of entering the android mobile terminal, an initial view of one or more applications is displayed in the interface. Or the user enters an interface which refers to the initial interface of a specific application program displayed after the application program is touched. In this embodiment, loading the interface view layout file corresponding to the interface to be displayed includes the above two cases. For both cases, the specific view in a specific application program is actually finally parsed and loaded. In the first case, the user enters an initial interface of the android mobile terminal, and the interface view layout files of all the application programs in the interface are loaded. In this case, the step often includes the user selecting all the application programs and selecting a specific application program. And when the second condition is met, entering a specific interface of the application program, and loading the interface view layout file of the application program.
As an application scenario, in the forum application, each registered user of the forum is assigned a virtual room, a microphone for presenting a speech to the registered user is set in the room, and various decorations such as head portrait, head portrait frame, nickname, level, expression, special effect of getting on the microphone are provided on the microphone. The decorations are stacked on the microphone according to a certain layout rule, are not displayed when a registered user initially enters a room interface, and are displayed as required when data are pulled or specific time notification is received. In this embodiment, the decorations are actually divided into different views, each view respectively completes its own service function, and addition, deletion, layout planning adjustment and the like of the decorations are easily implemented according to the service adjustment, so that the encoding is convenient, the flexible configuration is possible, and the expandability is strong.
Before the view is displayed as required, the interface is entered, and the interface view layout file corresponding to the interface to be displayed is analyzed to obtain interface view metadata. The required view can be displayed through a view layout file of the interface view element data.
103: when view trigger information is received, responding to the view trigger information based on the corresponding view layout file.
The view trigger information in the embodiment of the application may be initiated by a user actively, for example, when the user logs in to a specific application interface, such as a forum application, the forum application provides a personal virtual room and a public forum, and when the user further clicks to enter the personal virtual room, the user triggers a view layout file, such as a user name, a user level, a user head portrait and a published language, which loads a first-level decoration in the personal virtual room. On the other hand, the triggering may be triggered by other conditions, for example, the triggering condition is preset, when the user enters the personal virtual room in the forum application program, the view layout file of the first-level decoration in the personal virtual room, such as a user name, a user level, and a user head portrait, is triggered and loaded, if the triggering condition is a preset duration, and when the preset duration is met, the view layout file of the user posting the speech is automatically loaded and displayed.
In this embodiment of the present application, specifically, the layout parameters of the traceable view include a first ID attribute and a lazy loading attribute, the view layout file includes a second ID attribute, and the assignment of the first ID attribute, the assignment of the lazy loading (infledid) attribute, and the assignment of the second ID attribute are equal.
The layout properties are specified in layout parameters of the traceable view, which are used to indicate the corresponding view layout file. When the view elements of the view layout file are loaded at a subsequent delay, the layout parameters of the traceback view are applied to the view. And assigning consistency is kept among a first ID attribute and a lazy loading attribute in the layout parameters of the specified tracing view and a second ID attribute of the layout parameters of the specified view layout file. And when the interface view layout file is loaded, rewriting the second ID attribute by using the lazy loading attribute. Therefore, after the view is loaded in a delayed mode, constraint setting in the layout file can be guaranteed to be continuously effective according to the ID attribute of the view, and the view elements are placed on the corresponding positions of the interface.
As shown in fig. 2, an embodiment of the present application further provides another interface view delay loading method, including:
201: and loading an interface view layout file corresponding to the interface to be displayed.
202: and analyzing the interface view layout file to obtain all view layout files of the interface view metadata.
And analyzing the interface view layout file based on the loaded interface view layout file to obtain interface view metadata. In this embodiment, the interface view metadata corresponds to one or more view layout files, and after parsing, all view layout files of the interface view metadata may be acquired. The view layout file corresponds to a view, which may include one or more view elements.
203: defining each view layout file corresponding to the source view as a target view layout file, acquiring the attribute parameters of the target view layout file, and analyzing the attribute parameters of the target view layout file.
In the embodiment of the present application, a root view group with constrained layout is adopted, and this root view group contains hierarchical structure information, that is, the hierarchical relationship between different views, including the parent-child relationship between a peer in the root view group and an upper-lower level. In the method, the source tracing view mode is mainly adopted to occupy the position in the constraint layout, but the method is not limited in that all views in the constraint layout adopt the source tracing view mode, and comprises a source tracing view display mode and a non-source tracing view display mode so as to adapt to the delayed loading-on-demand of some view elements and the delayed loading of some view elements. In this embodiment, the focus is on further description of the view elements that need to be displayed with a delay. Therefore, the view layout file needing to be loaded in a delayed and required mode is defined as the target view layout file, only the attribute parameters of the target view layout file are obtained, and the attribute parameters are analyzed, so that the view can be loaded according to the attribute parameters in the follow-up process.
204: and acquiring the dependency relationship among the views based on the attribute parameters of the target view layout files.
Because the hierarchical structure relationship and the layout parameters of each traceability view are configured in the constraint layout, the traceability views correspond to the specific view layout files, the view layout files comprise attribute parameters, the attribute parameters of the view layout files and the attribute parameters of the traceability views are mapped mutually, the traceability views corresponding to the view layout files can be obtained according to the attribute parameters of the view layout files, the traceability views have dependency relationships among the traceability views, and the corresponding dependency relationships are formed among the view layout files. In the application, dependency relationships, namely, loaded precedence relationships, are formed among the views. Since the views correspond to view layout files, there are also dependencies between the view layout files.
205: when view trigger information is received, responding to the view trigger information based on the corresponding view layout file.
Fig. 3 is a flowchart illustrating another interface view delay loading method according to an embodiment of the present application, where as shown in fig. 3, an interface view delay loading method includes:
301: and loading an interface view layout file corresponding to the interface to be displayed.
302: and analyzing the interface view layout file to obtain all view layout files of the interface view metadata.
303: defining each view layout file corresponding to the source view as a target view layout file, acquiring the attribute parameters of the target view layout file, and analyzing the attribute parameters of the target view layout file.
In this step, a view layout file of all views inside the constrained layout can be obtained by a getChildren () method in the constrained layout, whether the view is a traceable view is further judged, the view is defined as ViewStub a, if so, all attribute parameters of the view layout file are obtained by a getLayoutParams () method, and the attribute parameters are analyzed.
304: and calling a view finding function to find a target object based on each assignment in the attribute parameters of the target view layout file. The view finding function is also the findViewById () method.
The attribute parameters correspond to various parameters, and each parameter corresponds to an assignment. E.g. the property parameters comprise font size, font color, the font size and font analysis correspond to the assignment, respectively. Specifically, for example, the attribute parameters include "layout _ constrained left _ tolftof, layout _ constrained left _ tolghtof, layout _ constrained right _ tolftof, layout _ constrained right _ toltoff, layout _ constrained right _ toltopof, layout _ constrained bottom _ topof, layout _ constrained bottom _ toltoff, layout _ constrained base _ topfoundation _ topof, layout _ constrained bottom _ topend, layout _ constrained bottom _ totail, layout _ constrained bottom _ tot _ endof, layout _ constrained bottom _ tot, layout _ constrained bottom _ tot _ start _ tot, layout _ constrained bottom _ end, layout _ entry, and layout _ end _ object _ end _ obtained, and the values of the respective attribute parameters are obtained.
The findViewById () method finds the target object by calling the desired view in the object, i.e., finding the view group and sub-views. And judging the type of the obtained target object by calling a findViewById () method, if the type is also the source view type and is positioned as a Viewstub B, the Viewstub B is the view depended by the Viewstub A, and storing the dependency relationship of the Viewstub B in a storage dependency relationship set. When the view pointed by the ViewStub a needs to be loaded as required, it is first determined whether the view pointed by the ViewStub B has been loaded first.
305: when the target object corresponds to the source tracing view, defining the target object as a dependent view layout file of the target view layout file, and acquiring the dependency relationship between the target view layout file and the target object.
When the found target object corresponds to a source view, namely belongs to a delayed view loaded on demand, the target object is a dependent view of a target view layout file, and the dependency relationship is acquired so as to judge whether the dependent view is loaded in advance when the view is loaded in the follow-up process.
In this embodiment, the dependency relationship between the target view layout file and the target object is stored in a set, and the set further stores flag information, where the flag information is used to indicate whether the target view layout file is completely loaded.
306: when view trigger information is received, responding to the view trigger information based on the corresponding view layout file.
Fig. 4 is a flowchart illustrating another interface view delay loading method according to an embodiment of the present application, and as shown in fig. 4, an interface view delay loading method includes:
401: and loading an interface view layout file corresponding to the interface to be displayed.
402: and analyzing the interface view layout file to obtain all view layout files of the interface view metadata.
403: defining each view layout file corresponding to the source view as a target view layout file, acquiring the attribute parameters of the target view layout file, and analyzing the attribute parameters of the target view layout file.
404: and calling a view finding function to find a target object based on each assignment in the attribute parameters of the target view layout file. Specifically, in this embodiment, the view finding function is a findViewById () method, which defines attributes of a view in a file to obtain a corresponding view object.
405: when the target object corresponds to the source tracing view, defining the target object as a dependent view layout file of the target view layout file, and acquiring the dependency relationship between the target view layout file and the target object.
406: and receiving view trigger information, wherein the view trigger information comprises the view information to be loaded. And calling a target view layout file corresponding to the view information to be loaded based on the view trigger information.
407: and detecting whether the target view layout file is completely loaded. And responding to the view trigger information when the loading of the target view layout file is completed. And when the target view layout file is not loaded completely, acquiring the dependency relationship of the target view layout file.
408: and judging whether all the target objects corresponding to the dependency relationship are loaded completely, and loading the target view layout file when all the target objects are loaded completely. And when the target objects are not completely loaded, loading the unloaded target objects, and loading the target view layout file after all the target objects are completely loaded.
In this embodiment, when view loading is performed, it is first checked from the stored set of dependency relationships whether other views that depend on are loaded in advance, and if not, the view that depends on is loaded first. And repeating the recursive check until the views in the dependency relationship are loaded completely, and then loading the views. And expanding a flag bit in the set of the storage dependency relationship, setting flag information, wherein the flag information is false initially, is modified to true during loading, and can judge whether the view is loaded according to the flag information.
As a preferred embodiment, responding to the view trigger information includes rendering and displaying a view corresponding to the target view layout file.
As shown in fig. 5, an embodiment of the present application further provides an interface view delay loading apparatus, which includes a file loading module 501, a file parsing module 502, and a view loading module 503. The file loading module 501 is configured to load an interface view layout file corresponding to an interface to be displayed, where the interface view layout file uses constraint layout as a root view group, a plurality of source tracing views are formed in the root view group of the interface view layout file, each source tracing view has layout parameters, and a dependency relationship is formed between the source tracing views. The file analysis module 502 is configured to analyze the interface view layout file to obtain interface view metadata, where the interface view metadata includes a view layout file of views included in an interface to be displayed, and the view layout file includes attribute parameters and hierarchical structure information between the views; each tracing view corresponds to a view layout file; the layout parameter of the tracing view is used for indicating the corresponding view layout file. The view loading module 503 is configured to load the corresponding view layout file when receiving the view trigger information.
In this embodiment, the layout parameters of the source-tracing view include a first ID attribute and a lazy loading attribute, the view layout file includes a second ID attribute, and the assignment of the first ID attribute, the assignment of the lazy loading attribute, and the assignment of the second ID attribute are all equal. And when the interface view layout file is loaded, rewriting the second ID attribute by using the lazy loading attribute.
As a preferred embodiment, in the file analyzing module 502, analyzing the interface view layout file specifically includes analyzing the interface view layout file to obtain all view layout files of the interface view metadata; defining each view layout file corresponding to a source view as a target view layout file, acquiring attribute parameters of the target view layout file, and analyzing the attribute parameters of the target view layout file; and acquiring the dependency relationship among the views based on the attribute parameters of the target view layout files.
As a further preferred embodiment, the obtaining of the dependency relationship between the views based on the attribute parameters of the view layout files of the respective targets includes: calling a findViewById () method to find a target object based on each assignment in the attribute parameters of the target view layout file; when the target object corresponds to the source tracing view, defining the target object as a dependent view layout file of the target view layout file, and acquiring the dependency relationship between the target view layout file and the target object.
In this embodiment, the dependency relationship between the target view layout file and the target object is stored in a set, and the set further stores flag information, where the flag information is used to indicate whether the target view layout file is completely loaded. When view trigger information is received, calling a target view layout file corresponding to view information to be loaded and contained in the view trigger information based on the view trigger information, detecting whether the target view layout file is completely loaded, and responding to the view trigger information when the target view layout file is completely loaded; when the target view layout file is not loaded, acquiring the dependency relationship of the target view layout file; and judging whether all the target objects corresponding to the dependency relationship are loaded completely, and loading the target view layout file when all the target objects are loaded completely.
As shown in fig. 6, an embodiment of the present application further provides a computer device, including: a memory 601 and one or more processors 602; the memory 601 is used for storing one or more programs; when executed by the one or more processors 602, cause the one or more processors to implement an interface view latency loading method as described herein.
Embodiments of the present application further provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are used to perform a method for interface view delayed loading as provided in the above embodiments.
Of course, the storage medium containing the computer-executable instructions provided in the embodiments of the present application is not limited to the interface view delayed loading method described above, and may also perform related operations in an interface view delayed loading method provided in any embodiment of the present application.
The interface view delay loading device, and the storage medium provided in the embodiments above may execute the interface view delay loading method provided in any embodiment of the present application, and reference may be made to the path selection method based on data transmission of the internet of things provided in any embodiment of the present application without detailed technical details described in the embodiments above.
The foregoing is considered as illustrative of the preferred embodiments of the invention and the technical principles employed. The present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the claims.

Claims (10)

1. An interface view delay loading method is characterized by comprising the following steps:
loading an interface view layout file corresponding to an interface to be displayed, wherein the interface view layout file takes constraint layout as a root view group, a plurality of traceability views are formed in the root view group of the interface view layout file, each traceability view respectively has layout parameters and hierarchical structure information, and dependency relationships are formed among the traceability views;
analyzing the interface view layout file to obtain interface view metadata, wherein the interface view metadata comprise view layout files of views included in an interface to be displayed, and the view layout files comprise attribute parameters and dependency relationships among the views; each tracing view corresponds to a view layout file; the layout parameter of the tracing view is used for indicating the corresponding view layout file;
when view trigger information is received, responding to the view trigger information based on the corresponding view layout file.
2. The interface view delayed loading method according to claim 1, wherein the layout parameters of the source-tracing view include a first ID attribute and a lazy loading attribute, the view layout file includes a second ID attribute, and the assignment of the first ID attribute, the assignment of the lazy loading attribute and the assignment of the second ID attribute are all equal;
and when the interface view layout file is loaded, rewriting the second ID attribute by using the lazy loading attribute.
3. The interface view delay loading method according to claim 1, wherein parsing the interface view layout file includes:
analyzing the interface view layout file to obtain all view layout files of the interface view metadata;
defining each view layout file corresponding to a source view as a target view layout file, acquiring attribute parameters of the target view layout file, and analyzing the attribute parameters of the target view layout file;
and acquiring the dependency relationship among the views based on the attribute parameters of the target view layout files.
4. The interface view delay loading method according to claim 3, wherein obtaining the dependency relationship between the views based on the attribute parameters of the view layout files of the targets comprises:
calling a view finding function to find a target object based on each assignment in the attribute parameters of the target view layout file;
when the target object corresponds to the source tracing view, defining the target object as a dependent view layout file of the target view layout file, and acquiring the dependency relationship between the target view layout file and the target object.
5. The interface view delayed loading method according to claim 4, wherein the dependency relationship between the target view layout file and the target object is stored in a set, and the set further stores flag information, and the flag information is used to indicate whether the target view layout file is completely loaded.
6. The interface view delayed loading method according to claim 5, wherein when receiving view trigger information, responding to the view trigger information based on the corresponding view layout file comprises:
receiving view trigger information, wherein the view trigger information comprises view information to be loaded;
calling a target view layout file corresponding to the view information to be loaded based on the view trigger information, and detecting whether the target view layout file is loaded completely;
when the target view layout file is loaded, responding to the view trigger information;
when the target view layout file is not loaded, acquiring the dependency relationship of the target view layout file;
and judging whether all the target objects corresponding to the dependency relationship are loaded completely, and loading the target view layout file when all the target objects are loaded completely.
7. The interface view delayed loading method of claim 6, wherein responding to the view trigger information comprises rendering and displaying a view corresponding to a target view layout file.
8. An interface view delay loading device, comprising:
a file loading module: the interface view layout file is used for loading an interface view layout file corresponding to an interface to be displayed, the interface view layout file takes constraint layout as a root view group, a plurality of source tracing views are formed in the root view group of the interface view layout file, each source tracing view is provided with layout parameters, and a dependency relationship is formed among the source tracing views;
a file analysis module: the interface view layout file is used for analyzing the interface view layout file to obtain interface view metadata, the interface view metadata comprise view layout files of views included in an interface to be displayed, and the view layout files comprise attribute parameters and hierarchical structure information among the views; each tracing view corresponds to a view layout file; the layout parameter of the tracing view is used for indicating the corresponding view layout file;
the view loading module: and the view layout file is used for loading the corresponding view layout file when the view trigger information is received.
9. A computer device, comprising: a memory and one or more processors;
the memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the interface view latency loading method of any one of claims 1-7.
10. A storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the interface view latency loading method of any one of claims 1 to 7.
CN202110155778.XA 2021-02-04 2021-02-04 Interface view delay loading method and device Pending CN112800362A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110155778.XA CN112800362A (en) 2021-02-04 2021-02-04 Interface view delay loading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110155778.XA CN112800362A (en) 2021-02-04 2021-02-04 Interface view delay loading method and device

Publications (1)

Publication Number Publication Date
CN112800362A true CN112800362A (en) 2021-05-14

Family

ID=75814190

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110155778.XA Pending CN112800362A (en) 2021-02-04 2021-02-04 Interface view delay loading method and device

Country Status (1)

Country Link
CN (1) CN112800362A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101652787A (en) * 2007-03-30 2010-02-17 微软公司 In-memory caching of shared customizable multi-tenant data
US20130226992A1 (en) * 2012-02-24 2013-08-29 Qualcomm Incorporated Cooperative loading of webpages based on shared meta information
CN105446755A (en) * 2014-08-06 2016-03-30 阿里巴巴集团控股有限公司 Method and device for rapidly loading Activity data for Android system
CN109634598A (en) * 2018-12-14 2019-04-16 北京字节跳动网络技术有限公司 A kind of page display method, device, equipment and storage medium
CN110020280A (en) * 2017-09-08 2019-07-16 腾讯科技(深圳)有限公司 Application page methods of exhibiting, device, storage medium and computer equipment
CN110832456A (en) * 2018-03-27 2020-02-21 谷歌有限责任公司 Creating default layout constraints for a graphical interface
CN111367518A (en) * 2018-12-26 2020-07-03 北京奇虎科技有限公司 Page layout method and device, computing equipment and computer storage medium
CN111475163A (en) * 2020-06-22 2020-07-31 腾讯科技(深圳)有限公司 Method, device and equipment for generating code file of view template and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101652787A (en) * 2007-03-30 2010-02-17 微软公司 In-memory caching of shared customizable multi-tenant data
US20130226992A1 (en) * 2012-02-24 2013-08-29 Qualcomm Incorporated Cooperative loading of webpages based on shared meta information
CN105446755A (en) * 2014-08-06 2016-03-30 阿里巴巴集团控股有限公司 Method and device for rapidly loading Activity data for Android system
CN110020280A (en) * 2017-09-08 2019-07-16 腾讯科技(深圳)有限公司 Application page methods of exhibiting, device, storage medium and computer equipment
CN110832456A (en) * 2018-03-27 2020-02-21 谷歌有限责任公司 Creating default layout constraints for a graphical interface
CN109634598A (en) * 2018-12-14 2019-04-16 北京字节跳动网络技术有限公司 A kind of page display method, device, equipment and storage medium
CN111367518A (en) * 2018-12-26 2020-07-03 北京奇虎科技有限公司 Page layout method and device, computing equipment and computer storage medium
CN111475163A (en) * 2020-06-22 2020-07-31 腾讯科技(深圳)有限公司 Method, device and equipment for generating code file of view template and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
CHENG JI ET AL.: "Inspection and Characterization of App File Usage in Mobile Devices", 《ACM TRANSACTIONS ON STORAGE》, 24 September 2020 (2020-09-24), pages 1 - 25, XP058691877, DOI: 10.1145/3404119 *
郝秋影: "基于Android的消息应用的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 November 2013 (2013-11-15), pages 138 - 410 *
龚文静: "基于Android平台的保健食品移动监管系统的研究与开发", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 March 2016 (2016-03-15), pages 138 - 2738 *

Similar Documents

Publication Publication Date Title
KR101790190B1 (en) Application scenario identification method, power consumption management method, apparatus, and terminal device
CN105511873B (en) User interface control display method and device
EP3304286B1 (en) Data binding dependency analysis
CN102221993B (en) The declarative definition of complex user interface Status Change
US8762936B2 (en) Dynamic design-time extensions support in an integrated development environment
US20060117267A1 (en) System and method for property-based focus navigation in a user interface
US20060174215A1 (en) Method and system for a digital device menu editor
JP2005346722A (en) Method and apparatus for generating form using form type
US8458648B2 (en) Graphical modelization of user interfaces for data intensive applications
CN111068328A (en) Game advertisement configuration table generation method, terminal device and medium
CA2786385A1 (en) Pattern-based user interfaces
CN109933381A (en) A kind of loading method and device of kernel
US8615729B2 (en) Extending existing model-to-model transformations
CN115080016A (en) Extended function implementation method, device, equipment and medium based on UE editor
CN113934429B (en) Design draft conversion method and device, computer equipment and storage medium
CN112965716B (en) Page processing method and device, electronic equipment and readable storage medium
CN113448650A (en) Live broadcast function plug-in loading method, device, equipment and storage medium
CN107977307B (en) Application debugging method and device
CN114911541B (en) Processing method and device of configuration information, electronic equipment and storage medium
CN112800362A (en) Interface view delay loading method and device
CN113177292B (en) Universal BIM secondary development implementation method and device
CN114186526A (en) Automatic punching method and device for integrated circuit based on R tree MBR algorithm
CN111124386B (en) Animation event processing method, device, equipment and storage medium based on Unity
CN114489619A (en) Interface view display method, terminal equipment and computer readable storage medium
KR100948472B1 (en) Automatic updating of variables in a data language

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