Theme management method, device and system

By adopting a singleton theme management module in the HarmonyOS NEXT system, efficient theme management and switching are achieved, solving the problems of low automatic switching and management efficiency in traditional solutions, and improving user experience and system performance.

CN120631477APending Publication Date: 2025-09-12SHENZHEN GREEN CONNECTION TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510470243.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

The traditional theme management solution in the HarmonyOS NEXT system cannot automatically switch themes according to user preferences or system settings at runtime, and requires manual management of themes and style files, resulting in low theme management efficiency and poor user experience.

Method used

A singleton theme management module is used to determine the target theme type by receiving theme configuration requests, read the corresponding configuration information and render the target configuration components, so as to achieve efficient theme switching and updating, avoid repeated instantiation and reduce memory usage.

Benefits of technology

Improved the theme management and switching efficiency of the HarmonyOS NEXT system, allowing theme switching without refreshing the interface, improving user experience and reducing memory usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120631477A_ABST
    Figure CN120631477A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and discloses a theme management method, device and system, the method is applied to a singleton theme management module included in a theme management framework, and the method comprises the following steps: when a theme configuration request for an object to be configured is received, determining a target theme type corresponding to the theme configuration request; the to-be-configured object comprises an operating system and / or any application; reading target configuration information corresponding to the target theme type according to the theme configuration information storage space or path, and determining corresponding target configuration data according to the target configuration information; and based on the target configuration data, rendering at least one target configuration component matched with the target configuration data in the to-be-configured object. Visibly, the theme switching function can be realized without interface refreshing while the theme management efficiency is improved, and the theme switching efficiency is improved, so that the user experience of the theme management function is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a topic management method, device and system. Background Art

[0002] As a new generation of operating system, HarmonyOS NEXT's biggest feature is that it has broken away from its dependence on the Linux kernel and the Android Open Source Project (AOSP). It adopts a microkernel architecture and only supports the HarmonyOS kernel and native applications of the HarmonyOS system. This new architecture makes the system lighter, more efficient and more secure.

[0003] Currently, the traditional theme management solution used in the HarmonyOS NEXT system cannot automatically switch themes according to user preferences or system settings during runtime. The theme can only be switched after restarting the component, which reduces the user experience. In addition, in the traditional theme management solution, the theme and corresponding style files need to be manually managed, resulting in low theme management efficiency.

[0004] Therefore, it is particularly important to propose a technical solution that can improve the theme management efficiency of the HarmonyOS NEXT system while improving the theme switching efficiency of the HarmonyOS NEXT system, so as to improve the user experience of the theme management function. Summary of the Invention

[0005] The present invention provides a theme management method, device and system, which can improve the theme management efficiency of the HarmonyOS NEXT system while improving the theme switching efficiency of the HarmonyOS NEXT system, which is conducive to improving the user experience of the theme management function.

[0006] To solve the above technical problems, the first aspect of the present invention discloses a theme management method. The method is applied to an electronic device equipped with HarmonyOS NEXT, and the electronic device has an application installed in it. The electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application. The method is specifically applied to a singleton theme management module included in a theme management framework in the electronic device, and the singleton theme management module is constructed based on the singleton mode. The method includes:

[0007] Upon receiving a theme configuration request for an object to be configured, determining a target theme type corresponding to the theme configuration request; the object to be configured includes an operating system and / or any application; the theme configuration request includes a theme switching request or a theme update request;

[0008] Reading target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determining target configuration data corresponding to the target theme type according to the target configuration information; the target configuration information is used to indicate / record the theme configuration data required for the target theme type;

[0009] Based on the target configuration data, at least one target configuration component in the object to be configured that matches the target configuration data is rendered.

[0010] As an optional embodiment, in the first aspect of the present invention, reading the target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determining the target configuration data corresponding to the target theme type according to the target configuration information, includes:

[0011] Calling a preset configuration loading method to read target configuration information corresponding to the target subject type from a configuration mapping table corresponding to the object to be configured; the configuration mapping table stores subject configuration information corresponding to all subject types of the object to be configured; the subject configuration information corresponding to each subject type includes multiple key-value pairs; the target configuration information includes at least one target key-value pair;

[0012] According to the target configuration information, target configuration data required by the target theme type is loaded; the target configuration data includes at least one of target color data, target image data and target style data.

[0013] As an optional embodiment, in the first aspect of the present invention, each of the target key-value pairs is one of a target color key-value pair, a target image key-value pair, and a target style key-value pair; the theme management framework further includes an image module;

[0014] The step of loading target configuration data required for the target subject type according to the target configuration information includes:

[0015] When the target configuration information includes at least one target image key-value pair, for each target image key-value pair, determining whether there is cached image data matching the target image key-value pair in the image cache pool of the theme management framework;

[0016] When it is determined that cached image data matching the target image key-value pair exists in the image cache pool of the theme management framework, the cached image data is loaded into the singleton theme management module as the first target image data required by the target theme type;

[0017] When it is determined that there is no cached image data matching the target image key-value pair in the image cache pool of the theme management framework, the second target image data stored in the image storage path indicated by the target image key-value pair is loaded into the image module, and the second target image data is loaded into the singleton theme management module through the resource management module, and the second target image data is cached into the image cache pool.

[0018] As an optional embodiment, in the first aspect of the present invention, the method further comprises:

[0019] When it is detected that an image loading exception occurs during the process of loading the second target image data stored in the image storage path indicated by the target image key-value pair into the image module, capturing the image loading exception and recording an exception log regarding the image loading exception;

[0020] Performing an exception handling operation for the image loading exception;

[0021] An abnormal image loading method is called to load preset image data as target image data into the singleton theme management module; the preset image data is placeholder image data or application default image data.

[0022] As an optional embodiment, in the first aspect of the present invention, the method further comprises:

[0023] Detecting whether the number of image caches in the image cache pool is greater than or equal to a preset maximum cache number;

[0024] When it is detected that the number of image caches in the image cache pool is greater than or equal to the maximum cache number, counting the non-accessed time length of each cached image data in the image cache pool;

[0025] Based on a preset cache cleaning strategy and according to the non-accessed time, determining at least one image data to be cleaned from all the cached image data;

[0026] A cleaning operation is performed on all the image data to be cleaned in the image cache pool, so that the image cache quantity of the image cache pool after the cleaning operation is performed is less than the maximum cache quantity.

[0027] As an optional embodiment, in the first aspect of the present invention, before calling the preset configuration loading method to read the target configuration information corresponding to the target subject type from the configuration mapping table corresponding to the object to be configured, the method further includes:

[0028] When it is detected that the target theme type is not any historical theme type, obtaining a new theme configuration file corresponding to the target theme type; each of the historical theme types is a preset theme type or a theme type configured for the object to be configured;

[0029] Add the newly added theme configuration file to the resource directory corresponding to the object to be configured;

[0030] Parse the newly added theme configuration file to obtain a file parsing result corresponding to the newly added theme configuration file;

[0031] Generate new theme configuration information indicated by the new theme configuration file according to the file parsing result; the new theme configuration information includes at least one new key-value pair;

[0032] The newly added topic configuration information is stored in the configuration mapping table.

