CN108874495A - Theme resource conversion method and device and electronic equipment - Google Patents
Theme resource conversion method and device and electronic equipment Download PDFInfo
- Publication number
- CN108874495A CN108874495A CN201810666638.7A CN201810666638A CN108874495A CN 108874495 A CN108874495 A CN 108874495A CN 201810666638 A CN201810666638 A CN 201810666638A CN 108874495 A CN108874495 A CN 108874495A
- Authority
- CN
- China
- Prior art keywords
- picture
- array
- resource
- theme
- directory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 74
- 238000006243 chemical reaction Methods 0.000 title claims abstract description 52
- 238000012545 processing Methods 0.000 claims description 8
- 230000006835 compression Effects 0.000 claims description 2
- 238000007906 compression Methods 0.000 claims description 2
- 230000007547 defect Effects 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 14
- 230000000694 effects Effects 0.000 description 10
- 238000004590 computer program Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000009466 transformation Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 3
- 238000003491 array Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012216 screening Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/02—Input arrangements using manually operated switches, e.g. using keyboards or dials
- G06F3/023—Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes
- G06F3/0233—Character input methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention discloses a theme resource conversion method, a theme resource conversion device and electronic equipment, relates to the technical field of mobile phones, and can make up for the defect that the existing original input method of an iOS system cannot switch themes. The theme resource conversion method comprises the following steps: acquiring first theme resource information; the first theme resource comprises an original picture; constructing a picture catalog for storing the target picture under the second theme resource catalog; the original picture is redrawn or directly copied to the picture directory by comparing the size of the original picture with the size of the target picture; and generating a plist file corresponding to the converted theme resource under the second theme resource catalog. The method is particularly suitable for converting android resources into iOS resources.
Description
Technical Field
The invention belongs to the technical field of mobile phones, and particularly relates to a theme resource conversion method and device and electronic equipment.
Background
With the rapid development of mobile phone technology, different mobile phone manufacturers have their own unique operating systems. Due to the difference of different operating systems, theme resources developed by two different operating system platforms cannot be commonly used, so that if one set of input method theme needs to be used in different operating systems, special design needs to be performed for a plurality of systems. When the input method APP supports double ends, a large number of first input method themes cannot be adapted to the second operating system platform. Therefore, the existing input method can not be developed to fully utilize the existing resources. Currently, for the most widely used Android (Android) and apple (iOS) systems, the theme designed by the same designer cannot be adapted to the two system platforms at the same time, and the third-party input method cannot freely switch themes.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for theme resource conversion, and an electronic device, which can solve the problem that theme resources of an existing input method cannot be adapted to different operating systems at the same time.
In a first aspect, an embodiment of the present invention provides a theme resource conversion method, including:
acquiring first theme resource information; the first theme resource comprises an original picture;
constructing a picture catalog for storing the target picture under the second theme resource catalog;
the original picture is redrawn or directly copied to the picture directory by comparing the size of the original picture with the preset size of the target picture;
and generating a plist file corresponding to the converted theme resource under the second theme resource catalog.
With reference to the first aspect, in a first implementation manner of the first aspect, after the generating a plist file corresponding to the currently converted topic resource in the second topic resource directory, the method further includes:
and compressing and storing the second theme resource directory.
With reference to the first aspect, in a second implementation manner of the first aspect, the obtaining the first topic resource information includes:
acquiring an application identifier of a first subject resource;
according to the application identification of the first theme resource, inquiring a storage path of an original picture in a database in which the first theme resource is stored;
generating a first array for storing original picture information; the data structure of the first array is the file name of the original picture and the corresponding original picture storage path.
With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, after constructing a picture directory for storing target pictures under the second theme resource directory, the method further includes:
establishing a second array for storing target picture information required by the second theme resource in a default sample resource folder of the second theme resource;
the data structure of the second array is a preset target picture file name and a corresponding target picture size;
the method for redrawing or directly copying the original picture to the picture directory by comparing the size of the original picture with the preset size of the target picture comprises the following steps:
circularly traversing the first array, and calculating the size of each original picture recorded in the first array;
judging whether the original picture size corresponding to the same picture file name in the second array and the first array is consistent with a preset target picture size or not;
if the original image size corresponding to the same image file name is consistent with the target image size, directly copying the original image to the image directory;
and if the size of the original picture corresponding to the same picture file name is not consistent with the size of the target picture, redrawing the original picture and then storing the original picture in the picture directory.
With reference to the third implementation manner of the first aspect, in a fourth implementation manner of the first aspect, the picture directory includes a double picture directory for storing double pictures of the target picture and a triple picture directory for storing triple pictures of the target picture;
the establishing of the second array for storing the target picture information required by the second theme resource in the default sample resource folder of the second theme resource further includes:
establishing a third array and a fifth array for storing double-fold picture information and establishing a fourth array and a sixth array for storing triple-fold picture information in a default sample resource folder of the second theme resource; the data structure of the third/fourth array is the file name of the original picture, the name of the corresponding target picture and the size of the target picture; the data structure of the fifth/sixth array is the original image file name and the corresponding original image storage path, the target image name and the target image size;
if the original picture size corresponding to the same picture file name is not consistent with the target picture size, redrawing the original picture and then storing the original picture in the picture directory, wherein the method comprises the following steps of:
copying picture information of which the target picture size in the second array is inconsistent with the original picture size corresponding to the same picture file name in the first array into the third array and the fourth array;
judging whether the picture file names in the third array and the fourth array can be matched in the first array or not;
if the picture file names in the third array and the fourth array can be matched in the first array, judging whether the currently matched picture file name contains a preset character pattern in a corresponding file suffix name in the database according to a storage path recorded by the first array;
if the currently matched picture file name contains a preset typeface in the corresponding file suffix name in the database, setting a first attribute for the same picture file name in the third array and the fourth array; if the currently matched picture file name does not contain a preset typeface in the corresponding file suffix name in the database, setting a second attribute for the same picture file name in the third array and the fourth array;
copying picture information with a first attribute/a second attribute in a third array into a fifth array, and copying an original picture storage path corresponding to the same picture name in the first array into a corresponding record in the fifth array; copying picture information with a first attribute/a second attribute in a fourth array into a sixth array, and copying an original picture storage path corresponding to the same picture name in the first array into a corresponding record in a fifth array;
redrawing the original pictures recorded in the fifth array and the sixth array according to a preset drawing strategy;
storing a new picture generated according to the original picture recorded in the fifth array into the double-picture directory, and storing a new picture generated according to the original picture recorded in the sixth array into the triple-picture directory; and adding the predetermined typeface to the corresponding new picture suffix name of the picture file name with the first attribute in the fifth array and the sixth array during storage.
With reference to the fourth implementation manner of the first aspect, in a fifth implementation manner of the first aspect, the generating a plist file corresponding to the currently converted topic resource in the second topic resource directory includes:
setting a plist folder for generating a second theme resource under the second theme resource directory;
presetting plist file information of a third attribute of the target picture and storing the plist file information into a preset seventh array;
taking out a default plist file related to a third attribute of a second theme resource picture from the default sample resource folder of the second theme resource, wherein the data structures of the eighth array and the ninth array are plist file names and parameter values in corresponding files;
respectively writing default plist file information of currently taken third attributes of the double-fold picture and the triple-fold picture of the second subject resource picture into a preset eighth array and a preset ninth array; the data structures of the eighth array and the ninth array are plist file names and parameter values in corresponding files;
circularly traversing the seventh array, and judging whether the plist file name in the seventh array can be matched in the eighth array or the ninth array;
if the plist file name in the seventh array can be matched in the eighth array or the ninth array, judging whether the parameter value in the file corresponding to the currently matched plist file name is consistent with the parameter value in the same plist file in the plist folder under the first subject resource directory;
if the parameter value of the currently matched file corresponding to the plist filename is consistent with the parameter value of the same plist file in the plist folder under the first subject resource directory, copying the file corresponding to the same plist filename in the default sample resource folder of the second subject resource into the plist folder under the second subject resource directory;
if the parameter value in the file corresponding to the currently matched plist file name is not consistent with the parameter value in the same plist file in the plist folder under the first subject resource directory, replacing the parameter value in the file corresponding to the same plist file name in the default sample resource folder of the second subject resource with the parameter value in the file corresponding to the same plist file name in the plist folder under the first subject resource directory, and then storing the file into the plist folder under the second resource directory.
With reference to any implementation manner of the first aspect to the fifth aspect, in a sixth implementation manner of the first aspect, after the obtaining the first topic resource information, the method further includes:
judging whether audio resources exist in a sound folder under the first theme resource directory;
if the sound folder under the first theme resource directory contains audio resources, copying the audio resources in the sound folder under the first theme resource directory into the sound folder under the second theme resource directory;
and if no audio resource exists in the sound folder under the first theme resource directory, copying the audio resource in the default audio folder of the second theme resource into the sound folder under the second theme resource directory.
With reference to the first aspect to any one of the fifth implementation manners of the first aspect, in a seventh implementation manner of the first aspect, the first theme resource is an Android theme resource, and the second theme resource is an apple iOS theme resource.
In a second aspect, an embodiment of the present invention provides a theme resource conversion apparatus, including:
the acquisition module is used for acquiring first theme resource information; the first theme resource comprises an original picture;
the configuration module is used for constructing a picture catalogue for storing the target picture under the second theme resource catalogue;
the picture processing module is used for redrawing the original picture or directly copying the original picture to the picture directory by comparing the size of the original picture with the preset target picture size;
and the file generation module is used for generating a plist file corresponding to the converted theme resource under the second theme resource catalog.
With reference to the second aspect, in a first implementation manner of the second aspect, the theme resource conversion apparatus further includes:
and the compression module is used for compressing and storing the second theme resource directory.
With reference to the second aspect, in a second implementation manner of the second aspect, the obtaining module includes:
the identification obtaining submodule is used for obtaining an application identification of the first theme resource;
the first query submodule is used for querying a storage path of the original picture in a database in which the first theme resource is stored according to the application identifier of the first theme resource;
the first generation submodule is used for generating a first array for storing original picture information; the data structure of the first array is the file name of the original picture and the corresponding original picture storage path.
With reference to the second implementation manner of the second aspect, in a third implementation manner of the first aspect, the theme resource conversion apparatus further includes: the array establishing module is used for establishing a second array for storing the target picture information required by the second theme resource in the default sample resource folder of the second theme resource; the data structure of the second array is a preset target picture file name and a corresponding target picture size;
the picture processing module comprises:
the calculation submodule is used for circularly traversing the first array generated by the first generation submodule and calculating the size of each original picture recorded in the first array;
the first judgment sub-module is used for judging whether the original picture size corresponding to the same picture file name in the second array and the first array is consistent with a preset target picture size or not;
the first copying submodule is used for directly copying the currently judged original picture to the picture directory according to the picture multiple when the judgment result of the first judging submodule is yes;
and the drawing sub-module is used for re-drawing the currently judged original picture and then storing the original picture into the picture directory according to the picture multiple when the judgment result of the first judgment sub-module is negative.
With reference to the third implementation manner of the second aspect, in a fourth implementation manner of the second aspect, the picture directory configured by the configuration module includes a double picture directory for storing double pictures of the target picture and a triple picture directory for storing triple pictures of the target picture;
the array establishing module is further used for establishing a third array and a fifth array for storing double-fold picture information in a default sample resource folder of the second theme resource, and establishing a fourth array and a sixth array for storing triple-fold picture information; the data structure of the third/fourth array is the file name of the original picture, the name of the corresponding target picture and the size of the target picture; the data structure of the fifth/sixth array is the original image file name and the corresponding original image storage path, the target image name and the target image size;
the drawing submodule comprises:
the first copying unit is used for copying picture information of which the target picture size in the second array is inconsistent with the original picture size corresponding to the same picture file name in the first array into the third array and the fourth array;
the first judging unit is used for judging whether the picture file names in the third array and the fourth array can be matched in the first array or not;
the second judging unit is used for judging whether the picture file name currently matched by the first judging unit contains a preset character pattern in the corresponding file suffix name in the database according to the storage path recorded by the first array when the judging result of the first judging unit is yes;
the attribute setting unit is used for setting a first attribute for the same picture file name in the third array and the fourth array when the judgment result of the second judging unit is yes;
when the judgment result of the second judgment unit is negative, setting a second attribute for the same picture file name in the third array and the fourth array;
the second copying unit is used for copying the picture information with the first attribute/the second attribute in the third array into a fifth array and copying an original picture storage path corresponding to the same picture name in the first array into a corresponding record in the fifth array;
copying picture information with a first attribute/a second attribute in a fourth array into a sixth array, and copying an original picture storage path corresponding to the same picture name in the first array into a corresponding record in a fifth array;
the drawing unit is used for redrawing the original pictures recorded in the fifth array and the sixth array according to a preset drawing strategy;
the storage unit is used for storing a new picture generated by the drawing unit according to the original picture recorded in the fifth array into the double-picture directory and storing a new picture generated by the drawing unit according to the original picture recorded in the sixth array into the triple-picture directory; and adding a preset typeface to the picture file name with the first attribute in the fifth array and the sixth array when the picture file name is stored, wherein the preset typeface is added to the corresponding new picture suffix name.
With reference to the fourth implementation manner of the second aspect, in a fifth implementation manner of the second aspect, the file generation module includes:
the second generation submodule is used for setting a plist folder for generating a second theme resource in the second theme resource directory;
the first writing sub-module is used for presetting plist file information of a third attribute of the target picture and storing the plist file information into a preset seventh array;
the reading sub-module is used for taking out a default plist file related to a third attribute of a second subject resource picture from a default sample resource folder of the second subject resource, and the second subject resource picture comprises a double picture and a triple picture;
the second writing sub-module is used for writing the default plist file information of the currently taken third attribute of the double-fold picture and the triple-fold picture related to the second subject resource picture into a preset eighth array and a preset ninth array respectively; the data structures of the eighth array and the ninth array are plist file names and parameter values in corresponding files;
the second judgment submodule is used for circularly traversing the seventh array and judging whether the plist file name in the seventh array can be matched in the eighth array or the ninth array;
a third judging submodule, configured to, when a judgment result of the second judging submodule is yes, judge whether a parameter value in a file corresponding to a currently matched plist filename is consistent with a parameter value in the same plist file in a plist folder under the first subject resource directory;
a second copying submodule, configured to copy, when a determination result of the third determining submodule is yes, a file corresponding to the same plist filename in a default sample resource folder of the second subject resource to a plist folder in the second subject resource directory;
and the replacing sub-module is used for replacing the parameter value in the file corresponding to the same plist filename in the plist folder under the first subject resource directory with the parameter value in the file corresponding to the same plist filename in the plist folder under the second resource directory when the judgment result of the third judging sub-module is negative, and then storing the file into the plist folder under the second resource directory.
With reference to any one implementation manner of the second aspect to the fifth implementation manner of the second aspect, in a sixth implementation manner of the second aspect, the theme resource conversion apparatus further includes:
the audio judgment module is used for judging whether audio resources exist in the sound folder under the first theme resource directory;
the audio copying module is used for copying the audio resources in the sound folder under the first theme resource directory into the sound folder under the second theme resource directory when the judgment result of the audio judging module is yes; and the audio resource management module is further configured to copy the audio resource in the default audio folder of the second theme resource to the sound folder in the second theme resource directory if the judgment result of the audio judgment module is negative.
With reference to the second aspect to any one of the fifth implementation manners of the second aspect, in a seventh implementation manner of the second aspect, the first theme resource is an Android theme resource, and the second theme resource is an apple iOS theme resource.
In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes: the device comprises a shell, a processor, a memory, a circuit board and a power circuit, wherein the circuit board is arranged in a space enclosed by the shell, and the processor and the memory are arranged on the circuit board; the power supply circuit is used for supplying power to each circuit or device of the client; the memory is used for storing executable program codes; the processor executes a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the theme resource conversion method described in any one of the foregoing embodiments.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, or the computer program implements the steps of the theme resource conversion method described in any of the foregoing embodiments.
According to the theme resource conversion method, the device and the electronic equipment, the first theme picture resource is obtained, the double-picture directory and the triple-picture directory for storing the target picture are constructed in the second theme resource directory and are copied, the size of the original picture is compared with the size of the target picture, the original picture with the size consistent with that of the target picture is directly copied into the double-picture directory/triple-picture directory in the second theme resource directory, on one hand, the existing first theme resource can be fully utilized, and on the other hand, the original picture with the size inconsistent with that of the target picture is redrawn and converted into the second theme picture resource. The invention solves the technical difficulty that the same set of input method theme can not be adapted to two resource platforms, greatly saves the theme making time, improves the working efficiency of developers, enables a third-party input method to make up the defect that the iOS native input method can not switch themes, and meets the requirements of iOS users on personalized themes.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a theme resource conversion method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart illustrating the process of acquiring the first topic resource information according to the embodiment of the present invention;
FIG. 3 is a flowchart of an implementation of step 103 in FIG. 1;
FIG. 4 is a flowchart illustrating an implementation of step 304 of FIG. 3;
FIG. 5 is a flowchart illustrating an implementation of step 104 in FIG. 1;
FIG. 6 is a schematic structural diagram of a theme resource converting apparatus according to a first embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a second embodiment of a resource transformation apparatus according to the present invention;
FIG. 8 is a schematic structural diagram of a third embodiment of a resource transformation device according to the present invention;
FIG. 9 is a schematic structural diagram of a fourth embodiment of a resource transformation device according to the present invention;
FIG. 10 is a schematic structural diagram of a resource converting apparatus according to a fifth embodiment of the present invention;
FIG. 11 is a schematic structural diagram of a resource transformation apparatus according to a sixth embodiment of the present invention;
fig. 12 is a schematic structural diagram of an embodiment of an electronic device according to the present invention.
Detailed Description
A theme resource conversion scheme according to an embodiment of the present invention is described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a theme resource conversion method according to an embodiment of the present invention, and as shown in fig. 1, the method according to the embodiment may include:
step 101, acquiring first theme resource information; wherein the first theme resource comprises an original picture.
In the invention, in order to conveniently distinguish the difference of resource classification before and after conversion, the theme resource before conversion is called a first theme resource, and the resource after conversion is called a second theme resource.
In this step, as an optional embodiment, fig. 2 is a schematic flow chart of acquiring the first topic resource information in the embodiment of the present invention. Referring to fig. 2, the process includes:
step 201, obtaining an application identifier of a first theme resource.
Step 202, according to the application identifier of the first theme resource, querying a storage path of the original picture in a database in which the first theme resource is stored.
In this embodiment, a database of a theme resource management platform (server) for performing unified management of theme resource storage, conversion, and the like may store a plurality of theme resources, and the various theme resources are distinguished from each other by application identifiers (such as input method (tid) identifiers), and a path of a first theme resource stored in the server is queried in the database according to the tid identifier. For convenience of description, the picture in the first subject resource in the database is referred to as an original picture.
Step 203, a first array for storing original picture information is generated.
The data structure of the first array is an original image file name and a corresponding original image storage path.
In this embodiment, a storage path of an original picture of the first theme resource is searched in the database according to the tid identifier, and the storage path of the original picture is stored in the first array, where the file name of the original picture and the storage path of the original picture are stored in the first array and are in a one-to-one correspondence relationship, that is, one picture name corresponds to one picture link.
And 102, constructing a picture catalog for storing the target picture under the second theme resource catalog.
In this embodiment, for convenience of description, the original image conversion result (second theme image resource) is referred to as a target image.
And 103, redrawing the original picture or directly copying the original picture to the picture directory by comparing the size of the original picture with the preset target picture size.
In this embodiment, the size required by the target picture is preset or automatically generated according to the theme resource conversion request, and the original picture size in the first theme resource is compared with the preset (required) target picture size, that is: comparing the width and height of the original picture corresponding to the same picture name with the width and height of the target picture, if the width and height of the original picture and the target picture are equal, representing that the picture in the first theme resource can be applicable to the second theme resource, and directly copying the picture to a picture catalog in a second theme resource catalog; if the original picture and the target picture are not equal in width and height, the original picture needs to be redrawn, so that the picture can be used as a second theme resource after the size of the original picture is converted into the size of the target picture.
And step 104, generating a plist file corresponding to the converted theme resource under the second theme resource catalog.
The Hypertext Preprocessor (PHP) may be configured to generate a plist file corresponding to the currently converted theme resource in the second theme resource directory.
In the embodiment, the original image size and the target image size are compared after the image directory for storing the target image is established in the second theme resource directory by acquiring the first theme image resource, the original image with the size consistent with that of the target image is directly copied into the image directory in the second theme resource directory, the existing first theme resource is fully utilized, the original image with the size inconsistent with that of the target image is redrawn and converted into the second image resource, the technical problem that the same set of input method theme cannot be adapted to two resource platforms is solved, the theme making time is greatly saved, the working efficiency of developers is improved, the third input method can make up the defect that the iOS native input method cannot switch themes, and the requirement of an iOS user on the personalized theme is met.
In this embodiment of the present invention, as an optional embodiment, after generating a plist file corresponding to the currently converted theme resource in the second theme resource directory, the method may further include: and compressing the second theme resource directory and storing the compressed second theme resource directory to a specified position, for example, storing the compressed second theme resource directory in a database used by the current server for storing theme resources or other backup databases.
In this embodiment of the present invention, as an optional embodiment, after step 102 and before step 103, the method may further include: establishing a second array for storing target picture information required by the second theme resource in a default sample resource folder of the second theme resource; and the data structure of the second array is a preset target picture file name and a corresponding target picture size. In this embodiment, the sizes of the pictures in the first array and the second array need to be compared to determine the first theme resource picture that can be directly used and the picture that needs to be redrawn. Specifically, as shown in fig. 3, the step 103 may include the following steps 301-304:
step 301, circularly traversing the first array, and calculating the size of each original picture recorded in the first array.
Step 302, judging whether the original picture size corresponding to the same picture file name in the second array and the first array is consistent with a preset target picture size; if so, go to step 303, otherwise go to step 304.
After the specific implementation, the picture names in the nth (the initial value of N is 1) record stored in the second array may be extracted to match the first array for whether the same picture names exist, and if the same picture names are matched, the sizes (width and height) of the two pictures are compared for consistency.
And step 303, directly copying the original picture with the size consistent with the target picture into the picture directory.
And for the original picture and the target picture information corresponding to the same picture name, if the target picture size is consistent with the original picture size, directly copying the original picture to the picture directory.
And step 304, redrawing the original picture with the size inconsistent with the size of the target picture, and storing the original picture into the picture directory.
In the embodiment, the second array is established to store the required second resource information, the original picture can be screened by comparing the main information of the picture resources stored in the first array and the second array, the comparison method is simple, the screening efficiency is high, the existing picture resources can be fully utilized, and the workload of the designer for redrawing is reduced.
For some subject resources (e.g., iOS resources), there are two times (2X) pictures and three times (3X) pictures for picture resources, and thus, as an alternative embodiment, the picture directory constructed in step 102 includes a two times picture directory for storing two times pictures of the target picture and a three times picture directory for storing three times pictures of the target picture. In this embodiment, when the second array is established, the method may further include: establishing a third array and a fifth array for storing 2X picture information and establishing a fourth array and a sixth array for storing 3X picture information in a default sample resource folder of the second theme resource; the data structure of the third/fourth array is the file name of the original picture, the name of the corresponding target picture and the size of the target picture; and the data structure of the fifth/sixth array is the file name of the original picture, the corresponding storage path of the original picture, the name of the target picture and the size of the target picture. Then, as shown in fig. 4, the step 304 may include the following steps 401 and 407:
step 401, copying the picture information in which the target picture size in the second array is inconsistent with the original picture size corresponding to the same picture file name in the first array into the third array and the fourth array.
And copying the file name of the original picture, the corresponding target picture name and the target picture size into the third array and the fourth array respectively if the target picture size in the second array is inconsistent with the original picture size corresponding to the same picture file name in the first array.
Step 402, judging whether the picture file names in the third array and the fourth array can be matched in the first array; if yes, go to step 403.
In this embodiment, if the picture file names in the third array and the fourth array can be matched in the first array, it represents that the picture file names in the third array and the fourth array have corresponding first theme resources, and the picture file names can be converted into second theme resources after being redrawn by using the picture source, and if the picture file names in the third array and the fourth array do not exist in the first array, the picture names have no corresponding picture source, a required second theme resource picture cannot be generated, and the generation of a new picture fails.
Step 403, according to the storage path recorded by the first array, judging whether the currently matched picture file name contains a predetermined typeface in the corresponding file suffix name in the database; if yes, go to step 404, otherwise go to step 405.
Since the same picture name in the first theme resource may have two pictures, one is in a common format and the other is in a predetermined format (for example, a format with a 9.png suffix), if the picture name is not distinguished, errors such as failure or omission of conversion of the related theme resource may be caused. If the picture names in the third array and the fourth array are matched in the first array, it is further necessary to determine whether the corresponding file suffix name contains a predetermined typeface, so that the picture in the predetermined format is stored without changing its format after being redrawn. Preferably, the predetermined typeface is the ". 9. png" typeface.
Step 404, setting a first attribute for the same picture file name in the third array and the fourth array, and continuing to execute step 406.
In this embodiment, if the picture file name in the first array can be matched in the third array and the fourth array, and the currently matched picture file name contains a predetermined character pattern in the corresponding file suffix name in the database, a first attribute is set for the same picture file name in the third array and the fourth array, where the first attribute may be a predefined value or character, and for example, setting the attribute value corresponding to the picture file name to 1 indicates that the picture file name has the first attribute.
Step 405, setting a second attribute for the same picture file name in the third array and the fourth array, and continuing to execute step 406.
In this embodiment, if the picture file name in the first array can be matched in the third array and the fourth array, but the currently matched picture file name does not contain a predetermined typeface in the corresponding file suffix name in the database, a second attribute is set for the same picture file name in the third array and the fourth array, the second attribute may be a predefined numerical value or character, and for example, setting the attribute value corresponding to the picture file name to 0 indicates that the picture file name has the second attribute.
And 406, copying the picture information with the first attribute/the second attribute in the third array and the fourth array to a fifth array and a sixth array respectively, and copying an original picture storage path corresponding to the same picture name in the first array to corresponding records in the fifth array and the sixth array.
Specifically, the picture information with the first attribute/the second attribute in the third array is copied into the fifth array, and the original picture storage path corresponding to the same picture name in the first array is copied into a corresponding record in the fifth array; copying the picture information with the first attribute/the second attribute in the fourth array to the sixth array, and copying the original picture storage path corresponding to the same picture name in the first array to the corresponding record in the fifth array
As can be seen from the above description, the picture names corresponding to the picture information having the first/second attribute in the third and fourth arrays can be matched in the first array, that is, the third and fourth arrays have the first theme picture resources, and the pictures can be redrawn and then converted into the second theme picture resources. Therefore, in this step, the picture information with the first attribute and the picture information with the second attribute in the third array are both copied to the fifth array, and the picture storage path corresponding to each picture name copied to the fifth array in the first array is also copied to the corresponding record in the fifth array, and the fourth array operates similarly, and is not described any more.
And step 407, redrawing the original pictures recorded in the fifth array and the sixth array according to a preset drawing strategy.
And redrawing the original pictures recorded in the fifth array into second theme resource pictures in a double-picture form, and redrawing the original pictures recorded in the sixth array into second theme resource pictures in a triple-picture form. For example, the file name of the original image recorded in the fifth array is "flower", and the file name of the target image obtained by redrawing the original image according to the predetermined drawing policy is "flower @2 x"; similarly, for the picture with the original image file name "flower" recorded in the sixth array, the file name of the target picture obtained after redrawing the picture according to the predetermined drawing policy is "flower @3 x".
And step 408, storing the new picture generated according to the original pictures recorded in the fifth/sixth array into the double/triple picture directory.
And adding a preset typeface to the suffix name of the new picture file corresponding to the picture file name with the first attribute in the fifth array and the sixth array during storage.
Specifically, storing a new picture generated according to the original picture recorded in the fifth array in the double-picture directory, and storing a new picture generated according to the original picture recorded in the sixth array in the triple-picture directory; and adding the predetermined typeface to the corresponding new picture suffix name of the picture file name with the first attribute in the fifth array and the sixth array during storage. And storing the new pictures corresponding to the picture file names with the second attribute in the fifth array and the sixth array as the picture files with the common picture suffix names.
For example, the file name of the picture recorded in the fifth array is "flower", the suffix of the corresponding picture is ". 9. png", and the file name of the target picture obtained in the previous step after the picture is redrawn according to the preset drawing strategy is "flower @2 x"; then when the "flower @2 x" new picture is stored under the double picture directory, the picture file is stored as "flower @2x.9. png".
In this embodiment, the picture with the size requirement inconsistent with the original picture size after the conversion is redrawn, and the picture with the predetermined format is still stored in the predetermined format after the picture with the predetermined format is drawn in the redrawing process, and the format of the picture with the predetermined format is not changed after the picture resource is converted.
In the embodiment of the present invention, as an optional embodiment, as shown in fig. 5, the step 104 may include the following steps 501 and 508:
step 501, setting a plist folder for generating the second theme resource in the second theme resource directory.
Step 502, plist file information of the third attribute of the target picture is preset and stored in a preset seventh array.
The third attribute of the picture may be an attribute such as a color value of the picture.
In this step, plist file information of a third attribute of the target picture is preset, namely one or more plist file information about the third attribute of the target picture, which needs to be stored in the plist folder set in the previous step; and a script can be preset, a seventh array is preset in the script, the seventh array is used for recording plist file information about a third attribute of the target picture, and the data structure of the seventh array can be a list file name.
Step 503, taking out a default plist file related to the third attribute of the second theme resource picture from the default sample resource folder of the second theme resource.
Namely: and taking out a plist file with a third attribute of the default second subject resource picture from the default sample resource folder of the second subject resource, wherein the second subject resource picture comprises a double picture and a triple picture.
Step 504, writing the default plist file information of the currently taken third attribute of the double-fold picture and the triple-fold picture related to the second subject resource picture into a preset eighth array and a preset ninth array respectively.
The data structure of the eighth array and the ninth array is a plist file name and a parameter value in a corresponding file. The eighth array is for storing default plist file information regarding a third attribute of a 2X picture of the second subject resource picture, and the ninth array is for storing default plist file information regarding a third attribute of a 3X picture of the second subject resource picture.
Step 505, circularly traversing the seventh array, and judging whether the plist file name in the seventh array can be matched in the eighth array or the ninth array; if yes, go to step 506.
In this step, the seventh array is traversed in a circulating manner, and whether the plist file name of the third attribute of the target picture preset in the seventh array can be matched with the default plist file is judged.
Step 506, judging whether the parameter value in the file corresponding to the currently matched plist filename is consistent with the parameter value in the same plist file in the plist folder under the first subject resource directory; if yes, go to step 507, otherwise go to step 508.
In this step, it is determined whether the parameter value in the default plist file currently matched is consistent with the parameter value in the same plist file in the plist folder under the first subject resource directory.
And 507, copying a file corresponding to the same plist file name in the default sample resource folder of the second subject resource to the plist folder under the second subject resource directory.
In this embodiment, if the plist file name in the seventh array can be matched in the eighth array or the ninth array in step 505, and it is determined in step 506 that the parameter value in the file corresponding to the matched file name is consistent with the parameter value in the same plist file in the plist folder under the first subject resource directory, the file corresponding to the plist file name in the default sample resource folder of the second subject resource is copied to the plist folder under the second subject resource directory.
Step 508, replacing the parameter value in the file corresponding to the same plist filename in the plist folder of the default sample resource folder of the second subject resource with the parameter value in the file corresponding to the same plist filename in the plist folder of the first subject resource directory, and then storing the file in the plist folder of the second resource directory.
In this embodiment, if the plist filename in the seventh array can be matched in the eighth array or the ninth array in step 505, and it is determined in step 506 that the parameter value in the file corresponding to the matched filename is inconsistent with the parameter value in the same plist file in the plist folder under the first subject resource directory, the parameter value in the file corresponding to the same plist filename in the plist folder under the first subject resource directory is used as the parameter value in the file corresponding to the same plist filename in the default sample resource folder of the second subject resource, so as to ensure that the parameter value corresponding to the third attribute corresponding to the first subject resource is converted into the parameter value corresponding to the third attribute corresponding to the second subject resource.
In this embodiment of the present invention, as an optional embodiment, after acquiring the first theme resource information in any of the above embodiments, the method may further include the steps of: judging whether audio resources exist in a sound folder under the first theme resource directory; if so, copying the audio resources in the sound folder under the first theme resource directory into the sound folder under the second theme resource directory; otherwise, copying the audio resources in the default audio folder of the second theme resource to the sound folder under the second theme resource directory. In this embodiment, if the first theme resource has an audio resource, the first theme resource is directly copied to the sound folder in the second theme resource directory to serve as a matching audio file of the converted second theme resource, and if the first theme resource does not have an audio resource, the default audio resource of the second theme resource is used.
In this embodiment of the present invention, as an optional embodiment, after step 104 is completed, manual configuration of an audio resource may be performed, and specifically, after step 104, the method may further include the steps of: receiving a selection of an audio resource in a first subject resource; and copying the currently selected audio resource into a sound folder under the second theme resource directory.
Preferably, the first theme resource is an Android theme resource, and the second theme resource is an apple iOS theme resource. The method provided by the invention is particularly suitable for converting the Android subject resource into the iOS subject resource.
The following describes in detail the technical solution of the method embodiment shown in any one of fig. 1 to 5, using two specific embodiments.
In a specific embodiment, if a user needs to convert an Android theme into an iOS theme, the method includes the following steps:
(1) after selecting a theme to be converted from the Android theme background, a user clicks a preset conversion request button, for example, a button of 'one-key to iOS resource' can be displayed on a display screen of a client;
(2) the server performs theme resource conversion on the theme to be converted according to the method provided by any embodiment, and sends a corresponding resource conversion completion notification to the user after the conversion is completed so as to remind the user whether to download the converted iOS theme resource;
(3) the user downloads and opens the converted iOS resource package, and can see that a 2X folder and a 3X folder are arranged in the iOS resource package, and three files are respectively arranged in the two folders: file one: images; document two: a sound; file three: plist;
(4) and a user creates an iOS theme in an iOS theme management background provided by the server, configures the 2X folder and the 3X folder in the iOS resource package downloaded in the previous step into the new theme and clicks the new theme to be put on the shelf, so that the iOS theme configuration is completed, and the theme resource can be normally displayed and used at the iOS end.
In a specific embodiment two, if the user needs to select the sound effect resource from the Android theme to configure the sound effect resource in the iOS theme, the following steps are performed:
(1) after selecting a resource theme to be converted from the Android theme background, a user clicks a preset conversion request button, for example, a button of converting one key to iOS resources can be displayed on a display screen of a client;
(2) the server performs theme resource conversion on the theme to be converted according to the method provided by any embodiment, and sends a corresponding resource conversion completion notification to the user after the conversion is completed so as to remind the user whether to download the converted iOS theme resource;
(3) the user downloads and opens the converted iOS resource package, and can see that a 2X folder and a 3X folder are arranged in the iOS resource package, and three files are respectively arranged in the two folders: file one: images; document two: a sound; file three: plist;
(4) a user selects a required sound effect file from a sound folder (Android theme folder) of a theme to be converted and replaces the sound effect file into sound files in two folders of 2X and 3X of a downloaded iOS theme resource package;
(5) and finding an identifier of a theme to be converted in the iOS theme management background, updating the 2X folder and the 3X folder which replace the sound effect resource to the iOS theme center, finishing updating the iOS theme, and normally displaying and using the iOS theme at the iOS end.
The theme resource conversion method effectively solves the technical difficulty that the same input method theme cannot be adapted to the Android and iOS platforms, fully utilizes the existing resources, greatly saves the theme making time and improves the working efficiency of developers. And the third-party input method can make up the defect that the iOS native input method cannot switch themes, and meets the requirements of iOS users on personalized themes.
Fig. 6 is a schematic structural diagram of a theme resource conversion apparatus according to a first embodiment of the present invention, and as shown in fig. 6, the apparatus of this embodiment may include: the system comprises an acquisition module 11, a configuration module 12, an image processing module 13 and a file generation module 14;
the acquiring module 11 is configured to acquire first theme resource information;
the first theme resource comprises an original picture;
the configuration module 12 is configured to construct a picture directory for storing the target picture under the second theme resource directory;
the picture processing module 13 is used for redrawing the original picture or directly copying the original picture to the picture directory by comparing the size of the original picture with a preset target picture size;
and a file generating module 14, configured to generate a plist file corresponding to the currently converted theme resource in the second theme resource directory. Wherein the second topic resource directory is stored in the server database.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 1, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 7 is a schematic structural diagram of a second embodiment of a resource conversion device as a subject of the present invention, as shown in fig. 7, the device of this embodiment further includes, on the basis of the device structure shown in fig. 6:
and the compressing module 15 is configured to compress and store the second theme resource directory.
Fig. 8 is a schematic structural diagram of a third embodiment of the resource conversion apparatus as a subject of the present invention, as shown in fig. 8, the apparatus of this embodiment is based on the apparatus structure shown in fig. 6, and further, the obtaining module 11 includes:
an identification acquisition submodule 111, a first query submodule 112 and a first generation submodule 113;
the identifier obtaining sub-module 111 is configured to obtain an application identifier of the first theme resource;
a first query submodule 112, configured to query, according to the application identifier of the first theme resource, a storage path of the original picture in a database in which the first theme resource is stored;
a first generating sub-module 113 configured to generate a first array for storing original picture information; the data structure of the first array is the file name of the original picture and the corresponding original picture storage path.
The apparatus of this embodiment may be used to implement the technical solutions of the method embodiments shown in fig. 1 or fig. 2, and the implementation principles and technical effects are similar, which are not described herein again.
Fig. 9 is a schematic structural diagram of a fourth embodiment of the theme resource conversion apparatus according to the present invention, as shown in fig. 9, based on the apparatus structure shown in fig. 8, the theme resource conversion apparatus further includes an array establishing module 16, configured to establish a second array for storing the target picture information required by the second theme resource in the default sample resource folder of the second theme resource;
and the data structure of the second array is a preset target picture file name and a corresponding target picture size. Further, the picture processing module 13 includes:
a calculation submodule 131, a first judgment submodule 132, a first copy submodule 133 and a drawing submodule 134;
the calculating submodule 131 is configured to cycle through the first array generated by the first generating submodule 113, and calculate the size of each original picture recorded in the first array;
a first judging submodule 132, configured to judge whether an original picture size corresponding to the same picture file name in the second array and the first array is consistent with a preset target picture size;
a first copying submodule 133, configured to copy the currently determined original picture directly into the picture directory if the determination result of the first determining submodule 132 is yes;
and a drawing sub-module 134, configured to, if the determination result of the first determining sub-module 132 is negative, redraw the currently determined original picture, and then store the redrawn original picture in the picture directory.
The apparatus of this embodiment may be used to execute the technical solution of the method embodiment shown in fig. 1, fig. 2, or fig. 3, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 10 is a schematic structural diagram of a fifth embodiment of a resource conversion device as a subject of the present invention, as shown in fig. 10, the device of this embodiment is based on the device structure shown in fig. 9, and further,
the configuration module 12 is used for configuring the picture directories, and the picture directories comprise a double-picture directory for storing double pictures of the target picture and a triple-picture directory for storing triple pictures of the target picture;
the array establishing module 16 is further configured to establish a third array and a fifth array for storing double-fold picture information in a default sample resource folder of the second theme resource, and establish a fourth array and a sixth array for storing triple-fold picture information at the same time;
the data structure of the third/fourth array is the file name of the original picture, the name of the corresponding target picture and the size of the target picture;
and the data structure of the fifth/sixth array is the file name of the original picture, the corresponding storage path of the original picture, the name of the target picture and the size of the target picture.
In addition, in this embodiment, the drawing submodule 134 includes: a first copying unit 21, a first judging unit 22, a second judging unit 23, an attribute setting unit 24, a second copying unit 25, a drawing unit 26, and a storage unit 27.
In the context of figure 10 of the drawings,
the first copying unit 21 is configured to copy picture information in which a target picture size in the second array is inconsistent with an original picture size corresponding to the same picture file name in the first array into the third array and the fourth array;
a first judging unit 22, configured to judge whether each picture file name in the third array and the fourth array can be matched in the first array;
a second judging unit 23, configured to, when the judgment result of the first judging unit 22 is yes, judge, according to the storage path recorded by the first array, whether the picture file name currently matched by the first judging unit 22 includes a predetermined typeface in the corresponding file suffix name in the database;
an attribute setting unit 24, configured to set a first attribute for the same picture file name in the third array and the fourth array if the determination result of the second determining unit 23 is yes, and set a second attribute for the same picture file name in the third array and the fourth array if the determination result of the second determining unit 23 is no;
a second copying unit 25, configured to copy, after the setting by the attribute setting unit 24 is completed, the picture information having the first attribute/the second attribute in the third array to a fifth array, and copy an original picture storage path corresponding to the same picture name in the first array to a corresponding record in the fifth array;
the image information with the first attribute/the second attribute in the fourth array is copied to the sixth array, and the original image storage path corresponding to the same image name in the first array is copied to a corresponding record in the fifth array;
a drawing unit 26, configured to redraw the original pictures recorded in the fifth array and the sixth array according to a predetermined drawing policy after the second copying unit 25 finishes copying the information, and a storage unit 27, configured to store, in the double-picture directory, a new picture generated by the drawing unit 26 according to the original pictures recorded in the fifth array, and store, in the triple-picture directory, a new picture generated by the drawing unit according to the original pictures recorded in the sixth array; and adding a preset typeface to the picture file name with the first attribute in the fifth array and the sixth array when the picture file name is stored, wherein the preset typeface is added to the corresponding new picture suffix name. .
The apparatus of this embodiment may be configured to execute the technical solution of the method embodiment shown in fig. 1, 2, 3, or 4, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 11 is a schematic structural diagram of a sixth embodiment of the subject resource conversion apparatus of the present invention, as shown in fig. 11, the apparatus of this embodiment is based on the apparatus structure shown in fig. 6, and further, the file generation module 14 includes: a second generation sub-module 141, a first writing sub-module 142, a reading sub-module 143, a second writing sub-module 144, a second judgment sub-module 145, a third judgment sub-module 146, a second duplication sub-module 147 and a replacement sub-module 148; wherein,
a second generating submodule 141, configured to set a plist folder for generating a second theme resource in the second theme resource directory;
the first writing sub-module 142 is configured to preset plist file information of a third attribute of the target picture and store the plist file information in a preset seventh array;
a reading sub-module 143, configured to take out a default plist file related to a third attribute of a second theme resource picture from the default sample resource folder of the second theme resource, where the second theme resource picture includes a double picture and a triple picture;
a second writing sub-module 144, configured to write default plist file information of a third attribute of a double-fold picture and a triple-fold picture, which are currently taken out, of the second subject resource picture into a preset eighth array and a preset ninth array, respectively;
the data structures of the eighth array and the ninth array are plist file names and parameter values in corresponding files; the second judgment submodule 145 is configured to cycle through the seventh array, and judge whether the plist filename in the seventh array can be matched in the eighth array or the ninth array;
a third determining sub-module 146, configured to determine, when the determination result of the second determining sub-module 145 is yes, whether a parameter value in a file corresponding to the currently matched plist filename is consistent with a parameter value in the same plist file in the plist folder under the first subject resource directory;
a second copying sub-module 147, configured to copy, when the determination result of the third determining sub-module 146 is yes, a file corresponding to the same plist filename in the default sample resource folder of the second topic resource to the plist folder in the second topic resource directory;
and a replacing sub-module 148, configured to, when the determination result of the third determining sub-module 146 is negative, replace the parameter value in the file corresponding to the same plist filename in the default sample resource folder of the second subject resource with the parameter value in the file corresponding to the same plist filename in the plist folder under the first subject resource directory, and then store the file in the plist folder under the second resource directory.
The apparatus of this embodiment may be configured to execute the technical solution of the method embodiment shown in fig. 1, 2, 3, 4, or 5, and the implementation principle and the technical effect are similar, which are not described herein again.
In an embodiment of the present invention, as an optional embodiment, the above theme resource conversion apparatus may further include an audio determining module and an audio copying module, wherein the audio determining module is configured to determine whether there is an audio resource in the sound folder in the first theme resource directory; the audio copying module is used for copying the audio resources in the sound folder under the first theme resource directory into the sound folder under the second theme resource directory when the judgment result of the audio judging module is yes; and the audio resource management module is further configured to copy the audio resource in the default audio folder of the second theme resource to the sound folder in the second theme resource directory if the judgment result of the audio judgment module is negative.
Preferably, the first theme resource converted by the theme resource conversion device provided in the embodiment of the present invention is an Android theme resource, and the second theme resource is an apple iOS theme resource.
Corresponding to the theme resource conversion method provided in the embodiment of the present invention, an embodiment of the present invention further provides an electronic device, fig. 12 is a schematic structural diagram of an embodiment of the electronic device of the present invention, and a flow of the embodiment shown in fig. 1 of the present invention may be implemented, as shown in fig. 12, where the electronic device may include: the device comprises a shell 31, a processor 32, a memory 33, a circuit board 34 and a power circuit 35, wherein the circuit board 34 is arranged inside a space enclosed by the shell 31, and the processor 32 and the memory 33 are arranged on the circuit board 34; a power supply circuit 35 for supplying power to each circuit or device of the electronic apparatus; the memory 33 is used for storing executable program codes; the processor 32 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 33, for executing the subject resource conversion method of any of the foregoing embodiments.
The above electronic devices exist in a variety of forms, including but not limited to:
(1) a mobile communication device: such devices are characterized by mobile communications capabilities and are primarily targeted at providing voice, data communications. Such terminals include: smart phones (e.g., iphones), multimedia phones, functional phones, and low-end phones, among others.
(2) Ultra mobile personal computer device: the equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include: PDA, MID, and UMPC devices, etc., such as ipads.
(3) A portable entertainment device: such devices can display and play multimedia content. This type of device comprises: audio and video playing modules (such as an iPod), handheld game consoles, electronic books, and intelligent toys and portable car navigation devices.
(4) A server: the device for providing the computing service comprises a processor, a hard disk, a memory, a system bus and the like, and the server is similar to a general computer architecture, but has higher requirements on processing capacity, stability, reliability, safety, expandability, manageability and the like because of the need of providing high-reliability service.
(5) And other electronic equipment with data interaction function.
The present invention also provides a computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, is adapted to implement the steps of the theme resource conversion method of any one of the preceding embodiments.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. A method for converting a theme resource, comprising:
acquiring first theme resource information; the first theme resource comprises an original picture;
constructing a picture catalog for storing the target picture under the second theme resource catalog;
the original picture is redrawn or directly copied to the picture directory by comparing the size of the original picture with the preset size of the target picture;
and generating a plist file corresponding to the converted theme resource under the second theme resource catalog.
2. The method for converting topic resources according to claim 1, wherein after generating the plist file corresponding to the topic resource after the conversion in the second topic resource directory, the method further comprises:
and compressing and storing the second theme resource directory.
3. The method for converting topic resources according to claim 1, wherein the obtaining the first topic resource information comprises:
acquiring an application identifier of a first subject resource;
according to the application identification of the first theme resource, inquiring a storage path of an original picture in a database in which the first theme resource is stored;
generating a first array for storing original picture information; the data structure of the first array is the file name of the original picture and the corresponding original picture storage path.
4. The theme resource conversion method according to claim 3, further comprising, after constructing a picture directory for storing the target picture under the second theme resource directory:
establishing a second array for storing target picture information required by the second theme resource in a default sample resource folder of the second theme resource; the data structure of the second array is a preset target picture file name and a corresponding target picture size;
the method for redrawing or directly copying the original picture to the picture directory by comparing the size of the original picture with the preset size of the target picture comprises the following steps:
circularly traversing the first array, and calculating the size of each original picture recorded in the first array;
judging whether the original picture size corresponding to the same picture file name in the second array and the first array is consistent with a preset target picture size or not;
if the original image size corresponding to the same image file name is consistent with the target image size, directly copying the original image to the image directory;
and if the size of the original picture corresponding to the same picture file name is not consistent with the size of the target picture, redrawing the original picture and then storing the original picture in the picture directory.
5. The subject matter resource conversion method according to claim 4, wherein the picture directory includes a double picture directory for storing double pictures of the target picture and a triple picture directory for storing triple pictures of the target picture;
the establishing of the second array for storing the target picture information required by the second theme resource in the default sample resource folder of the second theme resource further includes:
establishing a third array and a fifth array for storing double-fold picture information and establishing a fourth array and a sixth array for storing triple-fold picture information in a default sample resource folder of the second theme resource;
the data structure of the third/fourth array is the file name of the original picture, the name of the corresponding target picture and the size of the target picture;
the data structure of the fifth/sixth array is the original image file name and the corresponding original image storage path, the target image name and the target image size;
if the original picture size corresponding to the same picture file name is not consistent with the target picture size, redrawing the original picture and then storing the original picture in the picture directory, wherein the method comprises the following steps of:
copying picture information of which the target picture size in the second array is inconsistent with the original picture size corresponding to the same picture file name in the first array into the third array and the fourth array;
judging whether the picture file names in the third array and the fourth array can be matched in the first array or not;
if the picture file names in the third array and the fourth array can be matched in the first array, judging whether the currently matched picture file name contains a preset character pattern in a corresponding file suffix name in the database according to a storage path recorded by the first array;
if the currently matched picture file name contains a preset typeface in the corresponding file suffix name in the database, setting a first attribute for the same picture file name in the third array and the fourth array;
if the currently matched picture file name does not contain a preset typeface in the corresponding file suffix name in the database, setting a second attribute for the same picture file name in the third array and the fourth array;
copying picture information with a first attribute/a second attribute in a third array into a fifth array, and copying an original picture storage path corresponding to the same picture name in the first array into a corresponding record in the fifth array; copying picture information with a first attribute/a second attribute in a fourth array into a sixth array, and copying an original picture storage path corresponding to the same picture name in the first array into a corresponding record in a fifth array;
redrawing the original pictures recorded in the fifth array and the sixth array according to a preset drawing strategy;
storing a new picture generated according to the original picture recorded in the fifth array into the double-picture directory, and storing a new picture generated according to the original picture recorded in the sixth array into the triple-picture directory; and adding the predetermined typeface to the corresponding new picture suffix name of the picture file name with the first attribute in the fifth array and the sixth array during storage.
6. The method for converting topic resources according to claim 1, wherein the generating a plist file corresponding to the topic resource after the conversion under the second topic resource directory comprises:
setting a plist folder for generating a second theme resource under the second theme resource directory;
presetting plist file information of a third attribute of the target picture and storing the plist file information into a preset seventh array;
taking out a default plist file related to a third attribute of a second subject resource picture from a default sample resource folder of the second subject resource, wherein the second subject resource picture comprises a double picture and a triple picture;
respectively writing default plist file information of currently taken third attributes of the double-fold picture and the triple-fold picture of the second subject resource picture into a preset eighth array and a preset ninth array; the data structures of the eighth array and the ninth array are plist file names and parameter values in corresponding files;
circularly traversing the seventh array, and judging whether the plist file name in the seventh array can be matched in the eighth array or the ninth array;
if the plist file name in the seventh array can be matched in the eighth array or the ninth array, judging whether the parameter value in the file corresponding to the currently matched plist file name is consistent with the parameter value in the same plist file in the plist folder under the first subject resource directory;
if the parameter value of the currently matched file corresponding to the plist filename is consistent with the parameter value of the same plist file in the plist folder under the first subject resource directory, copying the file corresponding to the same plist filename in the default sample resource folder of the second subject resource into the plist folder under the second subject resource directory;
if the parameter value in the file corresponding to the currently matched plist file name is not consistent with the parameter value in the same plist file in the plist folder under the first subject resource directory, replacing the parameter value in the file corresponding to the same plist file name in the default sample resource folder of the second subject resource with the parameter value in the file corresponding to the same plist file name in the plist folder under the first subject resource directory, and then storing the file into the plist folder under the second resource directory.
7. The method for converting a theme resource according to any one of claims 1 to 6, further comprising, after the acquiring the first theme resource information:
judging whether audio resources exist in a sound folder under the first theme resource directory;
if the sound folder under the first theme resource directory contains audio resources, copying the audio resources in the sound folder under the first theme resource directory into the sound folder under the second theme resource directory;
and if no audio resource exists in the sound folder under the first theme resource directory, copying the audio resource in the default audio folder of the second theme resource into the sound folder under the second theme resource directory.
8. The theme resource conversion method according to any one of claims 1 to 6, wherein the first theme resource is an Android theme Android resource, and the second theme resource is an apple iOS theme resource.
9. A theme resource converting apparatus, comprising:
the acquisition module is used for acquiring first theme resource information; the first theme resource comprises an original picture;
the configuration module is used for constructing a picture catalogue for storing the target picture under the second theme resource catalogue;
the picture processing module is used for redrawing the original picture or directly copying the original picture to the picture directory by comparing the size of the original picture with the preset target picture size;
and the file generation module is used for generating a plist file corresponding to the converted theme resource under the second theme resource catalog.
10. The theme resource converting apparatus according to claim 9, further comprising:
and the compression module is used for compressing and storing the second theme resource directory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810666638.7A CN108874495B (en) | 2018-06-25 | 2018-06-25 | Theme resource conversion method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810666638.7A CN108874495B (en) | 2018-06-25 | 2018-06-25 | Theme resource conversion method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108874495A true CN108874495A (en) | 2018-11-23 |
CN108874495B CN108874495B (en) | 2022-02-11 |
Family
ID=64294767
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810666638.7A Active CN108874495B (en) | 2018-06-25 | 2018-06-25 | Theme resource conversion method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108874495B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109491741A (en) * | 2018-10-31 | 2019-03-19 | 维沃移动通信有限公司 | A kind of method and terminal switching background skin |
CN113822022A (en) * | 2020-06-18 | 2021-12-21 | 苏州谦问万答吧教育科技有限公司 | PPT (Power Point) auditing processing method, device, equipment and storage medium |
CN114218171A (en) * | 2021-12-22 | 2022-03-22 | 武汉斗鱼鱼乐网络科技有限公司 | Convenient storage method, electronic equipment, storage medium and system |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101719075A (en) * | 2009-12-29 | 2010-06-02 | 中兴通讯股份有限公司 | Method for switching theme of Java virtual machine and terminal device |
CN102419706A (en) * | 2011-09-29 | 2012-04-18 | 奇智软件(北京)有限公司 | Method for editing skin of user interface |
CN104503747A (en) * | 2014-12-11 | 2015-04-08 | 北京金和软件股份有限公司 | Database storage structure of APP (Application) production platform |
CN104699833A (en) * | 2015-03-31 | 2015-06-10 | 北京奇艺世纪科技有限公司 | Picture presentation method, picture storage method, picture presentation device and picture storage device |
CN105224302A (en) * | 2014-06-27 | 2016-01-06 | 北京搜狗科技发展有限公司 | The skin processing method of input method and input method system |
US20170103548A1 (en) * | 2014-03-27 | 2017-04-13 | Pansonic Intellectual Property Manamagement Co., Ltd. | Vehicle-mounted display device, method for controlling vehicle-mounted display device, and program |
CN106569658A (en) * | 2016-10-19 | 2017-04-19 | 武汉悦然心动网络科技股份有限公司 | Multimedia theme configuration method and multimedia theme configuration system of input method |
-
2018
- 2018-06-25 CN CN201810666638.7A patent/CN108874495B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101719075A (en) * | 2009-12-29 | 2010-06-02 | 中兴通讯股份有限公司 | Method for switching theme of Java virtual machine and terminal device |
CN102419706A (en) * | 2011-09-29 | 2012-04-18 | 奇智软件(北京)有限公司 | Method for editing skin of user interface |
US20170103548A1 (en) * | 2014-03-27 | 2017-04-13 | Pansonic Intellectual Property Manamagement Co., Ltd. | Vehicle-mounted display device, method for controlling vehicle-mounted display device, and program |
CN105224302A (en) * | 2014-06-27 | 2016-01-06 | 北京搜狗科技发展有限公司 | The skin processing method of input method and input method system |
CN104503747A (en) * | 2014-12-11 | 2015-04-08 | 北京金和软件股份有限公司 | Database storage structure of APP (Application) production platform |
CN104699833A (en) * | 2015-03-31 | 2015-06-10 | 北京奇艺世纪科技有限公司 | Picture presentation method, picture storage method, picture presentation device and picture storage device |
CN106569658A (en) * | 2016-10-19 | 2017-04-19 | 武汉悦然心动网络科技股份有限公司 | Multimedia theme configuration method and multimedia theme configuration system of input method |
Non-Patent Citations (1)
Title |
---|
张梦云等: ""基于角色模型的智能手机界面设计研究"", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109491741A (en) * | 2018-10-31 | 2019-03-19 | 维沃移动通信有限公司 | A kind of method and terminal switching background skin |
CN109491741B (en) * | 2018-10-31 | 2022-01-28 | 维沃移动通信有限公司 | Method and terminal for switching background skin |
CN113822022A (en) * | 2020-06-18 | 2021-12-21 | 苏州谦问万答吧教育科技有限公司 | PPT (Power Point) auditing processing method, device, equipment and storage medium |
CN114218171A (en) * | 2021-12-22 | 2022-03-22 | 武汉斗鱼鱼乐网络科技有限公司 | Convenient storage method, electronic equipment, storage medium and system |
Also Published As
Publication number | Publication date |
---|---|
CN108874495B (en) | 2022-02-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103235685B (en) | A kind of method and apparatus that terminal operating system desktop contents is set | |
CN108874495B (en) | Theme resource conversion method and device and electronic equipment | |
CN109725933B (en) | Big data document generation method, device, equipment and computer readable storage medium | |
CN103049515A (en) | Method, device and equipment for classifying application programs | |
CN108279882B (en) | Framework generation method, device, equipment and computer readable medium | |
CN105700925A (en) | APP interface implementation method and apparatus | |
CN112882746B (en) | Application program updating method and device, storage medium and computer equipment | |
CN105512276B (en) | Method and device for constructing junk file and electronic equipment | |
CN113885935A (en) | Resource packaging method and device, electronic equipment and computer readable storage medium | |
CN110365776B (en) | Picture batch downloading method and device, electronic equipment and storage medium | |
CN110652728A (en) | Game resource management method and device, electronic equipment and storage medium | |
CN113268232B (en) | Page skin generation method and device and computer readable storage medium | |
CN112799955A (en) | Model change detection method and device, storage medium and electronic equipment | |
CN111984293A (en) | Information processing method, device and storage medium | |
CN112052157A (en) | Test message construction method, device and system | |
CN116048609A (en) | Configuration file updating method, device, computer equipment and storage medium | |
CN114675912B (en) | Theme skin switching method and device, computer equipment and computer storage medium | |
CN112691382B (en) | Resource processing method, device and computer readable storage medium | |
CN112044061B (en) | Game picture processing method and device, electronic equipment and storage medium | |
CN108920658B (en) | Mobile device desktop moving method and device and electronic device | |
CN111001157B (en) | Method and device for generating reference information, storage medium and electronic device | |
CN113918096A (en) | Method and device for uploading algorithm mirror image packet and application | |
CN111880896A (en) | Method and device for rapidly restoring container and running state data | |
CN114115811A (en) | Compatible configuration method and device of system characteristics, computer equipment and medium | |
CN109344159B (en) | Lookup method and device for LDAP (lightweight directory Access protocol), electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |