blob: e0cfa27ba449f59364d5031b2542e1ff21240149 [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();
45
46 /*
47 * Extension points for providing custom behavior on certain user interactions.
48 */
49 public void onLauncherProviderChange();
50 public void finishBindingItems(final boolean upgradePath);
51 public void onClickAllAppsButton(View v);
52 public void bindAllApplications(ArrayList<AppInfo> apps);
53 public void onClickFolderIcon(View v);
54 public void onClickAppShortcut(View v);
55 public void onClickPagedViewIcon(View v);
56 public void onClickWallpaperPicker(View v);
57 public void onClickSettingsButton(View v);
58 public void onClickAddWidgetButton(View v);
59 public void onPageSwitch(View newPage, int newPageIndex);
60 public void onWorkspaceLockedChanged();
61 public void onDragStarted(View view);
62 public void onInteractionBegin();
63 public void onInteractionEnd();
64
65 /*
66 * Extension points for replacing the search experience
67 */
68 public boolean forceDisableVoiceButtonProxy();
69 public boolean providesSearch();
70 public boolean startSearch(String initialQuery, boolean selectInitialQuery,
71 Bundle appSearchData, Rect sourceBounds);
72 public void startVoice();
73 public boolean hasCustomContentToLeft();
74 public void populateCustomContentContainer();
75 public View getQsbBar();
76
77 /*
78 * Extensions points for adding / replacing some other aspects of the Launcher experience.
79 */
80 public Intent getFirstRunActivity();
81 public boolean hasFirstRunActivity();
82 public boolean hasDismissableIntroScreen();
83 public View getIntroScreen();
84 public boolean shouldMoveToDefaultScreenOnHomeIntent();
85 public boolean hasSettings();
86 public ComponentName getWallpaperPickerComponent();
87 public boolean overrideWallpaperDimensions();
88 public boolean isLauncherPreinstalled();
89
Adam Cohenc2d6e892014-10-16 09:49:24 -070090 /**
91 * Returning true will immediately result in a call to {@link #setLauncherOverlayView(ViewGroup,
92 * com.android.launcher3.Launcher.LauncherOverlayCallbacks)}.
93 *
94 * @return true if this launcher extension will provide an overlay
95 */
96 public boolean hasLauncherOverlay();
97
98 /**
99 * Handshake to establish an overlay relationship
100 *
101 * @param overlayView Full screen overlay ViewGroup into which custom views can be placed.
102 * @param callbacks A set of callbacks provided by Launcher in relation to the overlay
103 * @return an interface used to make requests and notify the Launcher in relation to the overlay
104 */
105 public Launcher.LauncherOverlay setLauncherOverlayView(ViewGroup overlayView,
106 Launcher.LauncherOverlayCallbacks callbacks);
107
Adam Cohen9211d422014-10-07 18:14:53 -0700108}