[0033] As an optional implementation, in the first aspect of the present invention, the theme management framework further includes a persistent storage module;

[0034] The method further comprises:

[0035] Transmitting the target topic type to the persistent storage module, and having the persistent storage module store the target topic type;

[0036] When the object to be configured needs to be reloaded, the target subject type is read from the persistent storage module to restore the subject type of the object to be configured to the target subject type.

[0037] A second aspect of the present invention discloses a theme management device, which is applied to an electronic device equipped with HarmonyOS NEXT, and an application is installed in the electronic device. The electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application. The device is specifically applied to a singleton theme management module included in a theme management framework in the electronic device, and the singleton theme management module is constructed based on a singleton mode. The device includes:

[0038] a determining unit configured to, upon receiving a theme configuration request for an object to be configured, determine a target theme type corresponding to the theme configuration request; the object to be configured includes an operating system and / or any application; the theme configuration request includes a theme switching request or a theme update request;

[0039] a data loading unit, configured to read target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determine target configuration data corresponding to the target theme type according to the target configuration information; the target configuration information is used to indicate / record the theme configuration data required for the target theme type;

[0040] A rendering unit is configured to render, based on the target configuration data, at least one target configuration component in the object to be configured that matches the target configuration data.

[0041] As an optional embodiment, in the second aspect of the present invention, the data loading unit reads the target configuration information corresponding to the target topic type according to the determined topic configuration information storage space or topic configuration information storage path, and determines the target configuration data corresponding to the target topic type according to the target configuration information. The specific method includes:

[0042] Calling a preset configuration loading method to read target configuration information corresponding to the target subject type from a configuration mapping table corresponding to the object to be configured; the configuration mapping table stores subject configuration information corresponding to all subject types of the object to be configured; the subject configuration information corresponding to each subject type includes multiple key-value pairs; the target configuration information includes at least one target key-value pair;

[0043] According to the target configuration information, target configuration data required by the target theme type is loaded; the target configuration data includes at least one of target color data, target image data and target style data.

[0044] As an optional embodiment, in the second aspect of the present invention, each of the target key-value pairs is one of a target color key-value pair, a target image key-value pair, and a target style key-value pair; the theme management framework further includes an image module;

[0045] The specific manner in which the data loading unit loads the target configuration data required by the target subject type according to the target configuration information includes:

[0046] When the target configuration information includes at least one target image key-value pair, for each target image key-value pair, determining whether there is cached image data matching the target image key-value pair in the image cache pool of the theme management framework;

[0047] When it is determined that cached image data matching the target image key-value pair exists in the image cache pool of the theme management framework, the cached image data is loaded into the singleton theme management module as the first target image data required by the target theme type;

[0048] When it is determined that there is no cached image data matching the target image key-value pair in the image cache pool of the theme management framework, the second target image data stored in the image storage path indicated by the target image key-value pair is loaded into the image module, and the second target image data is loaded into the singleton theme management module through the resource management module, and the second target image data is cached into the image cache pool.

[0049] As an optional embodiment, in the second aspect of the present invention, the device further includes:

[0050] an exception handling unit, configured to, when detecting that an image loading exception occurs during the process of loading the second target image data stored in the image storage path indicated by the target image key-value pair into the image module, capture the image loading exception and record an exception log regarding the image loading exception;

[0051] Performing an exception handling operation for the image loading exception;

[0052] The data loading unit is further configured to call an abnormal image loading method to load preset image data as target image data into the singleton theme management module; the preset image data is placeholder image data or application default image data.

[0053] As an optional embodiment, in the second aspect of the present invention, the device further includes:

[0054] A detection unit, configured to detect whether the number of image caches in the image cache pool is greater than or equal to a preset maximum cache number;

[0055] a counting unit, configured to count a time period during which each cached image data in the image cache pool has not been accessed when it is detected that the number of image caches in the image cache pool is greater than or equal to the maximum cache number;

[0056] The determining unit is further configured to determine at least one to-be-cleared image data to be cleared from all the cached image data based on a preset cache clearing strategy and according to the non-accessed time period;

[0057] The cache cleaning unit is configured to perform a cleaning operation on all the image data to be cleaned in the image cache pool, so that the image cache quantity of the image cache pool after performing the cleaning operation is less than the maximum cache quantity.

[0058] As an optional implementation manner, in the second aspect of the present invention, the data loading unit is further configured to:

[0059] Before calling the preset configuration loading method to read the target configuration information corresponding to the target theme type from the configuration mapping table corresponding to the object to be configured, when it is detected that the target theme type is not any historical theme type, obtaining a new theme configuration file corresponding to the target theme type; each of the historical theme types is a preset theme type or a theme type configured for the object to be configured;

[0060] Add the newly added theme configuration file to the resource directory corresponding to the object to be configured;

[0061] Parse the newly added theme configuration file to obtain a file parsing result corresponding to the newly added theme configuration file;

[0062] Generate new theme configuration information indicated by the new theme configuration file according to the file parsing result; the new theme configuration information includes at least one new key-value pair;

[0063] The newly added topic configuration information is stored in the configuration mapping table.

[0064] As an optional implementation, in the second aspect of the present invention, the theme management framework further includes a persistent storage module;

[0065] Wherein, the device further includes:

[0066] A storage unit, configured to transmit the target topic type to the persistent storage module, and store the target topic type by the persistent storage module;

[0067] The reading unit is configured to read the target subject type from the persistent storage module when the object to be configured needs to be reloaded, so as to restore the subject type of the object to be configured to the target subject type.

[0068] A third aspect of the present invention discloses another theme management device, comprising:

[0069] a memory storing executable program code;

[0070] a processor coupled to the memory;

[0071] The processor calls the executable program code stored in the memory to execute part or all of the steps of the subject management method disclosed in the first aspect of the present invention.

[0072] The fourth aspect of the present invention discloses a theme management system, which includes at least the theme management device disclosed in the second aspect of the present invention, and a network-attached storage device that is communicatively connected to the theme management device, and theme configuration data is stored on the network-attached storage device. When the theme management device loads the target configuration data in the theme configuration data, the theme management device completes the theme management operation for the object to be configured according to the theme management method disclosed in the first aspect of the present invention and based on the target configuration data.

[0073] A fifth aspect of the present invention discloses a computer storage medium storing computer instructions, which, when called, are used to execute part or all of the steps of the subject management method disclosed in the first aspect of the present invention.

[0074] Compared with the prior art, the present invention has the following beneficial effects:

[0075] The implementation of the present invention can, when receiving a theme configuration request for the system and / or application to be configured, first determine the target theme type that needs to be configured, then call the configuration loading method, thereby loading the target configuration data corresponding to the target theme type, and then render the target configuration component based on the target configuration data, thereby achieving efficient loading of the theme configuration data that needs to be switched / updated, thereby improving the theme management efficiency of the HarmonyOS NEXT system while achieving the theme switching function without refreshing the interface, thereby improving the theme switching efficiency of the HarmonyOS NEXT system, and further helping to improve the user's interface browsing experience for themes that need to be switched / updated, and helping to improve the user's experience of using the theme management function; further, a singleton theme management module using a singleton mode can avoid repeated instantiation through the singleton mode, thereby significantly reducing the memory required for theme management and further improving the theme management efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0077] Figure 1 This is a flowchart of a topic management method disclosed in an embodiment of the present invention;

