First of all, my idea:
The logic for changing the icons inside the Luancher3 is as follows:
Query the app resource bundle first--database query--Other places to query icon
Therefore, we just need to get the icon code from the database early to extract from the app resource bundle.
Our external app just needs to add an icon to the Launcher.db's icon field. We can.
Then notify the desktop to update the icon. You can complete the entire desktop icon itself to replace the effect of the active.
Advantages of doing this:
With less code churn, theme apps don't have to be connected to the Launcher3 desktop app. Equivalent to an external application.
(Front 8th I have slightly briefed the next Launcher3 content provider, need to write 2 permissions)
Detailed ideas are simpler and clearer. And it's achieved.
Need to be able to leave a message, I can give the demo ha.
Read button:
The LAUNCHER.DB database is read by the content provider and parsed into a List<shotcupinfo> object, which facilitates the subsequent traversal of the update icon to the database.
Update button: after clicking. The icon database for the update launcher.db will be specified based on the ID of the app previously obtained. Here we will convert the icon inside the SD card into a byte array and save it to the database.
App Theme: Notify Desktop to refresh. (This step is in fact not necessary, because when you take the second step, the update operation, when you visit the database, the desktop database is a register of the Observer Listener database changes. The workspace icon is updated. )
Topic Source: Miui Theme Resource Pack extracted:
The resource structure folder such as the following
Phone SD card root folder: _theme------------------The following include theme packs for each ZIP compression format.
When we launch the theme app, we will actively detect _theme the folder under the zip file, assuming there is a zip decompression, and delete the original zip file. Here we have extracted the resources.
Unzip folders such as the following:
Icon: Put icons resource: folder structure is ICON_RES_DRAWBLE-XHDMI
Wallpaper: Put is wallpaper 2 Zhang. One for the lock screen, one for the default main screen wallpaper
Preview: Put on the subject. Easy to access the theme market, to get the resources displayed to the user to see.
(The above topic package resources are all from the folder structure of the MIUI theme.) )
Demo Click Apply Theme: Replace icon Demo:
Because it's just a test, all the icons are just a few replacements. function is implemented. The next thing is just fine.
Tinkering with things.
(9) Change theme Theme APP demo principle and demo Launcher3