OSDN Git Service

Animate discovery bounce for all apps pull up interaction
[android-x86/packages-apps-Launcher3.git] / src / com / android / launcher3 / LauncherCallbacks.java
1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package com.android.launcher3;
18
19 import android.content.Intent;
20 import android.graphics.Rect;
21 import android.os.Bundle;
22 import android.view.Menu;
23 import android.view.View;
24
25 import com.android.launcher3.allapps.AllAppsSearchBarController;
26 import com.android.launcher3.logging.UserEventDispatcher;
27 import com.android.launcher3.util.ComponentKey;
28
29 import java.io.FileDescriptor;
30 import java.io.PrintWriter;
31 import java.util.ArrayList;
32 import java.util.List;
33
34 /**
35  * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks
36  * in order to add additional functionality. Some of these are very general, and give extending
37  * classes the ability to react to Activity life-cycle or specific user interactions. Others
38  * are more specific and relate to replacing parts of the application, for example, the search
39  * interface or the wallpaper picker.
40  */
41 public interface LauncherCallbacks {
42
43     /*
44      * Activity life-cycle methods. These methods are triggered after
45      * the code in the corresponding Launcher method is executed.
46      */
47     public void preOnCreate();
48     public void onCreate(Bundle savedInstanceState);
49     public void preOnResume();
50     public void onResume();
51     public void onStart();
52     public void onStop();
53     public void onPause();
54     public void onDestroy();
55     public void onSaveInstanceState(Bundle outState);
56     public void onPostCreate(Bundle savedInstanceState);
57     public void onNewIntent(Intent intent);
58     public void onActivityResult(int requestCode, int resultCode, Intent data);
59     public void onRequestPermissionsResult(int requestCode, String[] permissions,
60             int[] grantResults);
61     public void onWindowFocusChanged(boolean hasFocus);
62     public void onAttachedToWindow();
63     public void onDetachedFromWindow();
64     public boolean onPrepareOptionsMenu(Menu menu);
65     public void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args);
66     public void onHomeIntent();
67     public boolean handleBackPressed();
68     public void onTrimMemory(int level);
69
70     /*
71      * Extension points for providing custom behavior on certain user interactions.
72      */
73     public void onLauncherProviderChange();
74     public void finishBindingItems(final boolean upgradePath);
75     public void bindAllApplications(ArrayList<AppInfo> apps);
76     public void onInteractionBegin();
77     public void onInteractionEnd();
78
79     @Deprecated
80     public void onWorkspaceLockedChanged();
81
82     public boolean providesSearch();
83     public boolean startSearch(String initialQuery, boolean selectInitialQuery,
84             Bundle appSearchData, Rect sourceBounds);
85     public boolean hasCustomContentToLeft();
86     public void populateCustomContentContainer();
87     public View getQsbBar();
88     public Bundle getAdditionalSearchWidgetOptions();
89
90     /*
91      * Extensions points for adding / replacing some other aspects of the Launcher experience.
92      */
93     public UserEventDispatcher getUserEventDispatcher();
94     public Intent getFirstRunActivity();
95     public boolean hasFirstRunActivity();
96     public boolean hasDismissableIntroScreen();
97     public View getIntroScreen();
98     public boolean shouldMoveToDefaultScreenOnHomeIntent();
99     public boolean hasSettings();
100     public AllAppsSearchBarController getAllAppsSearchBarController();
101     public List<ComponentKey> getPredictedApps();
102     public static final int SEARCH_BAR_HEIGHT_NORMAL = 0, SEARCH_BAR_HEIGHT_TALL = 1;
103     /** Must return one of {@link #SEARCH_BAR_HEIGHT_NORMAL} or {@link #SEARCH_BAR_HEIGHT_TALL} */
104     public int getSearchBarHeight();
105
106     /**
107      * Sets the callbacks to allow reacting the actions of search overlays of the launcher.
108      *
109      * @param callbacks A set of callbacks to the Launcher, is actually a LauncherSearchCallback,
110      *                  but for implementation purposes is passed around as an object.
111      */
112     public void setLauncherSearchCallback(Object callbacks);
113
114     public boolean shouldShowDiscoveryBounce();
115 }