[0078] Figure 2 This is a flowchart of another topic management method disclosed in an embodiment of the present invention;

[0079] Figure 3 This is a schematic diagram of the structure of a theme management framework disclosed in an embodiment of the present invention;

[0080] Figure 4 This is a structural diagram of a theme management device disclosed in an embodiment of the present invention;

[0081] Figure 5 It is a structural diagram of another theme management device disclosed in an embodiment of the present invention;

[0082] Figure 6 This is a structural diagram of another theme management device disclosed in an embodiment of the present invention;

[0083] Figure 7 It is a structural diagram of a theme management system disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0084] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0085] The terms "first," "second," and so on, in the description and claims of the present invention and the accompanying drawings are used to distinguish between different items, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or end comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed therein, or may optionally include other steps or elements inherent to such process, method, product, or end.

[0086] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0087] The present invention discloses a theme management method, device and system. When receiving a theme configuration request for a system and / or application to be configured, the method can first determine the target theme type to be configured, then call a configuration loading method to load target configuration data corresponding to the target theme type, and then render a target configuration component based on the target configuration data. This method can achieve efficient loading of theme configuration data that needs to be switched / updated, thereby improving the theme management efficiency of the HarmonyOS NEXT system while achieving a theme switching function without refreshing the interface, thereby improving the theme switching efficiency of the HarmonyOS NEXT system, thereby facilitating a user's browsing experience for interfaces that need to switch / update themes, and improving the user's experience of using the theme management function. Furthermore, a singleton theme management module using a singleton mode can avoid repeated instantiation through the singleton mode, thereby significantly reducing the memory required for theme management and further improving theme management efficiency. Detailed descriptions are given below.

[0088] Example 1

[0089] See also Figure 1 , Figure 1 This is a flow chart of a topic management method disclosed in an embodiment of the present invention. Figure 1 The described theme management method can be applied to a theme management device, which may include one of a theme management terminal, a theme management device, and a server, wherein the server may be a local server or a cloud server, which is not limited by the embodiment of the present invention. In addition, the method can be applied to an electronic device equipped with HarmonyOS NEXT, and an application is installed in the electronic device, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application. Furthermore, the method can be specifically applied to a theme management framework in an electronic device, and more specifically, it can be applied to a singleton theme management module included in the theme management framework, and the singleton theme management module is constructed based on the singleton pattern; optionally, the theme management framework can be built using the ArkTS language, which is not limited by the embodiment of the present invention. As Figure 1 As shown, the topic management method may include the following operations:

[0090] 101. When receiving a topic configuration request for an object to be configured, determine a target topic type corresponding to the topic configuration request.

[0091] In an embodiment of the present invention, the object to be configured may include an operating system and / or any application; further, the object to be configured may specifically include the UI interface (User Interface) of the operating system and / or any application, which is not limited in the embodiment of the present invention; wherein, the operating system may be the HarmonyOS NEXT system, and the above-mentioned application may be an application program installed in / running in the above-mentioned operating system, which is not limited in the embodiment of the present invention. wherein, the theme configuration request may include a theme switching request or a theme update request; further, the theme update request may be sent by any interface element of the above-mentioned object to be configured to the singleton theme management module, wherein the interface element may include any page of the object to be configured and / or at least one UI component in any page, which is not limited in the embodiment of the present invention.

[0092] In the embodiment of the present invention, the theme configuration request may include at least one of an image configuration request, a color configuration request, and a style configuration request, which is not limited in the embodiment of the present invention.

[0093] 102. Read target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determine target configuration data corresponding to the target theme type according to the target configuration information.

[0094] In an embodiment of the present invention, optionally, the above-mentioned subject configuration information storage space or subject configuration information storage path can be a configuration mapping table corresponding to the object to be configured, or other files that can be used to store subject configuration information, or other types of storage space or storage path, which is not limited by the embodiment of the present invention.

[0095] In the embodiment of the present invention, the target configuration information is used to indicate the theme configuration data required by the target theme type and / or records the theme configuration data required by the target theme type.

[0096] In an embodiment of the present invention, optionally, the target configuration data may be recorded in the above-mentioned target configuration information, or may be stored in a local storage corresponding to the object to be configured, or may be stored in other storage devices that are communicatively connected to the object to be configured, and the embodiment of the present invention does not limit this. Further, optionally, the other storage device may be a network-attached storage device, or may be other devices with data storage capabilities, and the embodiment of the present invention does not limit this.

[0097] In an embodiment of the present invention, optionally, the target configuration data may include at least one of target color data, target image data, and target style data, which is not limited in the embodiment of the present invention; wherein, exemplarily, the target style data may include one or more of fonts, spacing, animation effects, and may also include other types of style data, which is not limited in the embodiment of the present invention.

[0098] 103. Based on the target configuration data, render at least one target configuration component in the object to be configured that matches the target configuration data.

[0099] In an embodiment of the present invention, for example, the target configuration component that needs to be rendered may include all UI components in a certain page, or may include one or more UI components in a certain page, which is not limited in the embodiment of the present invention; further optionally, the target configuration component that needs to be rendered may be at least one target configuration component in the currently opened page in the object to be configured, which is not limited in the embodiment of the present invention.

[0100] In the embodiment of the present invention, optionally, step 103 may specifically include the following operations:

[0101] According to the subject configuration request, at least one target configuration component that needs to be rendered in the object to be configured and the target page where the target configuration component is located are determined; the target configuration data is transmitted to the target page to render all the above target configuration components based on the target configuration data.

[0102] It can be seen that the method described in the embodiment of the present invention can, when receiving a theme configuration request for the system and / or application to be configured, first determine the target theme type that needs to be configured, and then call the configuration loading method to load the target configuration data corresponding to the target theme type, and then render the target configuration component based on the target configuration data, so as to achieve efficient loading of the theme configuration data that needs to be switched / updated, thereby improving the theme management efficiency of the HarmonyOS NEXT system while realizing the theme switching function without refreshing the interface, thereby improving the theme switching efficiency of the HarmonyOS NEXT system, and further helping to improve the user's interface browsing experience for the theme that needs to be switched / updated, and helping to improve the user's experience of using the theme management function; further, the singleton theme management module using the singleton mode can avoid repeated instantiation through the singleton mode, thereby significantly reducing the memory required for theme management and further improving the theme management efficiency.

[0103] In an optional embodiment, the theme management framework may further include a persistent storage module. The persistent storage module may be used to store the currently set theme type of the object to be configured. Optionally, the persistent storage module may be implemented based on the HarmonyOS Preferences mechanism, which is not limited in this embodiment of the present invention.

[0104] Optionally, the method may further include the following operations:

[0105] Transmit the target topic type to the persistent storage module, and the persistent storage module stores the target topic type;

[0106] When the object to be configured needs to be reloaded, the target topic type is read from the persistent storage module to restore the topic type of the object to be configured to the target topic type.

[0107] Optionally, the need to reload the object to be configured may specifically be a case of restarting the application / system, or may specifically be a case of reloading any page in the application / system, which is not limited in the embodiment of the present invention.

