Theme skin switching method, device, computer equipment and computer storage medium

By obtaining and traversing the target element values ​​of page elements and unifying the assignment method, the problem of traditional theme skin switching taking a long time is solved and the switching speed is improved.

CN114675912BActive Publication Date: 2024-10-15TENCENT CLOUD COMPUTING (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110493009.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-06
Publication Date
2024-10-15
Estimated Expiration
2041-05-06

AI Technical Summary

Technical Problem

The traditional theme skin switching method is time-consuming, resulting in low switching speed.

Method used

By obtaining the target theme skin package and page information, traversing the page elements, obtaining the target element value, and adding it to the target assignment method, the assignment method of the page element is unified to increase the switching speed.

Benefits of technology

The speed of theme skin switching is improved, and the problem of low page element change rate caused by different assignment methods in different theme skin packages is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114675912B_ABST
    Figure CN114675912B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, computer equipment and computer storage medium for switching a theme skin, wherein the method comprises: if there is a theme skin switching operation, obtaining a target theme skin package and page information, the page information comprising one or more first page elements, and a first assignment method for each first page element; traversing one or more first page elements, and obtaining a target element value of the currently traversed target first page element in the target theme skin package; adding the target element value to the first assignment method of the target first page element to obtain a target assignment method for one or more first page elements; calling the target assignment method of each first page element in the one or more first page elements, changing each first page element, and obtaining a target page. The theme skin switching method provided by the present application can effectively improve the rate of theme skin switching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for switching theme skins, a computer device, and a computer storage medium. Background Art

[0002] As mobile terminal development becomes more mature, users have higher and higher requirements for products. For example, users usually require applications to have the function of switching themes. However, traditional methods of switching themes usually take a long time to switch, which leads to a low rate of switching themes. Therefore, how to improve the rate of switching themes has become an important research goal for developers. Summary of the invention

[0003] The present application provides a theme skin switching method, device, computer equipment and computer storage medium, which can improve the rate of theme skin switching.

[0004] On the one hand, the present application provides a method for switching a theme skin, the method comprising:

[0005] If there is a theme skin switching operation, then obtaining a target theme skin package and page information, wherein the page information includes one or more first page elements and a first assignment method of each first page element;

[0006] Traversing the one or more first page elements, and obtaining a target element value of the currently traversed target first page element in the target theme skin package;

[0007] Adding the target element value to the first assignment method of the target first page element to obtain the target assignment method of the one or more first page elements;

[0008] The target assignment method of each first page element among the one or more first page elements is called to modify each first page element to obtain a target page.

[0009] On the one hand, the present application provides a theme skin switching device, comprising:

[0010] An acquisition unit, configured to acquire a target theme skin package and page information if a theme skin switching operation exists, wherein the page information includes one or more first page elements and a first value assignment method for each first page element;

[0011] A traversal unit, used for traversing the one or more first page elements, and obtaining a target element value of a currently traversed target first page element in the target theme skin package;

[0012] A processing unit, configured to add the target element value to the first assignment method of the target first page element to obtain the target assignment method of the one or more first page elements;

[0013] The processing unit is further used to call a target assignment method of each first page element among the one or more first page elements, modify each first page element, and obtain a target page.

[0014] In one aspect, the present application provides a computer device, comprising:

[0015] a processor adapted to implement one or more computer programs;

[0016] A computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded and executed by the processor:

[0017] If there is a theme skin switching operation, the target theme skin package and page information are obtained, and the page information includes one or more first page elements, and the first assignment method of each first page element; the one or more first page elements are traversed, and the target element value of the currently traversed target first page element is obtained in the target theme skin package; the target element value is added to the first assignment method of the target first page element to obtain the target assignment method of the one or more first page elements; the target assignment method of each first page element in the one or more first page elements is called to change the each first page element to obtain the target page.

[0018] In one aspect, the present application provides a computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded and executed by a processor:

[0019] If there is a theme skin switching operation, the target theme skin package and page information are obtained, and the page information includes one or more first page elements, and the first assignment method of each first page element; the one or more first page elements are traversed, and the target element value of the currently traversed target first page element is obtained in the target theme skin package; the target element value is added to the first assignment method of the target first page element to obtain the target assignment method of the one or more first page elements; the target assignment method of each first page element in the one or more first page elements is called to change the each first page element to obtain the target page.

[0020] In one aspect, the present application provides a computer program product or a computer program, the computer program product comprising a computer program, the computer program being stored in a computer storage medium; a processor of a computer device reading the computer program from the computer storage medium, the processor executing the computer program, so that the computer device executes:

[0021] If there is a theme skin switching operation, the target theme skin package and page information are obtained, and the page information includes one or more first page elements, and the first assignment method of each first page element; the one or more first page elements are traversed, and the target element value of the currently traversed target first page element is obtained in the target theme skin package; the target element value is added to the first assignment method of the target first page element to obtain the target assignment method of the one or more first page elements; the target assignment method of each first page element in the one or more first page elements is called to change the each first page element to obtain the target page.

[0022] When switching the theme skin of an application, the present application can first obtain each first page element and the first assignment method of each first page element, and then obtain the target element value of the target first page element in the target theme skin package based on the first page element and the first assignment method. After the computer device obtains the target element value, the target first page element can be changed. It can be seen that when the theme skin switching method provided by the present application changes the same page element to different theme skins, the assignment method used is the first assignment method of the page element, which avoids the problem of low page element change rate due to different assignment methods for the target first page element in different theme skin packages, thereby improving the theme skin switching rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0024] Figure 1 It is a schematic diagram of an application page update provided by the present application;

[0025] Figure 2 is a schematic flow chart of a method for switching theme skins provided by the present application;

[0026] Figure 3 It is a flowchart of a method for switching theme skins provided by the present application;

[0027] Figure 4 is a schematic diagram of a theme skin switching method provided by the present application;

