Android4.4 Application Analysis--Modify LAUNCHER3 application to fit single wallpaper

Source: Internet
Author: User

Launcher3 Wallpaper Specifications By default is: wallpaper height = screen height, wallpaper broadband = screen width * twice times

Android4.4 Wallpaper information is stored in the/data/system/users/0/directory, Wallpapermanagerservice startup, will generate the following two files in the/data/system/users/0/directory:

    Static final String wallpaper = "wallpaper";   Set the wallpaper picture, generally for the JPEG format    static final String wallpaper_info = "Wallpaper_info.xml";    Contains the specifications of the wallpaper: high, wide

Wallpaper_info.xml can view the Wallpapermanagerservice's loadsettingslocked () method. Below iswallpapermanagerservice start sequence diagram, do not explain the use of friends can look at the source:


Below we should in the Launcher3 the high and wide information of the wallpaper to the above mentioned Wallpaper_info.xml file (of course the time to write the action or in the framework), Launcher3 just to its own needs of the wallpaper high, Wide write wallpaper_info.xml, You use Go desktop, that must be high and wide on the Go desktop setting.

1. Find the right position is very simple, is Launcher3 Wallpapercropactivity.java file Getdefaultwallpapersize ().

    Static protected point Getdefaultwallpapersize (Resources res, WindowManager windowmanager) {Point mindims = NE        W Point ();        Point maxdims = new Point ();        Windowmanager.getdefaultdisplay (). Getcurrentsizerange (Mindims, maxdims);        int Maxdim = Math.max (maxdims.x, MAXDIMS.Y);        int Mindim = Math.max (mindims.x, MINDIMS.Y); if (Android.os.Build.VERSION.SDK_INT >= Android.os.Build.VERSION_CODES.            JELLY_BEAN_MR1) {Point realsize = new Point ();            Windowmanager.getdefaultdisplay (). Getrealsize (Realsize);            Maxdim = Math.max (realsize.x, realsize.y);        Mindim = Math.min (realsize.x, realsize.y); }//We need to ensure that there are enough extra space in the wallpaper//for the intended//Paral        LAX effects final int defaultwidth, defaultheight;            if (Isscreenlarge (res)) {defaultwidth = (int) (Maxdim * Wallpapertraveltoscreenwidthratio (Maxdim, Mindim)); DefaulTheight = Maxdim;            } else {defaultwidth = Math.max ((int) (Mindim * wallpaper_screens_span), Maxdim);        DefaultHeight = Maxdim;    } return new Point (DefaultWidth, defaultheight); }

DefaultWidth and DefaultHeight are respectively assigned to the width and height of the screen.


2. Cropimageandsetwallpaper () method, this method should be to set the wallpaper, according to the wallpaper specifications to cut the picture used, the same method as above.


3. to prevent Launcher3 slide, slide the wallpaper: In Workspace.java, note the call of the Updateoffset () method (there are two).



Please correct me if there is any wrong place to be continued.




Android4.4 Application Analysis--Modify LAUNCHER3 application to fit single wallpaper

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.