[0108] It can be seen that this optional embodiment can store the target theme type by using a persistent storage module, and can read the target theme type from the persistent storage module when the object to be configured needs to be reloaded, so as to restore the theme type of the object to be configured to the target theme type, thereby improving the theme recovery efficiency and theme recovery accuracy when reloading the object to be configured, which is conducive to further improving the user's theme browsing experience when reloading the object to be configured.

[0109] In another optional embodiment, the method may further include the following operations:

[0110] Set the appearance mode listener on the object to be configured;

[0111] When the appearance mode listener listens to the appearance mode change event for the object to be configured, the current appearance mode of the object to be configured is obtained, and the interface element corresponding to the object to be configured generates a theme configuration request corresponding to the appearance mode change event, and sends the theme configuration request to the singleton theme management module.

[0112] Optionally, the theme configuration request received by the singleton theme management module may be a theme configuration request sent by the above-mentioned interface element, which is not limited in the embodiment of the present invention.

[0113] Optionally, the current appearance mode of the object to be configured may be obtained through an API (Application Programming Interface) provided by the operating system, which is not limited in the embodiment of the present invention. The target theme type may correspond to the current appearance mode.

[0114] Among them, the appearance mode change event is used to indicate that the appearance mode of the operating system or application has changed; among them, for example, the appearance mode may include one or more of light mode, dark mode and custom mode, which is not limited in the embodiment of the present invention; further, the custom mode may include the appearance mode customized by the user and / or the extended appearance mode selected by the user, which is not limited in the embodiment of the present invention.

[0115] It can be seen that this optional embodiment can set an appearance mode listener, and after listening to the appearance mode change event, send a corresponding theme configuration request to the singleton theme management module, which can improve the monitoring efficiency and accuracy of the system / application's appearance mode changes, thereby helping to improve the transmission efficiency and accuracy of the theme configuration request, and further helping to improve the loading efficiency of the theme configuration data.

[0116] Example 2

[0117] See also Figure 2 , Figure 2 This is a flow chart of a topic management method disclosed in an embodiment of the present invention. Figure 2 The described theme management method can be applied to a theme management device, which may include one of a theme management terminal, a theme management device, and a server, wherein the server may be a local server or a cloud server, which is not limited by the embodiment of the present invention. In addition, the method can be applied to an electronic device equipped with HarmonyOS NEXT, and an application is installed in the electronic device, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application. Furthermore, the method can be specifically applied to a theme management framework in an electronic device, and more specifically, it can be applied to a singleton theme management module included in the theme management framework, and the singleton theme management module is constructed based on the singleton pattern; optionally, the theme management framework can be built using the ArkTS language, which is not limited by the embodiment of the present invention. As Figure 2 As shown, the topic management method may include the following operations:

[0118] 201. When receiving a topic configuration request for an object to be configured, determine a target topic type corresponding to the topic configuration request.

[0119] In the embodiment of the present invention, the object to be configured includes an operating system and / or any application; the theme configuration request includes a theme switching request or a theme updating request.

[0120] 202. Call a preset configuration loading method to read target configuration information corresponding to the target subject type from a configuration mapping table corresponding to the object to be configured.

[0121] In the embodiment of the present invention, optionally, the above configuration loading method may be a public method in the singleton theme management module, which is not limited in the embodiment of the present invention.

[0122] In an embodiment of the present invention, the configuration mapping table corresponding to the object to be configured stores the subject configuration information corresponding to all subject types of the object to be configured; wherein, the subject configuration information corresponding to any subject type is used to indicate the subject configuration data required for the subject type / records the subject configuration data required for the subject type, and the subject configuration information corresponding to each subject type includes multiple key-value pairs, and each key-value pair is used to record any subject configuration data and / or the storage path corresponding to any subject configuration data, which is not limited in the embodiment of the present invention; the target configuration information may include at least one target key-value pair. Optionally, the configuration mapping table may be a memory mapping table; further optionally, the configuration mapping table may be a private attribute of a singleton subject management module, which is not limited in the embodiment of the present invention.

[0123] In an embodiment of the present invention, optionally, the theme configuration information stored in the configuration mapping table can be obtained by parsing the theme configuration file corresponding to each theme type, which is not limited in the embodiment of the present invention; wherein, optionally, the theme configuration file can be a JSON format file, which is not limited in the embodiment of the present invention; wherein, the theme configuration file can be stored in the resource directory corresponding to the object to be configured, which is not limited in the embodiment of the present invention.

[0124] 203. Load target configuration data required by the target topic type according to the target configuration information.

[0125] In an embodiment of the present invention, the target configuration data may include at least one of target color data, target image data, and target style data.

[0126] 204. Based on the target configuration data, render at least one target configuration component in the object to be configured that matches the target configuration data.

[0127] In the embodiment of the present invention, for other detailed descriptions of step 201 and step 204, please refer to the detailed descriptions of step 101 and step 103 in the first embodiment, which will not be repeated in the embodiment of the present invention.

[0128] It can be seen that the method described in the embodiment of the present invention can, when receiving a theme configuration request for the system and / or application to be configured, first determine the target theme type that needs to be configured, and then call the configuration loading method to load the target configuration data corresponding to the target theme type, and then render the target configuration component based on the target configuration data, so as to achieve efficient loading of the theme configuration data that needs to be switched / updated, thereby improving the theme management efficiency of the HarmonyOS NEXT system while realizing the theme switching function without refreshing the interface, thereby improving the theme switching efficiency of the HarmonyOS NEXT system, and further helping to improve the user's interface browsing experience for the theme that needs to be switched / updated, and helping to improve the user's experience of using the theme management function; further, the singleton theme management module using the singleton mode can avoid repeated instantiation through the singleton mode, thereby significantly reducing the memory required for theme management and further improving the theme management efficiency. In addition, by calling the configuration loading method, the corresponding target configuration information can be read from the configuration mapping table, and then the target configuration data can be loaded based on the target configuration information containing at least one key-value pair, which can improve the reading efficiency of the configuration information corresponding to the target theme type, thereby facilitating further improving the loading efficiency and loading accuracy of the target configuration data required for the target theme type; and, by configuring the mapping table to store the relevant key-value pairs of the configuration data required for the theme type, the number of repeated parsing of the theme configuration file can be reduced, and the reading efficiency of the key-value pairs can be improved, thereby improving the loading efficiency of the target configuration data.

[0129] In an optional embodiment, each target key-value pair can be one of a target color key-value pair, a target image key-value pair, and a target style key-value pair. Optionally, the target color key-value pair can include color value data, the target image key-value pair can include an image storage path, and the target style key-value pair can include style data, all of which are not limited in this embodiment of the present invention. Furthermore, the image storage path can be a storage path stored in a network attached storage device or in another device, all of which are not limited in this embodiment of the present invention.

[0130] Optionally, the theme management framework may also include a resource management module and an image module.

[0131] In this optional embodiment, optionally, loading target configuration data required by the target topic type according to the target configuration information may include the following operations:

[0132] When the target configuration information includes at least one target image key-value pair, for each target image key-value pair, determining whether there is cached image data matching the target image key-value pair in the image cache pool of the theme management framework;

