Method, device, equipment, medium and program product for caching layout parameters

CN123020510APending Publication Date: 2026-10-30BYTEDANCE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510571258.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2026-10-30

Smart Images

  • Figure CN123020510A_ABST
    Figure CN123020510A_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a method, device, equipment, storage medium and computer program product for caching layout parameters. The method comprises determining whether a layout parameter cache exists for a target control in response to a call for setting a layout parameter of the target control. The method further comprises determining whether the layout parameter of the target control needs to be set according to the layout parameter cache in response to the layout parameter cache existing. The method further comprises canceling the call for setting the layout parameter of the target control in response to the layout parameter of the target control not needing to be set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure generally relates to the field of computers, and more specifically to methods, apparatus, devices, computer-readable storage media, and computer program products for cache layout parameters. Background Technology

[0002] In today's era of widespread internet access, technical frameworks provide strong support for building application display content. Layout parameters allow for adjustments to the layout of displayed controls. These parameters precisely define the size, position, margins, and other attributes of controls, enabling real-time and flexible adjustments to their display position and size.

[0003] For example, in the live streaming industry, the interactive experience between users, streamers, and other viewers is crucial. Controls, as the carriers of live streaming-related business logic (such as displaying live content and interactive information), play a vital role in enhancing user experience through their proper adjustment. Whether it's streamers needing to clearly showcase their image and explanations, or viewers expecting to quickly access product details and participate in interactive discussions, efficient and flexible control setting technology is essential. Summary of the Invention

[0004] According to exemplary embodiments of this disclosure, a method, apparatus, device, computer storage medium, and computer program product for caching layout parameters are provided.

[0005] In a first aspect of this disclosure, a method for caching layout parameters is provided. The method includes determining, in response to a call to set layout parameters for a target control, whether a layout parameter cache exists for the target control. The method further includes determining, based on the layout parameter cache, whether it is necessary to set the layout parameters for the target control, in response to the existence of the layout parameter cache. The method also includes canceling a call to set layout parameters for the target control in response to the absence of the need to set the layout parameters for the target control.

[0006] In a second aspect of this disclosure, an apparatus for caching layout parameters is provided. The apparatus includes a first determining module configured to determine, in response to a call to set layout parameters for a target control, whether a layout parameter cache exists for the target control. The apparatus also includes a second determining module configured to determine, based on the layout parameter cache, whether it is necessary to set the layout parameters of the target control in response to the existence of the layout parameter cache. The apparatus further includes a canceling module configured to cancel a call to set layout parameters for the target control in response to the decision that it is not necessary to set the layout parameters of the target control.

[0007] In a third aspect of this disclosure, an electronic device is provided, comprising: at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method described in the first aspect of this disclosure when executed by the at least one processing unit.

[0008] In a fourth aspect of this disclosure, a computer-readable storage medium is provided having machine-executable instructions stored thereon, which, when executed by a device, cause the device to perform the method described in the first aspect of this disclosure.

[0009] In a fifth aspect of this disclosure, a computer program product is provided, including computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the method described in the first aspect of this disclosure.

[0010] The summary section is provided to introduce a series of concepts in a simplified form, which will be further described in the detailed description below. The summary section is not intended to identify key or essential features of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0011] Figure 1 A schematic diagram of an example environment in which embodiments of the present disclosure can be implemented is shown;

[0012] Figure 2 A flowchart of a method for caching layout parameters according to an embodiment of the present disclosure is shown;

[0013] Figure 3A A schematic diagram of a process for caching layout parameters according to an embodiment of the present disclosure is shown;

[0014] Figure 3B A schematic diagram illustrating the effect of a process for caching layout parameters according to an embodiment of the present disclosure is shown.

[0015] Figure 4 A schematic diagram of the hierarchical structure of layout parameter caching according to an embodiment of the present disclosure is shown;

[0016] Figure 5 A schematic diagram of an adaptation processing control according to an embodiment of the present disclosure is shown;

[0017] Figure 6 A schematic diagram of a process for caching layout parameters according to an embodiment of the present disclosure is shown;

[0018] Figure 7A schematic block diagram of an example apparatus according to some embodiments of the present disclosure is shown;

[0019] Figure 8 A block diagram of an example device that can be used to implement embodiments of the present disclosure is shown.

[0020] In all the accompanying figures, the same or similar reference numerals denote the same or similar elements. Detailed Implementation

[0021] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of these messages or information. It is understood that before using the technical solutions disclosed in the embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0022] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message. As an optional but non-limiting implementation, the prompt message can be sent to the user in the form of a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0023] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0024] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0025] In the description of embodiments of this disclosure, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects unless explicitly stated. Other explicit and implicit definitions may also be included below.