[0028] Figure 5 It is a structural schematic diagram of a theme skin switching device provided by the present application;

[0029] Figure 6 It is a structural schematic diagram of a computer device provided by this application. DETAILED DESCRIPTION

[0030] With the rapid development of the Internet, various applications have appeared on the market. Most powerful applications support users to change the application's theme skin on the application's settings page, so that the page elements in the application change, and then the application can be displayed in different display effects on the computer device running the application. Among them, page elements can be understood as button colors, button shapes, background images, etc. on any page in the application.

[0031] Based on this, the present application provides a theme skin switching scheme, the general principle of which is as follows: after establishing a theme skin switching event, the initial assignment method of each initial page element in the application is obtained through "reflection", and a mapping relationship (or corresponding relationship) is established based on each initial page element and the initial assignment method of the initial page element to generate an initial global dictionary; wherein, the theme skin switching event can be understood as: a container that carries the application to switch the theme skin, based on which the application can download and save the theme skin package, modify the theme skin configuration file, and switch between theme skins, etc. Exemplarily, the theme skin switching event can include a ThemeManger singleton, and the theme skin configuration file can include a ThemeColor class, which refers to: a class that includes one or more attributes of a page element, such as: the attributes included can include: theme name, theme color value, picture address (supporting local pictures and network pictures), UIView (representing a rectangular area on the screen, responsible for rendering the content of the area, and responding to touch events occurring in the area), and the setter (assignment) method of the attribute in the ThemeColor subclass. The initial page element may refer to: the page element created in the process of creating a theme skin switching event. Since the application can obtain all the properties and methods of any class in the application code when it is running, and can call and modify all the properties and methods of any class or instance, the reflection mentioned above can be understood as: obtaining the value of the object attribute through the name of the object and the attribute, such as: obtaining the color value corresponding to the color of the search box (such as gray) through "search box" and "search box color".

