Method, device and equipment for changing display mode of application program

By calling the update function and block information in the view recorder, the application's display mode is directly adjusted, which solves the problem that changing the display mode in the prior art requires relying on system mode switching, and realizes efficient and low-cost display mode replacement and custom support.

CN113760425BActive Publication Date: 2025-05-16BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110792144.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-13
Publication Date
2025-05-16
Estimated Expiration
2041-07-13

AI Technical Summary

Technical Problem

In the prior art, the display mode of replacing the application program needs to rely on the system mode switching of the terminal device, resulting in large adaptation workload, high code overhead, high cost and low efficiency.

Method used

By calling the update function, the block information corresponding to the display mode to be replaced in the view recorder, the view object is obtained, and the application's display mode is adjusted according to the view configuration parameters to realize the replacement of the display mode.

Benefits of technology

Reduces adaptation workload and code overhead, reduces the cost of developing and replacing application display modes, improves efficiency, and supports custom display modes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760425B_ABST
    Figure CN113760425B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a method, device and equipment for changing the display mode of an application, wherein the method comprises: in response to a change request, calling an update function, wherein the update function includes the display mode to be changed and view configuration parameters; according to the update function, retrieving the block information corresponding to the display mode to be changed in the view recorder; calling the view object indicated by the block information corresponding to the display mode to be changed, passing in the view configuration parameters indicated by the update function, and adjusting the display mode of the application to the display mode to be changed according to the view configuration parameters and the view object indicated by the block information corresponding to the display mode to be changed. The adaptation workload and code overhead are reduced, the cost of developing the display mode of the application is reduced, and the cost of changing the display mode of the application is reduced, and the display mode of the application can be developed and changed efficiently. The application is adapted to multiple display modes and supports customized display modes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of terminal technology, and in particular to a method, device and equipment for changing the display mode of an application. Background Art

[0002] With the development of terminals, terminal devices have become important tools in people's lives and work. During the use of terminal devices, the terminal devices can be equipped with a variety of applications, and users have a need to change the display mode of the application.

[0003] In the prior art, two modes are provided for the system of the terminal device, namely, the light mode and the dark mode. The display mode of the application program can be changed along with the change of the system mode of the terminal device.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: the display mode of the application can only be switched based on switching the system mode, and adaptation needs to be performed when each view element of the application is created and initialized, which results in a large workload for adaptation and a large amount of code, resulting in high cost and low efficiency for changing the display mode of the application. Summary of the invention

[0005] The embodiments of the present invention provide a method, device and equipment for changing the display mode of an application program, so as to solve the problem of high cost and low efficiency in changing the display mode of an application program.

[0006] In a first aspect, an embodiment of the present invention provides a method for changing a display mode of an application, the method comprising:

[0007] In response to a change request for changing the display mode of the application, calling an update function, wherein the change request is used to indicate the display mode to be changed, and the update function includes the display mode to be changed and view configuration parameters;

[0008] According to the update function, the block information corresponding to the display mode to be replaced in the view recorder is retrieved, wherein the block information is used to indicate the view object corresponding to the display mode to be replaced;

[0009] Call the view object indicated by the block information corresponding to the display mode to be replaced, and pass in the view configuration parameters indicated by the update function, and adjust the display mode of the application to the display mode to be replaced according to the view configuration parameters and the view object indicated by the block information corresponding to the display mode to be replaced.

[0010] In a possible implementation, the update function also includes key value information, and there is a correspondence between the display mode to be changed, the view configuration parameters and the key value information in the update function; the key value information is used to indicate the block information corresponding to the display mode to be changed.

[0011] In a possible implementation manner, the view object has a first extended attribute, and the first extended attribute is used to indicate that the block information and the key value information are in a binding relationship;

[0012] If the key value information is empty, then according to the update function, the block information corresponding to the display mode to be changed in the view recorder is retrieved, including:

[0013] According to the update function, the block information bound to the key value information in the view recorder is retrieved.

[0014] In a possible implementation manner, the view object has a second extended attribute, and the second extended attribute is used to indicate that the block information and the key value information are in a key-value correspondence relationship;

[0015] If the key value information is not empty, then according to the update function, the block information corresponding to the display mode to be changed in the view recorder is retrieved, including:

[0016] According to the update function, the block information in the view recorder having a key-value corresponding relationship with the key-value information is retrieved.

[0017] In a possible implementation manner, the replacement request is any one of the following: a replacement request related to a system of a terminal device, a replacement request related to user customization, and a replacement request indicating a key value.

[0018] In a possible implementation manner, if the change request is a change request related to the system of the terminal device, then in response to the change request for changing the display mode of the application, calling the update function includes:

[0019] In response to a request to change the display mode of the application, calling an update mode function, wherein the update mode function indicates that the display mode to be changed is different from the current display mode of the application;

[0020] According to the calling mode function, the update function is called, and the local setting function is called and executed, wherein the local setting function is used to instruct to perform local persistence processing on the view object corresponding to the display mode to be changed.

[0021] In a possible implementation manner, the method further includes:

[0022] According to the calling mode function, a system setting function is called, and according to the system setting function, the display mode of the components of the system of the terminal device is updated to the display mode to be changed.

[0023] In a possible implementation, if the change request is a change request related to the system of the terminal device, the change request is any one of the following: a change request to follow the system to change the display mode, a change request to enter the background, a change request to switch the system mode, and a change request to indicate the display mode to be changed.

[0024] In a possible implementation manner, if the change request is a change request related to user customization, the change request is a change request indicating a customized display mode, or a change request indicating block information.

[0025] In a possible implementation manner, if the change request is a change request indicating a key value, and the change request includes key value information, then in response to the change request for changing the display mode of the application, calling an update function includes:

[0026] In response to a request to change the display mode of the application program, a key value setting function is called;

[0027] Determine the block information corresponding to the key value information in the replacement request according to the key value setting function, and store the block information corresponding to the key value information in the replacement request in a view recorder;

[0028] After executing the key value setting function, the update function is called.

[0029] In a possible implementation manner, the method further includes:

[0030] A weak pointer corresponding to each view element is added to the view recorder, wherein the weak pointer is used to indicate the view object.

[0031] In a possible implementation manner, the method further includes:

[0032] In response to a view closing instruction, the block information in the view recorder is released.

[0033] In a possible implementation manner, after releasing the block information in the view recorder in response to the view closing instruction, the method further includes:

[0034] In response to a view close instruction, traverse each weak pointer in the view recorder, wherein the weak pointer is used to indicate a view object;

[0035] If the weak pointer is null, the null weak pointer is deleted.

[0036] In a possible implementation manner, the method further includes:

[0037] The view object indicated by the block information corresponding to the display mode to be changed is stored in the view recorder.

[0038] In a possible implementation manner, adjusting the display mode of the application to the display mode to be replaced according to the view configuration parameter and the view object indicated by the block information corresponding to the display mode to be replaced includes:

[0039] According to the view configuration parameters, the view object indicated by the block information corresponding to the display mode to be changed is applied to the interface of the application.

[0040] In a possible implementation manner, the view object includes a view element corresponding to at least one page of the application.

[0041] An embodiment of the above invention has the following advantages or beneficial effects: when changing the display mode of an application, it is not necessary to rely on the system mode of the terminal device. In addition, this embodiment provides a new mode change solution, which does not require adaptation when each view element of the application is created and initialized. It only needs to call the view configuration parameters indicated by the update function and the view object indicated by the block information to update the display mode of the entire application; at the same time, the block information is used to indicate the view object composed of view elements to reduce the code overhead. Thereby, the adaptation workload and code overhead are reduced, the cost of developing the display mode of the application is reduced, and the cost of changing the display mode of the application is reduced, and the display mode of the application can be efficiently developed and changed. In addition, the solution provided by this embodiment can enable the application to adapt to multiple display modes and support customized display modes; it can enable the application to efficiently adapt to any of the multiple display modes.

[0042] Alternatively, another embodiment of the above invention has the following advantages or beneficial effects: the display mode of the application is updated based on the view recorder, and then through a unified adaptation entry, the update of the display mode of the application can be conveniently supported. The solution provided by this embodiment is applicable to multiple operating systems (operating systems of terminal devices, for example, different versions of Android systems, different versions of IOS systems); and at the same time, since multiple interface methods of the view object of the view recorder are provided, the solution of this embodiment can be used to replace and update the display mode of the application for different display modes.