[0133] When it is determined that cached image data matching the target image key-value pair exists in the image cache pool of the theme management framework, the cached image data is loaded into the singleton theme management module as first target image data required by the target theme type;

[0134] When it is determined that there is no cached image data matching the target image key-value pair in the image cache pool of the theme management framework, the second target image data stored in the image storage path indicated by the target image key-value pair is loaded into the image module, and the second target image data is loaded into the singleton theme management module through the resource management module, and the second target image data is cached into the image cache pool.

[0135] Optionally, the second target image data stored in the image storage path indicated by the target image key-value pair may be loaded into the image module by calling a preset image actual loading method, which is not limited in the embodiment of the present invention.

[0136] Optionally, the image cache pool may be set in a singleton theme management module or in other modules of the theme management framework, which is not limited in the embodiment of the present invention.

[0137] Exemplarily, when it is detected that the user has uploaded user-configured image data for the target theme type through any page of the object to be configured, an image loading request is triggered, and the public image acquisition method set by the singleton theme management module is called to request the target image data from the singleton theme management module, thereby calling a pre-set cache call method to determine whether the user-configured image data exists in the image cache pool. If the user-configured image data exists in the image cache pool, the cached image data in the image cache pool that matches the user-configured image data is loaded into the singleton theme management module; otherwise, the user-configured image data can be loaded from the specified path by calling a pre-set image actual loading method. If the loading of the user-configured image data is successful, the user-configured image data is cached in the image cache pool and loaded into the singleton theme management module; further, the target image data loaded into the singleton theme management module is returned to the interface element through the image acquisition method to display the target image data in the target configuration component, which is not limited in the embodiment of the present invention.

[0138] It can be seen that this optional embodiment can first determine whether there is corresponding cached image data in the image cache pool when image data needs to be loaded. If so, the cached image data is directly loaded. Otherwise, the required configured image data is loaded through the image storage path, and the image data is cached to the image cache pool. By adopting a three-level cache structure (memory mapping table-image cache-disk loading), it can improve the loading efficiency of the image data required for switching / updating the theme while reducing the number of IO operations required for loading the configuration data, which is conducive to further improving the theme rendering efficiency, thereby further improving the theme switching efficiency.

[0139] In this optional embodiment, the method may further include the following operations:

[0140] When it is detected that an image loading exception occurs during the process of loading the second target image data stored in the image storage path indicated by the target image key-value pair into the image module, capturing the image loading exception and recording an exception log regarding the image loading exception;

[0141] Perform exception handling operations for image loading exceptions;

[0142] The abnormal image loading method is called to load the preset image data as the target image data into the singleton theme management module; wherein the preset image data can be placeholder image data or application default image data.

[0143] Optionally, the image loading exception may be an invalid image storage path exception or a network exception, or may be other types of exceptions that may occur during the image loading process, which is not limited in the embodiment of the present invention.

[0144] The exception log may record the relevant file identifier of the image loading exception. Specifically, the file identifier may be a file name, which is not limited in the embodiment of the present invention.

[0145] It can be seen that this optional embodiment can also capture and record the exception log of image loading exceptions during the actual loading of image data. It can reduce the possibility of system crashes by capturing exceptions while improving the accuracy of recording image loading exceptions, thereby helping to improve exception handling efficiency and processing accuracy, and thus helping to improve the system's operational reliability; and it can also load pre-prepared default image data to the corresponding component when an image loading exception occurs, which can maintain the continuity of the user's interface browsing experience for the object to be configured, and thus help to improve the user's interface browsing experience for the need to switch / update themes.

[0146] In this optional embodiment, the method may further include the following operations:

[0147] Check whether the number of image caches in the image cache pool is greater than or equal to a preset maximum cache number;

[0148] When it is detected that the number of image caches in the image cache pool is greater than or equal to the maximum cache number, the non-access time of each cached image data in the image cache pool is counted;

[0149] Based on a pre-set cache cleaning strategy and according to a length of time that the cached image data has not been accessed, at least one image data to be cleaned up is determined from all cached image data;

[0150] A cleaning operation is performed on all image data to be cleaned in the image cache pool, so that the number of image caches in the image cache pool after the cleaning operation is performed is less than the maximum cache number.

[0151] Exemplarily, the maximum number of caches may be 60, or other numbers, which is not limited in the embodiment of the present invention.

[0152] Among them, as another optional implementation, it is also possible to detect whether the image cache size of the image cache pool is greater than or equal to a preset maximum cache capacity. When it is detected that the image cache size of the image cache pool is greater than or equal to the maximum cache capacity, a cache cleaning operation as in the above optional implementation may also be performed to make the image cache size of the image cache pool smaller than the maximum cache capacity. This is not limited in the embodiment of the present invention.

[0153] Among them, optionally, the above-mentioned cache cleaning strategy can be an LRU (Least Recently Used) strategy, which is not limited in the embodiment of the present invention; when the cache cleaning strategy is the LRU strategy, at least one cached image data whose non-access time is greater than or equal to a preset time threshold is filtered out from all cached image data as the image data to be cleaned, or a preset number of cached image data with the longest non-access time are filtered out from all cached image data as the image data to be cleaned, which is not limited in the embodiment of the present invention.

[0154] It can be seen that this optional embodiment can also detect whether the number of image caches in the image cache pool exceeds the preset maximum cache number limit. If it has exceeded, the image cache pool is cleaned based on the cache cleaning strategy, so that the cleaned image cache pool can have sufficient cache space to cache the image configuration data that is currently required to be loaded. By setting the maximum cache number limit, the risk of memory leakage can be reduced, which is conducive to improving the reliability of theme management and maintaining the data security and stability of system operation.

[0155] In this optional embodiment, optionally, loading target configuration data required by the target topic type according to the target configuration information may include the following operations:

[0156] When the target configuration information includes at least one target color key-value pair, reading the color value data in each target color key-value pair, and loading the read color value data as the target color data into the singleton theme management module; and / or,

[0157] When the target configuration information includes at least one target style key-value pair, the style data in each target style key-value pair is read, and the read style data is loaded into the singleton theme management module as the target style data.

[0158] Among them, optionally, when the interface element of the object to be configured needs to switch / update the color configuration data, the target color data can be requested by calling the public color acquisition method set by the singleton theme management module, and the target color data can be returned to the interface element through the color acquisition method, thereby performing color configuration on the target configuration component, which is not limited in the embodiment of the present invention.

[0159] It can be seen that this optional embodiment can read the data in the key-value pair as the target configuration data and load it into the singleton theme management module when color data and / or style data needs to be loaded, which can improve the reading efficiency of color configuration data and / or style configuration data, thereby improving the loading efficiency of color configuration data and / or sample color configuration data.

[0160] In another optional embodiment, before calling a preset configuration loading method to read target configuration information corresponding to the target subject type from the configuration mapping table corresponding to the object to be configured, the method may further include the following operations:

[0161] When it is detected that the target theme type is not any historical theme type, a new theme configuration file corresponding to the target theme type is obtained; each historical theme type is a preset theme type or a theme type configured for the object to be configured;

[0162] Add the new theme configuration file to the resource directory corresponding to the object to be configured;