[0032] Furthermore, after the application is started, each page element in the current page can be obtained (also referred to as: first page element, and the first assignment method of each first page element can be constructed, and then the initial assignment method can be replaced with the first assignment method, and then the corresponding relationship in the initial global dictionary can be updated (the "correspondence between the first page element and the initial assignment method" is changed to: the correspondence between the first page element and the first assignment method) to obtain the target global dictionary. Among them, the current page can be understood as the page displayed by the application under the current theme skin; the first page element can be the initial page element; the first assignment method can be understood as: an assignment method for unifying the assignment of the same first page element in each theme skin package, so as to achieve the purpose of increasing the theme skin switching rate. Furthermore, after detecting the theme skin switching behavior, based on the target global dictionary, the first assignment method is called to change the page element corresponding to the first assignment method, and then the current page is changed to obtain the target page, and the various page elements in the target page are the various page elements corresponding to the target theme skin package.

[0033] See also Figure 1 As shown, for example, assuming that the current page of the application (see Figure 1 11) contains the page element "search box shape" (see Figure 1 111), and the assignment method of the "shape of the search box" in theme skin package A is a1, and the assignment method of the "shape of the search box" in theme skin package B is a2. Then, in order to avoid the slow switching rate of theme skins due to the different methods used in different theme packages to assign the same page element when performing the theme skin switching operation, the present application will unify the assignment method of the "shape of the search box"; specifically, the present application will construct a first assignment method for the shape of the search box to unify the assignment methods for the shape of the search box in theme skin package A and theme skin package B. It can be understood that after the assignment method of the shape of the search box is unified, whether it is switching from the current theme skin to the theme skin corresponding to theme skin package A, or switching from the current skin to the theme skin corresponding to theme skin package B, when changing the page element of the shape of the search box, the first assignment method will be used. Therefore, when the first assignment method is called, the shape of the search box in the current page will be converted to the target page (see Figure 1 12) in the shape of the search box (see Figure 1 121).

[0034] In a specific implementation, the above-mentioned theme skin switching scheme can be executed by a computer device, which can be a terminal or a server. Among them, the terminal may include but is not limited to: smart phones, tablet computers, laptops, desktop computers, smart TVs, etc.; various clients (applications, APPs) can be run in the terminal, such as multimedia playback clients, social clients, browser clients, information flow clients, educational clients, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as basic cloud computing services such as big data and artificial intelligence platforms, etc.

[0035] Based on the principle description of the above-mentioned theme skin switching solution, the present application provides a theme skin switching method, which can be executed by the above-mentioned computer device; see Figure 2 As shown, the theme skin switching method includes the following steps S201-S204:

[0036] S201, if there is a theme skin switching operation, obtain the target theme skin package and page information.

[0037] Among them, the target theme skin package is the theme skin package that the application needs to switch to, and the page information includes one or more first page elements and the first assignment method of each first page element, where one or more represents "at least one".

[0038] Optionally, the first page element can understand the properties of the control, then the first page element can belong to the control. Specifically, a control can include at least one first page element. For example, the control can include: UISwitch (switch control), UISlider (progress bar control), UISearchBar (search box control), UITableView (list), etc. Among them, the switch control can include the onTintColor attribute (the color when the switch state is "on"), the thumbTintColor attribute (the color of the state button of the switch control); UISlider (progress bar control) can include the minimumTrackTintColor attribute (the color on the left side of the slider), the maximumTrackTintColor (the color on the right side of the slider) attribute and the thumbTintColor attribute (the color of the slider). UISearchBar (search box control) can include barTintColor (background color), placeholderColor attribute (placeholder color) and textColor attribute (text color); UITableView (list control) can include backgroundColor attribute (background color), sectionIndexColor attribute (index font color) and sectionIndexBackgroundColor attribute (index background color).

[0039] S202, traversing one or more first page elements, and obtaining a target element value of a currently traversed target first page element in a target theme skin package.

[0040] Among them, based on the above description, it can be understood that the target element value of the first page element can be understood as: the value of the attribute of the control, such as: the color value of the switch (red, blue, etc.), the font size of the switch (12px, 14px, etc.). Optionally, the computer device traverses one or more first page elements by: the computer device traverses the rootViewController.view (root view controller) and its subViewController.view (subview controller) of the keywindow, wherein the keywindow can be understood as: a page that can obtain all views under the mainController, which can receive keyboard input and other non-touch events. Uiwindow (can be understood as a container for storing page elements), in the application, there is one and only one keywindow, and the keywindow can be obtained through the UIApplication class. The UIApplication class requires a proxy object so that the computer device can handle the theme skin switching event of the application through the proxy object; wherein the UIApplication class can be obtained by the computer device calling the ThemeChanged method (theme skin switching method) in the memory.

[0041] In specific applications, the page elements included in each page can be regarded as a tree structure. Therefore, when the computer device traverses one or more first page elements, it can be understood that: the computer device recursively operates on subViewController.view.subviews, and the termination condition of the recursive operation is that the subViews attribute is empty, that is, the condition for the end of the traversal is: all page elements are selected as "target first page elements". Exemplarily, the computer device can perform the following in the recursive body: matching the control type, and obtaining the second assignment method of the target first page element through NSSelectorFromString (dynamic loading instance method) (which can be understood as: the assignment method for the target first page element in the target theme skin package). Furthermore, when the computer device successfully matches the control type, the target element value can be stored in the NSInvocation object through the first assignment method of the target first page element.

[0042] S203: Add the target element value to the first assignment method of the target first page element to obtain one or more target assignment methods of the first page elements.

[0043] Among them, the target assignment method can be understood as a combination of the first assignment method and the target element value, and the target element value is: the element value that matches the target first page element; illustratively, the target element value can be regarded as the parameter value of the first assignment method. For example, assuming that there is an element value 1 - "red" and an element value 2 - "ellipse" in the memory of the computer device, then if the target first page element is "the color of the search box", the computer device will match "red" from the memory of the computer device and use "red" as the target element value of the "color of the search box".

[0044] S204, calling a target assignment method of each first page element in one or more first page elements, modifying each first page element, and obtaining a target page.

[0045] In one embodiment, the computer device can batch update the first page elements through the NSInvocation object to render the page. Specifically, the computer device batch update method can be: update the first page elements of the same page in the same batch; or: update the first page elements of the same type in the same batch, etc., and this application does not limit this.

[0046] To sum up, the complete process of switching the theme skin of the computer device can be found in Figure 3 shown.

[0047] Based on the above description, it can be known that before switching the theme skin of the application, the present application has already unified the assignment methods of each page element in the application in advance. Therefore, when the computer device switches the theme skin, it is only necessary to obtain the first page elements that need to be changed, and the first assignment method of each first page element, and then obtain the target element value of the target first page element in the target theme skin package based on the first page element and the first assignment method. After the computer device obtains the target element value, the target first page element can be changed, avoiding the problem of low page element change rate due to different assignment methods of the target first page elements in different theme skin packages, thereby improving the theme skin switching rate.

[0048] See also Figure 4 , Figure 4 A method for switching a theme skin provided by the present application may include the following steps S401-S405:

[0049] S401, if there is a theme skin switching operation, obtain the target theme skin package and page information.

[0050] In one embodiment, if there is a theme skin switching operation, the computer device may first obtain the theme skin package identifier of the target theme skin package, and then the computer device may first search for the target theme skin package in the memory according to the theme skin package identifier of the target theme skin package; if the target theme skin package exists in the memory, the target theme skin package is obtained from the memory. Correspondingly, if the target theme skin package does not exist in the memory, the download address of the target theme skin package is obtained, and the target theme skin package is downloaded based on the download address of the target theme skin package, and then the target theme skin package is stored in the memory.

[0051] Exemplarily, after detecting a theme skin switching operation, the computer device can first determine through ThemeManager (theme skin switching event) whether the target theme skin package to be switched already exists in the memory of the computer device. If not, the computer device can download the target theme skin package and parse the resource materials required for each page element in the current page after the download is complete (which can be understood as: element values, such as: image resources, general color values, special page color values, text, page background images, navigation bar colors, and some customized page colors, etc.), and the computer device can asynchronously write the resource materials into the memory of the computer device, so that the computer device can traverse and obtain the one or more first page elements from the memory of the computer device.

[0052] S402, traversing one or more first page elements, and obtaining a target element value of a currently traversed target first page element in a target theme skin package.

[0053] Among them, the target theme skin package can also include one or more second assignment methods, and the element value of each second assignment method in the one or more second assignment methods. Among them, the second assignment method can be understood as: the assignment method of each first page element set in the target theme skin package. In a specific implementation, the computer device can use the first page element currently being traversed as the target first page element, and then for each target page element, the computer device can perform the following steps: match the target first page element with one or more second assignment methods. The main purpose of the matching is to determine whether the target first page element has a second assignment method when the computer device switches to the theme skin corresponding to the target theme skin package, and then determine whether the target first page element can be updated.

[0054] In one embodiment, if the target first page element matches one of the one or more second assignment methods, the second assignment method that matches the target first page element in the one or more second assignment methods is determined as the second assignment method of the target first page element, and the element value of the second assignment method of the target first page element in the target theme skin package is determined as the target element value of the target first page element; if the target first page element does not match any of the one or more second assignment methods, a first prompt message is generated, and exemplarily, the first prompt message may include information of the target first page element and a first reason for the failure to update the target first page element. The information of the first page element may be, for example, an element identifier of the target first page element, and the first reason may be, for example, that the assignment method of the target first page element does not exist in the target theme skin package.

[0055] In another embodiment, after the computer device determines the second assignment method of the target first page element, the computer device can search for the element value corresponding to the target first page element in the target theme skin package based on the second assignment of the target first page element; if the target theme skin package contains the parameter value of the second assignment method of the target first page element (that is, the element value of the target first page element), the computer device can execute the step of determining the element value of the second assignment method of the target first page element in the target theme skin package as the target element value of the target first page element.

[0056] Correspondingly, if the target element value of the second assignment method of the target first page element does not exist in the target theme skin package, a second prompt message is generated. Exemplarily, the second prompt message may include information of the target first page element and a second reason for the failure to update the target first page element, wherein the information of the target first page element may be, for example: the element identifier of the target first page element, the location information of the target first page element, etc.; the second reason may be, for example: the parameter value of the second assignment method for the target first page element does not exist in the target theme skin package (or: the parameter value of the second assignment method is empty), and the parameter value of the second assignment method is not applicable to the target first page element (such as: string format error).

[0057] In one embodiment, when the computer device is a terminal, if the number of prompt information generated after the theme skin switching operation in the computer device reaches the target number, the computer device can send the generated prompt information to the server; so that the server can modify the target theme skin package based on the generated prompt information to obtain a theme skin modification data packet, and the theme skin modification data packet can be used to change each first page element to obtain the target page. Further, the computer device can receive the theme skin modification data packet sent by the server, so that the next time the computer device switches the theme skin corresponding to the target theme skin package, the theme skin modification data packet can be used, thereby avoiding the problem of failure to update the target first page element. Among them, the generated prompt information can include the first prompt information or the second prompt information; but in actual application, the generated prompt information can also include the first prompt information and the second prompt information at the same time, so it can be understood that at this time, the number of the generated prompt information can be the sum of the number of the first prompt information and the number of the second prompt information; it should be noted that in other embodiments, the generated prompt information can also include other prompt information, then correspondingly, the number of the generated prompt information at least includes the number of other prompt information, and the present application does not limit the type of the generated prompt information.

[0058] S403, obtaining a target element replacement object.

[0059] Among them, the target element replacement object includes the first assignment method of the target first page element. In a specific implementation, the computer device can first obtain one or more first page elements in the current page, and generate the first assignment method of each first page element in the one or more first page elements in the current page; then the computer device can initialize the element replacement object according to the first assignment method of each first page element to obtain the target element replacement object. Exemplarily, the element replacement object can be understood as the "NSInvocation object" mentioned in the above step S202, and the target element replacement object can be understood as a container that stores the assignment methods of each first page element in the application, and the computer device can update each first page element based on the container.

[0060] In one embodiment, the target page element can be obtained by the following method: the computer device can first obtain one or more third assignment methods in each historical theme skin package, wherein each historical theme skin package is downloaded before the theme skin switching operation, that is, the historical theme skin package is located in the memory of the computer device. Then the computer device can traverse the one or more third assignment methods, and match the currently traversed target third assignment method with one or more first page elements in the current page; if each third assignment method in the one or more third assignment methods is successfully matched, the target element replacement object is kept unchanged.

[0061] For example, assuming that the downloaded historical theme skin package includes historical theme skin package 1 and historical theme skin package 2, historical theme skin package 1 includes the third assignment method of page element a and the third assignment method of page element b, and historical theme skin package 2 includes the third assignment method of page element a and the third assignment method of page element c, then, if the one or more first page elements include page element a and page element b, then: when the target third assignment method being traversed by the computer device is the third assignment method of page element a, or the third assignment method of page element b, since the computer device can match page element a or page element b in the one or more first page elements, this traversal will not update the element replacement object.

[0062] Correspondingly, if the target third assignment method fails to match, the computer device can generate a second page element corresponding to the target third assignment method, and the first assignment method of the second page element, and initialize the element replacement object according to the first assignment method of the second page element to obtain the target element replacement object.

[0063] For example, assuming that the downloaded historical theme skin package includes historical theme skin package 1 and historical theme skin package 2, historical theme skin package 1 includes the third assignment method of page element a and the third assignment method of page element b, and historical theme skin package 2 includes the third assignment method of page element a and the third assignment method of page element c, then, if the target third assignment method is the assignment method of page element c, since the one or more first page elements do not include page element c, the computer device will not be able to match the page element corresponding to the third assignment method, and then the computer device will generate page element c and the first assignment method of page element c based on the third assignment method, and update the element object according to the first assignment method of page element c to obtain the target element object. For example: when the computer device traverses the third assignment method of "background image of UISearchBar (search box control)" in the history theme skin package, if the "background image of the search box" does not exist in the one or more first page elements, then the computer device can create an NSMethodSignature (method signature) signature object through instanceMethodSignatureForSelector (instance method signature of the selector), and use searchFieldBackgroundImageForState (a method for obtaining the background image of the search box) to obtain the background image of the search box in the current state. Among them, the signature object records the return value type information of a method and the parameter type information corresponding to the method. It is used to forward messages that the message receiver cannot respond to, that is, it is used for "message forwarding". The so-called message forwarding means that when the computer device calls a function, it can capture the method signature of a function when the application is running, and forward the message to other objects for processing through the method signature. Furthermore, the computer device can use the acquired signature object as a parameter to initialize the NSInvocation object, and then the computer device can also mark the background image in the current state, so that after detecting the theme skin switching operation, the computer device can obtain the element value of the "background image of the search box" through the NSInvocation object, thereby updating the marked background image.

[0064] In another embodiment, the target element switching object can also be obtained in the following manner: the computer device can first obtain an initial global dictionary, wherein the initial global dictionary includes the correspondence between each initial page element and the initial assignment method of each initial page element in one or more initial page elements. In a specific implementation, the computer device can first establish an initial global dictionary before obtaining the initial global dictionary. Specifically, the computer device can generate one or more initial page elements and the initial assignment method of each initial page element; and establish the correspondence between each initial page element and the initial assignment method of each initial page element, and then the computer device can construct the initial global dictionary based on the correspondence between each initial page element and the initial assignment method of each initial page element. Exemplarily, the method for the computer to construct the initial global dictionary can be, for example: obtain the initial assignment method of each attribute through API-NSStringFromSelector call (a function that can be used to return the method name), map it in the ThemeManager singleton object, and generate a global dictionary. Among them, API-NSStringFromSelector can be used to convert SEL objects into NSString objects. The so-called SEL object refers to: a selector object, which is used to save the address of a method, that is, the address of a method can be found based on a SEL object; the ThemeManger singleton object can be understood as a special class with one and only one instance.

[0065] Furthermore, after obtaining the initial global dictionary, the computer device can adjust the correspondence between each initial page element in the initial global dictionary and the initial assignment method of each initial page element to obtain a target global dictionary, wherein the target global dictionary includes the correspondence between each initial page element and the first assignment method of each initial page element; then, the computer device can initialize the element replacement object based on the target global dictionary according to the first assignment method of each initial page element to obtain the target element replacement object.

[0066] S404, adding the target element value to the target element replacement object, and adding the target element value to the first assignment method of the target first page element through the target element replacement object to obtain one or more target assignment methods of the first page elements.

[0067] In one embodiment, after the computer device obtains the target element value of the target first page element, the target element value can be added to the target element replacement object. It can be understood that the target first page element and the target element value have a corresponding relationship; and because the target element replacement object includes the first assignment method of each first page element, and the target global dictionary includes the corresponding relationship between each first page element and its first assignment method, then, it can be further understood that the computer device can match the first assignment method corresponding to the target element value according to the target element value, and then the target element value can be added to the first assignment method corresponding to the target element value to obtain the target assignment method of the first page element.

[0068] S405, calling a target assignment method of each first page element in one or more first page elements, modifying each first page element, and obtaining a target page.

[0069] In one embodiment, the relevant specific embodiments in step S405 can refer to the description of step S204, and this application will not repeat them here.

[0070] Based on the above description, before switching the theme skin of the application, the present application has already unified the assignment method of each page element in the application in advance. Therefore, when the computer device switches the theme skin, it only needs to obtain each first page element that needs to be changed, and the first assignment method of each first page element, and then obtain the target element value of the target first page element in the target theme skin package based on the first page element and the first assignment method. After the computer device obtains the target element value, the target first page element can be changed, avoiding the problem of low page element change rate caused by different assignment methods of the target first page element in different theme skin packages, thereby improving the theme skin switching rate. In addition, the present application can obtain the prompt information generated after any page element fails to update in the application, and after the prompt information reaches a preset number, the target theme skin package indicated by the prompt information is modified to solve the theme skin switching problem corresponding to the prompt information, so that the theme skin switching method provided by the present application can monitor the error rate of theme skin switching (that is, the present application can perform fault-tolerant processing of theme skin switching for each page element), increase user stickiness, and optimize user experience.

[0071] Based on the description of the above-mentioned theme skin switching method related embodiments, the present application also discloses a theme skin switching device, which can be a computer program (including program code) running on the above-mentioned computer device. The theme skin switching device can execute the following steps: Figure 2 and Figure 4 For the method shown, see Figure 5 The theme skin switching device may at least include: an acquisition unit 501, a traversal unit 502 and a processing unit 503.

[0072] The acquisition unit 501 is used to acquire a target theme skin package and page information if there is a theme skin switching operation, wherein the page information includes one or more first page elements and a first assignment method of each first page element;

[0073] A traversal unit 502, configured to traverse the one or more first page elements and obtain a target element value of a currently traversed target first page element in the target theme skin package;

[0074] The processing unit 503 is used to add the target element value to the first assignment method of the target first page element to obtain the target assignment method of the one or more first page elements;

[0075] The processing unit 503 is further configured to call a target assignment method of each first page element among the one or more first page elements, modify each first page element, and obtain a target page.

[0076] In one implementation, the target theme skin package includes one or more second assignment methods and element values ​​of each of the one or more second assignment methods. The processing unit 503 may specifically execute:

[0077] Matching the target first page element with the one or more second assignment methods;

[0078] If the target first page element matches one of the one or more second assignment methods, the second assignment method that matches the target first page element among the one or more second assignment methods is determined as the second assignment method of the target first page element, and the element value of the second assignment method of the target first page element in the target theme skin package is determined as the target element value of the target first page element;

[0079] If the target first page element does not match any of the one or more second assignment methods, a first prompt message is generated.

[0080] In yet another embodiment, the processing unit 503 is further configured to execute:

[0081] If the target theme skin package contains the element value of the second assignment method of the target first page element, the step of determining the element value of the second assignment method of the target first page element in the target theme skin package as the target element value of the target first page element is executed;

[0082] If the target element value of the second assignment method of the target first page element does not exist in the target theme skin package, second prompt information is generated.

[0083] In yet another implementation, the processing unit 503 is further specifically configured to execute:

[0084] When the number of prompt information generated after the theme skin switching operation reaches the target number, sending the generated prompt information to the server, the generated prompt information includes the first prompt information or the second prompt information;

[0085] Receive a theme skin modification data packet sent by the server, wherein the theme skin modification data packet is obtained by the server modifying the target theme skin package based on the generated prompt information, and the theme skin modification data packet is used to change each of the first page elements to obtain the target page.

[0086] In yet another embodiment, when executing the first assignment method of adding the target element value to the target first page element to obtain the target assignment method of the one or more first page elements, the processing unit 503 is specifically configured to execute:

[0087] Obtain a target element replacement object, wherein the target element replacement object includes a first assignment method of the target first page element;

[0088] Adding the target element value to the target element replacement object, and adding the target element value to the first assignment method of the target first page element through the target element replacement object to obtain the target assignment method of the one or more first page elements;

[0089] When the processing unit 503 executes the target assignment method of calling each of the one or more first page elements to modify each of the first page elements to obtain the target page, the processing unit 503 specifically executes:

[0090] Based on the target element replacement object, one or more target assignment methods are called, and the first page element corresponding to each of the one or more target assignment methods is modified to obtain the target page.

[0091] In yet another implementation, the acquiring unit 501 is further specifically configured to execute:

[0092] Acquire one or more first page elements in the current page, and generate a first value assignment method for each of the one or more first page elements in the current page;

[0093] The element replacement object is initialized according to the first assignment method of each first page element to obtain the target element replacement object.

[0094] In yet another embodiment, the acquiring unit 501 is further configured to execute:

[0095] Obtaining one or more third assignment methods in each history theme skin package, wherein each history theme skin package is downloaded before the theme switching operation;

[0096] Traversing the one or more third assignment methods, and matching the currently traversed target third assignment method with one or more first page elements in the current page;

[0097] If each of the one or more third assignment methods matches successfully, the target element replacement object remains unchanged;

[0098] If the target third assignment method fails to match, a second page element corresponding to the target third assignment method and a first assignment method of the second page element are generated, and the element replacement object is initialized according to the first assignment method of the second page element to obtain the target element replacement object.

[0099] In yet another implementation, the acquisition unit 501 may also be configured to execute:

[0100] Acquire an initial global dictionary, wherein the initial global dictionary includes a correspondence between each initial page element and an initial value assignment method of each initial page element in one or more initial page elements;

[0101] Adjusting the correspondence between the initial page elements and the initial value assignment methods of the initial page elements in the initial global dictionary to obtain a target global dictionary, wherein the target global dictionary includes the correspondence between the initial page elements and the first value assignment methods of the initial page elements;

[0102] The initializing the element replacement object according to the first assignment method of each initial page element to obtain the target element replacement object includes:

[0103] Based on the target global dictionary, the element replacement object is initialized according to the first assignment method of each initial page element to obtain the target element replacement object.

[0104] In yet another implementation, the processing unit 503 may also be configured to execute:

[0105] Generate the one or more initial page elements, and an initial value assignment method for each of the initial page elements;

[0106] A correspondence between each of the initial page elements and the initial value assignment method of each of the initial page elements is established, and based on the correspondence between each of the initial page elements and the initial value assignment method of each of the initial page elements, the initial global dictionary is constructed.

[0107] In yet another embodiment, the acquiring unit 501 is further configured to execute:

[0108] According to the theme skin package identifier of the target theme skin package, searching for the target theme skin package in the memory;

[0109] If the target theme skin package exists in the memory, obtaining the target theme skin package from the memory;

[0110] If the target theme skin package does not exist in the memory, the target theme skin package is downloaded based on the download address of the target theme skin package, and the target theme skin package is stored in the memory.

[0111] According to one embodiment of the present application, Figure 2 and Figure 4 The various steps involved in the method shown can be performed by Figure 5 The theme skin switching device shown is executed by each unit. For example, Figure 2 Step S201 shown can be performed by Figure 5 The acquisition unit 501 in the theme skin switching device shown in the figure is executed; step S202 can be performed by Figure 5 The traversal unit 502 in the theme skin switching device shown in the figure is executed; both step S203 and step S204 can be performed by Figure 5 The processing unit 503 in the theme skin switching device shown in the figure is executed. Figure 4 The steps S401 and S403 shown in FIG. 4 can be performed by Figure 5 The acquisition unit 501 in the theme skin switching device shown in the figure is executed; step S402 can be performed by Figure 5 The traversal unit 502 in the theme skin switching device shown in the figure is executed; both step S404 and step S405 can be performed by Figure 5 The theme skin switching device is shown as being executed by the processing unit 503.

[0112] According to another embodiment of the present application, Figure 5The various units in the theme skin switching device shown are divided based on logical functions. The above-mentioned various units can be separately or completely combined into one or several other units to constitute, or one (some) of the units can be further divided into multiple functionally smaller units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. In other embodiments of the present application, the above-mentioned theme skin switching device can also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0113] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 or Figure 4 A computer program (including program code) for each step of the method shown in FIG. Figure 5 The theme skin switching device shown in the embodiment of the present application is implemented by the theme skin switching method. The computer program can be recorded on a computer storage medium, for example, and loaded into the above-mentioned computing device through the computer storage medium and run therein.