[0043] Alternatively, another embodiment of the above invention has the following advantages or beneficial effects: providing multiple different types of change requests, and making different function calls based on different change requests to change the display mode of the application; it can also change the display mode of the terminal device's system; and it provides multiple change methods for the terminal device and the user.

[0044] Alternatively, another embodiment of the above invention has the following advantages or beneficial effects: the user can customize the display mode of the application, thereby satisfying the user's demand for customization of the display mode of the application; multiple display modes are provided, and multiple themes or skins can be provided for the application.

[0045] In a second aspect, an embodiment of the present invention provides a device for changing a display mode of an application program, the device comprising:

[0046] A first calling unit, configured to call an update function in response to a change request for changing the display mode of an application program, wherein the change request is used to indicate the display mode to be changed, and the update function includes the display mode to be changed and a view configuration parameter;

[0047] A calling unit, configured to call, according to the update function, block information corresponding to the display mode to be replaced in a view recorder, wherein the block information is used to indicate a view object corresponding to the display mode to be replaced;

[0048] A second calling unit, configured to call the view object indicated by the block information corresponding to the display mode to be changed, and pass in the view configuration parameters indicated by the update function;

[0049] The adjusting unit is used to adjust the display mode of the application to the display mode to be replaced according to the view configuration parameters and the view object indicated by the block information corresponding to the display mode to be replaced.

[0050] In a possible implementation, the update function also includes key value information, and there is a correspondence between the display mode to be changed, the view configuration parameters and the key value information in the update function; the key value information is used to indicate the block information corresponding to the display mode to be changed.

[0051] In a possible implementation manner, the view object has a first extended attribute, and the first extended attribute is used to indicate that the block information and the key value information are in a binding relationship;

[0052] If the key value information is empty, the calling unit is specifically used to:

[0053] According to the update function, the block information bound to the key value information in the view recorder is retrieved.

[0054] In a possible implementation manner, the view object has a second extended attribute, and the second extended attribute is used to indicate that the block information and the key value information are in a key-value correspondence relationship;

[0055] If the key value information is not empty, the calling unit is specifically used to:

[0056] According to the update function, the block information in the view recorder having a key-value corresponding relationship with the key-value information is retrieved.

[0057] In a possible implementation manner, the replacement request is any one of the following: a replacement request related to a system of a terminal device, a replacement request related to user customization, and a replacement request indicating a key value.

[0058] In a possible implementation manner, if the replacement request is a replacement request related to a system of the terminal device, the first calling unit includes:

[0059] A first calling module, configured to call an update mode function in response to a request for changing a display mode of an application program, wherein the update mode function indicates that the display mode to be changed is different from a current display mode of the application program;

[0060] The second calling module is used to call the update function according to the calling mode function, and call and execute the local setting function, wherein the local setting function is used to instruct the view object corresponding to the display mode to be changed to be locally persisted.

[0061] In a possible implementation manner, the device further includes:

[0062] The third calling unit is used to call a system setting function according to the calling mode function, and update the display mode of the components of the system of the terminal device to the display mode to be changed according to the system setting function.

[0063] In a possible implementation, if the change request is a change request related to the system of the terminal device, the change request is any one of the following: a change request to follow the system to change the display mode, a change request to enter the background, a change request to switch the system mode, and a change request to indicate the display mode to be changed.

[0064] In a possible implementation manner, if the change request is a change request related to user customization, the change request is a change request indicating a customized display mode, or a change request indicating block information.

[0065] In a possible implementation manner, if the replacement request is a replacement request indicating a key value, and the replacement request includes key value information, the first calling unit includes:

[0066] A third calling module is used to call a key value setting function in response to a request to change the display mode of the application program;

[0067] a determination module, configured to determine, according to the key value setting function, block information corresponding to the key value information in the replacement request, and store the block information corresponding to the key value information in the replacement request in a view recorder;

[0068] The fourth calling module is used to call the updating function after executing the key value setting function.

[0069] In a possible implementation manner, the device further includes:

[0070] The processing unit is used to add a weak pointer corresponding to each view element in the view recorder, wherein the weak pointer is used to indicate the view object.

[0071] In a possible implementation manner, the device further includes:

[0072] A releasing unit is used to release the block information in the view recorder in response to a view closing instruction.

[0073] In a possible implementation manner, the device further includes:

[0074] A deleting unit is used to traverse each weak pointer in the view recorder in response to the view closing instruction after the releasing unit releases the block information in the view recorder in response to the view closing instruction, wherein the weak pointer is used to indicate the view object; if the weak pointer is empty, the empty weak pointer is deleted.

[0075] In a possible implementation manner, the device further includes:

[0076] The storage unit is used to store the view object indicated by the block information corresponding to the display mode to be changed in the view recorder.

[0077] In a possible implementation manner, the adjustment unit is specifically used to:

[0078] According to the view configuration parameters, the view object indicated by the block information corresponding to the display mode to be changed is applied to the interface of the application.

[0079] In a possible implementation manner, the view object includes a view element corresponding to at least one page of the application.

[0080] In a third aspect, an embodiment of the present invention provides a terminal device, including: a memory, a processor;

[0081] Memory; Memory for storing instructions executable by the processor;

[0082] The processor is configured to execute the method described in the first aspect.

[0083] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.

[0084] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer program, wherein the computer program is stored in a readable storage medium, and at least one processor of a terminal device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the terminal device executes the method described in the first aspect.

[0085] The method, device and equipment for changing the display mode of an application provided by the embodiment of the present invention initiate a change request when the display mode of the application needs to be changed, and then call the update function, call the block information corresponding to the display mode to be changed according to the update function, and then obtain the view object indicated by the block information; thus, the display mode of the application can be adjusted according to the view configuration parameters indicated by the update function and the called view object, and the display mode of the application is changed to the display mode to be changed. Therefore, when the display mode of the application needs to be changed, the block information corresponding to the display mode to be changed is executed, and then the view object is called, and the view object is applied to the application according to the view configuration parameters indicated by the update function, and the application can be updated. The solution provided by this embodiment does not need to rely on the system mode of the terminal device when changing the display mode of the application. In addition, this embodiment provides a new mode change solution, which does not need to be adapted when each view element of the application is created and initialized, and only needs to call the view configuration parameters indicated by the update function and the view object indicated by the block information to update the display mode of the entire application; at the same time, the block information is used to indicate the view object composed of the view elements, reducing the code overhead. Thus, the adaptation workload and code overhead are reduced, the cost of developing the display mode of the application is reduced, and the cost of changing the display mode of the application is reduced, so the display mode of the application can be developed and changed efficiently. In addition, the solution provided in this embodiment can make the application adapt to multiple display modes and support customized display modes; it can make the application efficiently adapt to any of the multiple display modes. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0087] Figure 1 A flowchart of a method for changing the display mode of an application provided in an embodiment of the present application;

[0088] Figure 2 A flowchart of another method for changing the display mode of an application provided in an embodiment of the present application;

[0089] Figure 3 A logical schematic diagram of a view recorder provided in an embodiment of the present application;

[0090] Figure 4 A logical diagram of a view object provided in an embodiment of the present application;

[0091] Figure 5A flowchart of a method for changing the display mode of another application provided in an embodiment of the present application;

[0092] Figure 6 A schematic diagram of a function calling process provided in an embodiment of the present application;

[0093] Figure 7 A schematic diagram of an AppearanceSetting module provided in an embodiment of the present application;

[0094] Figure 8 A schematic diagram of the structure of a device for changing the display mode of an application provided in an embodiment of the present application;

[0095] Fig. 9 A schematic diagram of the structure of another device for changing the display mode of an application provided in an embodiment of the present application;

[0096] Fig.10 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application;

[0097] Fig.11 The present invention is a block diagram of a terminal device according to an exemplary embodiment.

[0098] The above drawings have shown clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0099] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0100] With the development of terminals, terminal devices have become important tools in people's lives and work. During the use of the terminal, the display mode of the terminal device can be set.