[0163] Parse the newly added theme configuration file and obtain the file parsing result corresponding to the newly added theme configuration file;

[0164] Generate new theme configuration information indicated by the new theme configuration file according to the file parsing result; the new theme configuration information includes at least one new key-value pair;

[0165] Store the newly added topic configuration information in the configuration mapping table.

[0166] Exemplarily, when it is detected that the target theme type is a user-defined theme type newly set or a user-referenced extended theme type, the storage operation of the newly added theme configuration information of this optional embodiment is performed, which is not limited in the embodiment of the present invention.

[0167] Exemplarily, the newly added theme configuration file may be set as a theme configuration file named based on a preset rule, such as "theme3.json", which is not limited in the embodiment of the present invention.

[0168] It can be seen that this optional embodiment can first add the corresponding theme configuration file to the resource directory when it detects that the target theme type is a newly configured theme type, and then parse the theme configuration file to generate the corresponding key-value pairs, and store the generated key-value pairs in the configuration mapping table. It can realize dynamic expansion of theme packages, improve the flexibility of theme configuration, and help improve theme management efficiency and management flexibility; and it is beneficial to obtain configuration information by pre-parsing the configuration file, which can help improve the efficiency of subsequent reading of configuration information, and thus help improve the loading efficiency of theme configuration data.

[0169] In the embodiment of the present invention, for example, please refer to Figure 3 , Figure 3 This is a schematic diagram of the structure of a theme management framework disclosed in an embodiment of the present invention. Figure 3 As shown, the theme management framework can include UgAppTheme (i.e. the singleton theme management module), PreferenceManager (i.e. the persistent storage module), ResourceManager (i.e. the resource management module), Image module (i.e. the image module), UI components / pages (i.e. the interface elements) and theme resource files (i.e. the theme configuration files and / or image data). Furthermore, the interaction between the modules included in the theme management framework can be as follows: Figure 3 The connection relationship of each module in FIG is shown as follows, and is not limited in the embodiment of the present invention.

[0170] Among them, UgAppTheme is used to receive theme configuration requests for UI components / pages, and through interacting with other modules, receive target configuration data efficiently loaded by other modules, and transmit the configuration data requested by UI components / pages to UI components / pages. Furthermore, UgAppTheme may include private properties such as singleton instance (static private), target theme type, configuration mapping table, image cache pool and maximum cache quantity, which are not limited in the embodiment of the present invention; further, UgAppTheme may include public methods such as singleton entry method (for accessing the singleton instance of the singleton theme management module), color acquisition method, theme switching trigger, current theme type acquisition method (for obtaining the above-mentioned target theme type), image acquisition method, actual image loading method and cache cleaning strategy execution method, which are not limited in the embodiment of the present invention.

[0171] In addition, PreferenceManager is used to store the target theme type currently required for configuration, so that the user's selected theme type can be restored when the application is restarted or reloaded; UI components / pages are used to send theme configuration requests to UgAppTheme when the theme type / appearance mode needs to be switched or updated, and receive the target configuration data returned by UgAppTheme, and display / render the target configuration data on the target configuration component; ResourceManager is used to load theme configuration data from theme configuration files / image cache pools / storage paths where theme configuration data is stored; Image modules are used to process and load PixelMap (that is, images that actually need to be read from the image storage path and loaded into the theme management framework), and to manage image cache pools; theme resource files (for example, themeX.json, image data) can be used to record theme configuration data corresponding to the theme type of the object to be configured, which is not limited in the embodiment of the present invention. Furthermore, through modules such as ResourceManager, Image modules, and theme resource files, a three-level cache (configuration mapping table-image cache-disk loading) of the theme management framework is constructed, which can improve the speed of loading configuration resources while reducing the number of IO operations required to load configuration data.

[0172] Example 3

[0173] See also Figure 4 , Figure 4 : is a structural diagram of a theme management device disclosed in an embodiment of the present invention. Figure 4The described theme management apparatus may include one of a theme management terminal, a theme management device and a server, wherein the server may be a local server or a cloud server, which is not limited in the embodiment of the present invention; the apparatus may be applied to an electronic device equipped with HarmonyOS NEXT, and an application is installed in the electronic device, the electronic device is in communication connection with a network attached storage device, and the electronic device can access the network attached storage device through the application. Furthermore, the apparatus may be specifically applied to a theme management framework in an electronic device, and more specifically, may be applied to a singleton theme management module included in the theme management framework, and the singleton theme management module is constructed based on a singleton pattern; optionally, the theme management framework may be constructed using the ArkTS language, which is not limited in the embodiment of the present invention. Figure 4 As shown, the theme management device 30 may include:

[0174] The determining unit 301 is configured to, upon receiving a theme configuration request for an object to be configured, determine a target theme type corresponding to the theme configuration request; the object to be configured includes an operating system and / or any application; the theme configuration request includes a theme switching request or a theme update request;

[0175] The data loading unit 302 is configured to read the target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determine the target configuration data corresponding to the target theme type according to the target configuration information; the target configuration information is used to indicate / record the theme configuration data required for the target theme type;

[0176] The rendering unit 303 is configured to render, based on the target configuration data, at least one target configuration component in the object to be configured that matches the target configuration data.

[0177] It can be seen that the device described in the embodiment of the present invention can, when receiving a theme configuration request for the system and / or application to be configured, first determine the target theme type that needs to be configured, and then call the configuration loading method to load the target configuration data corresponding to the target theme type, and then render the target configuration component based on the target configuration data, so as to achieve efficient loading of the theme configuration data that needs to be switched / updated, thereby improving the theme management efficiency of the HarmonyOS NEXT system while realizing the theme switching function without refreshing the interface, thereby improving the theme switching efficiency of the HarmonyOS NEXT system, and thus helping to improve the user's interface browsing experience for the theme that needs to be switched / updated, and helping to improve the user's experience of using the theme management function; further, the singleton theme management module using the singleton mode can avoid repeated instantiation through the singleton mode, thereby significantly reducing the memory required for theme management and further improving the theme management efficiency.

[0178] In an optional embodiment, the data loading unit 302 reads the target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determines the target configuration data corresponding to the target theme type according to the target configuration information, including:

[0179] Calling a preset configuration loading method to read target configuration information corresponding to a target topic type from a configuration mapping table corresponding to the object to be configured; the configuration mapping table stores topic configuration information corresponding to all topic types of the object to be configured; the topic configuration information corresponding to each topic type includes multiple key-value pairs; the target configuration information includes at least one target key-value pair;

[0180] According to the target configuration information, target configuration data required by the target theme type is loaded; the target configuration data includes at least one of target color data, target image data, and target style data.

[0181] It can be seen that the device described in implementing this optional embodiment can read the corresponding target configuration information from the configuration mapping table by calling the configuration loading method, and then load the target configuration data based on the target configuration information containing at least one key-value pair, which can improve the reading efficiency of the configuration information corresponding to the target subject type, thereby facilitating further improving the loading efficiency and loading accuracy of the target configuration data required for the target subject type; and, by storing the relevant key-value pairs of the configuration data required for the subject type in the configuration mapping table, it can reduce the number of repeated parsing of the subject configuration file, improve the reading efficiency of the key-value pairs, and thus improve the loading efficiency of the target configuration data.

