Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Example one
Fig. 1 is a first flowchart of a skin-replacement method provided in an embodiment of the present application, where the method may be performed by a skin-replacement apparatus or an electronic device, where the apparatus or the electronic device may be implemented by software and/or hardware, and the apparatus or the electronic device may be integrated in any intelligent device with a network communication function. As shown in fig. 1, the skin replacement method may include the steps of:
s101, acquiring a skin replacement file corresponding to the application program.
In a specific embodiment of the present application, the electronic device may obtain a skin replacement file corresponding to the application program. Specifically, the electronic device may download a skin replacement file corresponding to the application program in the server. Because each application program comprises at least one display interface, the skin replacement file corresponding to the application program comprises the skin replacement subfile corresponding to each display interface. For example, assume that an application may include N display interfaces, which are: display interface 1, display interfaces 2 and … and display interface N; wherein N is a natural number greater than or equal to 1; the skin-replacement file corresponding to the application program may include: skin replacement subfile 1, skin replacement subfiles 2 and …, and skin replacement subfile N; each display interface corresponds to a skin replacement subfile. Each skin replacement subfile may be style.
S102, determining a target layout file corresponding to the application program based on the pre-acquired original layout file corresponding to the application program and the skin replacement file corresponding to the application program.
In this step, the electronic device may determine the target layout file corresponding to the application program based on the pre-obtained original layout file corresponding to the application program and the skin replacement file corresponding to the application program. Specifically, the electronic device may extract a skin replacement subfile corresponding to each display interface from a skin replacement file corresponding to the application program; extracting original layout subfiles corresponding to each display interface from the original layout files corresponding to the application program; then determining a target layout subfile corresponding to each display interface based on the original layout subfile corresponding to each display interface and the skin replacement subfile corresponding to each display interface; and combining the target local subfiles corresponding to all the display interfaces into a target layout file corresponding to the application program. The original layout subfile corresponding to each display interface may be layout1. xml.
In a specific embodiment of the application, the electronic device may download in advance an original layout file corresponding to the application program from the server; or simultaneously downloading the original layout file and the skin replacement file corresponding to the application program in the server. Because each application program comprises at least one display interface, the original layout file corresponding to the application program comprises original layout subfiles corresponding to the display interfaces. For example, assume that an application may include N display interfaces, which are: display interface 1, display interfaces 2 and … and display interface N; wherein N is a natural number greater than or equal to 1; the original layout file corresponding to the application program may include: original layout subfile 1, original layout subfiles 2, …, original layout subfile N; each display interface corresponds to an original layout subfile.
And S103, performing skin replacement on each display interface in the application program based on the target local file corresponding to the application program.
In this step, the electronic device may perform skin replacement on each display interface in the application program based on the target local file corresponding to the application program; the target layout file corresponding to each display interface may be layout2. xml.
The skin replacing method provided by the embodiment of the application comprises the steps of firstly obtaining a skin replacing file corresponding to an application program; then, determining a target layout file corresponding to the application program based on a pre-acquired original layout file corresponding to the application program and a skin replacement file corresponding to the application program; and then, based on the target local file corresponding to the application program, carrying out skin replacement on each display interface in the application program. That is, the application can separate the layout file and the skin replacement file corresponding to the application program; the original layout file corresponding to the application program can ensure the normal use of the application program; the skin replacing file corresponding to the application program can realize the skin replacing of the application program. In the existing skin replacement method, the service code and the skin change code are uniformly configured together, so that the skin change code occupies the resource of a package file. Because the technical means that the layout file corresponding to the application program is separated from the skin replacement file is adopted, the problem that the configuration information of a plurality of sets of skins needs to be packaged into the installation file at the same time in the prior art is solved, and the size of the installation file is increased invisibly; the technical scheme provided by the application can replace the skin at any time without influencing the normal use of the application; the installation files are not occupied, resources are saved, and the operation is convenient; moreover, the technical scheme of the embodiment of the application is simple and convenient to implement, convenient to popularize and wide in application range.
Example two
Fig. 2 is a second flowchart of a skin replacement method according to an embodiment of the present application. Further optimization and expansion are performed based on the technical scheme, and the method can be combined with the various optional embodiments. As shown in fig. 2, the skin replacement method may include the steps of:
s201, obtaining a skin replacement file corresponding to the application program.
The electronic equipment can acquire a skin replacement file corresponding to the application program; the skin change file corresponding to each display interface may be style. Bcs can include the following two parts: a first type of replacement description and a second type of replacement description. For example, the first type of replacement description is ". A1"; the second type of replacement description is "# ID"; wherein ". A1" corresponds to a tag of type (class) A1; "# ID" corresponds to the view ID (viewID) being the label of A1.
Illustratively, the skin replacement file style.bcs is described as follows:
.A1{
textColor:#FFFFFF
textSize:10sp
margin-left:10dip;
margin-rught:10dip
}
#A1{
textColor:#59F1FF
textSize:25sp
margin-left:10dip
margin-rught:10dip
padding-left:10dip
}
s202, extracting skin replacement subfiles corresponding to all display interfaces from skin replacement files corresponding to application programs; and extracting the original layout subfiles corresponding to each display interface from the original layout files corresponding to the application program.
In this step, the electronic device may extract a skin replacement subfile corresponding to each display interface from the skin replacement file corresponding to the application program; extracting original layout subfiles corresponding to each display interface from the original layout files corresponding to the application program; the original layout subfile corresponding to each display interface may be layout1. xml.
Illustratively, the original layout subfile, layout1.xml, is described as follows:
s203, determining a target layout subfile corresponding to each display interface based on the original layout subfile corresponding to each display interface and the skin replacement subfile corresponding to each display interface.
In this step, the electronic device may determine a target layout subfile corresponding to each display interface based on the original layout subfile corresponding to each display interface and the skin replacement subfile corresponding to each display interface. Specifically, the electronic device may first extract the first type of replacement description content and the second type of replacement description content from the skin replacement subfile corresponding to each display interface; then, determining label description content corresponding to the first type of replacement description content and label description content corresponding to the second type of replacement description content in the original layout subfile corresponding to each display interface; and then determining the target layout subfiles corresponding to each display interface based on the first type of replacement description content and the corresponding label description content, and the second type of replacement description content and the corresponding label description content.
Furthermore, the electronic device may combine the first type of replacement description content and the second type of replacement description content with the respective corresponding tag description content, respectively, to obtain a first type of target layout description content and a second type of target layout description content; and then combining the first type of target layout description content and the second type of target layout description content into a target layout subfile corresponding to each display interface.
Illustratively, the target layout subfile, layout2.xml, is described as follows:
and S204, combining the target local subfiles corresponding to all the display interfaces into a target layout file corresponding to the application program.
In this step, the electronic device may combine the target local subfiles corresponding to all the display interfaces into a target layout file corresponding to the application program. Specifically, the electronic device may combine the target local subfiles corresponding to all the display interfaces into the target layout file corresponding to the application program according to the structure of the display tree (ViewTree) corresponding to the application program.
And S205, performing skin replacement on each display interface in the application program based on the target local file corresponding to the application program.
The skin replacing method provided by the embodiment of the application comprises the steps of firstly obtaining a skin replacing file corresponding to an application program; then, determining a target layout file corresponding to the application program based on a pre-acquired original layout file corresponding to the application program and a skin replacement file corresponding to the application program; and then, based on the target local file corresponding to the application program, carrying out skin replacement on each display interface in the application program. That is, the application can separate the layout file and the skin replacement file corresponding to the application program; the original layout file corresponding to the application program can ensure the normal use of the application program; the skin replacing file corresponding to the application program can realize the skin replacing of the application program. In the existing skin replacement method, the service code and the skin change code are uniformly configured together, so that the skin change code occupies the resource of a package file. Because the technical means that the layout file corresponding to the application program is separated from the skin replacement file is adopted, the problem that the configuration information of a plurality of sets of skins needs to be packaged into the installation file at the same time in the prior art is solved, and the size of the installation file is increased invisibly; the technical scheme provided by the application can replace the skin at any time without influencing the normal use of the application; the installation files are not occupied, resources are saved, and the operation is convenient; moreover, the technical scheme of the embodiment of the application is simple and convenient to implement, convenient to popularize and wide in application range.
EXAMPLE III
Fig. 3 is a third flowchart of a skin replacement method according to an embodiment of the present application. Further optimization and expansion are performed based on the technical scheme, and the method can be combined with the various optional embodiments. As shown in fig. 3, the skin replacement method may include the steps of:
s301, acquiring a skin replacement file corresponding to the application program.
S302, extracting skin replacement subfiles corresponding to all display interfaces from the skin replacement files corresponding to the application programs; and extracting the original layout subfiles corresponding to each display interface from the original layout files corresponding to the application program.
And S303, extracting the first type of replacement description content and the second type of replacement description content from the skin replacement subfiles corresponding to the display interfaces respectively.
In this step, the electronic device may extract the first type of replacement description content and the second type of replacement description content from the skin replacement subfile corresponding to each display interface. For example, the first type of replacement description is ". A1"; the second type of replacement description is "# ID"; wherein ". A1" corresponds to a tag of type (class) A1; "# ID" corresponds to the view ID (viewID) being the label of A1.
S304, determining label description content corresponding to the first type of replacement description content and label description content corresponding to the second type of replacement description content in the original layout subfile corresponding to each display interface.
In this step, the electronic device may determine, in the original layout subfile corresponding to each display interface, tag description content corresponding to the replacement description content of the first type and tag description content corresponding to the replacement description content of the second type. Specifically, the electronic device may first search for a first type of tag and a second type of tag in the original layout subfiles corresponding to the respective display interfaces; then, acquiring label description content corresponding to the replacement description content of the first type from the labels of the first type; and acquiring the label description content corresponding to the replacement description content of the second type from the labels of the second type. For example, the electronic device may determine sknttextview 1 and sknttextview 2 corresponding to ". A1" and sknttextview 3 corresponding to "# ID" in the original layout subfile corresponding to each display interface.
S305, determining target layout subfiles corresponding to each display interface based on the replacement description content of the first type and the label description content corresponding to the replacement description content of the first type, and the replacement description content of the second type and the label description content corresponding to the replacement description content of the second type.
In this step, the electronic device may determine the target layout subfiles corresponding to the respective display interfaces based on the replacement description content of the first type and the tag description content corresponding to the replacement description content of the first type, and based on the replacement description content of the second type and the tag description content corresponding to the replacement description content of the second type. Specifically, the electronic device may combine the first type of replacement description content and the second type of replacement description content with the corresponding tag description content, respectively, to obtain the first type of target layout description content and the second type of target layout description content; and then combining the first type of target layout description content and the second type of target layout description content into a target layout subfile corresponding to each display interface.
Furthermore, the electronic device may extract a page attribute as the current page attribute from the first type of replacement description content and the second type of replacement description content, respectively; if the current page attribute does not exist in the corresponding tag description content, the electronic device may insert the current page attribute into the corresponding tag description content; if the current page attribute exists in the corresponding label description content, the electronic equipment can replace the current page attribute with the original page attribute in the corresponding label description content; the above operations are repeatedly performed until the page attributes are extracted from the replacement description contents of the first type and the replacement description contents of the second type.
And S306, combining the target local subfiles corresponding to all the display interfaces into a target layout file corresponding to the application program.
And S307, performing skin replacement on each display interface in the application program based on the target local file corresponding to the application program.
The skin replacing method provided by the embodiment of the application comprises the steps of firstly obtaining a skin replacing file corresponding to an application program; then, determining a target layout file corresponding to the application program based on a pre-acquired original layout file corresponding to the application program and a skin replacement file corresponding to the application program; and then, based on the target local file corresponding to the application program, carrying out skin replacement on each display interface in the application program. That is, the application can separate the layout file and the skin replacement file corresponding to the application program; the original layout file corresponding to the application program can ensure the normal use of the application program; the skin replacing file corresponding to the application program can realize the skin replacing of the application program. In the existing skin replacement method, the service code and the skin change code are uniformly configured together, so that the skin change code occupies the resource of a package file. Because the technical means that the layout file corresponding to the application program is separated from the skin replacement file is adopted, the problem that the configuration information of a plurality of sets of skins needs to be packaged into the installation file at the same time in the prior art is solved, and the size of the installation file is increased invisibly; the technical scheme provided by the application can replace the skin at any time without influencing the normal use of the application; the installation files are not occupied, resources are saved, and the operation is convenient; moreover, the technical scheme of the embodiment of the application is simple and convenient to implement, convenient to popularize and wide in application range.
Example four
Fig. 4 is a schematic structural diagram of a skin replacement device provided in an embodiment of the present application. As shown in fig. 4, the apparatus 400 includes: an acquisition module 401, a determination module 402 and a replacement module 403; wherein the content of the first and second substances,
the obtaining module 401 is configured to obtain a skin replacement file corresponding to an application;
the determining module 402 is configured to determine a target layout file corresponding to the application program based on a pre-obtained original layout file corresponding to the application program and a skin replacement file corresponding to the application program;
the replacing module 403 is configured to replace skins of each display interface in the application program based on the target local file corresponding to the application program.
Fig. 5 is a schematic structural diagram of a determination module provided in an embodiment of the present application. As shown in fig. 5, the determining module 402 includes: an extraction sub-module 4021, a determination sub-module 4022 and a combination sub-module 4023; wherein the content of the first and second substances,
the extracting submodule 4021 is configured to extract a skin replacement subfile corresponding to each display interface from the skin replacement file corresponding to the application program; extracting original layout subfiles corresponding to each display interface from the original layout files corresponding to the application program;
the determining sub-module 4022 is configured to determine a target layout sub-file corresponding to each display interface based on the original layout sub-file corresponding to each display interface and the skin replacement sub-file corresponding to each display interface;
the combining sub-module 4023 is configured to combine the target local sub-files corresponding to all the display interfaces into a target layout file corresponding to the application program.
Further, the determining sub-module 4022 is specifically configured to extract a first type of replacement description content and a second type of replacement description content from the skin replacement subfile corresponding to each display interface; determining label description content corresponding to the first type of replacement description content and label description content corresponding to the second type of replacement description content in an original layout subfile corresponding to each display interface; and determining a target layout subfile corresponding to each display interface based on the first type of replacement description content and the corresponding label description content, and the second type of replacement description content and the corresponding label description content.
Further, the determining sub-module 4022 is specifically configured to combine the first type of replacement description content and the second type of replacement description content with the corresponding tag description content, respectively, to obtain the first type of target layout description content and the second type of target layout description content; and combining the first type of target layout description content and the second type of target layout description content into a target layout subfile corresponding to each display interface.
Further, the determining sub-module 4022 is specifically configured to extract a page attribute from each of the first type replacement description content and the second type replacement description content as a current page attribute; if the current page attribute does not exist in the corresponding label description content, inserting the current page attribute into the corresponding label description content; if the current page attribute exists in the corresponding label description content, replacing the current page attribute with the original page attribute in the corresponding label description content; the above operations are repeatedly executed until the page attributes are extracted from the replacement description content of the first type and the replacement description content of the second type.
Further, the determining sub-module 4022 is specifically configured to search for a first type of tag and a second type of tag in the original layout subfile corresponding to each display interface; acquiring label description content corresponding to the replacement description content of the first type from the labels of the first type; and acquiring the label description content corresponding to the replacement description content of the second type from the labels of the second type.
The skin replacement device can execute the method provided by any embodiment of the application, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not elaborated in this embodiment, reference may be made to the skin replacement method provided in any of the embodiments of the present application.
EXAMPLE five
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
Fig. 6 is a block diagram of an electronic device of a skin replacement method according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 6, the electronic apparatus includes: one or more processors 601, memory 602, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 6, one processor 601 is taken as an example.
The memory 602 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the skin replacement method provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the skin replacement method provided herein.
The memory 602, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules (e.g., the obtaining module 401, the determining module 402, and the replacing module 403 shown in fig. 4) corresponding to the skin replacing method in the embodiment of the present application. The processor 601 executes various functional applications of the server and data processing by running non-transitory software programs, instructions and modules stored in the memory 602, namely, implements the skin replacement method in the above method embodiment.
The memory 602 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the skin-replacement electronic device, and the like. Further, the memory 602 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 602 optionally includes memory located remotely from the processor 601, and these remote memories may be connected to the skin-replacement electronic device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the skin replacement method may further include: an input device 603 and an output device 604. The processor 601, the memory 602, the input device 603 and the output device 604 may be connected by a bus or other means, and fig. 6 illustrates the connection by a bus as an example.
The input device 603 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the skin-replacement electronic device, such as a touch screen, keypad, mouse, track pad, touch pad, pointer stick, one or more mouse buttons, track ball, joystick, or other input device. The output devices 604 may include a display device, auxiliary lighting devices (e.g., LEDs), and tactile feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
According to the technical scheme of the embodiment of the application, a skin replacement file corresponding to an application program is obtained firstly; then, determining a target layout file corresponding to the application program based on a pre-acquired original layout file corresponding to the application program and a skin replacement file corresponding to the application program; and then, based on the target local file corresponding to the application program, carrying out skin replacement on each display interface in the application program. That is, the application can separate the layout file and the skin replacement file corresponding to the application program; the original layout file corresponding to the application program can ensure the normal use of the application program; the skin replacing file corresponding to the application program can realize the skin replacing of the application program. In the existing skin replacement method, the service code and the skin change code are uniformly configured together, so that the skin change code occupies the resource of a package file. Because the technical means that the layout file corresponding to the application program is separated from the skin replacement file is adopted, the problem that the configuration information of a plurality of sets of skins needs to be packaged into the installation file at the same time in the prior art is solved, and the size of the installation file is increased invisibly; the technical scheme provided by the application can replace the skin at any time without influencing the normal use of the application; the installation files are not occupied, resources are saved, and the operation is convenient; moreover, the technical scheme of the embodiment of the application is simple and convenient to implement, convenient to popularize and wide in application range.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, and the present invention is not limited herein.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.