[0101] In one example, two display modes are provided for applications, namely light mode and dark mode. For example, in the IOS system, a dark mode is provided for applications; in the dark mode, the system of the terminal device can be set to light mode or dark mode, and then the display mode of the application in the terminal device can be changed to light mode or dark mode according to the system mode; and in the IOS system, the applications running and not running in the terminal device will change to light mode or dark mode according to the system mode.

[0102] Among them, in light mode, the interface style of the application tends to be light. For example, in light mode, the interface of the application is black text on a white background. However, in light mode, the white background on the interface of the application occupies a larger area, which makes the screen of the terminal device in a very bright state, especially at night when the screen is brighter, which is more irritating to the user's eyes. In addition, the white display is displayed by the three optical primary colors to the brightest, so in light mode, the terminal device is very power-consuming. As a result, a dark mode was introduced, for example, changing black text on a white background to white text on a black background; in dark mode, the white background on the interface of the application occupies a smaller area, thereby reducing the stimulation to the user's eyes and saving power on the terminal device.

[0103] Since the terminal device provides a light mode and a dark mode, when the display mode of the application of the terminal device needs to be switched, the system mode of the terminal device can be switched, and then the display mode of the application of the terminal device can be switched.

[0104] The switching of display modes actually means loading the resources corresponding to different display modes in the terminal device, where the resources include colors and images. For example, in the IOS system, multiple ways to create dynamic colors and dynamic images are provided. Dynamic colors mean that the interface will display different colors in dark mode and light mode, such as semantic colors, system colors, custom colors, etc.

[0105] In one example, when the system mode of the terminal device is switched, a calling method is provided based on the view class, and the calling method is used to directly create dynamic colors and images for each view element of the application, thereby changing the display mode of the application of the terminal device.

[0106] In another example, when the system mode of the terminal device is switched, a calling method is provided based on the view class; using this calling method, when each view element of the application is initialized, each view element of the application is rendered into a style corresponding to the current system mode, thereby changing the display mode of the application of the terminal device.

[0107] However, in the above process, if the display mode of the application of the terminal device is switched, the system mode of the terminal device can only be changed, and then the display mode of the application can be switched based on the switching of the system mode. Therefore, when the display mode of the application of the terminal device is switched, it is based on each view element of the application; it is necessary to adapt when each view element is created and initialized, which results in a large workload for adaptation and a large amount of code consumption; and it is necessary to monitor the changes in the system mode of the terminal device for each view element of the application before the mode of each view element can be changed (and then the display mode of the application can be changed), which further results in a large workload for adaptation and a large amount of code consumption. Therefore, a large workload is required and the code intrusion is very serious; therefore, the cost of changing the display mode of the application is high and the efficiency is low. Since the code intrusion is very serious, it will have a great impact on the logic of other codes of the terminal device.

[0108] Moreover, for the iOS system, the switch between light mode and dark mode was only applied to terminal devices two years ago. Therefore, if the terminal device has a lower system version, the switch between light mode and dark mode cannot be completed, and the display mode of the application cannot be updated. In other words, the update of the display mode of the application cannot be adapted to the terminal device with a lower system version.

[0109] Secondly, if you want to switch the display mode of the application of the terminal device, you can only change the system mode of the terminal device, and then based on the switching of the system mode, you can switch the display mode of the application. Furthermore, the change of the display mode of the application must follow the system mode of the terminal device, and the display mode of the application cannot be separated from the system mode. Then, the user cannot customize the display mode of the application, and the user has no choice.

[0110] In addition, the display mode of the application must be changed according to the system mode of the terminal device, but the application has many interfaces and requires themes and skins of various styles, which requires a lot of code development and logic design for the application to make the display mode of the application change according to the system mode of the terminal device. This makes the code development and logic design very complicated, and the development and maintenance costs are high.

[0111] The method, device and apparatus for changing the display mode of an application provided in the embodiments of the present invention are intended to solve the above technical problems in the prior art.

[0112] The following specific embodiments are used to describe in detail the technical solutions of the present invention and how the technical solutions of the present application solve the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0113] Figure 1 A flowchart of a method for changing the display mode of an application provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0114] 101. In response to a request for changing the display mode of an application program, call an update function, wherein the change request is used to indicate the display mode to be changed, and the update function includes the display mode to be changed and view configuration parameters.

[0115] Exemplarily, the execution subject of this embodiment may be a terminal device. An application may be set in the terminal device, and when the display mode of the application is changed, the method provided by this embodiment may be adopted.

[0116] The terminal device receives a change request, which is used to instruct to change the display mode of the application of the terminal device; the change request includes the display mode to be changed (i.e., the display mode to be changed). The display mode of the application refers to the state of the color and picture on the interface of the application.

[0117] In one example, a user touches an application, thereby triggering a change in the display mode of the application. At this time, the terminal device receives a change request initiated by the user.

[0118] Alternatively, in one example, at a preset time point, the terminal device or the application automatically initiates a change request, and the change request indicates changing the display mode of the application.

[0119] After receiving the change request, an update function is called, which indicates the display mode to be changed, and the update function is used to carry the view configuration parameters, wherein the view configuration parameters include but are not limited to: the identifier of the new color of each view element of the application, the identifier of the new image of each view element of the application, and the new size of each view element of the application.

[0120] 102. According to the update function, retrieve the block information corresponding to the display mode to be changed in the view recorder, wherein the block information is used to indicate the view object corresponding to the display mode to be changed.

[0121] In one example, the view object includes a view element corresponding to at least one page of the application.

[0122] For example, although the update function carries the view configuration parameters, it is also necessary to retrieve the view object corresponding to the display mode to be changed. Each view object includes the view elements of each page of the application, that is, each view object includes each view element on a page. Alternatively, each view object includes the view elements of multiple pages of the application.

[0123] For example, an interface of an application has multiple view elements, such as multiple pictures and multiple backgrounds; and each view element of an interface can be a view object.

[0124] The block information corresponding to the display mode to be changed in the view recorder can be retrieved, wherein the block information corresponds to the view object. One block information can correspond to one view object of the display mode, or one block information can correspond to multiple view objects of the display mode.

[0125] 103. Call the view object indicated by the block information corresponding to the display mode to be replaced, and pass in the view configuration parameters indicated by the update function, and adjust the display mode of the application to the display mode to be replaced according to the view configuration parameters and the view object indicated by the block information corresponding to the display mode to be replaced.

[0126] Exemplarily, since the block information indicates the view object corresponding to the display mode to be replaced, the view object indicated by the block information can be retrieved; and the update function carries the view configuration parameters, the view configuration parameters can be passed in. At this time, the view object and the view configuration parameters indicated by the block information both correspond to the display mode to be replaced.

[0127] Thus, the view object indicated by the block information corresponding to the display mode to be replaced can be applied to the interface of the application program in the manner indicated by the view configuration parameters, and the display mode of the application program can be replaced with the display mode to be replaced.

[0128] In one example, the view configuration parameters include, but are not limited to: the identifier of the new color of each view element of the application, the identifier of the new image of each view element of the application, and the new size of each view element of the application. The view object indicated by the block information includes the new color and the new image. The view object can be applied to the interface of the application according to the view configuration parameters.

[0129] In this embodiment, when the display mode of the application needs to be changed, a change request is initiated, and then the update function is called. According to the update function, the block information corresponding to the display mode to be changed is called, and then the view object indicated by the block information can be obtained; thus, the display mode of the application can be adjusted according to the view configuration parameters indicated by the update function and the called view object, and the display mode of the application is changed to the display mode to be changed. Therefore, when the display mode of the application needs to be changed, the block information corresponding to the display mode to be changed is executed, and then the view object is called. According to the view configuration parameters indicated by the update function, the view object is applied to the application, and the application can be updated. The solution provided by this embodiment does not need to rely on the system mode of the terminal device when changing the display mode of the application. In addition, this embodiment provides a new mode change solution, which does not need to be adapted when each view element of the application is created and initialized. It only needs to call the view configuration parameters indicated by the update function and the view object indicated by the block information to update the display mode of the entire application; at the same time, the block information is used to indicate the view object composed of the view elements, which reduces the code overhead. Thus, the adaptation workload and code overhead are reduced, the cost of developing the display mode of the application is reduced, and the cost of changing the display mode of the application is reduced, so the display mode of the application can be developed and changed efficiently. In addition, the solution provided in this embodiment can make the application adapt to multiple display modes and support customized display modes; it can make the application efficiently adapt to any of the multiple display modes.

[0130] Figure 2 A flowchart of another method for changing the display mode of an application provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the method includes:

[0131] 201. In response to a request for changing the display mode of an application program, call an update function, wherein the change request is used to indicate the display mode to be changed, and the update function includes the display mode to be changed and view configuration parameters.

[0132] In one example, the update function also includes key value information, and there is a correspondence between the display mode to be changed, the view configuration parameters and the key value information in the update function; the key value information is used to indicate the block information corresponding to the display mode to be changed.

[0133] Exemplarily, the execution subject of this embodiment may be a terminal device. An application may be set in the terminal device, and when the display mode of the application is changed, the method provided by this embodiment may be adopted.

[0134] The terminal device obtains a change request, where the change request is used to instruct to change the display mode of the application of the terminal device; the change request includes the display mode to be changed (ie, the display mode to be changed to).

[0135] After obtaining the change request, call an update function, which includes indication parameters, the display mode to be changed, view configuration parameters, and key value information. Among them, the indication parameter is used to indicate the traversal view recorder. The key value information is used to indicate the block information corresponding to the display mode to be changed. The view configuration parameters include but are not limited to: the identification of the new color of each view element of the application, the identification of the new picture of each view element of the application, and the new size of each view element of the application. The indication parameter, the display mode to be changed, the view configuration parameter, and the key value information in the update function correspond to each other.

[0136] 202. The view object has a first extended attribute, and the first extended attribute is used to indicate that the block information is bound to the key value information; if the key value information is empty, the block information bound to the key value information in the view recorder is retrieved according to the update function. The block information is used to indicate the view object corresponding to the display mode to be changed.

[0137] Exemplarily, a view recorder is provided in this embodiment. Figure 3 A logical diagram of a view recorder provided in an embodiment of the present application, such as Figure 3 As shown, the view recorder is represented by ViewRecorder, and the view recorder can be used to record the view objects of the current display mode of the application. In addition, in the normal development of the application, each view object of the application has a life cycle; further, when the current display mode of the application is displayed, the view object will be created and displayed where it is needed, and when the view object of the application is closed or when the application is changed to another display mode, the view object needs to be released. The function of the view recorder is to record the view object without affecting the normal cycle of the view object, but not to hold the view object; when the life cycle of the view object ends (for example, when the view object of the application is closed or when the application is changed to another display mode), the view object needs to be automatically removed from the view recorder.

[0138] like Figure 3 As shown, the view recorder ViewRecorder uses an array weakPointers to store weak pointers of view objects, and each view object has its own weak pointer weakPointer. It can be seen that each weak pointer indicates a view object. In addition, a style manager can be used to manage each view recorder ViewRecorder.

[0139] The view recorder has a first interface method (enumerateUsingIndexBlock method). All interface methods of the view recorder are based on the first interface method (enumerateUsingIndexBlock method). The array weakPointers can be traversed based on the first interface method (enumerateUsingIndexBlock method). When calling the first interface method (enumerateUsingIndexBlock method), a block information (i.e., IndexBlock) is passed in, where the block information is used to indicate the view object; it can be seen that the block information has two parameters, namely the view object and the subscript of the view object; then, the array weakPointers is traversed; for each weak pointer weakPointer, if the weak pointer is empty, it is determined that the view object referred to by the weak pointer has been released, and at this time, the weak pointer is removed from the array; for each weak pointer weakPointer, if the weak pointer is not empty, the passed block information is called back. Among them, a block block is provided, and the block block is used to indicate the view object; that is, the block block has only one parameter, which is the view object.

[0140] In addition, the view recorder has a second interface method (enumerateUsingBlock method), and the terminal device can traverse the array weakPointers through the second interface method (enumerateUsingBlock method) and the first interface method (enumerateUsingIndexBlock method).

[0141] In addition, a third interface method (recordView method) is provided; a view object is added through the third interface method (recordView method). The array weakPointers is traversed through the third interface method (recordView method) and the first interface method (enumerateUsingIndexBlock method) to add a weak pointer (i.e., a weak pointer corresponding to the newly added view object) to the array weakPointers; at this time, the weak pointers in the array weakPointers need not have duplicate pointers.

[0142] A fourth interface method (removeView method) is provided; a view object is removed through the fourth interface method (removeView method). The array weakPointers is traversed through the fourth interface method (removeView method) and the first interface method (enumerateUsingIndexBlock method), and the weak pointer of the view object indicated by the fourth interface method is removed from the array weakPointers.

[0143] A fifth interface method (validView method) is provided; a valid view object is obtained through the fifth interface method (validView method). When the view object needs to be obtained, the array weakPointers is traversed through the fifth interface method and the first interface method to determine whether the weak pointer of the view object indicated by the fifth interface method exists in the array weakPointers; if so, the view object indicated by the fifth interface method is determined to be a valid view object, and then the view object indicated by the fifth interface method is obtained from the terminal device.

[0144] A sixth interface method (count method) is provided; the sixth interface method (count method) is used to count the number of valid view objects. When the view object needs to be obtained, the array weakPointers is traversed through the fifth interface method and the first interface method to count the total number of weak pointers in the array weakPointers that are not empty, and the total number is determined as the number of valid view objects.

[0145] Figure 4 A logical diagram of a view object provided in an embodiment of the present application, such as Figure 4 As shown, two internal attributes are provided to the view object (i.e., View classification) through runtime, namely the first extended attribute and the second extended attribute; it should be noted that the block information can indicate the view object. Each view object has an internal attribute, that is, each view object is configured with a first extended attribute or a second extended attribute. Among them, the first extended attribute indicates that the block information and the key value information are in a binding relationship, and the second extended attribute indicates that the block information and the key value information are in a key-value correspondence relationship. For example, for the first extended attribute, the appearanceUpdateBlock method is used to store the default bound block information block; for the second extended attribute, the BlockDictionary dictionary is used to store the block information block that has a key-value correspondence relationship with the key value information. Then, through the first extended attribute or the second extended attribute, the incoming block information blcok is associated with the view object View.

[0146] like Figure 4 As shown, the view object has two pairs of interface methods, the first pair of interface methods are used to operate the first extended attribute, and the second pair of interface methods are used to operate the second extended attribute.

[0147] The first pair of interface methods are the seventh interface method (bindAppearanceUpdateBlock: method) and the eighth interface method (removeAppearanceUpdateBlock method). The seventh interface method (bindAppearanceUpdateBlock: method) is used to bind the default block information (i.e., bind the key value information of the view object to the block information); the seventh interface method (bindAppearanceUpdateBlock: method) can be used to store the incoming block information block in the first extended attribute of the view object View, and then store the view object View in the first view recorder of the style manager, and then the block information block bound to the key value information of the view object can be synchronously called.

[0148] The eighth interface method (removeAppearanceUpdateBlock method) is used to remove the default block information (that is, to unbind the key value information of the view object from the block information); the eighth interface method (removeAppearanceUpdateBlock method) can be used to set the first extended attribute of the view object View to empty, and remove the view object View from the first view recorder of the style manager.

[0149] The second pair of interface methods are the ninth interface method (bindAppearanceUpdateBlock:key: method) and the tenth interface method (removeAppearanceUpdateBlockWithKey: method). The ninth interface method (bindAppearanceUpdateBlock:key: method) is used to store the passed key information key and block information block in the form of key-value correspondence (i.e., key-value form) in the second extended attribute of the view object View; then, the view object View can be stored in the second view recorder of the style manager, and then the block information block with a key-value correspondence with the key information of the view object can be synchronously called.

[0150] The tenth interface method (removeAppearanceUpdateBlockWithKey: method) is used to remove the block information block that has a key value corresponding relationship with the key value information key from the second extended attribute of the view object View through the key value information key. Specifically, first determine whether the second extended attribute of the view object View has other bound block information. If not, the block information block that has a key value corresponding relationship with the key value information key can be removed from the second extended attribute of the view object View through the key value information key.