[0114] When the theme skin switching device provided by the present application switches the theme skin of an application, it can first obtain each first page element and the first assignment method of each first page element, and then obtain the target element value of the target first page element in the target theme skin package based on the first page element and the first assignment method. After the computer device obtains the target element value, the target first page element can be changed. It can be seen that when the theme skin switching method provided by the present application changes the same page element to different theme skins, the assignment method used is the first assignment method of the page element, which avoids the problem of low page element change rate due to different assignment methods for the target first page element in different theme skin packages, thereby improving the theme skin switching rate.

[0115] Based on the description of the above method embodiment and device embodiment, the present application also provides a computer device, see Figure 6 The computer device at least includes a processor 601, an input interface 602, an output interface 603, and a computer storage medium 604, and the processor 601, input interface 602, output interface 603, and computer storage medium 604 of the computer device can be connected via a bus or other means.

[0116] The computer storage medium 602 is a memory device in a computer device, which is used to store programs and data. It is understandable that the computer storage medium 602 here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer storage medium 602 provides a storage space, which stores the operating system of the computer device. In addition, one or more computer programs suitable for being loaded and executed by the processor 601 are also stored in the storage space, and these computer programs can be one or more program codes. It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory; optionally, it can also be at least one computer storage medium located away from the aforementioned processor. The processor 601 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more computer programs, and is specifically suitable for loading and executing one or more computer programs to realize the corresponding method flow or corresponding function.

[0117] In one embodiment, the processor 601 may load and execute one or more computer programs stored in the computer storage medium 602 to implement the above-mentioned Figure 2 and Figure 4 Corresponding method steps in the method embodiment shown; in a specific implementation, one or more computer programs in the computer storage medium 602 are loaded by the processor 601 and execute the following steps:

[0118] If there is a theme skin switching operation, the target theme skin package and page information are obtained, and the page information includes one or more first page elements, and the first assignment method of each first page element; the one or more first page elements are traversed, and the target element value of the currently traversed target first page element is obtained in the target theme skin package; the target element value is added to the first assignment method of the target first page element to obtain the target assignment method of the one or more first page elements; the target assignment method of each first page element in the one or more first page elements is called to change the each first page element to obtain the target page.

[0119] In one implementation, the target theme skin package includes one or more second assignment methods and element values ​​of each of the one or more second assignment methods, and the processor 601 may be used to load and execute:

[0120] Matching the target first page element with the one or more second assignment methods;

[0121] If the target first page element matches one of the one or more second assignment methods, the second assignment method that matches the target first page element among the one or more second assignment methods is determined as the second assignment method of the target first page element, and the element value of the second assignment method of the target first page element in the target theme skin package is determined as the target element value of the target first page element;

[0122] If the target first page element does not match any of the one or more second assignment methods, a first prompt message is generated.

