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