[0151] In addition, you can add a view object through the recordView: method and remove a view object through the removeView: method.

[0152] like Figure 4 As shown, the block information and the key value information may have a binding relationship or a key value corresponding relationship. For example, the block information block1 and the key value information key1 have a binding relationship, the block information block2 and the key value information key2 have a key value corresponding relationship, and the block information block3 and the key value information key3 have a key value corresponding relationship.

[0153] After step 203, according to the above introduction, if the view object has the first extended attribute or the second extended attribute, it can be determined whether the key value information of the view object is empty. If it is empty, it is determined that the view object has the first extended attribute, that is, it is determined that the key value information of the view object has the block information of the binding relationship. At this time, according to the update function, the block information bound to the key value information in the view recorder is called.

[0154] 203. The view object has a second extended attribute, and the second extended attribute is used to indicate that the block information and the key value information are in a key-value correspondence relationship; if the key value information is not empty, then according to the update function, the block information in the view recorder that has a key-value correspondence relationship with the key value information is retrieved. The block information is used to indicate the view object corresponding to the display mode to be changed.

[0155] Exemplarily, after step 203, according to the above introduction, if the view object has the first extended attribute or the second extended attribute, it can be determined whether the key value information of the view object is empty. If it is empty, it is determined that the view object has the second extended attribute, that is, it is determined that the key value information of the view object has block information with a key-value correspondence relationship. At this time, according to the update function, the block information with a key-value correspondence relationship between the key value information and the view recorder is viewed.

[0156] 204. Call the view object indicated by the block information corresponding to the display mode to be changed, and pass in the view configuration parameters indicated by the update function.

[0157] In one example, the method provided by this embodiment further includes: storing the view object indicated by the block information corresponding to the display mode to be changed in a view recorder.

[0158] Exemplarily, after step 202 or step 203, since the block information indicates the view object corresponding to the display mode to be changed, the view object indicated by the block information of step 202 or step 203 can be called, and the view configuration parameters indicated by the update function can be passed in.

[0159] At this time, since the block information indicates the view object corresponding to the display mode to be changed, the view object indicated by the block information can also be stored in the view recorder of the style manager.

[0160] 205. Apply the view object indicated by the block information corresponding to the display mode to be changed to the interface of the application program according to the view configuration parameters.

[0161] Exemplarily, the view configuration parameters indicate the configuration mode between the view object and the application, wherein the view configuration parameters include, but are not limited to: the identification of the new color of each view element of the application, the identification of the new image of each view element of the application, and the new size of each view element of the application. Thus, according to the view configuration parameters, the view object indicated by the block information can be applied to the interface of the application, thereby changing the application to the display mode to be changed.

[0162] 206. Add a weak pointer corresponding to each view element in the view recorder, where the weak pointer is used to indicate the view object.

[0163] Exemplarily, since the view object indicated by the block information is stored in the view recorder of the style manager, a weak pointer corresponding to each view element may be added to the view recorder, and each weak pointer is used to indicate each added view object.

[0164] 207. In response to the view closing instruction, release the block information in the view recorder.

[0165] Exemplarily, if a view closing instruction is obtained, it is determined that the current display mode of the application is no longer in effect, and the view object needs to be released. That is, in response to the view closing instruction, it is determined that the view object of the application is closed or the application is changed to another display mode, and the view object needs to be released. Therefore, the block information in the view recorder needs to be released, and the view object can be automatically removed from the view recorder.

[0166] 208. In response to the view close instruction, traverse each weak pointer in the view recorder, wherein the weak pointer is used to indicate the view object; if the weak pointer is null, delete the null weak pointer.

[0167] Exemplarily, after step 207, the block information in the view recorder is released, that is, the view object is automatically removed from the view recorder, and the weak pointer needs to be released. At this time, the array weakPointers in the view recorder can be traversed, and for each weak pointer weakPointer, if the weak pointer is null, it is determined that the view object pointed to by the weak pointer has been released. At this time, the weak pointer is removed from the array, that is, the null weak pointer is deleted.

[0168] In this embodiment, based on the above embodiment, when the display mode of the application needs to be changed, the update function is called; if the key value information is empty, the block information bound to the key value information in the view recorder is retrieved according to the update function; if the key value information is not empty, the block information having a key value correspondence relationship with the key value information in the view recorder is retrieved according to the update function; the view object indicated by the block information corresponding to the display mode to be changed is called, and the view configuration parameters indicated by the update function are passed in. According to the view configuration parameters, the view object indicated by the block information corresponding to the display mode to be changed is applied to the interface of the application. Therefore, the display mode of the entire application can be updated by only calling the view configuration parameters indicated by the update function and the view object indicated by the block information; at the same time, the block information is used to indicate the view object composed of view elements, thereby reducing the code overhead. And based on the view recorder, the display mode of the application is updated, and then through a unified adaptation entry, the update of the display mode of the application can be conveniently supported. The solution provided by this embodiment is applicable to multiple operating systems (operating systems of terminal devices, for example, different versions of Android systems, different versions of IOS systems); and at the same time, because multiple interface methods of the view object of the view recorder are provided, the display mode of the application can be replaced and updated by using the solution of this embodiment for different display modes. In addition, the solution provided by this embodiment can effectively maintain and manage the code.

[0169] Figure 5 A flowchart of another method for changing the display mode of an application provided in an embodiment of the present application is shown as follows: Figure 5 As shown, the method includes:

[0170] 301. If the change request is a change request related to the system of the terminal device, in response to the change request for changing the display mode of the application, call an update mode function, the update mode function indicating that the display mode to be changed is different from the current display mode of the application. The change request is used to indicate the display mode to be changed.

[0171] In one example, if the change request is a change request related to the system of the terminal device, the change request is any one of the following: a change request to change the display mode following the system, a change request to enter the background, a change request to switch the system mode, and a change request to indicate the display mode to be changed.

[0172] Exemplarily, steps 301-302 may be performed, and then steps 306-307 may be performed; or step 303 may be performed, and then steps 306-307 may be performed; or steps 304-305 may be performed, and then steps 306-307 may be performed.

[0173] The execution subject of this embodiment may be a terminal device. An application may be set in the terminal device, and when the display mode of the application is changed, the method provided by this embodiment may be adopted.

[0174] Different methods of calling the update function are provided for different types of replacement requests. That is, if the replacement request is a replacement request related to the system of the terminal device, steps 301-302 are executed, and then steps 306-307 are executed. If the replacement request is a replacement request related to user customization, step 303 is executed, and then steps 306-307 are executed. If the replacement request is a replacement request indicating a key value, steps 304-305 are executed, and then steps 306-307 are executed.

[0175] If the replacement request is related to the system of the terminal device, then when the replacement request is received, the update mode function is first called; based on the update mode function, it is determined whether the display mode to be replaced indicated by the replacement request is different from the current display mode of the application.

[0176] 302. According to the calling mode function, the update function is called, and the local setting function is called and executed, wherein the local setting function is used to instruct to perform local persistence processing on the view object corresponding to the display mode to be changed. The update function includes the display mode to be changed and the view configuration parameters.

[0177] In one example, when executing steps 301-302, the following may also be performed: according to the calling mode function, calling the system setting function, and according to the system setting function, updating the display mode of the components of the system of the terminal device to the display mode to be changed.

[0178] Exemplarily, after step 301, if it is determined that the display mode to be replaced indicated by the replacement request is different from the current display mode of the application, then the update function is called according to the calling mode function. The update function indicates the display mode to be replaced, and the update function is used to carry the view configuration parameters. The view configuration parameters include, but are not limited to: the identifier of the new color of each view element of the application, the identifier of the new picture of each view element of the application, and the new size of each view element of the application.

[0179] When the update function is called, the local setting function is called at the same time; according to the local setting function, the view object corresponding to the display mode to be changed is stored locally on the terminal device, that is, the view object corresponding to the display mode to be changed is locally persisted.

