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