[0182] In this optional embodiment, optionally, each target key-value pair is one of a target color key-value pair, a target image key-value pair, and a target style key-value pair; the theme management framework further includes a resource management module and an image module;

[0183] The specific manner in which the data loading unit 302 loads the target configuration data required by the target theme type according to the target configuration information includes:

[0184] When the target configuration information includes at least one target image key-value pair, for each target image key-value pair, determining whether there is cached image data matching the target image key-value pair in the image cache pool of the theme management framework;

[0185] When it is determined that cached image data matching the target image key-value pair exists in the image cache pool of the theme management framework, the cached image data is loaded into the singleton theme management module as first target image data required by the target theme type;

[0186] When it is determined that there is no cached image data matching the target image key-value pair in the image cache pool of the theme management framework, the second target image data stored in the image storage path indicated by the target image key-value pair is loaded into the image module, and the second target image data is loaded into the singleton theme management module through the resource management module, and the second target image data is cached into the image cache pool.

[0187] It can be seen that the device described in the implementation of this optional embodiment can also first determine whether there is corresponding cached image data in the image cache pool when image data needs to be loaded. If so, the cached image data is directly loaded. Otherwise, the required configured image data is loaded through the image storage path, and the image data is cached to the image cache pool. By adopting a three-level cache structure (memory mapping table-image cache-disk loading), it can improve the loading efficiency of the image data required for switching / updating the theme while reducing the number of IO operations required for loading the configuration data, which is conducive to further improving the theme rendering efficiency, thereby further improving the theme switching efficiency.

[0188] In this optional embodiment, optionally, as Figure 5 As shown, the device may also include:

[0189] The exception handling unit 304 is configured to, when detecting that an image loading exception occurs during the process of loading the second target image data stored in the image storage path indicated by the target image key-value pair into the image module, capture the image loading exception, record an exception log regarding the image loading exception, and perform an exception handling operation for the image loading exception;

[0190] The data loading unit 302 is further configured to call an abnormal image loading method to load preset image data as target image data into the singleton theme management module; the preset image data is placeholder image data or application default image data.

[0191] It can be seen that the device described in the implementation of this optional embodiment can also capture and record the exception log of image loading exceptions during the actual loading of image data. It can reduce the possibility of system crashes by capturing exceptions, while improving the accuracy of recording image loading exceptions, thereby helping to improve exception handling efficiency and processing accuracy, and thus helping to improve the system's operational reliability; and it can also load pre-prepared default image data to the corresponding component when an image loading exception occurs, which can maintain the continuity of the user's interface browsing experience for the object to be configured, and thus help to improve the user's interface browsing experience for the need to switch / update themes.

[0192] In this optional embodiment, optionally, as Figure 5 As shown, the device may also include:

[0193] A detection unit 305 is used to detect whether the number of image caches in the image cache pool is greater than or equal to a preset maximum cache number;

[0194] A counting unit 306 is configured to count a non-accessed time period of each cached image data in the image cache pool when it is detected that the image cache number in the image cache pool is greater than or equal to the maximum cache number;

[0195] The determining unit 301 is further configured to determine at least one image data to be cleared from all cached image data based on a preset cache clearing strategy and a length of time the image data has not been accessed;

[0196] The cache clearing unit 307 is configured to perform a clearing operation on all the image data to be cleared in the image cache pool, so that the image cache quantity of the image cache pool after the clearing operation is performed is less than the maximum cache quantity.

[0197] It can be seen that the device described in the implementation of this optional embodiment can also detect whether the number of image caches in the image cache pool exceeds the preset maximum cache number limit. If it has exceeded, the image cache pool is cleaned based on the cache cleaning strategy, so that the cleaned image cache pool can have sufficient cache space to cache the image configuration data that is currently required to be loaded. By setting the maximum cache number limit, the risk of memory leakage can be reduced, which is conducive to improving the reliability of theme management and maintaining the data security and stability of system operation.

[0198] In this optional embodiment, optionally, the data loading unit 302 calls a preset configuration loading method to load the target configuration data corresponding to the target theme type, and the specific manner also includes:

[0199] Before calling a preset configuration loading method to read target configuration information corresponding to a target theme type from a configuration mapping table corresponding to the object to be configured, when it is detected that the target theme type is not any historical theme type, obtaining a new theme configuration file corresponding to the target theme type; each historical theme type is a preset theme type or a theme type that has been configured for the object to be configured;

[0200] Add the new theme configuration file to the resource directory corresponding to the object to be configured;

[0201] Parse the newly added theme configuration file and obtain the file parsing result corresponding to the newly added theme configuration file;

[0202] Generate new theme configuration information indicated by the new theme configuration file according to the file parsing result; the new theme configuration information includes at least one new key-value pair;

[0203] Store the newly added topic configuration information in the configuration mapping table.

[0204] It can be seen that the device described in implementing this optional embodiment can also add the corresponding theme configuration file to the resource directory when it detects that the target theme type is a newly configured theme type, and then parse the theme configuration file to generate the corresponding key-value pairs, and store the generated key-value pairs in the configuration mapping table, which can realize dynamic expansion of theme packages, improve the flexibility of theme configuration, and help improve theme management efficiency and management flexibility; and is conducive to obtaining configuration information by pre-parsing the configuration file, which can help improve the efficiency of subsequent reading of configuration information, and thus help improve the loading efficiency of theme configuration data.

[0205] In another optional embodiment, the theme management framework further includes a persistent storage module;

[0206] Among them, such as Figure 5 As shown, the device may also include:

[0207] The storage unit 308 is used to transmit the target topic type to the persistent storage module, and the persistent storage module stores the target topic type;

[0208] The reading unit 309 is configured to read the target subject type from the persistent storage module when the object to be configured needs to be reloaded, so as to restore the subject type of the object to be configured to the target subject type.

[0209] It can be seen that the device described in implementing this optional embodiment can store the target theme type by using a persistent storage module, and can read the target theme type from the persistent storage module when the object to be configured needs to be reloaded, so as to restore the theme type of the object to be configured to the target theme type, thereby improving the theme recovery efficiency and theme recovery accuracy when reloading the object to be configured, which is conducive to further improving the user's theme browsing experience when reloading the object to be configured.

[0210] Example 4

[0211] See also Figure 6 , Figure 6 This is a structural diagram of another theme management device disclosed in an embodiment of the present invention. Figure 6 As shown, the theme management device may include:

[0212] A memory 401 storing executable program code;

[0213] a processor 402 coupled to the memory 401;

[0214] The processor 402 calls the executable program code stored in the memory 401 to execute part or all of the steps in the topic management method described in the first embodiment or the second embodiment of the present invention.

[0215] Example 5

[0216] An embodiment of the present invention discloses a computer storage medium storing computer instructions. When the computer instructions are called, they are used to execute some or all of the steps in the topic management method described in the first embodiment or the second embodiment of the present invention.

[0217] Example 6

