Detailed Description
Exemplary embodiments of the present application will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present application are included to facilitate understanding, and are to be considered merely exemplary. 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 application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Example 1
Fig. 1 is a schematic flow chart of a skin replacement method according to an embodiment of the present application, where the method may be performed by a skin replacement apparatus or an electronic device, and the apparatus or the electronic device may be implemented by software and/or hardware, and the apparatus or the electronic device may be integrated into any intelligent device having 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 an 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 the 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 skin replacement subfiles corresponding to the display interfaces. For example, assume that a certain application program may include N display interfaces, respectively: display interface 1, display interfaces 2, …, 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, …, 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 an original layout file corresponding to the application program and a skin replacement file corresponding to the application program, which are acquired in advance.
In this step, the electronic device may determine the target layout file corresponding to the application program based on the original layout file corresponding to the application program and the skin replacement file corresponding to the application program, which are acquired in advance. Specifically, the electronic device may extract skin replacement subfiles corresponding to each display interface from skin replacement files corresponding to the application program; extracting original layout subfiles corresponding to each display interface from original layout files corresponding to the application programs; 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 all the target local subfiles corresponding to 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 present application, the electronic device may download in advance in a server to obtain an original layout file corresponding to the application program; the original layout file and the skin replacement file corresponding to the application program can be downloaded in the server at the same time. Because each application program comprises at least one display interface, the original layout file corresponding to the application program comprises the original layout subfiles corresponding to the display interfaces. For example, assume that a certain application program may include N display interfaces, respectively: display interface 1, display interfaces 2, …, 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.
S103, based on the target local file corresponding to the application program, performing skin replacement on each display interface in 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 replacement method provided by the embodiment of the application comprises the steps of firstly obtaining a skin replacement file corresponding to an application program; then, determining a target layout file corresponding to the application program based on the original layout file corresponding to the application program and the skin replacement file corresponding to the application program, which are obtained in advance; and then, based on the target local file corresponding to the application program, performing skin replacement on each display interface in the application program. That is, the present 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 replacement file corresponding to the application program can realize the skin replacement of the application program. In the existing skin replacement method, the service code and the skin replacement code are uniformly configured together, so that the skin replacement code occupies the resources of the packaged file. Because the application adopts the technical means that the layout file and the skin replacement file corresponding to the application program are separated, the problem that in the prior art, a plurality of sets of skin configuration information are required to be packaged into the installation file at the same time is solved, and the size of the installation file is increased intangibly; the technical scheme provided by the application can replace the skin at any time without affecting the normal use of the application program; the installation files are not occupied, the resources are saved, and the operation is convenient; in addition, the technical scheme of the embodiment of the application is simple and convenient to realize, convenient to popularize and wider in application range.
Example two
Fig. 2 is a schematic diagram of a second flow chart of a skin replacement method according to an embodiment of the present application. Further optimization and expansion based on the above technical solution can be combined with the above various alternative embodiments. As shown in fig. 2, the skin replacement method may include the steps of:
S201, acquiring a skin replacement file corresponding to an application program.
The electronic equipment can acquire a skin replacement file corresponding to the application program; the skin replacement file corresponding to each display interface may be style. Each style.bcs may 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 a tag whose view ID (viewID) is 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 the display interfaces from the original layout files corresponding to the application programs.
In this step, the electronic device may extract skin replacement subfiles corresponding to each display interface from skin replacement files corresponding to the application program; extracting original layout subfiles corresponding to each display interface from original layout files corresponding to the application programs; 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 target layout subfiles corresponding to all display interfaces based on the original layout subfiles corresponding to all display interfaces and the skin replacement subfiles corresponding to all display interfaces.
In this step, the electronic device may determine the 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 extract, first, a first type of replacement description content and a second type of replacement description content from skin replacement subfiles corresponding to respective display interfaces; then, determining tag description contents corresponding to the first type of replacement description contents and tag description contents corresponding to the second type of replacement description contents in original layout subfiles corresponding to the display interfaces; and determining the target layout subfiles corresponding to the display interfaces based on the first type of replacement description content and the tag description content corresponding to the first type of replacement description content, and the second type of replacement description content and the tag description content corresponding to the second type of replacement description content.
Further, the electronic device may combine the first type of replacement description content and the second type of replacement description content with the tag description content respectively, to obtain a first type of target layout description content and a 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 target layout subfiles corresponding to the display interfaces.
Illustratively, the target layout subfile layout2.Xml is described as follows:
s204, combining all the target local subfiles corresponding to the display interfaces into a target layout file corresponding to the application program.
In this step, the electronic device may combine all the target local subfiles corresponding to the display interface into the target layout file corresponding to the application program. Specifically, the electronic device may combine, according to the structure (ViewTree) of the display tree corresponding to the application program, all the target local subfiles corresponding to the display interface into the target layout file corresponding to the application program.
S205, based on the target local file corresponding to the application program, performing skin replacement on each display interface in the application program.
The skin replacement method provided by the embodiment of the application comprises the steps of firstly obtaining a skin replacement file corresponding to an application program; then, determining a target layout file corresponding to the application program based on the original layout file corresponding to the application program and the skin replacement file corresponding to the application program, which are obtained in advance; and then, based on the target local file corresponding to the application program, performing skin replacement on each display interface in the application program. That is, the present 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 replacement file corresponding to the application program can realize the skin replacement of the application program. In the existing skin replacement method, the service code and the skin replacement code are uniformly configured together, so that the skin replacement code occupies the resources of the packaged file. Because the application adopts the technical means that the layout file and the skin replacement file corresponding to the application program are separated, the problem that in the prior art, a plurality of sets of skin configuration information are required to be packaged into the installation file at the same time is solved, and the size of the installation file is increased intangibly; the technical scheme provided by the application can replace the skin at any time without affecting the normal use of the application program; the installation files are not occupied, the resources are saved, and the operation is convenient; in addition, the technical scheme of the embodiment of the application is simple and convenient to realize, convenient to popularize and wider in application range.
Example III
Fig. 3 is a schematic view of a third flow chart of a skin replacement method according to an embodiment of the present application. Further optimization and expansion based on the above technical solution can be combined with the above various alternative embodiments. As shown in fig. 3, the skin replacement method may include the steps of:
s301, acquiring a skin replacement file corresponding to an application program.
S302, 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 the display interfaces from the original layout files corresponding to the application programs.
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 subfiles corresponding to the respective display interfaces. 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 a tag whose view ID (viewID) is A1.
S304, determining the tag description content corresponding to the first type of replacement description content and the tag description content corresponding to the second type of replacement description content in the original layout subfiles corresponding to the display interfaces.
In this step, the electronic device may determine, in the original layout subfiles corresponding to the respective display interfaces, tag description contents corresponding to the first type of replacement description contents and tag description contents corresponding to the second type of replacement description contents. Specifically, the electronic device may first search for the first type of tag and the second type of tag in the original layout subfiles corresponding to the respective display interfaces; then, acquiring tag description contents corresponding to the first type of replacement description contents from the first type of tags; and acquiring the tag description content corresponding to the second type of replacement description content from the second type of tag. For example, the electronic device may determine SknTextView and SknTextView corresponding to ". A1" and SknTextView3 corresponding to "# ID" in the original layout subfiles corresponding to the respective display interfaces.
S305, determining a target layout subfile corresponding to each display interface based on the first type of replacement description content and the tag description content corresponding to the first type of replacement description content, and the second type of replacement description content and the tag description content corresponding to the second type of replacement description content.
In this step, the electronic device may determine the target layout subfiles corresponding to the respective display interfaces based on the first type of replacement description content and the tag description content corresponding to the first type of replacement description content, and the second type of replacement description content and the tag description content corresponding to the second type of replacement description content. Specifically, 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 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 target layout subfiles corresponding to the display interfaces.
Further, the electronic device may first extract a page attribute from the first type of replacement description content and the second type of replacement description content as a current page attribute, respectively; if the current page attribute does not exist in the corresponding tag description content, the electronic equipment can insert the current page attribute into the corresponding tag description content; if the current page attribute exists in the corresponding tag description content, the electronic equipment can replace the original page attribute in the corresponding tag description content with the current page attribute; the above operations are repeatedly performed until each page attribute is extracted in the first type of replacement description contents and the second type of replacement description contents.
S306, combining all the target local subfiles corresponding to the display interfaces into a target layout file corresponding to the application program.
S307, based on the target local file corresponding to the application program, performing skin replacement on each display interface in the application program.
The skin replacement method provided by the embodiment of the application comprises the steps of firstly obtaining a skin replacement file corresponding to an application program; then, determining a target layout file corresponding to the application program based on the original layout file corresponding to the application program and the skin replacement file corresponding to the application program, which are obtained in advance; and then, based on the target local file corresponding to the application program, performing skin replacement on each display interface in the application program. That is, the present 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 replacement file corresponding to the application program can realize the skin replacement of the application program. In the existing skin replacement method, the service code and the skin replacement code are uniformly configured together, so that the skin replacement code occupies the resources of the packaged file. Because the application adopts the technical means that the layout file and the skin replacement file corresponding to the application program are separated, the problem that in the prior art, a plurality of sets of skin configuration information are required to be packaged into the installation file at the same time is solved, and the size of the installation file is increased intangibly; the technical scheme provided by the application can replace the skin at any time without affecting the normal use of the application program; the installation files are not occupied, the resources are saved, and the operation is convenient; in addition, the technical scheme of the embodiment of the application is simple and convenient to realize, convenient to popularize and wider in application range.
Example IV
Fig. 4 is a schematic structural view of a skin replacement device according to 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 acquiring module 401 is configured to acquire a skin replacement file corresponding to an application program;
The determining module 402 is configured to determine a target layout file corresponding to the application program based on the original layout file corresponding to the application program and the skin replacement file corresponding to the application program, which are acquired in advance;
The replacing module 403 is configured to replace skin 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 determining module according to an embodiment of the present application. As shown in fig. 5, the determining module 402 includes: extracting the submodule 4021, determining the submodule 4022 and combining the submodule 4023; wherein,
The extracting sub-module 4021 is configured to extract skin replacement sub-files corresponding to each display interface from skin replacement files corresponding to the application program; extracting original layout subfiles corresponding to each display interface from the original layout files corresponding to the application programs;
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 combination sub-module 4023 is configured to combine all target local sub-files corresponding to the display interfaces into a target layout file corresponding to the application program.
Further, the determining submodule 4022 is specifically configured to extract, in the skin replacement subfiles corresponding to the display interfaces, a first type of replacement description content and a second type of replacement description content respectively; determining tag description contents corresponding to the first type of replacement description contents and tag description contents corresponding to the second type of replacement description contents in original layout subfiles corresponding to the display interfaces; and determining the target layout subfiles corresponding to the display interfaces based on the first type of replacement description contents and the tag description contents corresponding to the first type of replacement description contents, and the second type of replacement description contents and the tag description contents corresponding to the second type of replacement description contents.
Further, the determining submodule 4022 is specifically configured to combine the first type of replacement description content and the second type of replacement description content with respective corresponding tag description contents to obtain the first type of target layout description content and the second type of target layout description content; and combining the target layout description content of the first type and the target layout description content of the second type into target layout subfiles corresponding to all display interfaces.
Further, the determining submodule 4022 is specifically configured to extract a page attribute from the first type of replacement description content and the second type of replacement description content as a current page attribute respectively; if the current page attribute does not exist in the corresponding tag description content, inserting the current page attribute into the corresponding tag description content; if the current page attribute exists in the corresponding tag description content, replacing the original page attribute in the corresponding tag description content with the current page attribute; the above operations are repeatedly performed until each page attribute is extracted in the first type of replacement description content and the second type of replacement description content.
Further, the determining submodule 4022 is specifically configured to search the first type of tag and the second type of tag in the original layout subfiles corresponding to the display interfaces respectively; acquiring tag description contents corresponding to the first type of replacement description contents from the first type of tags; and acquiring the tag description content corresponding to the second type of replacement description content from the second type of tag.
The skin replacement device can execute the method provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail in this embodiment can be seen in the skin replacement method provided in any embodiment 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.
As shown in fig. 6, a block diagram of an electronic device according to 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 telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the applications described and/or claimed herein.
As shown in fig. 6, the electronic device includes: one or more processors 601, memory 602, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. 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 executing within the electronic device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple electronic devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 601 is illustrated in fig. 6.
The memory 602 is a non-transitory computer readable storage medium provided by the present application. Wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the skin replacement method provided by the present application. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to execute the skin replacement method provided by the present application.
The memory 602 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules (e.g., the acquisition module 401, the determination module 402, and the replacement module 403 shown in fig. 4) corresponding to the skin replacement method according to the embodiment of the present application. The processor 601 performs various functional applications of the server and data processing, i.e., implements the skin replacement method in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 602.
The memory 602 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for a function; the storage data area may store data created from the use of the skin-changed electronic device, etc. In addition, 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, memory 602 optionally includes memory remotely located relative to processor 601, which 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, memory 602, input device 603 and output device 604 may be connected by a bus or otherwise, for example in fig. 6.
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-changed electronic device, such as a touch screen, keypad, mouse, trackpad, touchpad, pointer stick, one or more mouse buttons, trackball, joystick, and like input devices. The output means 604 may include a display device, auxiliary lighting means (e.g., LEDs), tactile feedback means (e.g., vibration motors), and the like. 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 may be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASIC (application specific integrated circuit), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
These computing programs (also referred to as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented in a high-level procedural and/or object-oriented programming language, and/or in assembly/machine language. 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 pointing device (e.g., a mouse or 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 may 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 input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background 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 background, 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 a client and a server. The client and server are typically 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 hosts and VPS service are overcome.
According to the technical scheme of the embodiment of the application, firstly, skin replacement files corresponding to application programs are acquired; then, determining a target layout file corresponding to the application program based on the original layout file corresponding to the application program and the skin replacement file corresponding to the application program, which are obtained in advance; and then, based on the target local file corresponding to the application program, performing skin replacement on each display interface in the application program. That is, the present 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 replacement file corresponding to the application program can realize the skin replacement of the application program. In the existing skin replacement method, the service code and the skin replacement code are uniformly configured together, so that the skin replacement code occupies the resources of the packaged file. Because the application adopts the technical means that the layout file and the skin replacement file corresponding to the application program are separated, the problem that in the prior art, a plurality of sets of skin configuration information are required to be packaged into the installation file at the same time is solved, and the size of the installation file is increased intangibly; the technical scheme provided by the application can replace the skin at any time without affecting the normal use of the application program; the installation files are not occupied, the resources are saved, and the operation is convenient; in addition, the technical scheme of the embodiment of the application is simple and convenient to realize, convenient to popularize and wider in application range.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution disclosed in the present application can be achieved, and are not limited herein.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.