[0026] In general, during app runtime, content can be switched between different states, which involves changing the layout of certain controls. These changes can be achieved by setting layout parameters for a control, such as setting its position on the display screen, setting its height, width, or weight. To ensure timely and accurate display, the dimensions of controls on the screen, such as width and height, need to be calculated or measured after setting layout parameters. If multiple controls with inheritance relationships exist on the screen (e.g., base controls, text controls inheriting from base controls), the dimensions of all these controls need to be recalculated or measured. This consumes computing resources. For example, in live streaming scenarios, layout parameters for controls often need to be set frequently, resulting in a large number of recalculations of control dimensions. This leads to significant consumption of computing resources, overheating of the phone, and lag.

[0027] To address this issue, this disclosure proposes a method for caching layout parameters. Before setting layout parameters for a target control, this method determines the necessity of setting the layout parameters. First, it checks if a layout parameter cache exists for the target control. If it does, it checks whether it is necessary to call the layout parameter setting function based on the cache. If it is determined that it is unnecessary to call the layout parameter setting function, the setting of the layout parameters is canceled. This prevents the repeated setting of layout parameters for the target control and avoids redundant operations such as re-measuring or recalculating control sizes caused by setting layout parameters. This can save computing resources, improve the smoothness of the phone, and reduce phone overheating and lag.

[0028] The embodiments of this disclosure will now be described in further detail with reference to the accompanying drawings, wherein... Figure 1A schematic diagram of an example environment 100 in which embodiments of the present disclosure can be implemented is shown. The example environment 100 includes a computing device 110. In this embodiment, a user can install an application on the computing device 110. By launching the application, the application can provide the user with display content and business logic through a screen and controls therein. For example, the application could be a video application, which the user can open on the computing device 110 to watch live content. For example, the live content might display text messages such as "Sings so well!" indicating interaction between the viewer and the host. The live content can include controls, such as text controls and view controls, to provide the user with additional information and functionality. For example, the live content could include a target control 112 to indicate that the program type of the live content is music.

[0029] In some embodiments, the computing device 110 can set the layout parameters of the target control 112 in the live content according to a code file, such as an Extensible Markup Language (XML) file 120, during the playback of live content. When switching between different states, the layout parameter 122 can be assigned a value in the code file and the layout parameter can be set. In some technical frameworks, setting the layout parameter can be achieved through the setLayoutParams function in some technical frameworks. In the embodiments of this disclosure, the computing device 110 can add a cache 130 to detect in real time whether a call to set the layout parameter for the target control 112 occurs or is triggered during the execution of code logic. In some embodiments, the target control 112 stores a pointer to the layout parameter to be set, and copies the data at the storage address pointed to by the pointer to the variable of the target control 112. When transitioning from one state to another, it is usually only necessary to modify the data of the pointer (e.g., directly modify the pointer or variable), and call the relevant function to set the modified data (i.e., the layout parameter to be set) into the target control 112, thereby completing the setting of the layout parameter of the target control 112.

[0030] Unlike operations such as remeasuring the size of the target control 112 every time the layout parameters are set, embodiments of this disclosure terminate redundant calls to set layout parameters by establishing a layout parameter cache. In some embodiments, if a call to set layout parameters for the target control 112 occurs or is triggered, the computing device 110 can determine in cache 130 whether a layout parameter cache for the target control 112 exists. The computing device 110 can store the layout parameter cache at a specified storage address, such as memory. Storing the layout parameter cache in memory can have faster processing speed. If the computing device 110 does not cache the layout parameters of the target control 112 before calling the set layout parameters for the target control 112, for example, if there is no cached data in cache 130, or the cached data in cache 130 is null or inaccessible, it can be determined that no layout parameter cache for the target control 112 exists. If the layout parameter cache for the target control 112 can be obtained or accessed in cache 130, it can be determined that a layout parameter cache for the target control 112 exists.

[0031] In some embodiments, if a layout parameter cache exists in cache 130, computing device 110 can determine whether it is necessary to set the layout parameters of target control 112 based on the layout parameter cache. Here, computing device 110 can detect the necessity of calling to set layout parameters. If the layout parameter cache for target control 112 is the same as the layout parameters to be set, there is no need to call it. If the layout parameter cache is different from the layout parameters to be set, it is necessary to call to set the layout parameters to ensure accurate display. In some embodiments, computing device 110 can obtain the current layout parameters of target control 112 from cache 130. In some embodiments, computing device 110 can compare the current layout parameters 140 with the layout parameter cache to determine whether the layout parameter cache is the latest layout parameter. Only the layout parameter cache reflecting the latest layout parameters can be used to accurately determine necessity.

[0032] In some embodiments, if it is not necessary to set the layout parameters of the target control 112, the computing device 110 may cancel (e.g., terminate) the call to set the layout parameters for the target control 112. The cancellation operation may be a complete process of setting cached parameters, where any step is not executed. This can terminate the entire process of setting cached parameters, thus avoiding operations such as re-measuring the control's size or requesting layout operations (e.g., requestLayout() operations), which can significantly reduce the waste of computing resources. Although some embodiments of this disclosure use a live streaming scenario as an example, this disclosure can also be applied to other scenarios where the layout parameters of the target control need to be set.

