Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 1 | package com.android.launcher3; |
| 2 | |
| 3 | import android.content.ComponentName; |
| 4 | import android.content.Intent; |
| 5 | import android.graphics.Rect; |
| 6 | import android.os.Bundle; |
| 7 | import android.view.Menu; |
| 8 | import android.view.View; |
Adam Cohen | c2d6e89 | 2014-10-16 09:49:24 -0700 | [diff] [blame] | 9 | import android.view.ViewGroup; |
Winson Chung | ef7f874 | 2015-06-04 17:18:17 -0700 | [diff] [blame] | 10 | import com.android.launcher3.allapps.AllAppsSearchBarController; |
Hyunyoung Song | 8fd5e93 | 2016-03-08 16:55:47 -0800 | [diff] [blame] | 11 | import com.android.launcher3.logging.UserEventLogger; |
Winson Chung | 6b1c73f | 2015-06-18 11:38:42 -0700 | [diff] [blame] | 12 | import com.android.launcher3.util.ComponentKey; |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 13 | |
| 14 | import java.io.FileDescriptor; |
| 15 | import java.io.PrintWriter; |
| 16 | import java.util.ArrayList; |
Winson Chung | 4ac3006 | 2015-05-08 17:34:17 -0700 | [diff] [blame] | 17 | import java.util.List; |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks |
| 21 | * in order to add additional functionality. Some of these are very general, and give extending |
| 22 | * classes the ability to react to Activity life-cycle or specific user interactions. Others |
| 23 | * are more specific and relate to replacing parts of the application, for example, the search |
| 24 | * interface or the wallpaper picker. |
| 25 | */ |
| 26 | public interface LauncherCallbacks { |
| 27 | |
| 28 | /* |
| 29 | * Activity life-cycle methods. These methods are triggered after |
| 30 | * the code in the corresponding Launcher method is executed. |
| 31 | */ |
| 32 | public void preOnCreate(); |
| 33 | public void onCreate(Bundle savedInstanceState); |
| 34 | public void preOnResume(); |
| 35 | public void onResume(); |
| 36 | public void onStart(); |
| 37 | public void onStop(); |
| 38 | public void onPause(); |
| 39 | public void onDestroy(); |
| 40 | public void onSaveInstanceState(Bundle outState); |
| 41 | public void onPostCreate(Bundle savedInstanceState); |
| 42 | public void onNewIntent(Intent intent); |
| 43 | public void onActivityResult(int requestCode, int resultCode, Intent data); |
Dave Hawkey | 3a43ed6 | 2015-06-26 10:27:47 -0600 | [diff] [blame] | 44 | public void onRequestPermissionsResult(int requestCode, String[] permissions, |
| 45 | int[] grantResults); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 46 | public void onWindowFocusChanged(boolean hasFocus); |
Sunny Goyal | c86df47 | 2016-02-25 09:19:38 -0800 | [diff] [blame] | 47 | public void onAttachedToWindow(); |
| 48 | public void onDetachedFromWindow(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 49 | public boolean onPrepareOptionsMenu(Menu menu); |
| 50 | public void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args); |
| 51 | public void onHomeIntent(); |
| 52 | public boolean handleBackPressed(); |
Robert Kozikowski | 67c3086 | 2015-03-30 23:46:46 +0100 | [diff] [blame] | 53 | public void onTrimMemory(int level); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 54 | |
| 55 | /* |
| 56 | * Extension points for providing custom behavior on certain user interactions. |
| 57 | */ |
| 58 | public void onLauncherProviderChange(); |
| 59 | public void finishBindingItems(final boolean upgradePath); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 60 | public void bindAllApplications(ArrayList<AppInfo> apps); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 61 | public void onInteractionBegin(); |
| 62 | public void onInteractionEnd(); |
| 63 | |
| 64 | /** |
| 65 | * Extension points for Gel Logging. |
| 66 | */ |
| 67 | @Deprecated |
| 68 | public void onClickAllAppsButton(View v); |
| 69 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 70 | public void onClickFolderIcon(View v); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 71 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 72 | public void onClickAppShortcut(View v); |
Winson Chung | 8f1eff7 | 2015-05-28 17:33:40 -0700 | [diff] [blame] | 73 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 74 | public void onClickPagedViewIcon(View v); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 75 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 76 | public void onClickWallpaperPicker(View v); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 77 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 78 | public void onClickSettingsButton(View v); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 79 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 80 | public void onClickAddWidgetButton(View v); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 81 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 82 | public void onPageSwitch(View newPage, int newPageIndex); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 83 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 84 | public void onWorkspaceLockedChanged(); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 85 | @Deprecated |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 86 | public void onDragStarted(View view); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 87 | |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 88 | public boolean providesSearch(); |
| 89 | public boolean startSearch(String initialQuery, boolean selectInitialQuery, |
| 90 | Bundle appSearchData, Rect sourceBounds); |
Sunny Goyal | c42ac0a | 2016-02-18 15:31:55 -0800 | [diff] [blame] | 91 | @Deprecated |
Winson Chung | bedf923 | 2015-07-10 12:38:30 -0700 | [diff] [blame] | 92 | public boolean startSearchFromAllApps(String query); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 93 | public boolean hasCustomContentToLeft(); |
| 94 | public void populateCustomContentContainer(); |
| 95 | public View getQsbBar(); |
Tony Wickham | 775455c | 2015-10-16 09:49:32 -0700 | [diff] [blame] | 96 | public Bundle getAdditionalSearchWidgetOptions(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 97 | |
| 98 | /* |
| 99 | * Extensions points for adding / replacing some other aspects of the Launcher experience. |
| 100 | */ |
Hyunyoung Song | 8fd5e93 | 2016-03-08 16:55:47 -0800 | [diff] [blame] | 101 | public UserEventLogger getLogger(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 102 | public Intent getFirstRunActivity(); |
| 103 | public boolean hasFirstRunActivity(); |
| 104 | public boolean hasDismissableIntroScreen(); |
| 105 | public View getIntroScreen(); |
| 106 | public boolean shouldMoveToDefaultScreenOnHomeIntent(); |
| 107 | public boolean hasSettings(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 108 | public boolean overrideWallpaperDimensions(); |
| 109 | public boolean isLauncherPreinstalled(); |
Winson Chung | ef7f874 | 2015-06-04 17:18:17 -0700 | [diff] [blame] | 110 | public AllAppsSearchBarController getAllAppsSearchBarController(); |
Winson Chung | 6b1c73f | 2015-06-18 11:38:42 -0700 | [diff] [blame] | 111 | public List<ComponentKey> getPredictedApps(); |
Tony Wickham | 55616cd | 2015-09-23 14:55:17 -0700 | [diff] [blame] | 112 | public static final int SEARCH_BAR_HEIGHT_NORMAL = 0, SEARCH_BAR_HEIGHT_TALL = 1; |
| 113 | /** Must return one of {@link #SEARCH_BAR_HEIGHT_NORMAL} or {@link #SEARCH_BAR_HEIGHT_TALL} */ |
| 114 | public int getSearchBarHeight(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 115 | |
Adam Cohen | c2d6e89 | 2014-10-16 09:49:24 -0700 | [diff] [blame] | 116 | /** |
Jun Mukai | 8af0cd8 | 2015-05-12 12:32:12 -0700 | [diff] [blame] | 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); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 123 | } |