LauncherCallbacks.java revision 67c3086163593db47e57b8cf4fcb034334374000
1package com.android.launcher3; 2 3import android.content.ComponentName; 4import android.content.Intent; 5import android.graphics.Rect; 6import android.os.Bundle; 7import android.view.Menu; 8import android.view.View; 9import android.view.ViewGroup; 10 11import java.io.FileDescriptor; 12import java.io.PrintWriter; 13import java.util.ArrayList; 14 15/** 16 * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks 17 * in order to add additional functionality. Some of these are very general, and give extending 18 * classes the ability to react to Activity life-cycle or specific user interactions. Others 19 * are more specific and relate to replacing parts of the application, for example, the search 20 * interface or the wallpaper picker. 21 */ 22public interface LauncherCallbacks { 23 24 /* 25 * Activity life-cycle methods. These methods are triggered after 26 * the code in the corresponding Launcher method is executed. 27 */ 28 public void preOnCreate(); 29 public void onCreate(Bundle savedInstanceState); 30 public void preOnResume(); 31 public void onResume(); 32 public void onStart(); 33 public void onStop(); 34 public void onPause(); 35 public void onDestroy(); 36 public void onSaveInstanceState(Bundle outState); 37 public void onPostCreate(Bundle savedInstanceState); 38 public void onNewIntent(Intent intent); 39 public void onActivityResult(int requestCode, int resultCode, Intent data); 40 public void onWindowFocusChanged(boolean hasFocus); 41 public boolean onPrepareOptionsMenu(Menu menu); 42 public void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args); 43 public void onHomeIntent(); 44 public boolean handleBackPressed(); 45 public void onTrimMemory(int level); 46 47 /* 48 * Extension points for providing custom behavior on certain user interactions. 49 */ 50 public void onLauncherProviderChange(); 51 public void finishBindingItems(final boolean upgradePath); 52 public void onClickAllAppsButton(View v); 53 public void bindAllApplications(ArrayList<AppInfo> apps); 54 public void onClickFolderIcon(View v); 55 public void onClickAppShortcut(View v); 56 public void onClickPagedViewIcon(View v); 57 public void onClickWallpaperPicker(View v); 58 public void onClickSettingsButton(View v); 59 public void onClickAddWidgetButton(View v); 60 public void onPageSwitch(View newPage, int newPageIndex); 61 public void onWorkspaceLockedChanged(); 62 public void onDragStarted(View view); 63 public void onInteractionBegin(); 64 public void onInteractionEnd(); 65 66 /* 67 * Extension points for replacing the search experience 68 */ 69 public boolean forceDisableVoiceButtonProxy(); 70 public boolean providesSearch(); 71 public boolean startSearch(String initialQuery, boolean selectInitialQuery, 72 Bundle appSearchData, Rect sourceBounds); 73 public void startVoice(); 74 public boolean hasCustomContentToLeft(); 75 public void populateCustomContentContainer(); 76 public View getQsbBar(); 77 78 /* 79 * Extensions points for adding / replacing some other aspects of the Launcher experience. 80 */ 81 public Intent getFirstRunActivity(); 82 public boolean hasFirstRunActivity(); 83 public boolean hasDismissableIntroScreen(); 84 public View getIntroScreen(); 85 public boolean shouldMoveToDefaultScreenOnHomeIntent(); 86 public boolean hasSettings(); 87 public ComponentName getWallpaperPickerComponent(); 88 public boolean overrideWallpaperDimensions(); 89 public boolean isLauncherPreinstalled(); 90 91 /** 92 * Returning true will immediately result in a call to {@link #setLauncherOverlayView(ViewGroup, 93 * com.android.launcher3.Launcher.LauncherOverlayCallbacks)}. 94 * 95 * @return true if this launcher extension will provide an overlay 96 */ 97 public boolean hasLauncherOverlay(); 98 99 /** 100 * Handshake to establish an overlay relationship 101 * 102 * @param container Full screen overlay ViewGroup into which custom views can be placed. 103 * @param callbacks A set of callbacks provided by Launcher in relation to the overlay 104 * @return an interface used to make requests and notify the Launcher in relation to the overlay 105 */ 106 public Launcher.LauncherOverlay setLauncherOverlayView(InsettableFrameLayout container, 107 Launcher.LauncherOverlayCallbacks callbacks); 108 109} 110