[0033] The computing device 110 can be any type of mobile computing device, including mobile computers (e.g., personal digital assistants (PDAs), laptops, notebook computers, tablet computers, netbooks, etc.), mobile phones (e.g., cellular phones, smartphones, etc.), wearable computing devices (e.g., smartwatches, head-mounted devices, including smart glasses, etc.) or other types of mobile devices. In some embodiments, the computing device 110 can also be a fixed computing device, such as a desktop computer, game console, smart TV, etc.

[0034] It should be understood that the architecture and functionality in example environment 100 are described for illustrative purposes only and do not imply any limitation on the scope of this disclosure. Embodiments of this disclosure can also be applied to other environments with different structures and / or functionalities.

[0035] The processes according to embodiments of this disclosure will be described in detail below with reference to other accompanying drawings. For ease of understanding, the specific data mentioned in the following description are exemplary and not intended to limit the scope of this disclosure. It will be understood that the embodiments described below may also include additional actions not shown and / or actions shown may be omitted, and the scope of this disclosure is not limited in this respect.

[0036] Figure 2 A flowchart of a method 200 for caching layout parameters according to certain embodiments of the present disclosure is shown. In this embodiment, the method may be performed by a computing device 110. At block 202, in response to a call to set layout parameters for a target control, it is determined whether a layout parameter cache exists for the target control. The target control may include user interface (UI) elements for display, such as a graphical identifier for identifying the program type of live content. In some embodiments, the target control may not only act as an identifier but may also include certain business logic for interacting with the user. In some embodiments, the target control includes a target object (e.g., a button), and the layout parameters to be set are used to determine the position of the target object.

[0037] In some embodiments, layout parameters refer to parameters related to the layout of the target control, such as height, width, and left margin. For example, setting layout parameters can be used for a first type of live streaming event associated with the target control. This first type of live streaming event could be, for example, a live streaming event initiated by a single broadcaster account. By setting layout parameters, the layout of the target control can be adjusted in real time. As an example, the existence of a layout parameter cache can be detected from a pre-specified cache.

[0038] In box 204, in response to the existence of a layout parameter cache, the system determines whether the layout parameters of the target control need to be set based on the layout parameter cache. As an example, the layout parameter cache can serve as a basis for determining whether setting layout parameters is necessary. For instance, if a corresponding layout parameter cache is found, these cached data are further compared to determine whether the layout parameters currently being attempted to be set match the data in the cache, i.e., whether a new setting operation is truly necessary.

[0039] In box 206, in response to the fact that it is not necessary to set the layout parameters of the target control, the call to set the layout parameters for the target control is canceled. If it is not necessary to set the layout parameters of the target control, then it can be determined that setting the layout parameters is a redundant setting, and in this case, the setting operation will be canceled (e.g., terminated) to avoid redundant dimension calculations or measurement operations caused by it.

[0040] According to the method of the embodiments of this disclosure, it is first determined whether there is a layout parameter cache for the target control. If a cache exists, it is checked whether it is necessary to call the layout parameter setting based on the cache content. If it is determined that no call is needed, the setting operation is canceled, thereby avoiding repeated setting of the target control's layout parameters and preventing redundant settings of controls caused by setting layout parameters. This can save computing resources, improve the smoothness of the mobile phone, and reduce the occurrence of mobile phone overheating and lag.

[0041] Figure 3A A schematic diagram of a process for caching layout parameters according to an embodiment of the present disclosure is shown. At 302, a call to set layout parameters is detected, and the method described in the above embodiments can be executed. At 304, it is determined whether a layout parameter cache exists. If no layout parameter cache exists, there is no basis for analyzing the setting layout parameters, and the process proceeds to 312 to execute setting layout parameters. The layout of the target control is thus adjusted according to the layout parameters to be set. At 314, a layout parameter cache is obtained by caching the layout parameters to be set. This layout parameter cache can be utilized when setting layout parameters is called again subsequently.

[0042] If a layout parameter cache exists, the process proceeds to step 306 to further determine if the cached layout parameters match the current layout parameters. In some embodiments, if a layout parameter cache exists, the current layout parameters can be obtained from the target control. The target control typically stores a pointer to the layout parameters to be set (e.g., stored in a single variable), and copies the data at the storage address pointed to by this pointer to a specific variable of the target control. This way, when the target control is displayed, it no longer needs to repeatedly retrieve the layout parameters from the storage address pointed to by the pointer, but can directly read the layout parameters from the specific variable of the target control and display them accordingly. Therefore, if a layout parameter cache for the target control is detected, its current layout parameters (e.g., position, size, etc.) can be obtained from the target control itself.

[0043] Here, the current layout parameters of the target control can be obtained from one or more variables of the target control. Then, the layout parameter cache is compared with the current layout parameters to see if they are the same. In this embodiment, the layout parameter may not be a single layout parameter, but rather a layout parameter instance, such as a LayoutParams instance in some technical frameworks. This layout parameter instance may include multiple properties, each of which can be used to determine the layout of one aspect of the target component. For example, the layout parameter instance may include width, height, gravity, weight, top margin, etc.

[0044] In some embodiments, there are multiple ways to compare whether the layout parameter cache is consistent with the current layout parameters. For example, the layout parameter cache and the layout parameter to be set can be determined to be consistent if all attributes of the layout parameter cache and all attributes of the layout parameter to be set are the same. Alternatively, the layout parameter cache and the layout parameter to be set can be determined to be consistent if all specified attributes of the layout parameter cache and all specified attributes of the layout parameter to be set are the same, and so on. If the layout parameter cache is different from the current layout parameters, proceed to step 312. If the layout parameter cache and the current layout parameters are different, it is determined that the layout parameters of the target control need to be set. Therefore, the layout parameter setting is performed to modify the layout parameters of the target control. Then proceed to step 314, using the layout parameters to be set to update the layout parameter cache. Because the layout parameters are different, it means that the current layout of the target component is not the expected layout and needs to be set. Since the layout parameters of the target control may be modified in various ways, these modifications may not be updated in the layout parameter cache in a timely manner, so the layout parameter cache may not necessarily match the current layout parameters of the target control. By comparing the layout parameter cache with the current layout parameters, it can be ensured that the layout parameter cache reflects the current layout of the target control, and it can be determined whether the call to cancel the layout parameter setting needs to be cancelled. This can improve the accuracy of cancelling the layout parameter setting call.

[0045] If the layout parameter cache is the same as the current layout parameter, proceed to step 308. If the layout parameter cache and the current layout parameter are the same, determine whether the layout parameters of the target control need to be set based on the layout parameter cache and the layout parameter to be set. The layout parameter to be set is the layout parameter to be passed in for setting the layout parameters. In some embodiments, the layout parameter cache includes width and height attributes, and the layout parameter to be set also includes width and height attributes. In some embodiments, compare the width and height attributes of the layout parameter cache one by one with the width and height attributes of the layout parameter to be set. In some embodiments, if the width and height attributes of the layout parameter cache are both the same as the width and height attributes of the layout parameter to be set, it is determined that the layout parameter cache and the layout parameter to be set are the same. In some embodiments, if at least one attribute of the layout parameter cache is different from the corresponding attribute of the layout parameter to be set, it is determined that the layout parameter cache and the layout parameter to be set are different.

[0046] If the layout parameter cache is determined to be the same as the layout parameter to be set, the layout setting operation is canceled at point 310 to avoid unnecessary computational resource consumption and potential performance loss. The same layout parameter cache and layout parameter to be set indicate that setting the layout parameters is redundant and therefore unnecessary, avoiding unnecessary computational resource consumption and potential performance loss. Otherwise, at point 312, the layout parameters are set to modify the layout parameters of the target control. Then, the process proceeds to point 314, where the layout parameter cache is updated using the layout parameter to be set. After setting the layout parameters of the target control, the display of the target control can undergo the expected changes to achieve the purpose of setting the layout parameters. In this embodiment, by comparing the current layout parameters and the layout parameter to be set using the layout parameter cache, the necessity of calling the layout parameter setting function can be determined more accurately, thereby reducing redundant setting operations and subsequent operations such as re-measuring dimensions.

[0047] Figure 3BA schematic diagram illustrating the effect of a process for caching layout parameters according to an embodiment of the present disclosure is shown. At 340, when switching between different states, the same layout parameters as those cached for layout parameters can be set. For example, the layout parameters to be set are for a target control 322 of the live content 320, which can be used to identify the program category of the live content 320 as music, and its size and position are shown in the figure. In some embodiments, if switching from a first type of live activity associated with the target control (such as a live activity initiated by a single broadcaster account) to a second type of live activity associated with the target control, a call to set layout parameters for the target control can be determined. The second type of live activity may be, for example, a live activity involving multiple broadcaster accounts. Since a live activity involving multiple broadcaster accounts requires adjustments to the display interface when switching from a live activity initiated by a single broadcaster account to a live activity involving multiple broadcaster accounts, a call to set layout parameters for the target control will occur, which can serve as an example of the triggering timing in an embodiment of the present disclosure.

[0048] At position 350, the computing device 110 detects that the layout parameter cache is the same as the layout parameter to be set, and cancels the setting operation. As a result, the target control 332 of the live content 330 maintains its original layout parameters, such as width and height. Furthermore, there is no need to perform other operations related to setting layout parameters on the target control 332, such as re-measuring the size of the control or requesting layout operations, which can reduce the waste of computing resources.

[0049] In some technical frameworks, layout parameters can have complex hierarchical structures. Figure 4 A schematic diagram of the hierarchy of a layout parameter cache according to an embodiment of the present disclosure is shown. To ensure that the layout parameter cache can be compared with the layout parameters to be set, the hierarchy of the layout parameter cache 402 can be determined by referring to the hierarchy of the layout parameters to be set.