[0180] After executing steps 301-302, execute steps 306-307 to update the display mode of the application to the display mode to be replaced. In this case, the display model of the system of the terminal device can also be updated, and the display model of the system of the terminal device can also be updated to the display mode to be replaced. At this time, according to the calling mode function, the system setting function can be called, and the system setting function is used to adjust the view object of each component of the system of the terminal device; then, according to the system setting function, the view object of the component of the system of the terminal device is also adjusted to the view object indicated by the display mode to be replaced, and then the display mode of the system of the terminal device is replaced with the display mode to be replaced. It can be seen that if the replacement request is a replacement request related to the system of the terminal device, the display mode of the application can be updated to the display mode to be replaced, and the display model of the system of the terminal device can also be updated to the display mode to be replaced.

[0181] In one example, Figure 6 A schematic diagram of a function calling process provided in an embodiment of the present application, such as Figure 6 As shown, if the change request is a change request related to the system of the terminal device, the change request can be any one of the following: a change request to follow the system to change the display mode (followSystemMode), a change request to enter the background, a change request to switch the system mode, and a change request to indicate the display mode to be changed (performUpdateWithApperanceStyle:).

[0182] When a system-related change request related to the terminal device is received, the update mode function (i.e., updateWithApperanceStyle method) is called. When it is determined that the display mode to be replaced referred to by the change request is different from the current display mode of the application, the update mode function is used to call the update function. The update function (performUpdateWithViewRecorder:style:key:userInfo:) is the core method of this embodiment. The update function (performUpdateWithViewRecorder:style:key:userInfo:) accepts four parameters. ViewRecorder is the view recorder to be traversed, style is the display mode to be changed, key is the specified key value information, and userInfo here is the view configuration parameter. Through the update function, the traversal method is called to traverse the view recorder; if key is empty, it is determined to have the specified block information (i.e., the block information bound to the key value information), and then the default bound block information is directly called, such as Figure 6 As shown, operate viewRecorder, all view objects View recorded in viewRecorder are the default bound block information block; if key is not empty, determine the block information with a key-value correspondence relationship with the key, and then call the block information with a key-value correspondence relationship with the key, such as Figure 6 As shown, the keyViewRecorder is operated, and all the view objects View recorded in the keyViewRecorder are block information blocks with key-value correspondences for the specified key-value information key. Then the view object is retrieved, and the display model is replaced according to the passed-in style and view configuration parameter userInfo. Among them, for the keyViewRecorder, the AppearanceUpdateBlockDic method can be used to call the block information and put the block information into the keyViewRecorder; the AppearanceUpdateBlockDic method can also be used to remove the block information from the keyViewRecorder.

[0183] Furthermore, when it is determined that the display mode to be replaced referred to in the replacement request is different from the current display mode of the application (that is, the passed-in display mode style is different from the style of the current style manager), the updateWithUserInterfaceStyle method can be used to call the local setting function (that is, the setAppearanceStyle method) and the system setting function (setAllWindowsWithUserInterfaceStyle: method).

[0184] Through the local setting function (i.e., the setAppearanceStyle method), the view object corresponding to the display mode to be replaced is stored in the view recorder of the style manager, and the view object corresponding to the display mode to be replaced is stored locally (i.e., local persistence processing is performed). Since the system components of the terminal device will need to be used during the development and use of the application, in order to avoid inconsistency between the display mode of the system components of the terminal device and the display mode of the application, the system setting function (setAllWindowsWithUserInterfaceStyle: method) can be called to set the display mode of the system components of the terminal device, and update the display mode of the system components of the terminal device to the display mode to be replaced.

[0185] Among them, when implementing the local setting function (i.e., the setAppearanceStyle method), it is completed through the AppearanceSetting module. After the view object corresponding to the display mode to be changed is locally persisted, even if the application is closed or uninstalled (i.e., the application is killed), the data in the style manager can still be applied to the system of the terminal device. Figure 7 A schematic diagram of the AppearanceSetting module provided in an embodiment of the present application, such as Figure 7 As shown, the AppearanceSetting module has three properties that can be configured and can save three corresponding data, namely the display mode to be changed, the key value information key, and the conversion processing function convertAction. Figure 7 Among them, userinfo represents a request to change the block information (carrying the display mode to be changed), appearanceStyle represents any kind of change request (carrying the display mode to be changed), and followSystem represents a change request to follow the system to change the display mode (carrying the display mode to be changed). The view object corresponding to the display mode to be changed can be locally persisted through the AppearanceSetting module; the AppearanceSetting module uses the key value information key as an important part of storing and reading data.

[0186] For example, a change request to follow the system to change the display mode (followSystemMode) is received, wherein the change request carries an indication of "whether to follow the system mode". The first case is: if the "whether to follow the system mode" in the change request is yes, first set "whether to follow the system mode" to no, and then, if the display mode carried by the change request is different from the current display mode of the application, call the update mode function (i.e., updateWithApperanceStyle method); or, if the display mode is not carried by the change request, the update mode function (i.e., updateWithApperanceStyle method) can be called directly, and a display mode to be changed can be automatically specified; then, call the update function and directly call the local setting function (i.e., setAppearanceStyle method); then, set "whether to follow the system mode" to yes, and then directly call the system setting function (setAllWindowsWithUserInterfaceStyle: method) to set the display mode of the terminal device system. The second situation is: if the "whether to follow the system mode" in the change request is no, if the display mode carried by the change request is different from the current display mode of the application, the update mode function (that is, updateWithApperanceStyle method) is called; or, if the display mode not carried by the change request, the update mode function (that is, updateWithApperanceStyle method) can be called directly, and a display mode to be changed is automatically specified; then, the update function is called, the local setting function (that is, setAppearanceStyle method) and the system setting function (setAllWindowsWithUserInterfaceStyle: method) are called.

[0187] For example, a change request to enter the background is received, or a change request to switch the system mode is received, wherein the change request carries an indication of "whether to follow the system mode". The first case is: if the "whether to follow the system mode" in the change request is yes, first set "whether to follow the system mode" to no, and then, if the display mode carried by the change request is different from the current display mode of the application, call the update mode function (i.e., updateWithApperanceStyle method); or, if the display mode is not carried by the change request, the update mode function (i.e., updateWithApperanceStyle method) can be called directly, and a display mode to be changed is automatically specified; then, call the update function and use the updateWithUserInterfaceStyle method to call the local setting function (i.e., setAppearanceStyle method); then, set "whether to follow the system mode" to yes, and use the updateWithUserInterfaceStyle method to call the system setting function (setAllWindowsWithUserInterfaceStyle: method) to set the display mode of the terminal device system. The second case is: if the "whether to follow the system mode" in the change request is no, then if the display mode carried by the change request is different from the current display mode of the application, the update mode function (i.e., updateWithApperanceStyle method) is called; or, if the display mode is not carried by the change request, the update mode function (i.e., updateWithApperanceStyle method) can be called directly, and a display mode to be replaced is automatically specified; then, the update function is called, the local setting function (i.e., setAppearanceStyle method) and the system setting function (setAllWindowsWithUserInterfaceStyle: method) are called. It should be noted that if a change request to enter the background is received, or a change request to switch the system mode is received, a monitoring method is required to monitor the system of the terminal device; only when the monitoring method is used to monitor that the system of the terminal device is working normally, the updateWithUserInterfaceStyle method is used to call the system setting function (setAllWindowsWithUserInterfaceStyle: method).

[0188] 303. If the change request is a change request related to user customization, in response to the change request for changing the application display mode, call an update function, wherein the change request is used to indicate the display mode to be changed, and the update function includes the display mode to be changed and view configuration parameters.

[0189] In one example, if the change request is a change request related to user customization, the change request is a change request indicating a customized display mode, or a change request indicating block information.

[0190] Exemplarily, if the change request is a change request related to user customization, the update function can be directly called according to the change request. In this case, it can be a change request indicating a customized display mode (performUpdateWithKey:userinfo:) or a change request indicating block information (userinfo).

[0191] The display mode indicated by the change request indicating a custom display mode (performUpdateWithKey:userinfo:) is a display mode customized by the user. If a change request indicating a custom display mode (performUpdateWithKey:userinfo:) is received, the update function can be directly called. The change request carries the custom display mode, the specified key value information, the identifier of the view recorder corresponding to the specified key value information, and the view configuration parameters.

[0192] The request for changing the block information (userinfo) is a global custom configuration parameter that needs to be notified to all default bound block information blocks; therefore, if a request for changing the block information is received, the update function can be called directly. The view recorder to be accessed and the display mode to be changed can be passed to the update function through the change request related to user customization.

