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; |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 20 | import android.os.Bundle; |
| 21 | import android.view.Menu; |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 22 | |
| 23 | import java.io.FileDescriptor; |
| 24 | import java.io.PrintWriter; |
| 25 | import java.util.ArrayList; |
| 26 | |
| 27 | /** |
| 28 | * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks |
| 29 | * in order to add additional functionality. Some of these are very general, and give extending |
| 30 | * classes the ability to react to Activity life-cycle or specific user interactions. Others |
| 31 | * are more specific and relate to replacing parts of the application, for example, the search |
| 32 | * interface or the wallpaper picker. |
| 33 | */ |
| 34 | public interface LauncherCallbacks { |
| 35 | |
| 36 | /* |
| 37 | * Activity life-cycle methods. These methods are triggered after |
| 38 | * the code in the corresponding Launcher method is executed. |
| 39 | */ |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 40 | void onCreate(Bundle savedInstanceState); |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 41 | void onResume(); |
| 42 | void onStart(); |
| 43 | void onStop(); |
| 44 | void onPause(); |
| 45 | void onDestroy(); |
| 46 | void onSaveInstanceState(Bundle outState); |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 47 | void onActivityResult(int requestCode, int resultCode, Intent data); |
| 48 | void onRequestPermissionsResult(int requestCode, String[] permissions, |
Dave Hawkey | 3a43ed6 | 2015-06-26 10:27:47 -0600 | [diff] [blame] | 49 | int[] grantResults); |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 50 | void onAttachedToWindow(); |
| 51 | void onDetachedFromWindow(); |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 52 | void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args); |
Sunny Goyal | 8546213 | 2018-04-24 11:39:37 -0700 | [diff] [blame^] | 53 | void onHomeIntent(boolean internalStateHandled); |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 54 | boolean handleBackPressed(); |
| 55 | void onTrimMemory(int level); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 56 | |
| 57 | /* |
| 58 | * Extension points for providing custom behavior on certain user interactions. |
| 59 | */ |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 60 | void onLauncherProviderChange(); |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 61 | void bindAllApplications(ArrayList<AppInfo> apps); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 62 | |
Sunny Goyal | 6f28e71 | 2016-09-13 14:19:29 -0700 | [diff] [blame] | 63 | /** |
| 64 | * Starts a search with {@param initialQuery}. Return false if search was not started. |
| 65 | */ |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 66 | boolean startSearch( |
Sunny Goyal | 6f28e71 | 2016-09-13 14:19:29 -0700 | [diff] [blame] | 67 | String initialQuery, boolean selectInitialQuery, Bundle appSearchData); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 68 | |
| 69 | /* |
| 70 | * Extensions points for adding / replacing some other aspects of the Launcher experience. |
| 71 | */ |
Mario Bertschler | c06af33 | 2017-03-28 12:23:22 -0700 | [diff] [blame] | 72 | boolean hasSettings(); |
Sunny Goyal | 3bac2c2 | 2018-02-07 14:44:05 -0800 | [diff] [blame] | 73 | |
| 74 | /** |
| 75 | * Called when launcher integrated quickstep and some quickstep gesture started. It can be |
| 76 | * called multiple times for a single gesture an UI or background thread. |
| 77 | * |
| 78 | * @param isVisible if Launcher was visible when the gesture started. |
| 79 | */ |
| 80 | void onQuickstepGestureStarted(boolean isVisible); |
Adam Cohen | 9211d42 | 2014-10-07 18:14:53 -0700 | [diff] [blame] | 81 | } |