[0050] In this embodiment, the base class of the hierarchy 402 is the basic layout parameter 404, which includes at least width and height attributes. A subclass directly inheriting from the basic layout parameter 404 is the margin layout parameter 406, which includes at least left margin, top margin, right margin, start margin, and end margin attributes. Subclasses directly inheriting from the basic layout parameter 406 include frame layout parameter 408, linear layout parameter 410, and constraint layout parameter 412. Frame layout parameter 408 includes at least a gravity attribute. Linear layout parameter 410 includes at least a weight attribute and a gravity attribute. Constraint layout parameter 412 includes at least an attribute indicating a left-to-right direction, an attribute indicating a right-to-left direction, and a departure state attribute. Subclasses directly inheriting from constraint layout parameter 412 include cascading constraint layout parameter 414, which includes a layer attribute and a number attribute.

[0051] In some technical frameworks, for layout parameters to be set, it is possible to define custom layout parameter categories within an existing hierarchical structure and set these layout parameters within the layout parameters to be set. Accordingly, the layout parameter cache can have corresponding custom layout parameter categories. For example, a custom layout parameter category can be defined, inheriting from the linear layout parameter 410. This allows for caching all layout parameter data, improving the accuracy of determining whether it is necessary to call the layout parameter setting function.

[0052] This complex hierarchical structure leads to layout parameter caching consuming considerable storage space. In practice, even in live streaming scenarios, not every control is frequently adjusted. To address this, some embodiments determine the number of calls to set layout parameters for a target control. For example, a count is made for setting layout parameters, incrementing the count by one for each call. In some embodiments, if the number of calls exceeds a threshold, the layout parameter cache is updated based on the layout parameters to be set. For example, the threshold can be set to 2, so the method for caching layout parameters according to embodiments of this disclosure is only executed from the third call onwards. This can significantly reduce the storage resources consumed.

[0053] When setting layout parameters in some technical frameworks, different processing controls can be selected based on the type of layout parameter, including but not limited to view processing controls and FrameLayout processing controls. Since the processing logic for calling the setting of layout parameters has changed, the processing controls can be adapted accordingly, and appropriate processing controls can be selected based on the type of layout parameter. In some embodiments, when calling the setting of layout parameters for a target control, the type of layout parameter to be set is determined. In this embodiment, the processing controls in each technical framework are adapted based on the type of layout parameter, which conforms to general usage habits. In some embodiments, a source processing control is determined based on the type of layout parameter. This source processing control is the aforementioned view processing control, etc. In some embodiments, a target processing control is determined based on the source processing control. In some embodiments, the target processing control is used to determine whether a layout parameter cache for the target control exists.

[0054] In this embodiment, the processing controls are adapted so that each processing control can implement the method for caching layout parameters disclosed in the above embodiments for layout parameters of this type, such as comparing layout parameters. In some technical frameworks, the target processing control includes at least one of the following processing controls: view processing control, frame layout processing control, linear layout processing control, constraint layout processing control, and relative layout processing control.

[0055] Table 1 shows the source processing controls and the adapted processing controls.

[0056] Source Controls Adapted processing controls view LPO view Frame layout LPO Frame Layout Linear layout LPO linear layout Constraint Layout LPO constrained layout Relative layout LPO relative layout Image view / Compatible image view LPO Image View Card View LPO Card View Animated View LPO Animation View

[0057] The source processing controls and adapted processing controls in Table 1 are examples. Different processing controls can be used depending on the technical framework.

[0058] In some embodiments, when setting layout parameters for a target control is invoked, the processing control may determine a target service used to determine the target control. For example, in some technology frameworks, this target service may be used to generate target controls compatible with different versions of the technology framework. In some embodiments, a target constructor is determined based on the target service. This target constructor is used to convert an XML file into an instance of the target control.

[0059] In some embodiments, it is determined whether the target constructor has a target interface. This target interface allows intervention in the process of converting an XML file into a target control instance. In some embodiments, if the target constructor has a target interface, the target interface is used to determine the layout parameter category of the layout parameters to be set. In this target interface, the methods disclosed in the above embodiments can be integrated in code to achieve control adaptation.

[0060] In this embodiment, the adaptation of the processing controls is achieved by utilizing the existing services, base classes, or methods in the technical framework. This adaptation method does not require adjusting each control in the technical framework one by one (which would lead to a large amount of modification to the technical framework), and has a smaller scale of modification, thus resulting in lower maintenance costs and less business risk.

[0061] Figure 5 A schematic diagram of an adaptation processing control according to an embodiment of the present disclosure is shown. In this embodiment, layout parameters are set for a first type of live streaming activity 506, which is associated with a target control. The first type of live streaming activity 506 may inherit a base service (or base class) 502 in the technology framework, so that the first type of live streaming activity 506 has various specific services (e.g., various functions or methods) provided by the base service 502. The base service 502 may include a style setting service 508, which is used to generate target controls compatible with different versions of the technology framework. The style setting service 508 has a default conversion service 510, which is used to convert XML files into target controls according to a default conversion method.

