Andorid Launcher program code analysis

Source: Internet
Author: User

Launcher is a desktop system of the Android system. It is a very important and complex program. Here we will analyze its code and hope to serve as a reference.


1. What is Launcher? Live folder, widget, shortcut, wallpaper, see onActivityResult

2. the UI is divided into three parts: workspace, slibingdrawer, and deletezone.

3. Menu: see onCreateOptionsMenu in launcher. java.

4. the launcher class is an activity that follows the lifecycle of the activity.

5. There are many resource files. Here we only focus on Layout-related files.



Main line of code analysis:


1. Understand the class

2. Understand the relationship between classes




Classes in the Launcher project:




AddAdapter: Four listitems are maintained: live fold, widget, shortcut, and wallpaper. This list is displayed when you press the tab on the desktop.

Allcategory gridview: display the APP Mesh

ApplicationInfo: A launched Application

ApplicationsAdapter: the adapter of the gridview

BubbleTextView: a custom textview

CellLayout: screen gridded

DeleteZone: Part of the UI

DragController, dragscroroller, dragsource, and droptarget: drag and drop operations are supported.

DragLayer: Internal viewgroup that supports drag and drop

FastBitmapDrawable: Tool

Folder: Set of Icons

FolderIcon: the icon that appears in workspace represents a folder.

FolderInfo: ItemInfo subclass

HandleView: An imageview.

InstallShortcutReceiver, UninstallShortcutReceiver: A broadcastrecier

ItemInfo: indicates an Item in the Launcher (for example, folder)

Launcher: Main Window of the Launcher Program

LauncherApplication: set parameters in VM

LauncherAppWidgetHost, LauncherAppWidgetHostView,: Widget-related

LauncherModel: M in MVC

LauncherProvider: A contentprovider that stores information for Launcher.

LauncherSettings: Set related tools

LiveFolder, LiveFolderAdapter, LiveFolderIcon, LiveFolderInfo: livefolder

Search: Search

UserFolder, UserFolderInfo: folder contains applications, shortcuts

Utilities: gadgets

WallpaperChooser: select the activity of wallpaper.

Workspace: an area on the screen

Widget: indicates the started widget instance, such as search



For more information about the class relationships in Launcher, see (due to limited space, we cannot draw all the relationships one by one ).





Summary

1) The Launcher implements the MVC mode (M: launchermode, V: draglayer, C: launcher, you can get the details of Launcher's management of each component (such as the implementation of drag ).

2) if you go deep into the implementation details at the beginning, you will find a great deal of experience, and it is difficult to have a clear direction.




This article from the CSDN blog, reproduced please indicate the source: http://blog.csdn.net/fly123456/archive/2010/10/12/5935589.aspx

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.