Adam Cohen | 79d90c5 | 2016-04-22 13:29:20 -0700 | [diff] [blame] | 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 | |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 17 | package com.android.launcher3; |
| 18 | |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 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; |
Hyunyoung Song | ddec1c7 | 2016-04-12 18:32:04 -0700 | [diff] [blame] | 24 | |
Winson Chung | ef7f874 | 2015-06-04 17:18:17 -0700 | [diff] [blame] | 25 | import com.android.launcher3.allapps.AllAppsSearchBarController; |
Hyunyoung Song | aa95365 | 2016-04-19 18:30:24 -0700 | [diff] [blame] | 26 | import com.android.launcher3.logging.UserEventDispatcher; |
Winson Chung | 6b1c73f | 2015-06-18 11:38:42 -0700 | [diff] [blame] | 27 | import com.android.launcher3.util.ComponentKey; |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 28 | |
| 29 | import java.io.FileDescriptor; |
| 30 | import java.io.PrintWriter; |
| 31 | import java.util.ArrayList; |
Winson Chung | 4ac3006 | 2015-05-08 17:34:17 -0700 | [diff] [blame] | 32 | import java.util.List; |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 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); |
Dave Hawkey | 3a43ed6 | 2015-06-26 10:27:47 -0600 | [diff] [blame] | 59 | public void onRequestPermissionsResult(int requestCode, String[] permissions, |
| 60 | int[] grantResults); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 61 | public void onWindowFocusChanged(boolean hasFocus); |
Sunny Goyal | c86df47 | 2016-02-25 09:19:38 -0800 | [diff] [blame] | 62 | public void onAttachedToWindow(); |
| 63 | public void onDetachedFromWindow(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 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(); |
Robert Kozikowski | 67c3086 | 2015-03-30 23:46:46 +0100 | [diff] [blame] | 68 | public void onTrimMemory(int level); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 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); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 75 | public void bindAllApplications(ArrayList<AppInfo> apps); |
Hyunyoung Song | fbf19cc | 2016-02-19 12:14:47 -0800 | [diff] [blame] | 76 | public void onInteractionBegin(); |
| 77 | public void onInteractionEnd(); |
| 78 | |
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 onWorkspaceLockedChanged(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 81 | |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 82 | public boolean providesSearch(); |
| 83 | public boolean startSearch(String initialQuery, boolean selectInitialQuery, |
| 84 | Bundle appSearchData, Rect sourceBounds); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 85 | public boolean hasCustomContentToLeft(); |
| 86 | public void populateCustomContentContainer(); |
| 87 | public View getQsbBar(); |
Tony Wickham | 775455c | 2015-10-16 09:49:32 -0700 | [diff] [blame] | 88 | public Bundle getAdditionalSearchWidgetOptions(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 89 | |
| 90 | /* |
| 91 | * Extensions points for adding / replacing some other aspects of the Launcher experience. |
| 92 | */ |
Hyunyoung Song | aa95365 | 2016-04-19 18:30:24 -0700 | [diff] [blame] | 93 | public UserEventDispatcher getUserEventDispatcher(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 94 | public Intent getFirstRunActivity(); |
| 95 | public boolean hasFirstRunActivity(); |
| 96 | public boolean hasDismissableIntroScreen(); |
| 97 | public View getIntroScreen(); |
| 98 | public boolean shouldMoveToDefaultScreenOnHomeIntent(); |
| 99 | public boolean hasSettings(); |
Winson Chung | ef7f874 | 2015-06-04 17:18:17 -0700 | [diff] [blame] | 100 | public AllAppsSearchBarController getAllAppsSearchBarController(); |
Winson Chung | 6b1c73f | 2015-06-18 11:38:42 -0700 | [diff] [blame] | 101 | public List<ComponentKey> getPredictedApps(); |
Tony Wickham | 55616cd | 2015-09-23 14:55:17 -0700 | [diff] [blame] | 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(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 105 | |
Adam Cohen | c2d6e89 | 2014-10-16 09:49:24 -0700 | [diff] [blame] | 106 | /** |
Jun Mukai | 8af0cd8 | 2015-05-12 12:32:12 -0700 | [diff] [blame] | 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); |
Hyunyoung Song | c001cf5 | 2016-07-21 17:32:43 -0700 | [diff] [blame^] | 113 | |
| 114 | public boolean shouldShowDiscoveryBounce(); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 115 | } |