[0062] In this embodiment, a target conversion service 512 is used to replace the default conversion service 510. This target conversion service 512 can adjust the default conversion method, for example, it can detect calls to set layout parameters. The target conversion service 512 may have a layout parameter setting interface 514, which is used to load the method for caching layout parameters disclosed in the above embodiments. This allows specific types of processing controls to handle calls involving setting layout parameters for their respective categories. For example, if the layout parameter setting interface 514 determines, based on the mapping relationship in Table 1, to use an LPO view processing control to implement the above embodiments, then in response to a call to set layout parameters for the target control, the LPO view processing control can be used to determine whether a layout parameter cache exists for the target control. In response to the existence of a layout parameter cache, the LPO view processing control can be used to determine whether the layout parameters of the target control need to be set based on the layout parameter cache. In response to the absence of a need to set the layout parameters of the target control, the LPO view processing control can be used to cancel the call to set layout parameters for the target control.

[0063] Figure 6A schematic diagram of a process for caching layout parameters according to an embodiment of the present disclosure is shown. As described above, during the display process, the target component may store a pointer to a layout parameter to be set at a particular time. In this embodiment, the target layout parameter can be retrieved at 606. This retrieval may be a reference to the pointer to the target layout parameter. At 608, the layout parameter can be modified by changing its value. If no relevant function is called to set the modified data (i.e., the layout parameter to be set) to the target control after modifying the value of the layout parameter, the target control maintains its own copy or cached layout parameter. At 610, the setting layout parameter can be called. When the setting layout parameter is called, the call is not executed directly. Instead, at 612, it is determined whether the layout parameter of the target frame needs to be set according to the method for caching layout parameters described above. If the layout parameter does not need to be set, the setting layout parameter is canceled at 614. If the layout parameter needs to be set, the setting layout parameter is executed at 616.

[0064] In this embodiment, the data of the pointer can be directly modified (e.g., by directly assigning a value to the layout parameter pointed to by the pointer), and the relevant function can be called to set the modified data (i.e., the layout parameter to be set) into the target control, thereby completing the setting of the layout parameter of the target control. There is no need to consider whether the target layout parameter is the same as the original layout parameter. Because if they are the same, the setting of the layout parameter can be canceled, avoiding redundant calls. Therefore, this can improve programming efficiency.

[0065] Figure 7 A schematic block diagram of an example device 700 according to some embodiments of the present disclosure is shown. Device 700 can be implemented by software, hardware, or a combination of both. Figure 7 As shown, the device 700 includes a first determining module 710, a second determining module 720, and a canceling call module 730.

[0066] In some embodiments, the first determining module 710 may be configured to determine whether a layout parameter cache for the target control exists in response to a call to set layout parameters for the target control. The second determining module 720 may be configured to determine whether the layout parameters of the target control need to be set based on the layout parameter cache in response to the existence of the layout parameter cache. The canceling call module 730 may be configured to cancel the call to set layout parameters for the target control in response to the absence of needing to set the layout parameters of the target control.

[0067] In some embodiments, the second determining module 720 includes an acquisition module configured to acquire the current layout parameters through the target control in response to the existence of a layout parameter cache. The second determining module 720 also includes a first comparison module configured to determine whether the layout parameter cache and the current layout parameters are the same. The second determining module 720 further includes a third determining module configured to determine whether the layout parameters of the target control need to be set in response to a difference between the layout parameter cache and the current layout parameters. The second determining module 720 also includes a fourth determining module configured to determine whether the layout parameters of the target control need to be set based on the layout parameter cache and the layout parameters to be set in response to a difference between the layout parameter cache and the current layout parameters, wherein the layout parameters to be set are the layout parameters to be passed in for setting.

[0068] In some embodiments, the fourth determining module includes a second comparison module configured to determine whether the layout parameter cache and the layout parameter to be set are the same in response to the layout parameter cache being the same as the current layout parameter. The fourth determining module also includes a fifth determining module configured to determine that the layout parameters of the target control need to be set in response to the layout parameter cache being different from the layout parameter to be set. The fourth determining module also includes a sixth determining module configured to determine that the layout parameters of the target control do not need to be set in response to the layout parameter cache being the same as the layout parameter to be set.

[0069] In some embodiments, the layout parameter cache includes width and height attributes, and the layout parameter to be set also includes width and height attributes. The second comparison module includes a third comparison module configured to compare the width and height attributes of the layout parameter cache with those of the layout parameter to be set, one by one. The second comparison module further includes a seventh determination module configured to determine that the layout parameter cache and the layout parameter to be set are the same if both the width and height attributes of the layout parameter cache and the layout parameter to be set are the same. The second comparison module also includes an eighth determination module configured to determine that the layout parameter cache and the layout parameter to be set are different if at least one attribute of the layout parameter cache is different from the corresponding attribute of the layout parameter to be set.

[0070] In some embodiments, the apparatus 700 further includes an execution module configured to set the layout parameters of the target control by setting the layout parameters in response to the need to set the layout parameters of the target control. The apparatus 700 also includes an update module configured to update the layout parameter cache according to the layout parameters to be set.

[0071] In some embodiments, the update module includes a call count determination module, configured to determine the number of calls required to set layout parameters for the target control. The update module also includes a sub-update module configured to update the layout parameter cache based on the layout parameters to be set in response to a call count exceeding a threshold.