[0123] In yet another embodiment, the processor 601 may be configured to load and execute:

[0124] If the target theme skin package contains the element value of the second assignment method of the target first page element, the step of determining the element value of the second assignment method of the target first page element in the target theme skin package as the target element value of the target first page element is executed;

[0125] If the target element value of the second assignment method of the target first page element does not exist in the target theme skin package, second prompt information is generated.

[0126] In yet another embodiment, the output interface 603 may be used to load and execute:

[0127] When the number of prompt information generated after the theme skin switching operation reaches the target number, sending the generated prompt information to the server, the generated prompt information includes the first prompt information or the second prompt information;

[0128] The input interface 602 can be used to load and execute: receiving a theme skin modification data packet sent by the server, the theme skin modification data packet is obtained by the server modifying the target theme skin package based on the generated prompt information, the theme skin modification data packet is used to change each first page element to obtain the target page.

[0129] In yet another embodiment, when executing the first assignment method of adding the target element value to the target first page element to obtain the target assignment method of the one or more first page elements, the processor 601 may be configured to load and execute:

[0130] Obtain a target element replacement object, wherein the target element replacement object includes a first assignment method of the target first page element;

[0131] Adding the target element value to the target element replacement object, and adding the target element value to the first assignment method of the target first page element through the target element replacement object to obtain the target assignment method of the one or more first page elements;