[0218] See also Figure 7 , Figure 7 is a schematic diagram of the structure of another theme management device disclosed in an embodiment of the present invention. This embodiment of the present invention discloses a theme management system, which includes at least the theme management device 30 described in the third embodiment of the present invention, and a network-attached storage device 50 in communication with the theme management device, wherein the network-attached storage device 50 stores theme configuration data. When the theme management device 30 loads target configuration data from the theme configuration data, the theme management device 30 performs a theme management operation for the object to be configured based on the target configuration data and in accordance with the theme management method described in the first or second embodiment of the present invention.

[0219] Example 7

[0220] An embodiment of the present invention discloses a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to enable a computer to execute some or all of the steps in the topic management method described in embodiment 1 or embodiment 2.

[0221] The device embodiments described above are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Those skilled in the art can understand and implement the present invention without inventive effort.

[0222] Through the detailed description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus the necessary general hardware platform, or of course, by means of hardware. Based on this understanding, the above technical solution, in essence, or the portion that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, including a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.

[0223] Finally, it should be noted that the subject management method, device and system disclosed in the embodiments of the present invention are only preferred embodiments of the present invention, and are only used to illustrate the technical solutions of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A theme management method, wherein the method is applied to an electronic device equipped with HarmonyOS NEXT, wherein the electronic device has an application installed therein, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application, wherein: The method is specifically applied to a singleton theme management module included in a theme management framework in the electronic device, wherein the singleton theme management module is constructed based on a singleton pattern. The method includes: Upon receiving a theme configuration request for an object to be configured, determining a target theme type corresponding to the theme configuration request; the object to be configured includes an operating system and / or any application; the theme configuration request includes a theme switching request or a theme update request; Reading target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determining target configuration data corresponding to the target theme type according to the target configuration information; the target configuration information is used to indicate / record the theme configuration data required for the target theme type; Based on the target configuration data, at least one target configuration component in the object to be configured that matches the target configuration data is rendered.

2. The topic management method according to claim 1, characterized in that: The step of reading target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determining target configuration data corresponding to the target theme type according to the target configuration information, includes: Calling a preset configuration loading method to read target configuration information corresponding to the target subject type from a configuration mapping table corresponding to the object to be configured; the configuration mapping table stores subject configuration information corresponding to all subject types of the object to be configured; the subject configuration information corresponding to each subject type includes multiple key-value pairs; the target configuration information includes at least one target key-value pair; According to the target configuration information, target configuration data required by the target theme type is loaded; the target configuration data includes at least one of target color data, target image data and target style data.

3. The topic management method according to claim 2, characterized in that: Each of the target key-value pairs is one of a target color key-value pair, a target image key-value pair, and a target style key-value pair; the theme management framework further includes a resource management module and an image module; The step of loading target configuration data required for the target subject type according to the target configuration information includes: When the target configuration information includes at least one target image key-value pair, for each target image key-value pair, determining whether there is cached image data matching the target image key-value pair in the image cache pool of the theme management framework; When it is determined that cached image data matching the target image key-value pair exists in the image cache pool of the theme management framework, the cached image data is loaded into the singleton theme management module as the first target image data required by the target theme type; When it is determined that there is no cached image data matching the target image key-value pair in the image cache pool of the theme management framework, the second target image data stored in the image storage path indicated by the target image key-value pair is loaded into the image module, and the second target image data is loaded into the singleton theme management module through the resource management module, and the second target image data is cached into the image cache pool.

4. The topic management method according to claim 3, characterized in that: The method further comprises: When it is detected that an image loading exception occurs during the process of loading the second target image data stored in the image storage path indicated by the target image key-value pair into the image module, capturing the image loading exception and recording an exception log regarding the image loading exception; Performing an exception handling operation for the image loading exception; An abnormal image loading method is called to load preset image data as target image data into the singleton theme management module; the preset image data is placeholder image data or application default image data.

5. The topic management method according to claim 3, characterized in that: The method further comprises: Detecting whether the number of image caches in the image cache pool is greater than or equal to a preset maximum cache number; When it is detected that the number of image caches in the image cache pool is greater than or equal to the maximum cache number, counting the non-accessed time length of each cached image data in the image cache pool; Based on a preset cache cleaning strategy and according to the non-accessed time, determining at least one image data to be cleaned from all the cached image data; A cleaning operation is performed on all the image data to be cleaned in the image cache pool, so that the image cache quantity of the image cache pool after the cleaning operation is performed is less than the maximum cache quantity.

6. The topic management method according to claim 2, characterized in that: Before calling the preset configuration loading method to read the target configuration information corresponding to the target subject type from the configuration mapping table corresponding to the object to be configured, the method further includes: When it is detected that the target theme type is not any historical theme type, obtaining a new theme configuration file corresponding to the target theme type; each of the historical theme types is a preset theme type or a theme type configured for the object to be configured; Add the newly added theme configuration file to the resource directory corresponding to the object to be configured; Parse the newly added theme configuration file to obtain a file parsing result corresponding to the newly added theme configuration file; Generate new theme configuration information indicated by the new theme configuration file according to the file parsing result; the new theme configuration information includes at least one new key-value pair; The newly added topic configuration information is stored in the configuration mapping table.

7. The topic management method according to any one of claims 1 to 6, characterized in that: The theme management framework also includes a persistent storage module; The method further comprises: Transmitting the target topic type to the persistent storage module, and having the persistent storage module store the target topic type; When the object to be configured needs to be reloaded, the target subject type is read from the persistent storage module to restore the subject type of the object to be configured to the target subject type.

8. A theme management device, wherein the device is applied to an electronic device equipped with HarmonyOS NEXT, wherein the electronic device has an application installed therein, the electronic device is communicatively connected to a network attached storage device, and the electronic device can access the network attached storage device through the application, characterized in that: The device is specifically applied to a singleton theme management module included in a theme management framework in the electronic device, wherein the singleton theme management module is constructed based on a singleton pattern, and the device includes: a determining unit configured to, upon receiving a theme configuration request for an object to be configured, determine a target theme type corresponding to the theme configuration request; the object to be configured includes an operating system and / or any application; the theme configuration request includes a theme switching request or a theme update request; a data loading unit, configured to read target configuration information corresponding to the target theme type according to the determined theme configuration information storage space or theme configuration information storage path, and determine target configuration data corresponding to the target theme type according to the target configuration information; the target configuration information is used to indicate / record the theme configuration data required for the target theme type; A rendering unit is configured to render, based on the target configuration data, at least one target configuration component in the object to be configured that matches the target configuration data.

9. A theme management device, characterized in that: The device comprises: a memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the topic management method according to any one of claims 1 to 7.

10. A topic management system, characterized in that: The system includes at least the theme management device as described in claim 8, and a network-attached storage device that is communicatively connected to the theme management device, and theme configuration data is stored on the network-attached storage device. When the theme management device loads target configuration data in the theme configuration data, the theme management device completes the theme management operation for the object to be configured according to the theme management method as described in any one of claims 1 to 7 and based on the target configuration data.

11. A computer storage medium, characterized in that The computer storage medium stores computer instructions, and when the computer instructions are called, they are used to execute the topic management method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Application theme switching method, device and system

    CN112181580A

  • Interface theme switching method and device, equipment, storage medium and program product

    CN113076150A

  • Display theme switching method and device, wearable equipment and storage medium

    CN113722001A