blob: 89eef60ad17b2da2529d3117f8d8c74badf7cafa [file] [log] [blame]
Adam Cohen9211d422014-10-07 18:14:53 -07001package com.android.launcher3;
2
Adam Cohen9211d422014-10-07 18:14:53 -07003import android.content.Intent;
4import android.graphics.Rect;
5import android.os.Bundle;
6import android.view.Menu;
7import android.view.View;
Hyunyoung Songddec1c72016-04-12 18:32:04 -07008
Winson Chungef7f8742015-06-04 17:18:17 -07009import com.android.launcher3.allapps.AllAppsSearchBarController;
Hyunyoung Songaa953652016-04-19 18:30:24 -070010import com.android.launcher3.logging.UserEventDispatcher;
Winson Chung6b1c73f2015-06-18 11:38:42 -070011import com.android.launcher3.util.ComponentKey;
Adam Cohen9211d422014-10-07 18:14:53 -070012
13import java.io.FileDescriptor;
14import java.io.PrintWriter;
15import java.util.ArrayList;
Winson Chung4ac30062015-05-08 17:34:17 -070016import java.util.List;
Adam Cohen9211d422014-10-07 18:14:53 -070017
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);
Dave Hawkey3a43ed62015-06-26 10:27:47 -060043 public void onRequestPermissionsResult(int requestCode, String[] permissions,
44 int[] grantResults);
Adam Cohen9211d422014-10-07 18:14:53 -070045 public void onWindowFocusChanged(boolean hasFocus);
Sunny Goyalc86df472016-02-25 09:19:38 -080046 public void onAttachedToWindow();
47 public void onDetachedFromWindow();
Adam Cohen9211d422014-10-07 18:14:53 -070048 public boolean onPrepareOptionsMenu(Menu menu);
49 public void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args);
50 public void onHomeIntent();
51 public boolean handleBackPressed();
Robert Kozikowski67c30862015-03-30 23:46:46 +010052 public void onTrimMemory(int level);
Adam Cohen9211d422014-10-07 18:14:53 -070053
54 /*
55 * Extension points for providing custom behavior on certain user interactions.
56 */
57 public void onLauncherProviderChange();
58 public void finishBindingItems(final boolean upgradePath);
Adam Cohen9211d422014-10-07 18:14:53 -070059 public void bindAllApplications(ArrayList<AppInfo> apps);
Hyunyoung Songfbf19cc2016-02-19 12:14:47 -080060 public void onInteractionBegin();
61 public void onInteractionEnd();
62
Hyunyoung Songfbf19cc2016-02-19 12:14:47 -080063 @Deprecated
Adam Cohen9211d422014-10-07 18:14:53 -070064 public void onClickSettingsButton(View v);
Hyunyoung Songfbf19cc2016-02-19 12:14:47 -080065 @Deprecated
Adam Cohen9211d422014-10-07 18:14:53 -070066 public void onWorkspaceLockedChanged();
Adam Cohen9211d422014-10-07 18:14:53 -070067
Adam Cohen9211d422014-10-07 18:14:53 -070068 public boolean providesSearch();
69 public boolean startSearch(String initialQuery, boolean selectInitialQuery,
70 Bundle appSearchData, Rect sourceBounds);
Adam Cohen9211d422014-10-07 18:14:53 -070071 public boolean hasCustomContentToLeft();
72 public void populateCustomContentContainer();
73 public View getQsbBar();
Tony Wickham775455c2015-10-16 09:49:32 -070074 public Bundle getAdditionalSearchWidgetOptions();
Adam Cohen9211d422014-10-07 18:14:53 -070075
76 /*
77 * Extensions points for adding / replacing some other aspects of the Launcher experience.
78 */
Hyunyoung Songaa953652016-04-19 18:30:24 -070079 public UserEventDispatcher getUserEventDispatcher();
Adam Cohen9211d422014-10-07 18:14:53 -070080 public Intent getFirstRunActivity();
81 public boolean hasFirstRunActivity();
82 public boolean hasDismissableIntroScreen();
83 public View getIntroScreen();
84 public boolean shouldMoveToDefaultScreenOnHomeIntent();
85 public boolean hasSettings();
Winson Chungef7f8742015-06-04 17:18:17 -070086 public AllAppsSearchBarController getAllAppsSearchBarController();
Winson Chung6b1c73f2015-06-18 11:38:42 -070087 public List<ComponentKey> getPredictedApps();
Tony Wickham55616cd2015-09-23 14:55:17 -070088 public static final int SEARCH_BAR_HEIGHT_NORMAL = 0, SEARCH_BAR_HEIGHT_TALL = 1;
89 /** Must return one of {@link #SEARCH_BAR_HEIGHT_NORMAL} or {@link #SEARCH_BAR_HEIGHT_TALL} */
90 public int getSearchBarHeight();
Adam Cohen9211d422014-10-07 18:14:53 -070091
Adam Cohenc2d6e892014-10-16 09:49:24 -070092 /**
Jun Mukai8af0cd82015-05-12 12:32:12 -070093 * Sets the callbacks to allow reacting the actions of search overlays of the launcher.
94 *
95 * @param callbacks A set of callbacks to the Launcher, is actually a LauncherSearchCallback,
96 * but for implementation purposes is passed around as an object.
97 */
98 public void setLauncherSearchCallback(Object callbacks);
Adam Cohen9211d422014-10-07 18:14:53 -070099}