[0132] When the processor 601 executes the target assignment method of calling each of the one or more first page elements to modify each of the first page elements to obtain the target page, it can be used to load and execute:

[0133] Based on the target element replacement object, one or more target assignment methods are called, and the first page element corresponding to each of the one or more target assignment methods is modified to obtain the target page.

[0134] In yet another implementation, the processor 601 is further configured to load and execute:

[0135] Acquire one or more first page elements in the current page, and generate a first value assignment method for each of the one or more first page elements in the current page;

[0136] The element replacement object is initialized according to the first assignment method of each first page element to obtain the target element replacement object.

[0137] In yet another implementation, the processor 601 is further configured to load and execute:

[0138] Obtaining one or more third assignment methods in each history theme skin package, wherein each history theme skin package is downloaded before the theme switching operation;

[0139] Traversing the one or more third assignment methods, and matching the currently traversed target third assignment method with one or more first page elements in the current page;

[0140] If each of the one or more third assignment methods matches successfully, the target element replacement object remains unchanged;

[0141] If the target third assignment method fails to match, a second page element corresponding to the target third assignment method and a first assignment method of the second page element are generated, and the element replacement object is initialized according to the first assignment method of the second page element to obtain the target element replacement object.

[0142] In yet another implementation, the processor 601 is further configured to load and execute:

[0143] Acquire an initial global dictionary, wherein the initial global dictionary includes a correspondence between each initial page element and an initial value assignment method of each initial page element in one or more initial page elements;

[0144] Adjusting the correspondence between the initial page elements and the initial value assignment methods of the initial page elements in the initial global dictionary to obtain a target global dictionary, wherein the target global dictionary includes the correspondence between the initial page elements and the first value assignment methods of the initial page elements;

[0145] The initializing the element replacement object according to the first assignment method of each initial page element to obtain the target element replacement object includes:

[0146] Based on the target global dictionary, the element replacement object is initialized according to the first assignment method of each initial page element to obtain the target element replacement object.

[0147] In yet another implementation, the processor 601 is further configured to load and execute:

[0148] Generate the one or more initial page elements, and an initial value assignment method for each of the initial page elements;

[0149] A correspondence between each of the initial page elements and the initial value assignment method of each of the initial page elements is established, and based on the correspondence between each of the initial page elements and the initial value assignment method of each of the initial page elements, the initial global dictionary is constructed.

[0150] In yet another implementation, the processor 601 is further configured to load and execute:

[0151] According to the theme skin package identifier of the target theme skin package, searching for the target theme skin package in the memory;

[0152] If the target theme skin package exists in the memory, obtaining the target theme skin package from the memory;

[0153] If the target theme skin package does not exist in the memory, the target theme skin package is downloaded based on the download address of the target theme skin package, and the target theme skin package is stored in the memory.

[0154] When the computer device provided by the present application switches the theme skin of an application, it can first obtain each first page element and the first assignment method of each first page element, and then obtain the target element value of the target first page element in the target theme skin package based on the first page element and the first assignment method. After the computer device obtains the target element value, the target first page element can be changed. It can be seen that when the theme skin switching method provided by the present application changes the same page element to different theme skins, the assignment method used is the first assignment method of the page element, which avoids the problem of low page element change rate due to different assignment methods for the target first page element in different theme skin packages, thereby improving the theme skin switching rate.

