(9) Change theme Theme APP demo principle and demo Launcher3

Source: Internet
Author: User

First of all, my idea:

The logic for changing the icon inside the Luancher3 is as follows:

Check the app resource bundle first--database query--Other places to query icon

Therefore, we just need to get the icon code from the database forward to extract from the app resource bundle.


Come on, our external app simply adds an icon to the Launcher.db's icon field. Then notify the desktop to update the icon, you can complete the entire desktop icon automatic replacement effect.


Advantages of doing this:

With less code modifications, the theme app doesn't have to be associated with the Launcher3 desktop app. Equivalent to an external application.

(Front 8th I have slightly introduced the next Launcher3 content provider, need to write 2 permissions)


Specific ideas are relatively simple and clear. and realized.

There is a need 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 of the update launcher.db will be updated according to the ID of the app you previously acquired. 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 actually does not need to do, because when you take the second step, the update operation, when accessing the database, the desktop database registers the Observer listener database changes, then carries on the workspace icon the update. )




Topic Source: Miui Theme Resource Pack extracted:

The resource structure directory is as follows

Phone SD card root directory: _theme------------------The following are the theme packages in each ZIP format.

When we launch the theme app, it will automatically detect _theme the directory under the zip file, if there is a zip decompression, and delete the original zip file, where we have to extract resources.

Unzip the directory as follows:

Icon: Put icons resource: directory structure is ICON_RES_DRAWBLE-XHDMI

Wallpaper: Put is wallpaper 2, one for the lock screen, one for the default main screen wallpaper

Preview: Put the theme, easy to the theme of the market, to get the resources displayed to the user to see.


(The above topic package resources are from the directory 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 substitutions. The function is realized, and the thing behind it is good. Tinkering with things.





(9) Change theme Theme APP demo principle and demo Launcher3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.