[0072] In some embodiments, the first determining module 710 includes a ninth determining module configured to determine the layout parameter category of the layout parameter to be set in response to a call to set layout parameters for a target control. The first determining module 710 includes a tenth determining module configured to determine a source processing control based on the layout parameter category. The first determining module 710 includes a mapping module configured to determine a target processing control based on the source processing control. The first determining module 710 includes an eleventh determining module configured to use the target processing control to determine whether a layout parameter cache exists for the target control.

[0073] In some embodiments, the ninth determining module includes a twelfth determining module configured to determine a target service in response to a call to set layout parameters for a target control, the target service being used to determine the target control. The ninth determining module also includes a thirteenth determining module configured to determine a target constructor based on the target service. The ninth determining module further includes a fourteenth determining module configured to determine whether the target constructor has a target interface. The ninth determining module also includes a fifteenth determining module configured to determine the layout parameter category of the layout parameters to be set using the target interface in response to the target constructor having a target interface.

[0074] In some embodiments, the processing control includes at least one of a target view processing control, a frame layout processing control, a linear layout processing control, a constraint layout processing control, and a relative layout processing control.

[0075] In some embodiments, layout parameters are set for a first type of live streaming activity, which is associated with a target control.

[0076] In some embodiments, the apparatus 700 further includes a sixteenth determining module configured to determine, in response to switching from a first type of live streaming activity to a second type of live streaming activity, the existence of a call to set layout parameters for the target control, wherein the second type of live streaming activity is associated with the target control.

[0077] In some embodiments, the target control includes a target object, and the layout parameters to be set are used to determine the position of the target object.

[0078] The division of modules or units in the embodiments of this disclosure is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods. Furthermore, the functional units in the disclosed embodiments may be integrated into one unit, exist as separate physical entities, or two or more units may be integrated into one unit. The integrated unit described above can be implemented in hardware or as a software functional unit.

[0079] Figure 8 A block diagram of an example device 800 that can be used to implement embodiments of the present disclosure is shown. It should be understood that... Figure 8 The device 800 shown is merely an example and should not be construed as limiting the functionality and scope of the implementation described herein. For example, device 800 can be used in conjunction with the implementation described herein. Figure 1 The computing device 110 described above can be used to perform the above-described tasks. Figures 1 to 6 The process.

[0080] like Figure 8 As shown, device 800 is in the form of a general-purpose computing device. Components of computing device 800 may include, but are not limited to, one or more processors or processing units 810, memory 820, storage devices 830, one or more communication units 840, one or more input devices 850, and one or more output devices 860. Processing unit 810 may be a physical or virtual processor and is capable of performing various processes according to programs stored in memory 820. In a multiprocessor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of computing device 800.

[0081] Computing device 800 typically includes multiple computer storage media. Such media can be any available media accessible to computing device 800, including but not limited to volatile and non-volatile media, removable and non-removable media. Memory 820 can be volatile memory (e.g., registers, cache, random access memory (RAM)), non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof). Storage device 830 can be removable or non-removable media and may include machine-readable media, such as flash drives, disks, or any other media capable of storing information and / or data (e.g., training data for training) and accessible within computing device 800.

[0082] The computing device 800 may further include additional removable / non-removable, volatile / non-volatile storage media. Although not explicitly stated... Figure 8As shown, disk drives for reading from or writing to removable, non-volatile disks (e.g., "floppy disks") and optical disk drives for reading from or writing to removable, non-volatile optical disks can be provided. In these cases, each drive can be connected to a bus (not shown) via one or more data media interfaces. Memory 820 may include computer program product 825 having one or more program modules configured to perform various methods or actions of various implementations of this disclosure.

[0083] The communication unit 840 enables communication with other computing devices via a communication medium. Additionally, the components of the computing device 800 can function as a single computing cluster or multiple computing machines capable of communicating via communication connections. Therefore, the computing device 800 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network node.

[0084] Input device 850 can be one or more input devices, such as a mouse, keyboard, trackball, etc. Output device 860 can be one or more output devices, such as a monitor, speaker, printer, etc. Computing device 800 can also communicate with one or more external devices (not shown) via communication unit 840 as needed. These external devices include storage devices, display devices, etc., and can communicate with one or more devices that enable user interaction with computing device 800, or with any device that enables computing device 800 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication can be performed via an input / output (I / O) interface (not shown).

[0085] According to an exemplary implementation of this disclosure, a computer-readable storage medium is provided that stores computer-executable instructions thereon, wherein the computer-executable instructions are executed by a processor to implement the methods described above. According to an exemplary implementation of this disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, which are executed by a processor to implement the methods described above. According to an exemplary implementation of this disclosure, a computer program product is provided that stores a computer program thereon, which, when executed by a processor, implements the methods described above.

[0086] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0087] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0088] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions that execute on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0089] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0090] Various implementations of this disclosure have been described above. The foregoing description is exemplary and not exhaustive, nor is it limited to the disclosed implementations. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described implementations. The terminology used herein is chosen to best explain the principles, practical applications, or improvements to technology in the market, or to enable others skilled in the art to understand the various implementations disclosed herein.

Claims

1. A method for caching layout parameters, comprising: In response to a call to set layout parameters for a target control, determine whether there is a layout parameter cache for the target control; In response to the existence of the layout parameter cache, determine whether the layout parameters of the target control need to be set based on the layout parameter cache; as well as In response to the fact that the layout parameters of the target control do not need to be set, the call to set the layout parameters for the target control is cancelled.

2. The method according to claim 1, wherein determining whether to set the layout parameters of the target control based on the layout parameter cache in response to the existence of the layout parameter cache includes: In response to the existence of the layout parameter cache, the current layout parameters are obtained through the target control; Determine whether the layout parameter cache and the current layout parameters are the same; In response to the difference between the layout parameter cache and the current layout parameters, it is determined that the layout parameters of the target control need to be set; as well as In response to the fact that the layout parameter cache and the current layout parameter are the same, it is determined whether the layout parameter of the target control needs to be set based on the layout parameter cache and the layout parameter to be set, wherein the layout parameter to be set is the layout parameter to be passed to the setting layout parameter.

3. The method according to claim 2, wherein determining whether to set the layout parameters of the target control based on the layout parameter cache and the current layout parameters in response to the same layout parameter cache includes: In response to the fact that the layout parameter cache is the same as the current layout parameter, determine whether the layout parameter cache and the layout parameter to be set are the same; In response to the difference between the layout parameter cache and the layout parameter to be set, it is determined that the layout parameter of the target control needs to be set; as well as Since the layout parameter cache and the layout parameter to be set are the same, it is determined that there is no need to set the layout parameter of the target control.

4. The method according to claim 3, wherein the layout parameter cache includes width and height attributes, the layout parameter to be set also includes width and height attributes, and determining whether the layout parameter cache and the layout parameter to be set are the same includes: Compare the width and height attributes cached in the layout parameters one by one with the width and height attributes of the layout parameters to be set; In response to the fact that the width and height attributes of the layout parameter cache are both the same as the width and height attributes of the layout parameter to be set, it is determined that the layout parameter cache and the layout parameter to be set are the same; and In response to the fact that at least one attribute of the layout parameter cache is different from the corresponding attribute of the layout parameter to be set, it is determined that the layout parameter cache and the layout parameter to be set are different.

5. The method according to claim 4, further comprising: In response to the need to set the layout parameters of the target control, the layout parameters of the target control are set by setting the layout parameters; as well as Update the layout parameter cache according to the layout parameters to be set.

6. The method according to claim 5, wherein updating the layout parameter cache according to the layout parameters to be set comprises: Determine the number of times the layout parameters for the target control are called; as well as In response to the number of calls exceeding a threshold, the layout parameter cache is updated according to the layout parameters to be set.

7. The method of claim 1, wherein determining whether a layout parameter cache exists for the target control in response to a call to set layout parameters for the target control comprises: In response to the call to set layout parameters for the target control, determine the layout parameter category of the layout parameter to be set; The source processing control is determined based on the layout parameter category; Based on the source processing control, determine the target processing control; and Using the target processing control, determine whether there is a layout parameter cache for the target control.

8. The method of claim 7, wherein determining the layout parameter category of the layout parameter to be set in response to the call to set layout parameters for the target control includes: In response to the call to set layout parameters for the target control, a target service is determined, the target service being used to determine the target control; The target constructor is determined based on the target service; Determine whether the target constructor has a target interface; as well as In response to the target constructor having the target interface, the layout parameter category of the layout parameter to be set is determined using the target interface.

9. The method according to claim 8, wherein the target processing control includes at least one processing control selected from view processing control, frame layout processing control, linear layout processing control, constraint layout processing control, and relative layout processing control.

10. The method of claim 1, wherein the setting layout parameters are used for a first type of live streaming activity, the first type of live streaming activity being associated with the target control.

11. The method of claim 10, further comprising: In response to switching from the first type of live streaming activity to the second type of live streaming activity, it is determined that there is a call to set layout parameters for the target control, wherein the second type of live streaming activity is associated with the target control.

12. The method of claim 10, wherein the target control includes a target object, and the layout parameters to be set are used to determine the position of the target object.

13. An apparatus for caching layout parameters, comprising: The first determining module is configured to determine whether there is a layout parameter cache for the target control in response to a call to set layout parameters for the target control; The second determining module is configured to, in response to the existence of the layout parameter cache, determine whether the layout parameters of the target control need to be set based on the layout parameter cache. as well as The module is configured to cancel the call to set the layout parameters for the target control in response to the need to set the layout parameters for the target control.

14. An electronic device comprising: At least one processing unit; At least one memory is coupled to the at least one processing unit and stores a task to be executed by the at least one processing unit, the task causing the electronic device to perform the method according to any one of claims 1 to 12 when executed by the at least one processing unit.

15. A computer program product having a computer program stored thereon, which, when executed by a processor, implements the method according to any one of claims 1 to 12.