[0155] The present application also provides a computer storage medium, in which a computer program of the above-mentioned theme skin switching method is stored, and the computer program includes program instructions. When one or more processors load and execute the program instructions, the description of the theme skin switching method in the embodiment can be implemented, which will not be repeated here. The description of the beneficial effects of adopting the same method will not be repeated here. It is understandable that the program instructions can be deployed on one or more devices that can communicate with each other for execution.

[0156] It should be noted that, according to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor in a computer device reads the computer instructions from the computer-readable storage medium, and then executes the computer instructions, thereby enabling the computer device to perform the above Figure 2 and Figure 4 The subject skin switching method embodiment shown provides a method in various optional aspects.

[0157] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiment of the above-mentioned theme skin switching method. The computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0158] What is disclosed above is only a partial embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. A person skilled in the art can understand that the entire or partial process of implementing the above embodiment and the equivalent changes made according to the claims of the present application are still within the scope of the invention.

Claims

1. A method for switching a theme skin, characterized in that: include: If there is a theme skin switching operation, a target theme skin package and page information are obtained, wherein the target theme skin package includes one or more second assignment methods and element values ​​of each second assignment method in the one or more second assignment methods, wherein the second assignment method is an assignment method of each first page element set in the target theme skin package, and the page information includes one or more first page elements and a first assignment method of each first page element; The first assignment method is an assignment method for unifying the assignment of values ​​to the same first page element in each theme skin package; Traversing the one or more first page elements, and obtaining the target element value of the currently traversed target first page element in the target theme skin package; including: matching the target first page element with the one or more second assignment methods; if the target first page element matches a second assignment method among the one or more second assignment methods, determining the second assignment method that matches the target first page element among the one or more second assignment methods as the second assignment method of the target first page element, and determining the element value of the second assignment method of the target first page element in the target theme skin package as the target element value of the target first page element; Adding the target element value to the first assignment method of the target first page element to obtain the target assignment method of the one or more first page elements; The target assignment method of each first page element among the one or more first page elements is called to modify each first page element to obtain a target page.

2. The method according to claim 1, characterized in that: If the target first page element does not match any of the one or more second assignment methods, a first prompt message is generated.

3. The method according to claim 2, characterized in that The method further comprises: If the target theme skin package contains the element value of the second assignment method of the target first page element, the step of determining the element value of the second assignment method of the target first page element in the target theme skin package as the target element value of the target first page element is executed; If the target element value of the second assignment method of the target first page element does not exist in the target theme skin package, second prompt information is generated.

4. The method according to claim 3, characterized in that The method further comprises: When the number of prompt information generated after the theme skin switching operation reaches the target number, sending the generated prompt information to the server, the generated prompt information includes the first prompt information or the second prompt information; Receive a theme skin modification data packet sent by the server, wherein the theme skin modification data packet is obtained by the server modifying the target theme skin package based on the generated prompt information, and the theme skin modification data packet is used to change each of the first page elements to obtain the target page.

5. The method according to claim 1, characterized in that The step of adding the target element value to the first value assignment method of the target first page element to obtain the target value assignment method of the one or more first page elements includes: Obtain a target element replacement object, wherein the target element replacement object includes a first assignment method of the target first page element; Adding the target element value to the target element replacement object, and adding the target element value to the first assignment method of the target first page element through the target element replacement object to obtain the target assignment method of the one or more first page elements; The calling of the target assignment method of each first page element of the one or more first page elements to modify each first page element to obtain a target page includes: Based on the target element replacement object, one or more target assignment methods are called, and the first page element corresponding to each of the one or more target assignment methods is modified to obtain the target page.

6. The method according to claim 5, characterized in that The method further comprises: Acquire one or more first page elements in the current page, and generate a first value assignment method for each of the one or more first page elements in the current page; The element replacement object is initialized according to the first assignment method of each first page element to obtain the target element replacement object.

7. The method according to claim 6, characterized in that The method further comprises: Obtaining one or more third assignment methods in each history theme skin package, wherein each history theme skin package is downloaded before the theme switching operation; Traversing the one or more third assignment methods, and matching the currently traversed target third assignment method with one or more first page elements in the current page; If each of the one or more third assignment methods matches successfully, the target element replacement object remains unchanged; If the target third assignment method fails to match, a second page element corresponding to the target third assignment method and a first assignment method of the second page element are generated, and the element replacement object is initialized according to the first assignment method of the second page element to obtain the target element replacement object.

8. The method according to claim 6, characterized in that The method further comprises: Acquire an initial global dictionary, wherein the initial global dictionary includes a correspondence between each initial page element and an initial value assignment method of each initial page element in one or more initial page elements; Adjusting the correspondence between the initial page elements and the initial value assignment methods of the initial page elements in the initial global dictionary to obtain a target global dictionary, wherein the target global dictionary includes the correspondence between the initial page elements and the first value assignment methods of the initial page elements; The initializing the element replacement object according to the first assignment method of each initial page element to obtain the target element replacement object includes: Based on the target global dictionary, the element replacement object is initialized according to the first assignment method of each initial page element to obtain the target element replacement object.

9. The method according to claim 8, characterized in that The method further comprises: Generate the one or more initial page elements, and an initial value assignment method for each of the initial page elements; A correspondence between each of the initial page elements and the initial value assignment method of each of the initial page elements is established, and based on the correspondence between each of the initial page elements and the initial value assignment method of each of the initial page elements, the initial global dictionary is constructed.

10. The method according to claim 1, characterized in that The step of obtaining the target theme skin package includes: According to the theme skin package identifier of the target theme skin package, searching for the target theme skin package in the memory; If the target theme skin package exists in the memory, obtaining the target theme skin package from the memory; If the target theme skin package does not exist in the memory, the target theme skin package is downloaded based on the download address of the target theme skin package, and the target theme skin package is stored in the memory.