[0193] like Figure 6 As shown, if a request to change a custom display mode (performUpdateWithKey:userinfo:) or a request to change block information (userinfo) is received, the update function (performUpdateWithViewRecorder:style:key:userInfo:) can be called directly. The update function (performUpdateWithViewRecorder:style:key:userInfo:) accepts four parameters: ViewRecorder is the view recorder to be traversed, style is the display mode to be changed, key is the specified key value information, and userInfo here is the view configuration parameter. Through the update function, the traversal method is called to traverse the view recorder; if key is empty, it is determined to have the specified block information (that is, the block information bound to the key value information), and then the default bound block information is directly called, such as Figure 6As shown, operate viewRecorder, all view objects View recorded in viewRecorder are the default bound block information block; if key is not empty, determine the block information with a key-value correspondence relationship with the key, and then call the block information with a key-value correspondence relationship with the key, such as Figure 6 As shown, the keyViewRecorder is operated, and all the view objects View recorded in the keyViewRecorder are block information blocks with the specified key value information key and the key value corresponding relationship. Then the view object is retrieved, and the display model is replaced according to the passed-in style and view configuration parameter userInfo.

[0194] 304. If the change request is a change request indicating a key value, the change request includes key value information, and in response to the change request for changing the application display mode, a key value setting function is called.

[0195] Exemplarily, if the replacement request is a replacement request indicating a key value (setupWithKey:), it can be known that the key value information key is the key value information specified by the user; the key value setting function (ie, the setDataWithKey method) can be called according to the replacement request.

[0196] 305. According to the key value setting function, determine the block information corresponding to the key value information in the replacement request, and store the block information corresponding to the key value information in the replacement request in the view recorder; after executing the key value setting function, call the update function.

[0197] Exemplarily, after step 304, if the display mode indicated by the key value information is different from the current display mode of the application, or the view object in the display mode indicated by the key value information has changed, the block information corresponding to the key value information in the replacement request is stored in the view recorder through the key value setting function (i.e., the setDataWithKey method). Moreover, the key value information is passed to the update function through the key value setting function, and the update function (performUpdateWithViewRecorder:style:key:userInfo:) can be called, and the display mode to be replaced, the key value information, the identifier of the view object indicated by the key value information, and the view configuration parameters are passed to the update function.

[0198] In the implementation process of any of the above-mentioned change requests, the change request is transmitted through the enumeration type AppearanceStyle. For example, in iOS 12, the display mode to be changed in the change request is transmitted through the enumeration type UIUserInterfaceStyle.

[0199] Furthermore, in any of the above implementations, the block information block can be passed in advance through the bindAppearanceUpdateBlock method; the block information block includes the configuration parameters of the display mode of the application; the passed block information block is bound to the view object, and then the view object is stored in the view recorder. Among them, the key value information can correspond to at least one block information.

[0200] 306. According to the update function, retrieve the block information corresponding to the display mode to be changed in the view recorder, wherein the block information is used to indicate the view object corresponding to the display mode to be changed.

[0201] For example, this step can refer to the above embodiment and will not be described in detail.

[0202] 307. Call the view object indicated by the block information corresponding to the display mode to be replaced, and pass in the view configuration parameters indicated by the update function, and adjust the display mode of the application to the display mode to be replaced according to the view configuration parameters and the view object indicated by the block information corresponding to the display mode to be replaced.

[0203] For example, this step can refer to the above embodiment and will not be described in detail.

[0204] In this embodiment, on the basis of the above embodiment, a plurality of different types of change requests are provided, and different functions are called based on different change requests to change the display mode of the application; the display mode of the system of the terminal device can also be changed; and a plurality of change methods are provided for the terminal device and the user. Since the block information can be associated or bound with the view object, and the view object is stored in the view recorder, when the change request is received, the view recorder can be traversed, and then the block information associated or bound with the view element in the view recorder is executed, so as to display and update the view, and then the display mode of the application is changed. In this embodiment, the user can customize the display mode of the application, thereby meeting the user's demand for customizing the display mode of the application; multiple display modes are provided, and multiple themes or skins can be provided for the application. Moreover, in this embodiment, through the change request, the update function is called to change the display mode of the application, thereby providing a unified entry for access, to pass in block information or key value information, to change the display mode of the application, and no additional code cost is added. In this embodiment, there is no need to adapt each view element of the application when it is created and initialized. It is only necessary to call the view configuration parameters indicated by the update function and the view object indicated by the block information to update the display mode of the entire application. Therefore, the solution provided by this embodiment has a small amount of code, which reduces the adaptation workload and code overhead, reduces the cost of developing the display mode of the application, and reduces the cost of changing the display mode of the application, so that the display mode of the application can be developed and changed efficiently. In addition, the solution provided by this embodiment can enable the application to adapt to multiple display modes and support customized display modes; it can enable the application to efficiently adapt to any of the multiple display modes. The solution provided by this embodiment can be applied to multiple operating systems (different versions of Android systems, different versions of IOS systems)

[0205] Figure 8 A schematic diagram of a device for changing the display mode of an application provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the device comprises:

[0206] The first calling unit 41 is used to call an update function in response to a change request for changing the display mode of the application program, wherein the change request is used to indicate the display mode to be changed, and the update function includes the display mode to be changed and view configuration parameters.

[0207] The calling unit 42 is used to call the block information corresponding to the display mode to be changed in the view recorder according to the update function, wherein the block information is used to indicate the view object corresponding to the display mode to be changed.

[0208] The second calling unit 43 is used to call the view object indicated by the block information corresponding to the display mode to be changed, and pass in the view configuration parameters indicated by the update function.

[0209] The adjusting unit 44 is used to adjust the display mode of the application to the display mode to be changed according to the view configuration parameters and the view object indicated by the block information corresponding to the display mode to be changed.

[0210] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.

[0211] Fig. 9 A schematic diagram of a structure of another device for changing the display mode of an application provided in an embodiment of the present application, wherein Figure 8 Based on the embodiment shown, Fig. 9 As shown, in the device, the update function also includes key value information, and there is a corresponding relationship between the display mode to be replaced, the view configuration parameters and the key value information in the update function; the key value information is used to indicate the block information corresponding to the display mode to be replaced.

[0212] In one example, the view object has a first extended attribute, which is used to indicate that the block information is bound to the key value information; if the key value information is empty, the calling unit 42 is specifically used to: call the block information bound to the key value information in the view recorder according to the update function.

[0213] In one example, the view object has a second extended attribute, which is used to indicate that the block information and the key value information are in a key-value correspondence relationship; if the key value information is not empty, the calling unit 42 is specifically used to: according to the update function, call the block information in the view recorder that has a key-value correspondence relationship with the key value information.

[0214] In one example, the replacement request is any one of the following: a replacement request related to a system of the terminal device, a replacement request related to user customization, and a replacement request indicating a key value.

[0215] In one example, if the replacement request is a replacement request related to the system of the terminal device, the first calling unit 41 includes:

[0216] The first calling module 411 is used to call an update mode function in response to a request to change the display mode of the application program, where the update mode function indicates that the display mode to be changed is different from the current display mode of the application program.

[0217] The second calling module 412 is used to call the update function according to the calling mode function, and call and execute the local setting function, wherein the local setting function is used to instruct to perform local persistence processing on the view object corresponding to the display mode to be changed.

[0218] In one example, if the replacement request is a replacement request related to a system of the terminal device, the apparatus provided in this embodiment further includes:

[0219] The third calling unit is used to call the system setting function according to the calling mode function, and update the display mode of the components of the system of the terminal device to the display mode to be changed according to the system setting function.

[0220] In one example, if the change request is a change request related to the system of the terminal device, the change request is any one of the following: a change request to change the display mode following the system, a change request to enter the background, a change request to switch the system mode, and a change request to indicate the display mode to be changed.

[0221] In one example, if the change request is a change request related to user customization, the change request is a change request indicating a customized display mode, or a change request indicating block information.

[0222] In one example, if the replacement request is a replacement request indicating a key value, and the replacement request includes key value information, the first calling unit 41 includes:

[0223] The third calling module 413 is used to call a key value setting function in response to a request to change the display mode of the application program.

[0224] The determination module 414 is used to determine the block information corresponding to the key value information in the replacement request according to the key value setting function, and store the block information corresponding to the key value information in the replacement request in the view recorder.

[0225] The fourth calling module 415 is used to call the update function after executing the key value setting function.

[0226] In one example, the device provided by this embodiment further includes:

[0227] The processing unit 51 is used to add a weak pointer corresponding to each view element in the view recorder, wherein the weak pointer is used to indicate the view object.

[0228] In one example, the device provided by this embodiment further includes:

[0229] The releasing unit 52 is used to release the block information in the view recorder in response to the view closing instruction.

[0230] In one example, the device provided by this embodiment further includes:

[0231] The deleting unit 53 is used to traverse each weak pointer in the view recorder in response to the view closing instruction after the releasing unit 52 releases the block information in the view recorder in response to the view closing instruction, wherein the weak pointer is used to indicate the view object; if the weak pointer is empty, the empty weak pointer is deleted.

[0232] In one example, the device provided by this embodiment further includes:

[0233] The storage unit 54 is used to store the view object indicated by the block information corresponding to the display mode to be changed in the view recorder.

[0234] In one example, the adjustment unit 44 is specifically configured to apply the view object indicated by the block information corresponding to the display mode to be changed to the interface of the application program according to the view configuration parameters.

[0235] In one example, the view object includes a view element corresponding to at least one page of the application.

[0236] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.

[0237] Fig.10 A schematic diagram of the structure of a terminal device provided in an embodiment of the present application is shown in FIG. Fig.10 As shown, the terminal device includes: a memory 71, a processor 72; the memory 71; and a memory for storing instructions executable by the processor 72.

[0238] The processor 72 is configured to execute the method provided in the above embodiment.

[0239] The terminal device further includes a receiver 73 and a transmitter 74. The receiver 73 is used to receive instructions and data sent by other devices, and the transmitter 74 is used to send instructions and data to external devices.

[0240] Fig.11 It is a block diagram of a terminal device according to an exemplary embodiment. The device may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0241] The device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0242] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0243] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0244] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0245] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0246] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0247] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0248] The sensor assembly 814 includes one or more sensors for providing various aspects of the status assessment of the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0249] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0250] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.

[0251] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of the device 800 to complete the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device. The device 800 is a terminal device.

[0252] An embodiment of the present invention also provides a non-temporary computer-readable storage medium, which enables the terminal device to execute the above method when instructions in the storage medium are executed by a processor of the terminal device.

[0253] According to an embodiment of the present application, the present application also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of a terminal device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the terminal device executes the solution provided by any of the above embodiments.

[0254] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0255] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for changing a display mode of an application, the method comprising: In response to a change request for changing the display mode of the application, calling an update function, wherein the change request is used to indicate the display mode to be changed, and the update function includes the display mode to be changed and view configuration parameters; According to the update function, the block information corresponding to the display mode to be replaced in the view recorder is retrieved, wherein the block information is used to indicate the view object corresponding to the display mode to be replaced; Calling the view object indicated by the block information corresponding to the display mode to be replaced, and passing in the view configuration parameters indicated by the update function, and adjusting the display mode of the application to the display mode to be replaced according to the view configuration parameters and the view object indicated by the block information corresponding to the display mode to be replaced; The update function also includes key value information, and the key value information is used to indicate the block information corresponding to the display mode to be changed; When the view object has a first extended attribute, the first extended attribute is used to indicate that the block information is in a binding relationship with the key value information; if the key value information is empty, the block information bound to the key value information is retrieved; When the view object has a second extended attribute, the second extended attribute is used to indicate that the block information and the key value information are in a key-value correspondence relationship; if the key value information is not empty, the block information that has a key-value correspondence relationship with the key value information is retrieved.

2. According to the method of claim 1, there is a corresponding relationship between the display mode to be changed, the view configuration parameters and the key value information in the update function.

3. According to the method of claim 1, the replacement request is any one of the following: a replacement request related to the system of the terminal device, a replacement request related to user customization, and a replacement request indicating a key value.

4. The method according to claim 3, if the change request is a change request related to the system of the terminal device, then in response to the change request for changing the display mode of the application, calling the update function comprises: In response to a request to change the display mode of the application, calling an update mode function, wherein the update mode function indicates that the display mode to be changed is different from the current display mode of the application; According to the calling mode function, the update function is called, and the local setting function is called and executed, wherein the local setting function is used to instruct to perform local persistence processing on the view object corresponding to the display mode to be changed.

5. The method according to claim 4, further comprising: According to the calling mode function, a system setting function is called, and according to the system setting function, the display mode of the components of the system of the terminal device is updated to the display mode to be changed.

6. According to the method of claim 5, if the change request is a change request related to the system of the terminal device, then the change request is any one of the following: a change request to follow the system to change the display mode, a change request to enter the background, a change request to switch the system mode, and a change request to indicate the display mode to be changed. 7 . The method according to claim 4 , if the change request is a change request related to user customization, then the change request is a change request indicating a customized display mode, or a change request indicating block information.

8. The method according to claim 4, if the change request is a change request indicating a key value, and the change request includes key value information, then in response to the change request for changing the display mode of the application, calling an update function comprises: In response to a request to change the display mode of the application program, calling a key value setting function; Determine the block information corresponding to the key value information in the replacement request according to the key value setting function, and store the block information corresponding to the key value information in the replacement request in a view recorder; After executing the key value setting function, the update function is called.

9. The method according to any one of claims 1 to 8, further comprising: A weak pointer corresponding to each view element is added to the view recorder, wherein the weak pointer is used to indicate the view object.

10. The method according to any one of claims 1 to 8, further comprising: In response to a view closing instruction, the block information in the view recorder is released.

11. The method according to claim 10, after releasing the block information in the view recorder in response to the view closing instruction, further comprises: In response to a view close instruction, traverse each weak pointer in the view recorder, wherein the weak pointer is used to indicate a view object; If the weak pointer is null, the null weak pointer is deleted.

12. The method according to any one of claims 1 to 8, further comprising: The view object indicated by the block information corresponding to the display mode to be changed is stored in the view recorder.

13. The method according to any one of claims 1 to 8, adjusting the display mode of the application to the display mode to be replaced according to the view configuration parameter and the view object indicated by the block information corresponding to the display mode to be replaced, comprising: According to the view configuration parameters, the view object indicated by the block information corresponding to the display mode to be changed is applied to the interface of the application.

14. The method according to any one of claims 1-8, wherein the view object comprises a view element corresponding to at least one page of the application.

15. A device for changing a display mode of an application, the device comprising: A first calling unit, configured to call an update function in response to a change request for changing the display mode of an application program, wherein the change request is used to indicate the display mode to be changed, and the update function includes the display mode to be changed and a view configuration parameter; A calling unit, configured to call, according to the update function, block information corresponding to the display mode to be replaced in a view recorder, wherein the block information is used to indicate a view object corresponding to the display mode to be replaced; A second calling unit, configured to call the view object indicated by the block information corresponding to the display mode to be changed, and pass in the view configuration parameters indicated by the update function; an adjusting unit, configured to adjust the display mode of the application to the display mode to be replaced according to the view configuration parameter and the view object indicated by the block information corresponding to the display mode to be replaced; The update function also includes key value information, and the key value information is used to indicate the block information corresponding to the display mode to be changed; When the view object has a first extended attribute, the first extended attribute is used to indicate that the block information is in a binding relationship with the key value information; if the key value information is empty, the block information bound to the key value information is retrieved; When the view object has a second extended attribute, the second extended attribute is used to indicate that the block information and the key value information are in a key-value correspondence relationship; if the key value information is not empty, the block information that has a key-value correspondence relationship with the key value information is retrieved.

16. A terminal device, comprising: Memory, processor; Memory; a memory for storing instructions executable by the processor; The processor is configured to execute the method according to any one of claims 1 to 14.

17. A computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, wherein the computer-executable instructions are used to implement the method according to any one of claims 1 to 14 when executed by a processor.

18. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 14.

Citation Information

Patent Citations

  • Interface displaying method and device

    CN104750479A