blob: 2fee81c3d77d8677fa357229bdaf1e4f0cd7c6ce [file] [log] [blame]
Adam Cohen9211d422014-10-07 18:14:53 -07001package 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;
Adam Cohenc2d6e892014-10-16 09:49:24 -07009import android.view.ViewGroup;
Adam Cohen9211d422014-10-07 18:14:53 -070010
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();
Robert Kozikowski67c30862015-03-30 23:46:46 +010045 public void onTrimMemory(int level);
Adam Cohen9211d422014-10-07 18:14:53 -070046
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);
Winson Chung0f785722015-04-08 10:27:49 -070053 public void onAllAppsShown();
Adam Cohen9211d422014-10-07 18:14:53 -070054 public void bindAllApplications(ArrayList<AppInfo> apps);
55 public void onClickFolderIcon(View v);
56 public void onClickAppShortcut(View v);
57 public void onClickPagedViewIcon(View v);
58 public void onClickWallpaperPicker(View v);
59 public void onClickSettingsButton(View v);
60 public void onClickAddWidgetButton(View v);
61 public void onPageSwitch(View newPage, int newPageIndex);
62 public void onWorkspaceLockedChanged();
63 public void onDragStarted(View view);
64 public void onInteractionBegin();
65 public void onInteractionEnd();
66
67 /*
68 * Extension points for replacing the search experience
69 */
70 public boolean forceDisableVoiceButtonProxy();
71 public boolean providesSearch();
72 public boolean startSearch(String initialQuery, boolean selectInitialQuery,
73 Bundle appSearchData, Rect sourceBounds);
74 public void startVoice();
75 public boolean hasCustomContentToLeft();
76 public void populateCustomContentContainer();
77 public View getQsbBar();
78
79 /*
80 * Extensions points for adding / replacing some other aspects of the Launcher experience.
81 */
82 public Intent getFirstRunActivity();
83 public boolean hasFirstRunActivity();
84 public boolean hasDismissableIntroScreen();
85 public View getIntroScreen();
86 public boolean shouldMoveToDefaultScreenOnHomeIntent();
87 public boolean hasSettings();
88 public ComponentName getWallpaperPickerComponent();
89 public boolean overrideWallpaperDimensions();
90 public boolean isLauncherPreinstalled();
Winson Chung0f785722015-04-08 10:27:49 -070091 public boolean overrideAllAppsSearch();
Adam Cohen9211d422014-10-07 18:14:53 -070092
Adam Cohenc2d6e892014-10-16 09:49:24 -070093 /**
94 * Returning true will immediately result in a call to {@link #setLauncherOverlayView(ViewGroup,
95 * com.android.launcher3.Launcher.LauncherOverlayCallbacks)}.
96 *
97 * @return true if this launcher extension will provide an overlay
98 */
99 public boolean hasLauncherOverlay();
100
101 /**
102 * Handshake to establish an overlay relationship
103 *
Adam Cohena6d04922014-10-23 17:28:30 -0700104 * @param container Full screen overlay ViewGroup into which custom views can be placed.
Adam Cohenc2d6e892014-10-16 09:49:24 -0700105 * @param callbacks A set of callbacks provided by Launcher in relation to the overlay
106 * @return an interface used to make requests and notify the Launcher in relation to the overlay
107 */
Adam Cohena6d04922014-10-23 17:28:30 -0700108 public Launcher.LauncherOverlay setLauncherOverlayView(InsettableFrameLayout container,
Adam Cohenc2d6e892014-10-16 09:49:24 -0700109 Launcher.LauncherOverlayCallbacks callbacks);
110
Winson Chung0f785722015-04-08 10:27:49 -0700111 /**
112 * Sets the callbacks to allow any extensions to callback to the launcher.
113 *
114 * @param callbacks A set of callbacks to the Launcher, is actually a LauncherAppsCallback, but
115 * for implementation purposes is passed around as an object.
116 */
117 public void setLauncherAppsCallback(Object callbacks);
118
Adam Cohen9211d422014-10-07 18:14:53 -0700119}