The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 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 android.view; |
| 18 | |
Aurimas Liutikas | 67e2ae8 | 2016-10-11 18:17:42 -0700 | [diff] [blame] | 19 | import static android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; |
| 20 | |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 21 | import android.annotation.ColorInt; |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 22 | import android.annotation.DrawableRes; |
| 23 | import android.annotation.IdRes; |
| 24 | import android.annotation.LayoutRes; |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 25 | import android.annotation.NonNull; |
| 26 | import android.annotation.Nullable; |
Tor Norbye | 417ee5b | 2015-03-10 20:57:37 -0700 | [diff] [blame] | 27 | import android.annotation.StyleRes; |
Filip Gruszczynski | fe56835 | 2015-01-05 10:41:29 -0800 | [diff] [blame] | 28 | import android.annotation.SystemApi; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 29 | import android.content.Context; |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 30 | import android.content.pm.ActivityInfo; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 31 | import android.content.res.Configuration; |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 32 | import android.content.res.Resources; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 33 | import android.content.res.TypedArray; |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 34 | import android.graphics.PixelFormat; |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 35 | import android.graphics.Rect; |
Filip Gruszczynski | 14418da | 2015-10-04 16:43:48 -0700 | [diff] [blame] | 36 | import android.graphics.drawable.Drawable; |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 37 | import android.media.session.MediaController; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | import android.net.Uri; |
| 39 | import android.os.Bundle; |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 40 | import android.os.Handler; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 41 | import android.os.IBinder; |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 42 | import android.os.RemoteException; |
Romain Guy | 9622e20 | 2011-09-29 16:37:27 -0700 | [diff] [blame] | 43 | import android.os.SystemProperties; |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 44 | import android.transition.Scene; |
George Mount | e180337 | 2014-02-26 19:00:52 +0000 | [diff] [blame] | 45 | import android.transition.Transition; |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 46 | import android.transition.TransitionManager; |
svetoslavganov | 75986cf | 2009-05-14 22:28:01 -0700 | [diff] [blame] | 47 | import android.view.accessibility.AccessibilityEvent; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 48 | |
Clara Bayarri | 75e0979 | 2015-07-29 16:20:40 +0100 | [diff] [blame] | 49 | import java.util.List; |
| 50 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 51 | /** |
| 52 | * Abstract base class for a top-level window look and behavior policy. An |
| 53 | * instance of this class should be used as the top-level view added to the |
| 54 | * window manager. It provides standard UI policies such as a background, title |
| 55 | * area, default key processing, etc. |
| 56 | * |
| 57 | * <p>The only existing implementation of this abstract class is |
Jorim Jaggi | b10e33f | 2015-02-04 21:57:40 +0100 | [diff] [blame] | 58 | * android.view.PhoneWindow, which you should instantiate when needing a |
| 59 | * Window. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 60 | */ |
| 61 | public abstract class Window { |
| 62 | /** Flag for the "options panel" feature. This is enabled by default. */ |
| 63 | public static final int FEATURE_OPTIONS_PANEL = 0; |
| 64 | /** Flag for the "no title" feature, turning off the title at the top |
| 65 | * of the screen. */ |
| 66 | public static final int FEATURE_NO_TITLE = 1; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 67 | |
| 68 | /** |
| 69 | * Flag for the progress indicator feature. |
| 70 | * |
| 71 | * @deprecated No longer supported starting in API 21. |
| 72 | */ |
| 73 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 74 | public static final int FEATURE_PROGRESS = 2; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 75 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 76 | /** Flag for having an icon on the left side of the title bar */ |
| 77 | public static final int FEATURE_LEFT_ICON = 3; |
| 78 | /** Flag for having an icon on the right side of the title bar */ |
| 79 | public static final int FEATURE_RIGHT_ICON = 4; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * Flag for indeterminate progress. |
| 83 | * |
| 84 | * @deprecated No longer supported starting in API 21. |
| 85 | */ |
| 86 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 87 | public static final int FEATURE_INDETERMINATE_PROGRESS = 5; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 88 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 89 | /** Flag for the context menu. This is enabled by default. */ |
| 90 | public static final int FEATURE_CONTEXT_MENU = 6; |
| 91 | /** Flag for custom title. You cannot combine this feature with other title features. */ |
| 92 | public static final int FEATURE_CUSTOM_TITLE = 7; |
Adam Powell | 33b9743 | 2010-04-20 10:01:14 -0700 | [diff] [blame] | 93 | /** |
| 94 | * Flag for enabling the Action Bar. |
| 95 | * This is enabled by default for some devices. The Action Bar |
| 96 | * replaces the title bar and provides an alternate location |
| 97 | * for an on-screen menu button on some devices. |
| 98 | */ |
Adam Powell | 5d27977 | 2010-07-27 16:34:07 -0700 | [diff] [blame] | 99 | public static final int FEATURE_ACTION_BAR = 8; |
| 100 | /** |
Adam Powell | 6b336f8 | 2010-08-10 20:13:01 -0700 | [diff] [blame] | 101 | * Flag for requesting an Action Bar that overlays window content. |
| 102 | * Normally an Action Bar will sit in the space above window content, but if this |
| 103 | * feature is requested along with {@link #FEATURE_ACTION_BAR} it will be layered over |
| 104 | * the window content itself. This is useful if you would like your app to have more control |
| 105 | * over how the Action Bar is displayed, such as letting application content scroll beneath |
| 106 | * an Action Bar with a transparent background or otherwise displaying a transparent/translucent |
| 107 | * Action Bar over application content. |
Dianne Hackborn | 3a3a6cf | 2012-03-26 10:24:04 -0700 | [diff] [blame] | 108 | * |
| 109 | * <p>This mode is especially useful with {@link View#SYSTEM_UI_FLAG_FULLSCREEN |
| 110 | * View.SYSTEM_UI_FLAG_FULLSCREEN}, which allows you to seamlessly hide the |
| 111 | * action bar in conjunction with other screen decorations. |
| 112 | * |
| 113 | * <p>As of {@link android.os.Build.VERSION_CODES#JELLY_BEAN}, when an |
| 114 | * ActionBar is in this mode it will adjust the insets provided to |
| 115 | * {@link View#fitSystemWindows(android.graphics.Rect) View.fitSystemWindows(Rect)} |
| 116 | * to include the content covered by the action bar, so you can do layout within |
| 117 | * that space. |
Adam Powell | 6b336f8 | 2010-08-10 20:13:01 -0700 | [diff] [blame] | 118 | */ |
| 119 | public static final int FEATURE_ACTION_BAR_OVERLAY = 9; |
| 120 | /** |
Adam Powell | 5d27977 | 2010-07-27 16:34:07 -0700 | [diff] [blame] | 121 | * Flag for specifying the behavior of action modes when an Action Bar is not present. |
| 122 | * If overlay is enabled, the action mode UI will be allowed to cover existing window content. |
| 123 | */ |
Adam Powell | 6b336f8 | 2010-08-10 20:13:01 -0700 | [diff] [blame] | 124 | public static final int FEATURE_ACTION_MODE_OVERLAY = 10; |
Adam Powell | 18e905f | 2013-10-24 14:27:48 -0700 | [diff] [blame] | 125 | /** |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 126 | * Flag for requesting a decoration-free window that is dismissed by swiping from the left. |
| 127 | */ |
| 128 | public static final int FEATURE_SWIPE_TO_DISMISS = 11; |
Will Haldean Brown | 568628d | 2014-03-04 15:25:43 -0800 | [diff] [blame] | 129 | /** |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 130 | * Flag for requesting that window content changes should be animated using a |
| 131 | * TransitionManager. |
Adam Powell | 18e905f | 2013-10-24 14:27:48 -0700 | [diff] [blame] | 132 | * |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 133 | * <p>The TransitionManager is set using |
| 134 | * {@link #setTransitionManager(android.transition.TransitionManager)}. If none is set, |
| 135 | * a default TransitionManager will be used.</p> |
Adam Powell | 18e905f | 2013-10-24 14:27:48 -0700 | [diff] [blame] | 136 | * |
| 137 | * @see #setContentView |
| 138 | */ |
Will Haldean Brown | 568628d | 2014-03-04 15:25:43 -0800 | [diff] [blame] | 139 | public static final int FEATURE_CONTENT_TRANSITIONS = 12; |
Adam Powell | 4b6d93f | 2012-09-18 18:34:08 -0700 | [diff] [blame] | 140 | |
| 141 | /** |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 142 | * Enables Activities to run Activity Transitions either through sending or receiving |
| 143 | * ActivityOptions bundle created with |
| 144 | * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.app.Activity, |
| 145 | * android.util.Pair[])} or {@link android.app.ActivityOptions#makeSceneTransitionAnimation( |
| 146 | * android.app.Activity, View, String)}. |
| 147 | */ |
| 148 | public static final int FEATURE_ACTIVITY_TRANSITIONS = 13; |
| 149 | |
| 150 | /** |
Adam Powell | 4b6d93f | 2012-09-18 18:34:08 -0700 | [diff] [blame] | 151 | * Max value used as a feature ID |
| 152 | * @hide |
| 153 | */ |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 154 | public static final int FEATURE_MAX = FEATURE_ACTIVITY_TRANSITIONS; |
Adam Powell | 4b6d93f | 2012-09-18 18:34:08 -0700 | [diff] [blame] | 155 | |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 156 | /** |
| 157 | * Flag for setting the progress bar's visibility to VISIBLE. |
| 158 | * |
| 159 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 160 | * supported starting in API 21. |
| 161 | */ |
| 162 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 163 | public static final int PROGRESS_VISIBILITY_ON = -1; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 164 | |
| 165 | /** |
| 166 | * Flag for setting the progress bar's visibility to GONE. |
| 167 | * |
| 168 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 169 | * supported starting in API 21. |
| 170 | */ |
| 171 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 172 | public static final int PROGRESS_VISIBILITY_OFF = -2; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 173 | |
| 174 | /** |
| 175 | * Flag for setting the progress bar's indeterminate mode on. |
| 176 | * |
| 177 | * @deprecated {@link #FEATURE_INDETERMINATE_PROGRESS} and related methods |
| 178 | * are no longer supported starting in API 21. |
| 179 | */ |
| 180 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 181 | public static final int PROGRESS_INDETERMINATE_ON = -3; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 182 | |
| 183 | /** |
| 184 | * Flag for setting the progress bar's indeterminate mode off. |
| 185 | * |
| 186 | * @deprecated {@link #FEATURE_INDETERMINATE_PROGRESS} and related methods |
| 187 | * are no longer supported starting in API 21. |
| 188 | */ |
| 189 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 190 | public static final int PROGRESS_INDETERMINATE_OFF = -4; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 191 | |
| 192 | /** |
| 193 | * Starting value for the (primary) progress. |
| 194 | * |
| 195 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 196 | * supported starting in API 21. |
| 197 | */ |
| 198 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 199 | public static final int PROGRESS_START = 0; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 200 | |
| 201 | /** |
| 202 | * Ending value for the (primary) progress. |
| 203 | * |
| 204 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 205 | * supported starting in API 21. |
| 206 | */ |
| 207 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 208 | public static final int PROGRESS_END = 10000; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 209 | |
| 210 | /** |
| 211 | * Lowest possible value for the secondary progress. |
| 212 | * |
| 213 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 214 | * supported starting in API 21. |
| 215 | */ |
| 216 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 217 | public static final int PROGRESS_SECONDARY_START = 20000; |
Alan Viverette | 4aef7c8 | 2015-09-04 14:14:50 -0400 | [diff] [blame] | 218 | |
| 219 | /** |
| 220 | * Highest possible value for the secondary progress. |
| 221 | * |
| 222 | * @deprecated {@link #FEATURE_PROGRESS} and related methods are no longer |
| 223 | * supported starting in API 21. |
| 224 | */ |
| 225 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 226 | public static final int PROGRESS_SECONDARY_END = 30000; |
George Mount | 238010f | 2014-06-30 17:31:17 -0700 | [diff] [blame] | 227 | |
| 228 | /** |
| 229 | * The transitionName for the status bar background View when a custom background is used. |
| 230 | * @see android.view.Window#setStatusBarColor(int) |
| 231 | */ |
| 232 | public static final String STATUS_BAR_BACKGROUND_TRANSITION_NAME = "android:status:background"; |
| 233 | |
| 234 | /** |
| 235 | * The transitionName for the navigation bar background View when a custom background is used. |
| 236 | * @see android.view.Window#setNavigationBarColor(int) |
| 237 | */ |
| 238 | public static final String NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME = |
| 239 | "android:navigation:background"; |
| 240 | |
Bryce Lee | aa1008c | 2015-01-13 09:26:46 -0800 | [diff] [blame] | 241 | /** |
| 242 | * The default features enabled. |
| 243 | * @deprecated use {@link #getDefaultFeatures(android.content.Context)} instead. |
| 244 | */ |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 245 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 246 | @SuppressWarnings({"PointlessBitwiseExpression"}) |
| 247 | protected static final int DEFAULT_FEATURES = (1 << FEATURE_OPTIONS_PANEL) | |
| 248 | (1 << FEATURE_CONTEXT_MENU); |
| 249 | |
| 250 | /** |
| 251 | * The ID that the main layout in the XML layout file should have. |
| 252 | */ |
| 253 | public static final int ID_ANDROID_CONTENT = com.android.internal.R.id.content; |
| 254 | |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 255 | private static final String PROPERTY_HARDWARE_UI = "persist.sys.ui.hw"; |
| 256 | |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 257 | /** |
| 258 | * Flag for letting the theme drive the color of the window caption controls. Use with |
| 259 | * {@link #setDecorCaptionShade(int)}. This is the default value. |
| 260 | */ |
| 261 | public static final int DECOR_CAPTION_SHADE_AUTO = 0; |
| 262 | /** |
| 263 | * Flag for setting light-color controls on the window caption. Use with |
| 264 | * {@link #setDecorCaptionShade(int)}. |
| 265 | */ |
| 266 | public static final int DECOR_CAPTION_SHADE_LIGHT = 1; |
| 267 | /** |
| 268 | * Flag for setting dark-color controls on the window caption. Use with |
| 269 | * {@link #setDecorCaptionShade(int)}. |
| 270 | */ |
| 271 | public static final int DECOR_CAPTION_SHADE_DARK = 2; |
| 272 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 273 | private final Context mContext; |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 274 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 275 | private TypedArray mWindowStyle; |
| 276 | private Callback mCallback; |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 277 | private OnWindowDismissedCallback mOnWindowDismissedCallback; |
Michael Kwan | 67639a5 | 2016-12-16 12:38:10 -0800 | [diff] [blame] | 278 | private OnWindowSwipeDismissedCallback mOnWindowSwipeDismissedCallback; |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 279 | private WindowControllerCallback mWindowControllerCallback; |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 280 | private OnRestrictedCaptionAreaChangedListener mOnRestrictedCaptionAreaChangedListener; |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 281 | private Rect mRestrictedCaptionAreaRect; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 282 | private WindowManager mWindowManager; |
| 283 | private IBinder mAppToken; |
| 284 | private String mAppName; |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 285 | private boolean mHardwareAccelerated; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 286 | private Window mContainer; |
| 287 | private Window mActiveChild; |
| 288 | private boolean mIsActive = false; |
| 289 | private boolean mHasChildren = false; |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 290 | private boolean mCloseOnTouchOutside = false; |
| 291 | private boolean mSetCloseOnTouchOutside = false; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 292 | private int mForcedWindowFlags = 0; |
| 293 | |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 294 | private int mFeatures; |
| 295 | private int mLocalFeatures; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 296 | |
| 297 | private boolean mHaveWindowFormat = false; |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 298 | private boolean mHaveDimAmount = false; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 299 | private int mDefaultWindowFormat = PixelFormat.OPAQUE; |
| 300 | |
| 301 | private boolean mHasSoftInputMode = false; |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 302 | |
Dianne Hackborn | 291905e | 2010-08-17 15:17:15 -0700 | [diff] [blame] | 303 | private boolean mDestroyed; |
| 304 | |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 305 | private boolean mOverlayWithDecorCaptionEnabled = false; |
Michael Kwan | f7964be | 2016-11-30 16:44:33 -0800 | [diff] [blame] | 306 | private boolean mCloseOnSwipeEnabled = false; |
Filip Gruszczynski | 6325065 | 2015-11-18 14:43:01 -0800 | [diff] [blame] | 307 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 308 | // The current window attributes. |
| 309 | private final WindowManager.LayoutParams mWindowAttributes = |
| 310 | new WindowManager.LayoutParams(); |
| 311 | |
| 312 | /** |
| 313 | * API from a Window back to its caller. This allows the client to |
| 314 | * intercept key dispatching, panels and menus, etc. |
| 315 | */ |
| 316 | public interface Callback { |
| 317 | /** |
| 318 | * Called to process key events. At the very least your |
| 319 | * implementation must call |
| 320 | * {@link android.view.Window#superDispatchKeyEvent} to do the |
| 321 | * standard key processing. |
| 322 | * |
| 323 | * @param event The key event. |
| 324 | * |
| 325 | * @return boolean Return true if this event was consumed. |
| 326 | */ |
| 327 | public boolean dispatchKeyEvent(KeyEvent event); |
| 328 | |
| 329 | /** |
Jeff Brown | 64da12a | 2011-01-04 19:57:47 -0800 | [diff] [blame] | 330 | * Called to process a key shortcut event. |
| 331 | * At the very least your implementation must call |
| 332 | * {@link android.view.Window#superDispatchKeyShortcutEvent} to do the |
| 333 | * standard key shortcut processing. |
| 334 | * |
| 335 | * @param event The key shortcut event. |
| 336 | * @return True if this event was consumed. |
| 337 | */ |
| 338 | public boolean dispatchKeyShortcutEvent(KeyEvent event); |
| 339 | |
| 340 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 341 | * Called to process touch screen events. At the very least your |
| 342 | * implementation must call |
| 343 | * {@link android.view.Window#superDispatchTouchEvent} to do the |
| 344 | * standard touch screen processing. |
| 345 | * |
| 346 | * @param event The touch screen event. |
| 347 | * |
| 348 | * @return boolean Return true if this event was consumed. |
| 349 | */ |
| 350 | public boolean dispatchTouchEvent(MotionEvent event); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 351 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 352 | /** |
| 353 | * Called to process trackball events. At the very least your |
| 354 | * implementation must call |
| 355 | * {@link android.view.Window#superDispatchTrackballEvent} to do the |
| 356 | * standard trackball processing. |
| 357 | * |
| 358 | * @param event The trackball event. |
| 359 | * |
| 360 | * @return boolean Return true if this event was consumed. |
| 361 | */ |
| 362 | public boolean dispatchTrackballEvent(MotionEvent event); |
svetoslavganov | 75986cf | 2009-05-14 22:28:01 -0700 | [diff] [blame] | 363 | |
| 364 | /** |
Jeff Brown | cb1404e | 2011-01-15 18:14:15 -0800 | [diff] [blame] | 365 | * Called to process generic motion events. At the very least your |
| 366 | * implementation must call |
| 367 | * {@link android.view.Window#superDispatchGenericMotionEvent} to do the |
| 368 | * standard processing. |
| 369 | * |
| 370 | * @param event The generic motion event. |
| 371 | * |
| 372 | * @return boolean Return true if this event was consumed. |
| 373 | */ |
| 374 | public boolean dispatchGenericMotionEvent(MotionEvent event); |
| 375 | |
| 376 | /** |
svetoslavganov | 75986cf | 2009-05-14 22:28:01 -0700 | [diff] [blame] | 377 | * Called to process population of {@link AccessibilityEvent}s. |
| 378 | * |
| 379 | * @param event The event. |
| 380 | * |
| 381 | * @return boolean Return true if event population was completed. |
| 382 | */ |
| 383 | public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event); |
| 384 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 385 | /** |
| 386 | * Instantiate the view to display in the panel for 'featureId'. |
| 387 | * You can return null, in which case the default content (typically |
| 388 | * a menu) will be created for you. |
| 389 | * |
| 390 | * @param featureId Which panel is being created. |
| 391 | * |
| 392 | * @return view The top-level view to place in the panel. |
| 393 | * |
| 394 | * @see #onPreparePanel |
| 395 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 396 | @Nullable |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 397 | public View onCreatePanelView(int featureId); |
| 398 | |
| 399 | /** |
| 400 | * Initialize the contents of the menu for panel 'featureId'. This is |
| 401 | * called if onCreatePanelView() returns null, giving you a standard |
| 402 | * menu in which you can place your items. It is only called once for |
| 403 | * the panel, the first time it is shown. |
| 404 | * |
| 405 | * <p>You can safely hold on to <var>menu</var> (and any items created |
| 406 | * from it), making modifications to it as desired, until the next |
| 407 | * time onCreatePanelMenu() is called for this feature. |
| 408 | * |
| 409 | * @param featureId The panel being created. |
| 410 | * @param menu The menu inside the panel. |
| 411 | * |
| 412 | * @return boolean You must return true for the panel to be displayed; |
| 413 | * if you return false it will not be shown. |
| 414 | */ |
| 415 | public boolean onCreatePanelMenu(int featureId, Menu menu); |
| 416 | |
| 417 | /** |
| 418 | * Prepare a panel to be displayed. This is called right before the |
| 419 | * panel window is shown, every time it is shown. |
| 420 | * |
| 421 | * @param featureId The panel that is being displayed. |
| 422 | * @param view The View that was returned by onCreatePanelView(). |
| 423 | * @param menu If onCreatePanelView() returned null, this is the Menu |
| 424 | * being displayed in the panel. |
| 425 | * |
| 426 | * @return boolean You must return true for the panel to be displayed; |
| 427 | * if you return false it will not be shown. |
| 428 | * |
| 429 | * @see #onCreatePanelView |
| 430 | */ |
| 431 | public boolean onPreparePanel(int featureId, View view, Menu menu); |
| 432 | |
| 433 | /** |
| 434 | * Called when a panel's menu is opened by the user. This may also be |
| 435 | * called when the menu is changing from one type to another (for |
| 436 | * example, from the icon menu to the expanded menu). |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 437 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 438 | * @param featureId The panel that the menu is in. |
| 439 | * @param menu The menu that is opened. |
| 440 | * @return Return true to allow the menu to open, or false to prevent |
| 441 | * the menu from opening. |
| 442 | */ |
| 443 | public boolean onMenuOpened(int featureId, Menu menu); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 444 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 445 | /** |
| 446 | * Called when a panel's menu item has been selected by the user. |
| 447 | * |
| 448 | * @param featureId The panel that the menu is in. |
| 449 | * @param item The menu item that was selected. |
| 450 | * |
| 451 | * @return boolean Return true to finish processing of selection, or |
| 452 | * false to perform the normal menu handling (calling its |
| 453 | * Runnable or sending a Message to its target Handler). |
| 454 | */ |
| 455 | public boolean onMenuItemSelected(int featureId, MenuItem item); |
| 456 | |
| 457 | /** |
| 458 | * This is called whenever the current window attributes change. |
| 459 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 460 | */ |
| 461 | public void onWindowAttributesChanged(WindowManager.LayoutParams attrs); |
| 462 | |
| 463 | /** |
| 464 | * This hook is called whenever the content view of the screen changes |
| 465 | * (due to a call to |
| 466 | * {@link Window#setContentView(View, android.view.ViewGroup.LayoutParams) |
| 467 | * Window.setContentView} or |
| 468 | * {@link Window#addContentView(View, android.view.ViewGroup.LayoutParams) |
| 469 | * Window.addContentView}). |
| 470 | */ |
| 471 | public void onContentChanged(); |
| 472 | |
| 473 | /** |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 474 | * This hook is called whenever the window focus changes. See |
| 475 | * {@link View#onWindowFocusChanged(boolean) |
Svetoslav | 3a0d878 | 2014-12-04 12:50:11 -0800 | [diff] [blame] | 476 | * View.onWindowFocusChangedNotLocked(boolean)} for more information. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 477 | * |
| 478 | * @param hasFocus Whether the window now has focus. |
| 479 | */ |
| 480 | public void onWindowFocusChanged(boolean hasFocus); |
| 481 | |
| 482 | /** |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 483 | * Called when the window has been attached to the window manager. |
| 484 | * See {@link View#onAttachedToWindow() View.onAttachedToWindow()} |
| 485 | * for more information. |
| 486 | */ |
| 487 | public void onAttachedToWindow(); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 488 | |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 489 | /** |
| 490 | * Called when the window has been attached to the window manager. |
| 491 | * See {@link View#onDetachedFromWindow() View.onDetachedFromWindow()} |
| 492 | * for more information. |
| 493 | */ |
| 494 | public void onDetachedFromWindow(); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 495 | |
Dianne Hackborn | 3be63c0 | 2009-08-20 19:31:38 -0700 | [diff] [blame] | 496 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 497 | * Called when a panel is being closed. If another logical subsequent |
| 498 | * panel is being opened (and this panel is being closed to make room for the subsequent |
| 499 | * panel), this method will NOT be called. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 500 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 501 | * @param featureId The panel that is being displayed. |
| 502 | * @param menu If onCreatePanelView() returned null, this is the Menu |
| 503 | * being displayed in the panel. |
| 504 | */ |
| 505 | public void onPanelClosed(int featureId, Menu menu); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 506 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 507 | /** |
| 508 | * Called when the user signals the desire to start a search. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 509 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 510 | * @return true if search launched, false if activity refuses (blocks) |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 511 | * |
| 512 | * @see android.app.Activity#onSearchRequested() |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 513 | */ |
| 514 | public boolean onSearchRequested(); |
Adam Powell | 6e34636 | 2010-07-23 10:18:23 -0700 | [diff] [blame] | 515 | |
| 516 | /** |
Tim Kilbourn | 6a975b3 | 2015-04-09 17:14:34 -0700 | [diff] [blame] | 517 | * Called when the user signals the desire to start a search. |
| 518 | * |
| 519 | * @param searchEvent A {@link SearchEvent} describing the signal to |
| 520 | * start a search. |
| 521 | * @return true if search launched, false if activity refuses (blocks) |
| 522 | */ |
| 523 | public boolean onSearchRequested(SearchEvent searchEvent); |
| 524 | |
| 525 | /** |
Adam Powell | debf3be | 2010-11-15 18:58:48 -0800 | [diff] [blame] | 526 | * Called when an action mode is being started for this window. Gives the |
| 527 | * callback an opportunity to handle the action mode in its own unique and |
| 528 | * beautiful way. If this method returns null the system can choose a way |
Clara Bayarri | 4423d91 | 2015-03-02 19:42:48 +0000 | [diff] [blame] | 529 | * to present the mode or choose not to start the mode at all. This is equivalent |
| 530 | * to {@link #onWindowStartingActionMode(android.view.ActionMode.Callback, int)} |
| 531 | * with type {@link ActionMode#TYPE_PRIMARY}. |
Adam Powell | 6e34636 | 2010-07-23 10:18:23 -0700 | [diff] [blame] | 532 | * |
| 533 | * @param callback Callback to control the lifecycle of this action mode |
Adam Powell | debf3be | 2010-11-15 18:58:48 -0800 | [diff] [blame] | 534 | * @return The ActionMode that was started, or null if the system should present it |
Adam Powell | 6e34636 | 2010-07-23 10:18:23 -0700 | [diff] [blame] | 535 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 536 | @Nullable |
Adam Powell | debf3be | 2010-11-15 18:58:48 -0800 | [diff] [blame] | 537 | public ActionMode onWindowStartingActionMode(ActionMode.Callback callback); |
| 538 | |
| 539 | /** |
Clara Bayarri | 4423d91 | 2015-03-02 19:42:48 +0000 | [diff] [blame] | 540 | * Called when an action mode is being started for this window. Gives the |
| 541 | * callback an opportunity to handle the action mode in its own unique and |
| 542 | * beautiful way. If this method returns null the system can choose a way |
| 543 | * to present the mode or choose not to start the mode at all. |
| 544 | * |
| 545 | * @param callback Callback to control the lifecycle of this action mode |
| 546 | * @param type One of {@link ActionMode#TYPE_PRIMARY} or {@link ActionMode#TYPE_FLOATING}. |
| 547 | * @return The ActionMode that was started, or null if the system should present it |
| 548 | */ |
| 549 | @Nullable |
| 550 | public ActionMode onWindowStartingActionMode(ActionMode.Callback callback, int type); |
| 551 | |
| 552 | /** |
Adam Powell | debf3be | 2010-11-15 18:58:48 -0800 | [diff] [blame] | 553 | * Called when an action mode has been started. The appropriate mode callback |
| 554 | * method will have already been invoked. |
| 555 | * |
| 556 | * @param mode The new mode that has just been started. |
| 557 | */ |
| 558 | public void onActionModeStarted(ActionMode mode); |
| 559 | |
| 560 | /** |
| 561 | * Called when an action mode has been finished. The appropriate mode callback |
| 562 | * method will have already been invoked. |
| 563 | * |
| 564 | * @param mode The mode that was just finished. |
| 565 | */ |
| 566 | public void onActionModeFinished(ActionMode mode); |
Clara Bayarri | 75e0979 | 2015-07-29 16:20:40 +0100 | [diff] [blame] | 567 | |
| 568 | /** |
| 569 | * Called when Keyboard Shortcuts are requested for the current window. |
| 570 | * |
| 571 | * @param data The data list to populate with shortcuts. |
| 572 | * @param menu The current menu, which may be null. |
Clara Bayarri | fcd7e80 | 2016-03-10 12:58:18 +0000 | [diff] [blame] | 573 | * @param deviceId The id for the connected device the shortcuts should be provided for. |
Clara Bayarri | 75e0979 | 2015-07-29 16:20:40 +0100 | [diff] [blame] | 574 | */ |
Sunny Goyal | 2a6d9aa | 2016-03-16 17:12:46 -0700 | [diff] [blame] | 575 | default public void onProvideKeyboardShortcuts( |
Clara Bayarri | fcd7e80 | 2016-03-10 12:58:18 +0000 | [diff] [blame] | 576 | List<KeyboardShortcutGroup> data, @Nullable Menu menu, int deviceId) { }; |
Vladislav Kaznacheev | 3787de1 | 2016-12-21 10:36:35 -0800 | [diff] [blame] | 577 | |
| 578 | /** |
| 579 | * Called when pointer capture is enabled or disabled for the current window. |
| 580 | * |
| 581 | * @param hasCapture True if the window has pointer capture. |
| 582 | */ |
| 583 | default public void onPointerCaptureChanged(boolean hasCapture) { }; |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 584 | } |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 585 | |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 586 | /** @hide */ |
| 587 | public interface OnWindowDismissedCallback { |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 588 | /** |
| 589 | * Called when a window is dismissed. This informs the callback that the |
| 590 | * window is gone, and it should finish itself. |
Wale Ogunwale | ba7881c | 2015-08-01 19:28:29 -0700 | [diff] [blame] | 591 | * @param finishTask True if the task should also be finished. |
Ned Burns | 7d6cb91 | 2016-12-02 17:25:33 -0500 | [diff] [blame] | 592 | * @param suppressWindowTransition True if the resulting exit and enter window transition |
| 593 | * animations should be suppressed. |
Will Haldean Brown | ca6234e | 2014-02-12 10:23:41 -0800 | [diff] [blame] | 594 | */ |
Ned Burns | 7d6cb91 | 2016-12-02 17:25:33 -0500 | [diff] [blame] | 595 | void onWindowDismissed(boolean finishTask, boolean suppressWindowTransition); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 596 | } |
| 597 | |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 598 | /** @hide */ |
Michael Kwan | 67639a5 | 2016-12-16 12:38:10 -0800 | [diff] [blame] | 599 | public interface OnWindowSwipeDismissedCallback { |
| 600 | /** |
| 601 | * Called when a window is swipe dismissed. This informs the callback that the |
| 602 | * window is gone, and it should finish itself. |
| 603 | * @param finishTask True if the task should also be finished. |
| 604 | * @param suppressWindowTransition True if the resulting exit and enter window transition |
| 605 | * animations should be suppressed. |
| 606 | */ |
| 607 | void onWindowSwipeDismissed(); |
| 608 | } |
| 609 | |
| 610 | /** @hide */ |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 611 | public interface WindowControllerCallback { |
| 612 | /** |
Filip Gruszczynski | 411c06f | 2016-01-07 09:44:44 -0800 | [diff] [blame] | 613 | * Moves the activity from |
| 614 | * {@link android.app.ActivityManager.StackId#FREEFORM_WORKSPACE_STACK_ID} to |
| 615 | * {@link android.app.ActivityManager.StackId#FULLSCREEN_WORKSPACE_STACK_ID} stack. |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 616 | */ |
Filip Gruszczynski | 411c06f | 2016-01-07 09:44:44 -0800 | [diff] [blame] | 617 | void exitFreeformMode() throws RemoteException; |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 618 | |
Jaewan Kim | d98dcab | 2016-05-03 02:52:18 +0900 | [diff] [blame] | 619 | /** |
| 620 | * Puts the activity in picture-in-picture mode if the activity supports. |
| 621 | * @see android.R.attr#supportsPictureInPicture |
| 622 | */ |
| 623 | void enterPictureInPictureModeIfPossible(); |
| 624 | |
Wale Ogunwale | 868a5e1 | 2015-08-02 16:19:20 -0700 | [diff] [blame] | 625 | /** Returns the current stack Id for the window. */ |
| 626 | int getWindowStackId() throws RemoteException; |
| 627 | } |
| 628 | |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 629 | /** |
| 630 | * Callback for clients that want to be aware of where caption draws content. |
| 631 | */ |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 632 | public interface OnRestrictedCaptionAreaChangedListener { |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 633 | /** |
| 634 | * Called when the area where caption draws content changes. |
| 635 | * |
| 636 | * @param rect The area where caption content is positioned, relative to the top view. |
| 637 | */ |
| 638 | void onRestrictedCaptionAreaChanged(Rect rect); |
| 639 | } |
| 640 | |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 641 | /** |
| 642 | * Callback for clients that want frame timing information for each |
| 643 | * frame rendered by the Window. |
| 644 | */ |
Andres Morales | d908c62 | 2016-04-20 13:13:34 -0700 | [diff] [blame] | 645 | public interface OnFrameMetricsAvailableListener { |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 646 | /** |
| 647 | * Called when information is available for the previously rendered frame. |
| 648 | * |
| 649 | * Reports can be dropped if this callback takes too |
| 650 | * long to execute, as the report producer cannot wait for the consumer to |
| 651 | * complete. |
| 652 | * |
| 653 | * It is highly recommended that clients copy the passed in FrameMetrics |
| 654 | * via {@link FrameMetrics#FrameMetrics(FrameMetrics)} within this method and defer |
| 655 | * additional computation or storage to another thread to avoid unnecessarily |
| 656 | * dropping reports. |
| 657 | * |
| 658 | * @param window The {@link Window} on which the frame was displayed. |
| 659 | * @param frameMetrics the available metrics. This object is reused on every call |
| 660 | * and thus <strong>this reference is not valid outside the scope of this method</strong>. |
| 661 | * @param dropCountSinceLastInvocation the number of reports dropped since the last time |
| 662 | * this callback was invoked. |
| 663 | */ |
Andres Morales | d908c62 | 2016-04-20 13:13:34 -0700 | [diff] [blame] | 664 | void onFrameMetricsAvailable(Window window, FrameMetrics frameMetrics, |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 665 | int dropCountSinceLastInvocation); |
| 666 | } |
| 667 | |
| 668 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 669 | public Window(Context context) { |
| 670 | mContext = context; |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 671 | mFeatures = mLocalFeatures = getDefaultFeatures(context); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 672 | } |
| 673 | |
| 674 | /** |
| 675 | * Return the Context this window policy is running in, for retrieving |
| 676 | * resources and other information. |
| 677 | * |
| 678 | * @return Context The Context that was supplied to the constructor. |
| 679 | */ |
| 680 | public final Context getContext() { |
| 681 | return mContext; |
| 682 | } |
| 683 | |
| 684 | /** |
| 685 | * Return the {@link android.R.styleable#Window} attributes from this |
| 686 | * window's theme. |
| 687 | */ |
| 688 | public final TypedArray getWindowStyle() { |
| 689 | synchronized (this) { |
| 690 | if (mWindowStyle == null) { |
| 691 | mWindowStyle = mContext.obtainStyledAttributes( |
| 692 | com.android.internal.R.styleable.Window); |
| 693 | } |
| 694 | return mWindowStyle; |
| 695 | } |
| 696 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 697 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 698 | /** |
| 699 | * Set the container for this window. If not set, the DecorWindow |
| 700 | * operates as a top-level window; otherwise, it negotiates with the |
| 701 | * container to display itself appropriately. |
| 702 | * |
| 703 | * @param container The desired containing Window. |
| 704 | */ |
| 705 | public void setContainer(Window container) { |
| 706 | mContainer = container; |
| 707 | if (container != null) { |
| 708 | // Embedded screens never have a title. |
| 709 | mFeatures |= 1<<FEATURE_NO_TITLE; |
| 710 | mLocalFeatures |= 1<<FEATURE_NO_TITLE; |
| 711 | container.mHasChildren = true; |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | /** |
| 716 | * Return the container for this Window. |
| 717 | * |
| 718 | * @return Window The containing window, or null if this is a |
| 719 | * top-level window. |
| 720 | */ |
| 721 | public final Window getContainer() { |
| 722 | return mContainer; |
| 723 | } |
| 724 | |
| 725 | public final boolean hasChildren() { |
| 726 | return mHasChildren; |
| 727 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 728 | |
Dianne Hackborn | 291905e | 2010-08-17 15:17:15 -0700 | [diff] [blame] | 729 | /** @hide */ |
| 730 | public final void destroy() { |
| 731 | mDestroyed = true; |
| 732 | } |
| 733 | |
| 734 | /** @hide */ |
| 735 | public final boolean isDestroyed() { |
| 736 | return mDestroyed; |
| 737 | } |
| 738 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 739 | /** |
| 740 | * Set the window manager for use by this Window to, for example, |
| 741 | * display panels. This is <em>not</em> used for displaying the |
| 742 | * Window itself -- that must be done by the client. |
| 743 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 744 | * @param wm The window manager for adding new windows. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 745 | */ |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 746 | public void setWindowManager(WindowManager wm, IBinder appToken, String appName) { |
| 747 | setWindowManager(wm, appToken, appName, false); |
| 748 | } |
| 749 | |
| 750 | /** |
| 751 | * Set the window manager for use by this Window to, for example, |
| 752 | * display panels. This is <em>not</em> used for displaying the |
| 753 | * Window itself -- that must be done by the client. |
| 754 | * |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 755 | * @param wm The window manager for adding new windows. |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 756 | */ |
| 757 | public void setWindowManager(WindowManager wm, IBinder appToken, String appName, |
| 758 | boolean hardwareAccelerated) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 759 | mAppToken = appToken; |
| 760 | mAppName = appName; |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 761 | mHardwareAccelerated = hardwareAccelerated |
| 762 | || SystemProperties.getBoolean(PROPERTY_HARDWARE_UI, false); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 763 | if (wm == null) { |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 764 | wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 765 | } |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 766 | mWindowManager = ((WindowManagerImpl)wm).createLocalWindowManager(this); |
Dianne Hackborn | 5fd2169 | 2011-06-07 14:09:47 -0700 | [diff] [blame] | 767 | } |
| 768 | |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 769 | void adjustLayoutParamsForSubWindow(WindowManager.LayoutParams wp) { |
| 770 | CharSequence curTitle = wp.getTitle(); |
| 771 | if (wp.type >= WindowManager.LayoutParams.FIRST_SUB_WINDOW && |
tiger_huang | ff58e30 | 2015-10-13 21:38:19 +0800 | [diff] [blame] | 772 | wp.type <= WindowManager.LayoutParams.LAST_SUB_WINDOW) { |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 773 | if (wp.token == null) { |
| 774 | View decor = peekDecorView(); |
| 775 | if (decor != null) { |
| 776 | wp.token = decor.getWindowToken(); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 777 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 778 | } |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 779 | if (curTitle == null || curTitle.length() == 0) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 780 | final StringBuilder title = new StringBuilder(32); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 781 | if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 782 | title.append("Media"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 783 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 784 | title.append("MediaOvr"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 785 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 786 | title.append("Panel"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 787 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 788 | title.append("SubPanel"); |
Wale Ogunwale | 0a4dc22 | 2015-04-14 12:58:42 -0700 | [diff] [blame] | 789 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 790 | title.append("AboveSubPanel"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 791 | } else if (wp.type == WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 792 | title.append("AtchDlg"); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 793 | } else { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 794 | title.append(wp.type); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 795 | } |
| 796 | if (mAppName != null) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 797 | title.append(":").append(mAppName); |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 798 | } |
| 799 | wp.setTitle(title); |
Romain Guy | 529b60a | 2010-08-03 18:05:47 -0700 | [diff] [blame] | 800 | } |
tiger_huang | ff58e30 | 2015-10-13 21:38:19 +0800 | [diff] [blame] | 801 | } else if (wp.type >= WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW && |
| 802 | wp.type <= WindowManager.LayoutParams.LAST_SYSTEM_WINDOW) { |
| 803 | // We don't set the app token to this system window because the life cycles should be |
| 804 | // independent. If an app creates a system window and then the app goes to the stopped |
| 805 | // state, the system window should not be affected (can still show and receive input |
| 806 | // events). |
| 807 | if (curTitle == null || curTitle.length() == 0) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 808 | final StringBuilder title = new StringBuilder(32); |
| 809 | title.append("Sys").append(wp.type); |
tiger_huang | ff58e30 | 2015-10-13 21:38:19 +0800 | [diff] [blame] | 810 | if (mAppName != null) { |
Wale Ogunwale | 9b34442 | 2015-10-16 09:07:45 -0700 | [diff] [blame] | 811 | title.append(":").append(mAppName); |
tiger_huang | ff58e30 | 2015-10-13 21:38:19 +0800 | [diff] [blame] | 812 | } |
| 813 | wp.setTitle(title); |
| 814 | } |
Jeff Brown | d32460c | 2012-07-20 16:15:36 -0700 | [diff] [blame] | 815 | } else { |
| 816 | if (wp.token == null) { |
| 817 | wp.token = mContainer == null ? mAppToken : mContainer.mAppToken; |
| 818 | } |
| 819 | if ((curTitle == null || curTitle.length() == 0) |
| 820 | && mAppName != null) { |
| 821 | wp.setTitle(mAppName); |
| 822 | } |
| 823 | } |
| 824 | if (wp.packageName == null) { |
| 825 | wp.packageName = mContext.getPackageName(); |
| 826 | } |
Robert Carr | 13678ee | 2016-04-20 14:04:15 -0700 | [diff] [blame] | 827 | if (mHardwareAccelerated || |
| 828 | (mWindowAttributes.flags & FLAG_HARDWARE_ACCELERATED) != 0) { |
| 829 | wp.flags |= FLAG_HARDWARE_ACCELERATED; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 830 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 831 | } |
| 832 | |
| 833 | /** |
| 834 | * Return the window manager allowing this Window to display its own |
| 835 | * windows. |
| 836 | * |
| 837 | * @return WindowManager The ViewManager. |
| 838 | */ |
| 839 | public WindowManager getWindowManager() { |
| 840 | return mWindowManager; |
| 841 | } |
| 842 | |
| 843 | /** |
| 844 | * Set the Callback interface for this window, used to intercept key |
| 845 | * events and other dynamic operations in the window. |
| 846 | * |
| 847 | * @param callback The desired Callback interface. |
| 848 | */ |
| 849 | public void setCallback(Callback callback) { |
| 850 | mCallback = callback; |
| 851 | } |
| 852 | |
| 853 | /** |
| 854 | * Return the current Callback interface for this window. |
| 855 | */ |
| 856 | public final Callback getCallback() { |
| 857 | return mCallback; |
| 858 | } |
| 859 | |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 860 | /** |
| 861 | * Set an observer to collect frame stats for each frame rendererd in this window. |
| 862 | * |
| 863 | * Must be in hardware rendering mode. |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 864 | */ |
Andres Morales | d908c62 | 2016-04-20 13:13:34 -0700 | [diff] [blame] | 865 | public final void addOnFrameMetricsAvailableListener( |
| 866 | @NonNull OnFrameMetricsAvailableListener listener, |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 867 | Handler handler) { |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 868 | final View decorView = getDecorView(); |
| 869 | if (decorView == null) { |
| 870 | throw new IllegalStateException("can't observe a Window without an attached view"); |
| 871 | } |
| 872 | |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 873 | if (listener == null) { |
| 874 | throw new NullPointerException("listener cannot be null"); |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 875 | } |
| 876 | |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 877 | decorView.addFrameMetricsListener(this, listener, handler); |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 878 | } |
| 879 | |
| 880 | /** |
| 881 | * Remove observer and stop listening to frame stats for this window. |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 882 | */ |
Andres Morales | d908c62 | 2016-04-20 13:13:34 -0700 | [diff] [blame] | 883 | public final void removeOnFrameMetricsAvailableListener(OnFrameMetricsAvailableListener listener) { |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 884 | final View decorView = getDecorView(); |
| 885 | if (decorView != null) { |
Andres Morales | 910beb8 | 2016-02-02 16:19:40 -0800 | [diff] [blame] | 886 | getDecorView().removeFrameMetricsListener(listener); |
Andres Morales | 06f5bc7 | 2015-12-15 15:21:31 -0800 | [diff] [blame] | 887 | } |
| 888 | } |
| 889 | |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 890 | /** @hide */ |
| 891 | public final void setOnWindowDismissedCallback(OnWindowDismissedCallback dcb) { |
| 892 | mOnWindowDismissedCallback = dcb; |
| 893 | } |
| 894 | |
| 895 | /** @hide */ |
Ned Burns | 7d6cb91 | 2016-12-02 17:25:33 -0500 | [diff] [blame] | 896 | public final void dispatchOnWindowDismissed( |
| 897 | boolean finishTask, boolean suppressWindowTransition) { |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 898 | if (mOnWindowDismissedCallback != null) { |
Ned Burns | 7d6cb91 | 2016-12-02 17:25:33 -0500 | [diff] [blame] | 899 | mOnWindowDismissedCallback.onWindowDismissed(finishTask, suppressWindowTransition); |
Adam Powell | 117b695 | 2014-05-05 18:14:56 -0700 | [diff] [blame] | 900 | } |
| 901 | } |
| 902 | |
Stefan Kuhne | 9bad741 | 2015-08-07 10:35:52 -0700 | [diff] [blame] | 903 | /** @hide */ |
Michael Kwan | 67639a5 | 2016-12-16 12:38:10 -0800 | [diff] [blame] | 904 | public final void setOnWindowSwipeDismissedCallback(OnWindowSwipeDismissedCallback sdcb) { |
| 905 | mOnWindowSwipeDismissedCallback = sdcb; |
| 906 | } |
| 907 | |
| 908 | /** @hide */ |
| 909 | public final void dispatchOnWindowSwipeDismissed() { |
| 910 | if (mOnWindowSwipeDismissedCallback != null) { |
| 911 | mOnWindowSwipeDismissedCallback.onWindowSwipeDismissed(); |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | /** @hide */ |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 916 | public final void setWindowControllerCallback(WindowControllerCallback wccb) { |
| 917 | mWindowControllerCallback = wccb; |
Stefan Kuhne | 9bad741 | 2015-08-07 10:35:52 -0700 | [diff] [blame] | 918 | } |
| 919 | |
| 920 | /** @hide */ |
Skuhne | ce2faa5 | 2015-08-11 10:36:38 -0700 | [diff] [blame] | 921 | public final WindowControllerCallback getWindowControllerCallback() { |
| 922 | return mWindowControllerCallback; |
Stefan Kuhne | 9bad741 | 2015-08-07 10:35:52 -0700 | [diff] [blame] | 923 | } |
| 924 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 925 | /** |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 926 | * Set a callback for changes of area where caption will draw its content. |
| 927 | * |
| 928 | * @param listener Callback that will be called when the area changes. |
| 929 | */ |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 930 | public final void setRestrictedCaptionAreaListener(OnRestrictedCaptionAreaChangedListener listener) { |
| 931 | mOnRestrictedCaptionAreaChangedListener = listener; |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 932 | mRestrictedCaptionAreaRect = listener != null ? new Rect() : null; |
| 933 | } |
| 934 | |
| 935 | /** |
Dianne Hackborn | dc8a7f6 | 2010-05-10 11:29:34 -0700 | [diff] [blame] | 936 | * Take ownership of this window's surface. The window's view hierarchy |
| 937 | * will no longer draw into the surface, though it will otherwise continue |
| 938 | * to operate (such as for receiving input events). The given SurfaceHolder |
| 939 | * callback will be used to tell you about state changes to the surface. |
| 940 | */ |
Dianne Hackborn | d76b67c | 2010-07-13 17:48:30 -0700 | [diff] [blame] | 941 | public abstract void takeSurface(SurfaceHolder.Callback2 callback); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 942 | |
Dianne Hackborn | dc8a7f6 | 2010-05-10 11:29:34 -0700 | [diff] [blame] | 943 | /** |
Dianne Hackborn | 1e4b9f3 | 2010-06-23 14:10:57 -0700 | [diff] [blame] | 944 | * Take ownership of this window's InputQueue. The window will no |
| 945 | * longer read and dispatch input events from the queue; it is your |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 946 | * responsibility to do so. |
| 947 | */ |
Dianne Hackborn | 1e4b9f3 | 2010-06-23 14:10:57 -0700 | [diff] [blame] | 948 | public abstract void takeInputQueue(InputQueue.Callback callback); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 949 | |
Dianne Hackborn | a95e4cb | 2010-06-18 18:09:33 -0700 | [diff] [blame] | 950 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 951 | * Return whether this window is being displayed with a floating style |
| 952 | * (based on the {@link android.R.attr#windowIsFloating} attribute in |
| 953 | * the style/theme). |
| 954 | * |
| 955 | * @return Returns true if the window is configured to be displayed floating |
| 956 | * on top of whatever is behind it. |
| 957 | */ |
| 958 | public abstract boolean isFloating(); |
| 959 | |
| 960 | /** |
| 961 | * Set the width and height layout parameters of the window. The default |
Dianne Hackborn | c918935 | 2010-12-15 14:57:25 -0800 | [diff] [blame] | 962 | * for both of these is MATCH_PARENT; you can change them to WRAP_CONTENT |
| 963 | * or an absolute value to make a window that is not full-screen. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 964 | * |
| 965 | * @param width The desired layout width of the window. |
| 966 | * @param height The desired layout height of the window. |
Dianne Hackborn | c918935 | 2010-12-15 14:57:25 -0800 | [diff] [blame] | 967 | * |
| 968 | * @see ViewGroup.LayoutParams#height |
| 969 | * @see ViewGroup.LayoutParams#width |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 970 | */ |
Dianne Hackborn | c918935 | 2010-12-15 14:57:25 -0800 | [diff] [blame] | 971 | public void setLayout(int width, int height) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 972 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 973 | attrs.width = width; |
| 974 | attrs.height = height; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 975 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 976 | } |
| 977 | |
| 978 | /** |
| 979 | * Set the gravity of the window, as per the Gravity constants. This |
| 980 | * controls how the window manager is positioned in the overall window; it |
| 981 | * is only useful when using WRAP_CONTENT for the layout width or height. |
| 982 | * |
| 983 | * @param gravity The desired gravity constant. |
| 984 | * |
| 985 | * @see Gravity |
| 986 | * @see #setLayout |
| 987 | */ |
| 988 | public void setGravity(int gravity) |
| 989 | { |
| 990 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 991 | attrs.gravity = gravity; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 992 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 993 | } |
| 994 | |
| 995 | /** |
| 996 | * Set the type of the window, as per the WindowManager.LayoutParams |
| 997 | * types. |
| 998 | * |
| 999 | * @param type The new window type (see WindowManager.LayoutParams). |
| 1000 | */ |
| 1001 | public void setType(int type) { |
| 1002 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1003 | attrs.type = type; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1004 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1005 | } |
| 1006 | |
| 1007 | /** |
| 1008 | * Set the format of window, as per the PixelFormat types. This overrides |
| 1009 | * the default format that is selected by the Window based on its |
| 1010 | * window decorations. |
| 1011 | * |
| 1012 | * @param format The new window format (see PixelFormat). Use |
| 1013 | * PixelFormat.UNKNOWN to allow the Window to select |
| 1014 | * the format. |
| 1015 | * |
| 1016 | * @see PixelFormat |
| 1017 | */ |
| 1018 | public void setFormat(int format) { |
| 1019 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1020 | if (format != PixelFormat.UNKNOWN) { |
| 1021 | attrs.format = format; |
| 1022 | mHaveWindowFormat = true; |
| 1023 | } else { |
| 1024 | attrs.format = mDefaultWindowFormat; |
| 1025 | mHaveWindowFormat = false; |
| 1026 | } |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1027 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1028 | } |
| 1029 | |
| 1030 | /** |
| 1031 | * Specify custom animations to use for the window, as per |
| 1032 | * {@link WindowManager.LayoutParams#windowAnimations |
| 1033 | * WindowManager.LayoutParams.windowAnimations}. Providing anything besides |
| 1034 | * 0 here will override the animations the window would |
| 1035 | * normally retrieve from its theme. |
| 1036 | */ |
Tor Norbye | 417ee5b | 2015-03-10 20:57:37 -0700 | [diff] [blame] | 1037 | public void setWindowAnimations(@StyleRes int resId) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1038 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1039 | attrs.windowAnimations = resId; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1040 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1041 | } |
| 1042 | |
| 1043 | /** |
| 1044 | * Specify an explicit soft input mode to use for the window, as per |
| 1045 | * {@link WindowManager.LayoutParams#softInputMode |
| 1046 | * WindowManager.LayoutParams.softInputMode}. Providing anything besides |
| 1047 | * "unspecified" here will override the input mode the window would |
| 1048 | * normally retrieve from its theme. |
| 1049 | */ |
| 1050 | public void setSoftInputMode(int mode) { |
| 1051 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1052 | if (mode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) { |
| 1053 | attrs.softInputMode = mode; |
| 1054 | mHasSoftInputMode = true; |
| 1055 | } else { |
| 1056 | mHasSoftInputMode = false; |
| 1057 | } |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1058 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1059 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1060 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1061 | /** |
| 1062 | * Convenience function to set the flag bits as specified in flags, as |
| 1063 | * per {@link #setFlags}. |
| 1064 | * @param flags The flag bits to be set. |
| 1065 | * @see #setFlags |
Christopher Tate | 193fc07 | 2012-06-04 11:27:40 -0700 | [diff] [blame] | 1066 | * @see #clearFlags |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1067 | */ |
| 1068 | public void addFlags(int flags) { |
| 1069 | setFlags(flags, flags); |
| 1070 | } |
Adam Lesinski | 95c4297 | 2013-10-02 10:13:27 -0700 | [diff] [blame] | 1071 | |
| 1072 | /** @hide */ |
| 1073 | public void addPrivateFlags(int flags) { |
| 1074 | setPrivateFlags(flags, flags); |
| 1075 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1076 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1077 | /** |
| 1078 | * Convenience function to clear the flag bits as specified in flags, as |
| 1079 | * per {@link #setFlags}. |
| 1080 | * @param flags The flag bits to be cleared. |
| 1081 | * @see #setFlags |
Christopher Tate | 193fc07 | 2012-06-04 11:27:40 -0700 | [diff] [blame] | 1082 | * @see #addFlags |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1083 | */ |
| 1084 | public void clearFlags(int flags) { |
| 1085 | setFlags(0, flags); |
| 1086 | } |
| 1087 | |
| 1088 | /** |
| 1089 | * Set the flags of the window, as per the |
| 1090 | * {@link WindowManager.LayoutParams WindowManager.LayoutParams} |
| 1091 | * flags. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1092 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1093 | * <p>Note that some flags must be set before the window decoration is |
| 1094 | * created (by the first call to |
| 1095 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} or |
| 1096 | * {@link #getDecorView()}: |
| 1097 | * {@link WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN} and |
| 1098 | * {@link WindowManager.LayoutParams#FLAG_LAYOUT_INSET_DECOR}. These |
| 1099 | * will be set for you based on the {@link android.R.attr#windowIsFloating} |
| 1100 | * attribute. |
| 1101 | * |
| 1102 | * @param flags The new window flags (see WindowManager.LayoutParams). |
| 1103 | * @param mask Which of the window flag bits to modify. |
Christopher Tate | 193fc07 | 2012-06-04 11:27:40 -0700 | [diff] [blame] | 1104 | * @see #addFlags |
| 1105 | * @see #clearFlags |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1106 | */ |
| 1107 | public void setFlags(int flags, int mask) { |
| 1108 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1109 | attrs.flags = (attrs.flags&~mask) | (flags&mask); |
| 1110 | mForcedWindowFlags |= mask; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1111 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1112 | } |
| 1113 | |
Adam Lesinski | 95c4297 | 2013-10-02 10:13:27 -0700 | [diff] [blame] | 1114 | private void setPrivateFlags(int flags, int mask) { |
| 1115 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1116 | attrs.privateFlags = (attrs.privateFlags & ~mask) | (flags & mask); |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1117 | dispatchWindowAttributesChanged(attrs); |
| 1118 | } |
| 1119 | |
| 1120 | /** |
| 1121 | * {@hide} |
| 1122 | */ |
Wale Ogunwale | 393b1c1 | 2014-10-18 16:22:01 -0700 | [diff] [blame] | 1123 | protected void setNeedsMenuKey(int value) { |
| 1124 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1125 | attrs.needsMenuKey = value; |
| 1126 | dispatchWindowAttributesChanged(attrs); |
| 1127 | } |
| 1128 | |
| 1129 | /** |
| 1130 | * {@hide} |
| 1131 | */ |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1132 | protected void dispatchWindowAttributesChanged(WindowManager.LayoutParams attrs) { |
Adam Lesinski | 95c4297 | 2013-10-02 10:13:27 -0700 | [diff] [blame] | 1133 | if (mCallback != null) { |
| 1134 | mCallback.onWindowAttributesChanged(attrs); |
| 1135 | } |
| 1136 | } |
| 1137 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1138 | /** |
Romain Guy | 4832745 | 2017-01-23 17:03:35 -0800 | [diff] [blame] | 1139 | * <p>Set the color mode of the window. Setting the color mode might |
| 1140 | * override the window's pixel {@link WindowManager.LayoutParams#format format}.</p> |
| 1141 | * |
| 1142 | * <p>The color mode must be one of {@link ActivityInfo#COLOR_MODE_DEFAULT}, |
| 1143 | * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}.</p> |
| 1144 | */ |
| 1145 | public void setColorMode(@ActivityInfo.ColorMode int colorMode) { |
| 1146 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1147 | attrs.setColorMode(colorMode); |
| 1148 | dispatchWindowAttributesChanged(attrs); |
| 1149 | } |
| 1150 | |
| 1151 | /** |
| 1152 | * Returns the color mode of the window, one of {@link ActivityInfo#COLOR_MODE_DEFAULT}, |
| 1153 | * {@link ActivityInfo#COLOR_MODE_WIDE_COLOR_GAMUT} or {@link ActivityInfo#COLOR_MODE_HDR}. |
| 1154 | */ |
| 1155 | @ActivityInfo.ColorMode |
| 1156 | public int getColorMode() { |
| 1157 | return getAttributes().getColorMode(); |
| 1158 | } |
| 1159 | |
| 1160 | /** |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1161 | * Set the amount of dim behind the window when using |
| 1162 | * {@link WindowManager.LayoutParams#FLAG_DIM_BEHIND}. This overrides |
| 1163 | * the default dim amount of that is selected by the Window based on |
| 1164 | * its theme. |
| 1165 | * |
| 1166 | * @param amount The new dim amount, from 0 for no dim to 1 for full dim. |
| 1167 | */ |
| 1168 | public void setDimAmount(float amount) { |
| 1169 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1170 | attrs.dimAmount = amount; |
| 1171 | mHaveDimAmount = true; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1172 | dispatchWindowAttributesChanged(attrs); |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1173 | } |
| 1174 | |
| 1175 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1176 | * Specify custom window attributes. <strong>PLEASE NOTE:</strong> the |
| 1177 | * layout params you give here should generally be from values previously |
| 1178 | * retrieved with {@link #getAttributes()}; you probably do not want to |
| 1179 | * blindly create and apply your own, since this will blow away any values |
| 1180 | * set by the framework that you are not interested in. |
| 1181 | * |
| 1182 | * @param a The new window attributes, which will completely override any |
| 1183 | * current values. |
| 1184 | */ |
| 1185 | public void setAttributes(WindowManager.LayoutParams a) { |
| 1186 | mWindowAttributes.copyFrom(a); |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1187 | dispatchWindowAttributesChanged(mWindowAttributes); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1188 | } |
| 1189 | |
| 1190 | /** |
| 1191 | * Retrieve the current window attributes associated with this panel. |
| 1192 | * |
| 1193 | * @return WindowManager.LayoutParams Either the existing window |
| 1194 | * attributes object, or a freshly created one if there is none. |
| 1195 | */ |
| 1196 | public final WindowManager.LayoutParams getAttributes() { |
| 1197 | return mWindowAttributes; |
| 1198 | } |
| 1199 | |
| 1200 | /** |
| 1201 | * Return the window flags that have been explicitly set by the client, |
| 1202 | * so will not be modified by {@link #getDecorView}. |
| 1203 | */ |
| 1204 | protected final int getForcedWindowFlags() { |
| 1205 | return mForcedWindowFlags; |
| 1206 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1207 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1208 | /** |
| 1209 | * Has the app specified their own soft input mode? |
| 1210 | */ |
| 1211 | protected final boolean hasSoftInputMode() { |
| 1212 | return mHasSoftInputMode; |
| 1213 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1214 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1215 | /** @hide */ |
| 1216 | public void setCloseOnTouchOutside(boolean close) { |
| 1217 | mCloseOnTouchOutside = close; |
| 1218 | mSetCloseOnTouchOutside = true; |
| 1219 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1220 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1221 | /** @hide */ |
Dianne Hackborn | ef57575 | 2011-01-18 17:35:17 -0800 | [diff] [blame] | 1222 | public void setCloseOnTouchOutsideIfNotSet(boolean close) { |
| 1223 | if (!mSetCloseOnTouchOutside) { |
| 1224 | mCloseOnTouchOutside = close; |
| 1225 | mSetCloseOnTouchOutside = true; |
| 1226 | } |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1227 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1228 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1229 | /** @hide */ |
Filip Gruszczynski | fe56835 | 2015-01-05 10:41:29 -0800 | [diff] [blame] | 1230 | @SystemApi |
| 1231 | public void setDisableWallpaperTouchEvents(boolean disable) { |
| 1232 | setPrivateFlags(disable |
| 1233 | ? WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS : 0, |
| 1234 | WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS); |
| 1235 | } |
| 1236 | |
| 1237 | /** @hide */ |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1238 | public abstract void alwaysReadCloseOnTouchAttr(); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1239 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1240 | /** @hide */ |
| 1241 | public boolean shouldCloseOnTouch(Context context, MotionEvent event) { |
| 1242 | if (mCloseOnTouchOutside && event.getAction() == MotionEvent.ACTION_DOWN |
| 1243 | && isOutOfBounds(context, event) && peekDecorView() != null) { |
| 1244 | return true; |
| 1245 | } |
| 1246 | return false; |
| 1247 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1248 | |
Ruchi Kandoi | 43e38de | 2016-04-14 19:34:53 -0700 | [diff] [blame] | 1249 | /* Sets the Sustained Performance requirement for the calling window. |
| 1250 | * @param enable disables or enables the mode. |
| 1251 | */ |
| 1252 | public void setSustainedPerformanceMode(boolean enable) { |
| 1253 | setPrivateFlags(enable |
| 1254 | ? WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE : 0, |
| 1255 | WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE); |
| 1256 | } |
| 1257 | |
Dianne Hackborn | cfaf887 | 2011-01-18 13:57:54 -0800 | [diff] [blame] | 1258 | private boolean isOutOfBounds(Context context, MotionEvent event) { |
| 1259 | final int x = (int) event.getX(); |
| 1260 | final int y = (int) event.getY(); |
| 1261 | final int slop = ViewConfiguration.get(context).getScaledWindowTouchSlop(); |
| 1262 | final View decorView = getDecorView(); |
| 1263 | return (x < -slop) || (y < -slop) |
| 1264 | || (x > (decorView.getWidth()+slop)) |
| 1265 | || (y > (decorView.getHeight()+slop)); |
| 1266 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1267 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1268 | /** |
| 1269 | * Enable extended screen features. This must be called before |
| 1270 | * setContentView(). May be called as many times as desired as long as it |
| 1271 | * is before setContentView(). If not called, no extended features |
| 1272 | * will be available. You can not turn off a feature once it is requested. |
| 1273 | * You canot use other title features with {@link #FEATURE_CUSTOM_TITLE}. |
| 1274 | * |
| 1275 | * @param featureId The desired features, defined as constants by Window. |
| 1276 | * @return The features that are now set. |
| 1277 | */ |
| 1278 | public boolean requestFeature(int featureId) { |
| 1279 | final int flag = 1<<featureId; |
| 1280 | mFeatures |= flag; |
| 1281 | mLocalFeatures |= mContainer != null ? (flag&~mContainer.mFeatures) : flag; |
| 1282 | return (mFeatures&flag) != 0; |
| 1283 | } |
| 1284 | |
Adam Powell | f4a6ec4 | 2010-08-24 14:18:10 -0700 | [diff] [blame] | 1285 | /** |
| 1286 | * @hide Used internally to help resolve conflicting features. |
| 1287 | */ |
| 1288 | protected void removeFeature(int featureId) { |
| 1289 | final int flag = 1<<featureId; |
| 1290 | mFeatures &= ~flag; |
| 1291 | mLocalFeatures &= ~(mContainer != null ? (flag&~mContainer.mFeatures) : flag); |
| 1292 | } |
| 1293 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1294 | public final void makeActive() { |
| 1295 | if (mContainer != null) { |
| 1296 | if (mContainer.mActiveChild != null) { |
| 1297 | mContainer.mActiveChild.mIsActive = false; |
| 1298 | } |
| 1299 | mContainer.mActiveChild = this; |
| 1300 | } |
| 1301 | mIsActive = true; |
| 1302 | onActive(); |
| 1303 | } |
| 1304 | |
| 1305 | public final boolean isActive() |
| 1306 | { |
| 1307 | return mIsActive; |
| 1308 | } |
| 1309 | |
| 1310 | /** |
| 1311 | * Finds a view that was identified by the id attribute from the XML that |
| 1312 | * was processed in {@link android.app.Activity#onCreate}. This will |
| 1313 | * implicitly call {@link #getDecorView} for you, with all of the |
| 1314 | * associated side-effects. |
| 1315 | * |
| 1316 | * @return The view if found or null otherwise. |
| 1317 | */ |
Scott Kennedy | c051955 | 2015-02-11 15:33:10 -0800 | [diff] [blame] | 1318 | @Nullable |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1319 | public View findViewById(@IdRes int id) { |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1320 | return getDecorView().findViewById(id); |
| 1321 | } |
| 1322 | |
| 1323 | /** |
| 1324 | * Convenience for |
| 1325 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} |
| 1326 | * to set the screen content from a layout resource. The resource will be |
| 1327 | * inflated, adding all top-level views to the screen. |
| 1328 | * |
| 1329 | * @param layoutResID Resource ID to be inflated. |
| 1330 | * @see #setContentView(View, android.view.ViewGroup.LayoutParams) |
| 1331 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1332 | public abstract void setContentView(@LayoutRes int layoutResID); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1333 | |
| 1334 | /** |
| 1335 | * Convenience for |
| 1336 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} |
| 1337 | * set the screen content to an explicit view. This view is placed |
| 1338 | * directly into the screen's view hierarchy. It can itself be a complex |
| 1339 | * view hierarhcy. |
| 1340 | * |
| 1341 | * @param view The desired content to display. |
| 1342 | * @see #setContentView(View, android.view.ViewGroup.LayoutParams) |
| 1343 | */ |
| 1344 | public abstract void setContentView(View view); |
| 1345 | |
| 1346 | /** |
| 1347 | * Set the screen content to an explicit view. This view is placed |
| 1348 | * directly into the screen's view hierarchy. It can itself be a complex |
| 1349 | * view hierarchy. |
| 1350 | * |
| 1351 | * <p>Note that calling this function "locks in" various characteristics |
| 1352 | * of the window that can not, from this point forward, be changed: the |
| 1353 | * features that have been requested with {@link #requestFeature(int)}, |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 1354 | * and certain window flags as described in {@link #setFlags(int, int)}.</p> |
| 1355 | * |
| 1356 | * <p>If {@link #FEATURE_CONTENT_TRANSITIONS} is set, the window's |
| 1357 | * TransitionManager will be used to animate content from the current |
| 1358 | * content View to view.</p> |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1359 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1360 | * @param view The desired content to display. |
| 1361 | * @param params Layout parameters for the view. |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 1362 | * @see #getTransitionManager() |
| 1363 | * @see #setTransitionManager(android.transition.TransitionManager) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1364 | */ |
| 1365 | public abstract void setContentView(View view, ViewGroup.LayoutParams params); |
| 1366 | |
| 1367 | /** |
| 1368 | * Variation on |
| 1369 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)} |
| 1370 | * to add an additional content view to the screen. Added after any existing |
| 1371 | * ones in the screen -- existing views are NOT removed. |
| 1372 | * |
| 1373 | * @param view The desired content to display. |
| 1374 | * @param params Layout parameters for the view. |
| 1375 | */ |
| 1376 | public abstract void addContentView(View view, ViewGroup.LayoutParams params); |
| 1377 | |
| 1378 | /** |
Filip Gruszczynski | a59ac9c | 2015-09-10 18:28:48 -0700 | [diff] [blame] | 1379 | * Remove the view that was used as the screen content. |
| 1380 | * |
| 1381 | * @hide |
| 1382 | */ |
| 1383 | public abstract void clearContentView(); |
| 1384 | |
| 1385 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1386 | * Return the view in this Window that currently has focus, or null if |
| 1387 | * there are none. Note that this does not look in any containing |
| 1388 | * Window. |
| 1389 | * |
| 1390 | * @return View The current View with focus or null. |
| 1391 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1392 | @Nullable |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1393 | public abstract View getCurrentFocus(); |
| 1394 | |
| 1395 | /** |
| 1396 | * Quick access to the {@link LayoutInflater} instance that this Window |
| 1397 | * retrieved from its Context. |
| 1398 | * |
| 1399 | * @return LayoutInflater The shared LayoutInflater. |
| 1400 | */ |
Tor Norbye | d9273d6 | 2013-05-30 15:59:53 -0700 | [diff] [blame] | 1401 | @NonNull |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1402 | public abstract LayoutInflater getLayoutInflater(); |
| 1403 | |
| 1404 | public abstract void setTitle(CharSequence title); |
| 1405 | |
Alan Viverette | 2525d9c | 2013-11-15 14:42:19 -0800 | [diff] [blame] | 1406 | @Deprecated |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 1407 | public abstract void setTitleColor(@ColorInt int textColor); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1408 | |
| 1409 | public abstract void openPanel(int featureId, KeyEvent event); |
| 1410 | |
| 1411 | public abstract void closePanel(int featureId); |
| 1412 | |
| 1413 | public abstract void togglePanel(int featureId, KeyEvent event); |
| 1414 | |
Dianne Hackborn | b31e84bc | 2010-06-08 18:04:35 -0700 | [diff] [blame] | 1415 | public abstract void invalidatePanelMenu(int featureId); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1416 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1417 | public abstract boolean performPanelShortcut(int featureId, |
| 1418 | int keyCode, |
| 1419 | KeyEvent event, |
| 1420 | int flags); |
| 1421 | public abstract boolean performPanelIdentifierAction(int featureId, |
| 1422 | int id, |
| 1423 | int flags); |
| 1424 | |
| 1425 | public abstract void closeAllPanels(); |
| 1426 | |
| 1427 | public abstract boolean performContextMenuIdentifierAction(int id, int flags); |
| 1428 | |
| 1429 | /** |
| 1430 | * Should be called when the configuration is changed. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1431 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1432 | * @param newConfig The new configuration. |
| 1433 | */ |
| 1434 | public abstract void onConfigurationChanged(Configuration newConfig); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1435 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1436 | /** |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1437 | * Sets the window elevation. |
Alan Viverette | 71922de | 2015-01-12 16:14:02 -0800 | [diff] [blame] | 1438 | * <p> |
| 1439 | * Changes to this property take effect immediately and will cause the |
| 1440 | * window surface to be recreated. This is an expensive operation and as a |
| 1441 | * result, this property should not be animated. |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1442 | * |
| 1443 | * @param elevation The window elevation. |
| 1444 | * @see View#setElevation(float) |
| 1445 | * @see android.R.styleable#Window_windowElevation |
| 1446 | */ |
| 1447 | public void setElevation(float elevation) {} |
| 1448 | |
| 1449 | /** |
Filip Gruszczynski | a59ac9c | 2015-09-10 18:28:48 -0700 | [diff] [blame] | 1450 | * Gets the window elevation. |
| 1451 | * |
| 1452 | * @hide |
| 1453 | */ |
| 1454 | public float getElevation() { |
| 1455 | return 0.0f; |
| 1456 | } |
| 1457 | |
| 1458 | /** |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1459 | * Sets whether window content should be clipped to the outline of the |
| 1460 | * window background. |
| 1461 | * |
| 1462 | * @param clipToOutline Whether window content should be clipped to the |
| 1463 | * outline of the window background. |
| 1464 | * @see View#setClipToOutline(boolean) |
| 1465 | * @see android.R.styleable#Window_windowClipToOutline |
| 1466 | */ |
| 1467 | public void setClipToOutline(boolean clipToOutline) {} |
| 1468 | |
| 1469 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1470 | * Change the background of this window to a Drawable resource. Setting the |
| 1471 | * background to null will make the window be opaque. To make the window |
| 1472 | * transparent, you can use an empty drawable (for instance a ColorDrawable |
| 1473 | * with the color 0 or the system drawable android:drawable/empty.) |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1474 | * |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1475 | * @param resId The resource identifier of a drawable resource which will |
| 1476 | * be installed as the new background. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1477 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1478 | public void setBackgroundDrawableResource(@DrawableRes int resId) { |
Alan Viverette | 79c067c5 | 2014-10-29 14:27:47 -0700 | [diff] [blame] | 1479 | setBackgroundDrawable(mContext.getDrawable(resId)); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1480 | } |
| 1481 | |
| 1482 | /** |
| 1483 | * Change the background of this window to a custom Drawable. Setting the |
| 1484 | * background to null will make the window be opaque. To make the window |
| 1485 | * transparent, you can use an empty drawable (for instance a ColorDrawable |
| 1486 | * with the color 0 or the system drawable android:drawable/empty.) |
| 1487 | * |
| 1488 | * @param drawable The new Drawable to use for this window's background. |
| 1489 | */ |
| 1490 | public abstract void setBackgroundDrawable(Drawable drawable); |
| 1491 | |
| 1492 | /** |
| 1493 | * Set the value for a drawable feature of this window, from a resource |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1494 | * identifier. You must have called requestFeature(featureId) before |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1495 | * calling this function. |
| 1496 | * |
| 1497 | * @see android.content.res.Resources#getDrawable(int) |
| 1498 | * |
| 1499 | * @param featureId The desired drawable feature to change, defined as a |
| 1500 | * constant by Window. |
| 1501 | * @param resId Resource identifier of the desired image. |
| 1502 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1503 | public abstract void setFeatureDrawableResource(int featureId, @DrawableRes int resId); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1504 | |
| 1505 | /** |
| 1506 | * Set the value for a drawable feature of this window, from a URI. You |
| 1507 | * must have called requestFeature(featureId) before calling this |
| 1508 | * function. |
| 1509 | * |
| 1510 | * <p>The only URI currently supported is "content:", specifying an image |
| 1511 | * in a content provider. |
| 1512 | * |
| 1513 | * @see android.widget.ImageView#setImageURI |
| 1514 | * |
| 1515 | * @param featureId The desired drawable feature to change. Features are |
| 1516 | * constants defined by Window. |
| 1517 | * @param uri The desired URI. |
| 1518 | */ |
| 1519 | public abstract void setFeatureDrawableUri(int featureId, Uri uri); |
| 1520 | |
| 1521 | /** |
| 1522 | * Set an explicit Drawable value for feature of this window. You must |
| 1523 | * have called requestFeature(featureId) before calling this function. |
| 1524 | * |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1525 | * @param featureId The desired drawable feature to change. Features are |
| 1526 | * constants defined by Window. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1527 | * @param drawable A Drawable object to display. |
| 1528 | */ |
| 1529 | public abstract void setFeatureDrawable(int featureId, Drawable drawable); |
| 1530 | |
| 1531 | /** |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1532 | * Set a custom alpha value for the given drawable feature, controlling how |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1533 | * much the background is visible through it. |
| 1534 | * |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1535 | * @param featureId The desired drawable feature to change. Features are |
| 1536 | * constants defined by Window. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1537 | * @param alpha The alpha amount, 0 is completely transparent and 255 is |
| 1538 | * completely opaque. |
| 1539 | */ |
| 1540 | public abstract void setFeatureDrawableAlpha(int featureId, int alpha); |
| 1541 | |
| 1542 | /** |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1543 | * Set the integer value for a feature. The range of the value depends on |
| 1544 | * the feature being set. For {@link #FEATURE_PROGRESS}, it should go from |
| 1545 | * 0 to 10000. At 10000 the progress is complete and the indicator hidden. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1546 | * |
Alan Viverette | 9678e34 | 2014-10-24 15:23:58 -0700 | [diff] [blame] | 1547 | * @param featureId The desired feature to change. Features are constants |
| 1548 | * defined by Window. |
| 1549 | * @param value The value for the feature. The interpretation of this |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1550 | * value is feature-specific. |
| 1551 | */ |
| 1552 | public abstract void setFeatureInt(int featureId, int value); |
| 1553 | |
| 1554 | /** |
| 1555 | * Request that key events come to this activity. Use this if your |
| 1556 | * activity has no views with focus, but the activity still wants |
| 1557 | * a chance to process key events. |
| 1558 | */ |
| 1559 | public abstract void takeKeyEvents(boolean get); |
| 1560 | |
| 1561 | /** |
| 1562 | * Used by custom windows, such as Dialog, to pass the key press event |
| 1563 | * further down the view hierarchy. Application developers should |
| 1564 | * not need to implement or call this. |
| 1565 | * |
| 1566 | */ |
| 1567 | public abstract boolean superDispatchKeyEvent(KeyEvent event); |
| 1568 | |
| 1569 | /** |
Jeff Brown | 64da12a | 2011-01-04 19:57:47 -0800 | [diff] [blame] | 1570 | * Used by custom windows, such as Dialog, to pass the key shortcut press event |
| 1571 | * further down the view hierarchy. Application developers should |
| 1572 | * not need to implement or call this. |
| 1573 | * |
| 1574 | */ |
| 1575 | public abstract boolean superDispatchKeyShortcutEvent(KeyEvent event); |
| 1576 | |
| 1577 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1578 | * Used by custom windows, such as Dialog, to pass the touch screen event |
| 1579 | * further down the view hierarchy. Application developers should |
| 1580 | * not need to implement or call this. |
| 1581 | * |
| 1582 | */ |
| 1583 | public abstract boolean superDispatchTouchEvent(MotionEvent event); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1584 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1585 | /** |
| 1586 | * Used by custom windows, such as Dialog, to pass the trackball event |
| 1587 | * further down the view hierarchy. Application developers should |
| 1588 | * not need to implement or call this. |
| 1589 | * |
| 1590 | */ |
| 1591 | public abstract boolean superDispatchTrackballEvent(MotionEvent event); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1592 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1593 | /** |
Jeff Brown | cb1404e | 2011-01-15 18:14:15 -0800 | [diff] [blame] | 1594 | * Used by custom windows, such as Dialog, to pass the generic motion event |
| 1595 | * further down the view hierarchy. Application developers should |
| 1596 | * not need to implement or call this. |
| 1597 | * |
| 1598 | */ |
| 1599 | public abstract boolean superDispatchGenericMotionEvent(MotionEvent event); |
| 1600 | |
| 1601 | /** |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1602 | * Retrieve the top-level window decor view (containing the standard |
| 1603 | * window frame/decorations and the client's content inside of that), which |
| 1604 | * can be added as a window to the window manager. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1605 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1606 | * <p><em>Note that calling this function for the first time "locks in" |
| 1607 | * various window characteristics as described in |
| 1608 | * {@link #setContentView(View, android.view.ViewGroup.LayoutParams)}.</em></p> |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1609 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1610 | * @return Returns the top-level window decor view. |
| 1611 | */ |
| 1612 | public abstract View getDecorView(); |
| 1613 | |
| 1614 | /** |
| 1615 | * Retrieve the current decor view, but only if it has already been created; |
| 1616 | * otherwise returns null. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1617 | * |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1618 | * @return Returns the top-level window decor or null. |
| 1619 | * @see #getDecorView |
| 1620 | */ |
| 1621 | public abstract View peekDecorView(); |
| 1622 | |
| 1623 | public abstract Bundle saveHierarchyState(); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1624 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1625 | public abstract void restoreHierarchyState(Bundle savedInstanceState); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1626 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1627 | protected abstract void onActive(); |
| 1628 | |
| 1629 | /** |
| 1630 | * Return the feature bits that are enabled. This is the set of features |
| 1631 | * that were given to requestFeature(), and are being handled by this |
| 1632 | * Window itself or its container. That is, it is the set of |
| 1633 | * requested features that you can actually use. |
| 1634 | * |
| 1635 | * <p>To do: add a public version of this API that allows you to check for |
| 1636 | * features by their feature ID. |
| 1637 | * |
| 1638 | * @return int The feature bits. |
| 1639 | */ |
| 1640 | protected final int getFeatures() |
| 1641 | { |
| 1642 | return mFeatures; |
| 1643 | } |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1644 | |
Adam Powell | 33b9743 | 2010-04-20 10:01:14 -0700 | [diff] [blame] | 1645 | /** |
Bryce Lee | d6e6e72 | 2014-11-21 11:08:45 -0800 | [diff] [blame] | 1646 | * Return the feature bits set by default on a window. |
| 1647 | * @param context The context used to access resources |
| 1648 | */ |
| 1649 | public static int getDefaultFeatures(Context context) { |
| 1650 | int features = 0; |
| 1651 | |
| 1652 | final Resources res = context.getResources(); |
| 1653 | if (res.getBoolean(com.android.internal.R.bool.config_defaultWindowFeatureOptionsPanel)) { |
| 1654 | features |= 1 << FEATURE_OPTIONS_PANEL; |
| 1655 | } |
| 1656 | |
| 1657 | if (res.getBoolean(com.android.internal.R.bool.config_defaultWindowFeatureContextMenu)) { |
| 1658 | features |= 1 << FEATURE_CONTEXT_MENU; |
| 1659 | } |
| 1660 | |
| 1661 | return features; |
| 1662 | } |
| 1663 | |
| 1664 | /** |
Adam Powell | 33b9743 | 2010-04-20 10:01:14 -0700 | [diff] [blame] | 1665 | * Query for the availability of a certain feature. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1666 | * |
Adam Powell | 33b9743 | 2010-04-20 10:01:14 -0700 | [diff] [blame] | 1667 | * @param feature The feature ID to check |
| 1668 | * @return true if the feature is enabled, false otherwise. |
| 1669 | */ |
| 1670 | public boolean hasFeature(int feature) { |
| 1671 | return (getFeatures() & (1 << feature)) != 0; |
| 1672 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1673 | |
| 1674 | /** |
| 1675 | * Return the feature bits that are being implemented by this Window. |
| 1676 | * This is the set of features that were given to requestFeature(), and are |
| 1677 | * being handled by only this Window itself, not by its containers. |
| 1678 | * |
| 1679 | * @return int The feature bits. |
| 1680 | */ |
| 1681 | protected final int getLocalFeatures() |
| 1682 | { |
| 1683 | return mLocalFeatures; |
| 1684 | } |
| 1685 | |
| 1686 | /** |
| 1687 | * Set the default format of window, as per the PixelFormat types. This |
| 1688 | * is the format that will be used unless the client specifies in explicit |
| 1689 | * format with setFormat(); |
| 1690 | * |
| 1691 | * @param format The new window format (see PixelFormat). |
| 1692 | * |
| 1693 | * @see #setFormat |
| 1694 | * @see PixelFormat |
| 1695 | */ |
| 1696 | protected void setDefaultWindowFormat(int format) { |
| 1697 | mDefaultWindowFormat = format; |
| 1698 | if (!mHaveWindowFormat) { |
| 1699 | final WindowManager.LayoutParams attrs = getAttributes(); |
| 1700 | attrs.format = format; |
Adrian Roos | ea56251 | 2014-05-05 13:33:03 +0200 | [diff] [blame] | 1701 | dispatchWindowAttributesChanged(attrs); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1702 | } |
| 1703 | } |
| 1704 | |
Dianne Hackborn | 661cd52 | 2011-08-22 00:26:20 -0700 | [diff] [blame] | 1705 | /** @hide */ |
| 1706 | protected boolean haveDimAmount() { |
| 1707 | return mHaveDimAmount; |
| 1708 | } |
| 1709 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1710 | public abstract void setChildDrawable(int featureId, Drawable drawable); |
| 1711 | |
| 1712 | public abstract void setChildInt(int featureId, int value); |
| 1713 | |
| 1714 | /** |
| 1715 | * Is a keypress one of the defined shortcut keys for this window. |
| 1716 | * @param keyCode the key code from {@link android.view.KeyEvent} to check. |
| 1717 | * @param event the {@link android.view.KeyEvent} to use to help check. |
| 1718 | */ |
| 1719 | public abstract boolean isShortcutKey(int keyCode, KeyEvent event); |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1720 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1721 | /** |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1722 | * @see android.app.Activity#setVolumeControlStream(int) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1723 | */ |
| 1724 | public abstract void setVolumeControlStream(int streamType); |
| 1725 | |
| 1726 | /** |
| 1727 | * @see android.app.Activity#getVolumeControlStream() |
| 1728 | */ |
| 1729 | public abstract int getVolumeControlStream(); |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1730 | |
| 1731 | /** |
RoboErik | fd63dd0 | 2014-08-28 15:22:55 -0700 | [diff] [blame] | 1732 | * Sets a {@link MediaController} to send media keys and volume changes to. |
| 1733 | * If set, this should be preferred for all media keys and volume requests |
| 1734 | * sent to this window. |
| 1735 | * |
| 1736 | * @param controller The controller for the session which should receive |
| 1737 | * media keys and volume changes. |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1738 | * @see android.app.Activity#setMediaController(android.media.session.MediaController) |
| 1739 | */ |
| 1740 | public void setMediaController(MediaController controller) { |
| 1741 | } |
| 1742 | |
| 1743 | /** |
RoboErik | fd63dd0 | 2014-08-28 15:22:55 -0700 | [diff] [blame] | 1744 | * Gets the {@link MediaController} that was previously set. |
| 1745 | * |
| 1746 | * @return The controller which should receive events. |
| 1747 | * @see #setMediaController(android.media.session.MediaController) |
RoboErik | 5501165 | 2014-07-09 15:05:53 -0700 | [diff] [blame] | 1748 | * @see android.app.Activity#getMediaController() |
| 1749 | */ |
| 1750 | public MediaController getMediaController() { |
| 1751 | return null; |
| 1752 | } |
| 1753 | |
| 1754 | /** |
Adam Powell | 269248d | 2011-08-02 10:26:54 -0700 | [diff] [blame] | 1755 | * Set extra options that will influence the UI for this window. |
| 1756 | * @param uiOptions Flags specifying extra options for this window. |
| 1757 | */ |
| 1758 | public void setUiOptions(int uiOptions) { } |
Adam Powell | e43fca9 | 2011-08-16 12:57:01 -0700 | [diff] [blame] | 1759 | |
| 1760 | /** |
| 1761 | * Set extra options that will influence the UI for this window. |
| 1762 | * Only the bits filtered by mask will be modified. |
| 1763 | * @param uiOptions Flags specifying extra options for this window. |
| 1764 | * @param mask Flags specifying which options should be modified. Others will remain unchanged. |
| 1765 | */ |
| 1766 | public void setUiOptions(int uiOptions, int mask) { } |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 1767 | |
| 1768 | /** |
| 1769 | * Set the primary icon for this window. |
| 1770 | * |
| 1771 | * @param resId resource ID of a drawable to set |
| 1772 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1773 | public void setIcon(@DrawableRes int resId) { } |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 1774 | |
| 1775 | /** |
| 1776 | * Set the default icon for this window. |
| 1777 | * This will be overridden by any other icon set operation which could come from the |
| 1778 | * theme or another explicit set. |
| 1779 | * |
| 1780 | * @hide |
| 1781 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1782 | public void setDefaultIcon(@DrawableRes int resId) { } |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 1783 | |
| 1784 | /** |
| 1785 | * Set the logo for this window. A logo is often shown in place of an |
| 1786 | * {@link #setIcon(int) icon} but is generally wider and communicates window title information |
| 1787 | * as well. |
| 1788 | * |
| 1789 | * @param resId resource ID of a drawable to set |
| 1790 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1791 | public void setLogo(@DrawableRes int resId) { } |
Adam Powell | 04fe6eb | 2013-05-31 14:39:48 -0700 | [diff] [blame] | 1792 | |
| 1793 | /** |
| 1794 | * Set the default logo for this window. |
| 1795 | * This will be overridden by any other logo set operation which could come from the |
| 1796 | * theme or another explicit set. |
| 1797 | * |
| 1798 | * @hide |
| 1799 | */ |
Tor Norbye | 7b9c912 | 2013-05-30 16:48:33 -0700 | [diff] [blame] | 1800 | public void setDefaultLogo(@DrawableRes int resId) { } |
keunyoung | 30f420f | 2013-08-02 14:23:10 -0700 | [diff] [blame] | 1801 | |
| 1802 | /** |
| 1803 | * Set focus locally. The window should have the |
| 1804 | * {@link WindowManager.LayoutParams#FLAG_LOCAL_FOCUS_MODE} flag set already. |
| 1805 | * @param hasFocus Whether this window has focus or not. |
| 1806 | * @param inTouchMode Whether this window is in touch mode or not. |
| 1807 | */ |
| 1808 | public void setLocalFocus(boolean hasFocus, boolean inTouchMode) { } |
| 1809 | |
| 1810 | /** |
| 1811 | * Inject an event to window locally. |
| 1812 | * @param event A key or touch event to inject to this window. |
| 1813 | */ |
| 1814 | public void injectInputEvent(InputEvent event) { } |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 1815 | |
| 1816 | /** |
| 1817 | * Retrieve the {@link TransitionManager} responsible for for default transitions |
| 1818 | * in this window. Requires {@link #FEATURE_CONTENT_TRANSITIONS}. |
| 1819 | * |
| 1820 | * <p>This method will return non-null after content has been initialized (e.g. by using |
| 1821 | * {@link #setContentView}) if {@link #FEATURE_CONTENT_TRANSITIONS} has been granted.</p> |
| 1822 | * |
| 1823 | * @return This window's content TransitionManager or null if none is set. |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 1824 | * @attr ref android.R.styleable#Window_windowContentTransitionManager |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 1825 | */ |
| 1826 | public TransitionManager getTransitionManager() { |
| 1827 | return null; |
| 1828 | } |
| 1829 | |
| 1830 | /** |
| 1831 | * Set the {@link TransitionManager} to use for default transitions in this window. |
| 1832 | * Requires {@link #FEATURE_CONTENT_TRANSITIONS}. |
| 1833 | * |
| 1834 | * @param tm The TransitionManager to use for scene changes. |
George Mount | c3a043c | 2015-02-04 14:37:04 -0800 | [diff] [blame] | 1835 | * @attr ref android.R.styleable#Window_windowContentTransitionManager |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 1836 | */ |
| 1837 | public void setTransitionManager(TransitionManager tm) { |
| 1838 | throw new UnsupportedOperationException(); |
| 1839 | } |
| 1840 | |
| 1841 | /** |
| 1842 | * Retrieve the {@link Scene} representing this window's current content. |
| 1843 | * Requires {@link #FEATURE_CONTENT_TRANSITIONS}. |
| 1844 | * |
| 1845 | * <p>This method will return null if the current content is not represented by a Scene.</p> |
| 1846 | * |
| 1847 | * @return Current Scene being shown or null |
| 1848 | */ |
| 1849 | public Scene getContentScene() { |
| 1850 | return null; |
| 1851 | } |
| 1852 | |
| 1853 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1854 | * Sets the Transition that will be used to move Views into the initial scene. The entering |
| 1855 | * Views will be those that are regular Views or ViewGroups that have |
| 1856 | * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 1857 | * {@link android.transition.Visibility} as entering is governed by changing visibility from |
| 1858 | * {@link View#INVISIBLE} to {@link View#VISIBLE}. If <code>transition</code> is null, |
| 1859 | * entering Views will remain unaffected. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1860 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1861 | * @param transition The Transition to use to move Views into the initial Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1862 | * @attr ref android.R.styleable#Window_windowEnterTransition |
Adam Powell | cfbe9be | 2013-11-06 14:58:58 -0800 | [diff] [blame] | 1863 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1864 | public void setEnterTransition(Transition transition) {} |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 1865 | |
| 1866 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1867 | * Sets the Transition that will be used to move Views out of the scene when the Window is |
| 1868 | * preparing to close, for example after a call to |
| 1869 | * {@link android.app.Activity#finishAfterTransition()}. The exiting |
| 1870 | * Views will be those that are regular Views or ViewGroups that have |
| 1871 | * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 1872 | * {@link android.transition.Visibility} as entering is governed by changing visibility from |
| 1873 | * {@link View#VISIBLE} to {@link View#INVISIBLE}. If <code>transition</code> is null, |
| 1874 | * entering Views will remain unaffected. If nothing is set, the default will be to |
| 1875 | * use the same value as set in {@link #setEnterTransition(android.transition.Transition)}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1876 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1877 | * @param transition The Transition to use to move Views out of the Scene when the Window |
| 1878 | * is preparing to close. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1879 | * @attr ref android.R.styleable#Window_windowReturnTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1880 | */ |
| 1881 | public void setReturnTransition(Transition transition) {} |
| 1882 | |
| 1883 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1884 | * Sets the Transition that will be used to move Views out of the scene when starting a |
| 1885 | * new Activity. The exiting Views will be those that are regular Views or ViewGroups that |
| 1886 | * have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 1887 | * {@link android.transition.Visibility} as exiting is governed by changing visibility |
| 1888 | * from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, the views will |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 1889 | * remain unaffected. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1890 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1891 | * @param transition The Transition to use to move Views out of the scene when calling a |
| 1892 | * new Activity. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1893 | * @attr ref android.R.styleable#Window_windowExitTransition |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 1894 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1895 | public void setExitTransition(Transition transition) {} |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 1896 | |
| 1897 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1898 | * Sets the Transition that will be used to move Views in to the scene when returning from |
| 1899 | * a previously-started Activity. The entering Views will be those that are regular Views |
| 1900 | * or ViewGroups that have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions |
| 1901 | * will extend {@link android.transition.Visibility} as exiting is governed by changing |
| 1902 | * visibility from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, |
| 1903 | * the views will remain unaffected. If nothing is set, the default will be to use the same |
| 1904 | * transition as {@link #setExitTransition(android.transition.Transition)}. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 1905 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1906 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1907 | * @param transition The Transition to use to move Views into the scene when reentering from a |
| 1908 | * previously-started Activity. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1909 | * @attr ref android.R.styleable#Window_windowReenterTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1910 | */ |
| 1911 | public void setReenterTransition(Transition transition) {} |
| 1912 | |
| 1913 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1914 | * Returns the transition used to move Views into the initial scene. The entering |
| 1915 | * Views will be those that are regular Views or ViewGroups that have |
| 1916 | * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 1917 | * {@link android.transition.Visibility} as entering is governed by changing visibility from |
| 1918 | * {@link View#INVISIBLE} to {@link View#VISIBLE}. If <code>transition</code> is null, |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 1919 | * entering Views will remain unaffected. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1920 | * |
| 1921 | * @return the Transition to use to move Views into the initial Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1922 | * @attr ref android.R.styleable#Window_windowEnterTransition |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 1923 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1924 | public Transition getEnterTransition() { return null; } |
George Mount | cb4b7d9 | 2014-02-25 10:47:55 -0800 | [diff] [blame] | 1925 | |
| 1926 | /** |
Chet Haase | b64e777f | 2016-12-09 07:17:10 -0800 | [diff] [blame] | 1927 | * Returns the Transition that will be used to move Views out of the scene when the Window is |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1928 | * preparing to close, for example after a call to |
| 1929 | * {@link android.app.Activity#finishAfterTransition()}. The exiting |
| 1930 | * Views will be those that are regular Views or ViewGroups that have |
| 1931 | * {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 1932 | * {@link android.transition.Visibility} as entering is governed by changing visibility from |
| 1933 | * {@link View#VISIBLE} to {@link View#INVISIBLE}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1934 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1935 | * @return The Transition to use to move Views out of the Scene when the Window |
| 1936 | * is preparing to close. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1937 | * @attr ref android.R.styleable#Window_windowReturnTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1938 | */ |
| 1939 | public Transition getReturnTransition() { return null; } |
| 1940 | |
| 1941 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1942 | * Returns the Transition that will be used to move Views out of the scene when starting a |
| 1943 | * new Activity. The exiting Views will be those that are regular Views or ViewGroups that |
| 1944 | * have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions will extend |
| 1945 | * {@link android.transition.Visibility} as exiting is governed by changing visibility |
| 1946 | * from {@link View#VISIBLE} to {@link View#INVISIBLE}. If transition is null, the views will |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 1947 | * remain unaffected. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1948 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1949 | * @return the Transition to use to move Views out of the scene when calling a |
| 1950 | * new Activity. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1951 | * @attr ref android.R.styleable#Window_windowExitTransition |
George Mount | cb4b7d9 | 2014-02-25 10:47:55 -0800 | [diff] [blame] | 1952 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1953 | public Transition getExitTransition() { return null; } |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 1954 | |
| 1955 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1956 | * Returns the Transition that will be used to move Views in to the scene when returning from |
| 1957 | * a previously-started Activity. The entering Views will be those that are regular Views |
| 1958 | * or ViewGroups that have {@link ViewGroup#isTransitionGroup} return true. Typical Transitions |
| 1959 | * will extend {@link android.transition.Visibility} as exiting is governed by changing |
| 1960 | * visibility from {@link View#VISIBLE} to {@link View#INVISIBLE}. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 1961 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1962 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1963 | * @return The Transition to use to move Views into the scene when reentering from a |
| 1964 | * previously-started Activity. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1965 | * @attr ref android.R.styleable#Window_windowReenterTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1966 | */ |
| 1967 | public Transition getReenterTransition() { return null; } |
| 1968 | |
| 1969 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1970 | * Sets the Transition that will be used for shared elements transferred into the content |
| 1971 | * Scene. Typical Transitions will affect size and location, such as |
George Mount | 990205e | 2014-06-24 09:36:18 -0700 | [diff] [blame] | 1972 | * {@link android.transition.ChangeBounds}. A null |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1973 | * value will cause transferred shared elements to blink to the final position. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 1974 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1975 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1976 | * @param transition The Transition to use for shared elements transferred into the content |
| 1977 | * Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1978 | * @attr ref android.R.styleable#Window_windowSharedElementEnterTransition |
George Mount | 0a778ed | 2013-12-13 13:35:36 -0800 | [diff] [blame] | 1979 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1980 | public void setSharedElementEnterTransition(Transition transition) {} |
George Mount | e180337 | 2014-02-26 19:00:52 +0000 | [diff] [blame] | 1981 | |
| 1982 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1983 | * Sets the Transition that will be used for shared elements transferred back to a |
| 1984 | * calling Activity. Typical Transitions will affect size and location, such as |
| 1985 | * {@link android.transition.ChangeBounds}. A null |
| 1986 | * value will cause transferred shared elements to blink to the final position. |
| 1987 | * If no value is set, the default will be to use the same value as |
| 1988 | * {@link #setSharedElementEnterTransition(android.transition.Transition)}. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 1989 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1990 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1991 | * @param transition The Transition to use for shared elements transferred out of the content |
| 1992 | * Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 1993 | * @attr ref android.R.styleable#Window_windowSharedElementReturnTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 1994 | */ |
| 1995 | public void setSharedElementReturnTransition(Transition transition) {} |
| 1996 | |
| 1997 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 1998 | * Returns the Transition that will be used for shared elements transferred into the content |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 1999 | * Scene. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2000 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2001 | * @return Transition to use for sharend elements transferred into the content Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2002 | * @attr ref android.R.styleable#Window_windowSharedElementEnterTransition |
George Mount | cb4b7d9 | 2014-02-25 10:47:55 -0800 | [diff] [blame] | 2003 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2004 | public Transition getSharedElementEnterTransition() { return null; } |
George Mount | cb4b7d9 | 2014-02-25 10:47:55 -0800 | [diff] [blame] | 2005 | |
| 2006 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2007 | * Returns the Transition that will be used for shared elements transferred back to a |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2008 | * calling Activity. Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2009 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2010 | * @return Transition to use for sharend elements transferred into the content Scene. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2011 | * @attr ref android.R.styleable#Window_windowSharedElementReturnTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2012 | */ |
| 2013 | public Transition getSharedElementReturnTransition() { return null; } |
| 2014 | |
| 2015 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2016 | * Sets the Transition that will be used for shared elements after starting a new Activity |
| 2017 | * before the shared elements are transferred to the called Activity. If the shared elements |
| 2018 | * must animate during the exit transition, this Transition should be used. Upon completion, |
| 2019 | * the shared elements may be transferred to the started Activity. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2020 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2021 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2022 | * @param transition The Transition to use for shared elements in the launching Window |
| 2023 | * prior to transferring to the launched Activity's Window. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2024 | * @attr ref android.R.styleable#Window_windowSharedElementExitTransition |
George Mount | e180337 | 2014-02-26 19:00:52 +0000 | [diff] [blame] | 2025 | */ |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2026 | public void setSharedElementExitTransition(Transition transition) {} |
| 2027 | |
| 2028 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2029 | * Sets the Transition that will be used for shared elements reentering from a started |
| 2030 | * Activity after it has returned the shared element to it start location. If no value |
| 2031 | * is set, this will default to |
| 2032 | * {@link #setSharedElementExitTransition(android.transition.Transition)}. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2033 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2034 | * |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2035 | * @param transition The Transition to use for shared elements in the launching Window |
| 2036 | * after the shared element has returned to the Window. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2037 | * @attr ref android.R.styleable#Window_windowSharedElementReenterTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2038 | */ |
| 2039 | public void setSharedElementReenterTransition(Transition transition) {} |
| 2040 | |
| 2041 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2042 | * Returns the Transition to use for shared elements in the launching Window prior |
| 2043 | * to transferring to the launched Activity's Window. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2044 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2045 | * |
| 2046 | * @return the Transition to use for shared elements in the launching Window prior |
| 2047 | * to transferring to the launched Activity's Window. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2048 | * @attr ref android.R.styleable#Window_windowSharedElementExitTransition |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2049 | */ |
| 2050 | public Transition getSharedElementExitTransition() { return null; } |
| 2051 | |
| 2052 | /** |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2053 | * Returns the Transition that will be used for shared elements reentering from a started |
| 2054 | * Activity after it has returned the shared element to it start location. |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2055 | * Requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2056 | * |
| 2057 | * @return the Transition that will be used for shared elements reentering from a started |
| 2058 | * Activity after it has returned the shared element to it start location. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2059 | * @attr ref android.R.styleable#Window_windowSharedElementReenterTransition |
George Mount | 68f96d8 | 2014-07-31 13:13:10 -0700 | [diff] [blame] | 2060 | */ |
| 2061 | public Transition getSharedElementReenterTransition() { return null; } |
| 2062 | |
| 2063 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2064 | * Controls how the transition set in |
| 2065 | * {@link #setEnterTransition(android.transition.Transition)} overlaps with the exit |
| 2066 | * transition of the calling Activity. When true, the transition will start as soon as possible. |
| 2067 | * When false, the transition will wait until the remote exiting transition completes before |
George Mount | 5d52d31 | 2016-06-10 14:16:45 -0700 | [diff] [blame] | 2068 | * starting. The default value is true. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2069 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2070 | * @param allow true to start the enter transition when possible or false to |
| 2071 | * wait until the exiting transition completes. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2072 | * @attr ref android.R.styleable#Window_windowAllowEnterTransitionOverlap |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2073 | */ |
| 2074 | public void setAllowEnterTransitionOverlap(boolean allow) {} |
| 2075 | |
| 2076 | /** |
| 2077 | * Returns how the transition set in |
| 2078 | * {@link #setEnterTransition(android.transition.Transition)} overlaps with the exit |
| 2079 | * transition of the calling Activity. When true, the transition will start as soon as possible. |
| 2080 | * When false, the transition will wait until the remote exiting transition completes before |
George Mount | 5d52d31 | 2016-06-10 14:16:45 -0700 | [diff] [blame] | 2081 | * starting. The default value is true. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2082 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2083 | * @return true when the enter transition should start as soon as possible or false to |
| 2084 | * when it should wait until the exiting transition completes. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2085 | * @attr ref android.R.styleable#Window_windowAllowEnterTransitionOverlap |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2086 | */ |
| 2087 | public boolean getAllowEnterTransitionOverlap() { return true; } |
| 2088 | |
| 2089 | /** |
| 2090 | * Controls how the transition set in |
| 2091 | * {@link #setExitTransition(android.transition.Transition)} overlaps with the exit |
| 2092 | * transition of the called Activity when reentering after if finishes. When true, |
| 2093 | * the transition will start as soon as possible. When false, the transition will wait |
| 2094 | * until the called Activity's exiting transition completes before starting. |
George Mount | 5d52d31 | 2016-06-10 14:16:45 -0700 | [diff] [blame] | 2095 | * The default value is true. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2096 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2097 | * @param allow true to start the transition when possible or false to wait until the |
| 2098 | * called Activity's exiting transition completes. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2099 | * @attr ref android.R.styleable#Window_windowAllowReturnTransitionOverlap |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2100 | */ |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2101 | public void setAllowReturnTransitionOverlap(boolean allow) {} |
| 2102 | |
| 2103 | /** |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2104 | * Returns how the transition set in |
| 2105 | * {@link #setExitTransition(android.transition.Transition)} overlaps with the exit |
| 2106 | * transition of the called Activity when reentering after if finishes. When true, |
| 2107 | * the transition will start as soon as possible. When false, the transition will wait |
| 2108 | * until the called Activity's exiting transition completes before starting. |
George Mount | 5d52d31 | 2016-06-10 14:16:45 -0700 | [diff] [blame] | 2109 | * The default value is true. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2110 | * |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2111 | * @return true when the transition should start when possible or false when it should wait |
| 2112 | * until the called Activity's exiting transition completes. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2113 | * @attr ref android.R.styleable#Window_windowAllowReturnTransitionOverlap |
George Mount | 31a2172 | 2014-03-24 17:44:36 -0700 | [diff] [blame] | 2114 | */ |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2115 | public boolean getAllowReturnTransitionOverlap() { return true; } |
| 2116 | |
| 2117 | /** |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2118 | * Returns the duration, in milliseconds, of the window background fade |
| 2119 | * when transitioning into or away from an Activity when called with an Activity Transition. |
| 2120 | * <p>When executing the enter transition, the background starts transparent |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2121 | * and fades in. This requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. The default is |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2122 | * 300 milliseconds.</p> |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2123 | * |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2124 | * @return The duration of the window background fade to opaque during enter transition. |
| 2125 | * @see #getEnterTransition() |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2126 | * @attr ref android.R.styleable#Window_windowTransitionBackgroundFadeDuration |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2127 | */ |
| 2128 | public long getTransitionBackgroundFadeDuration() { return 0; } |
| 2129 | |
| 2130 | /** |
| 2131 | * Sets the duration, in milliseconds, of the window background fade |
| 2132 | * when transitioning into or away from an Activity when called with an Activity Transition. |
| 2133 | * <p>When executing the enter transition, the background starts transparent |
George Mount | 9826f63 | 2014-09-11 08:50:09 -0700 | [diff] [blame] | 2134 | * and fades in. This requires {@link #FEATURE_ACTIVITY_TRANSITIONS}. The default is |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2135 | * 300 milliseconds.</p> |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2136 | * |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2137 | * @param fadeDurationMillis The duration of the window background fade to or from opaque |
| 2138 | * during enter transition. |
| 2139 | * @see #setEnterTransition(android.transition.Transition) |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2140 | * @attr ref android.R.styleable#Window_windowTransitionBackgroundFadeDuration |
George Mount | ed1e01d | 2014-06-05 13:49:12 -0700 | [diff] [blame] | 2141 | */ |
| 2142 | public void setTransitionBackgroundFadeDuration(long fadeDurationMillis) { } |
| 2143 | |
| 2144 | /** |
George Mount | b89d5cc | 2014-08-18 16:50:50 -0700 | [diff] [blame] | 2145 | * Returns <code>true</code> when shared elements should use an Overlay during |
| 2146 | * shared element transitions or <code>false</code> when they should animate as |
| 2147 | * part of the normal View hierarchy. The default value is true. |
| 2148 | * |
| 2149 | * @return <code>true</code> when shared elements should use an Overlay during |
| 2150 | * shared element transitions or <code>false</code> when they should animate as |
| 2151 | * part of the normal View hierarchy. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2152 | * @attr ref android.R.styleable#Window_windowSharedElementsUseOverlay |
George Mount | b89d5cc | 2014-08-18 16:50:50 -0700 | [diff] [blame] | 2153 | */ |
| 2154 | public boolean getSharedElementsUseOverlay() { return true; } |
| 2155 | |
| 2156 | /** |
| 2157 | * Sets whether or not shared elements should use an Overlay during shared element transitions. |
| 2158 | * The default value is true. |
| 2159 | * |
| 2160 | * @param sharedElementsUseOverlay <code>true</code> indicates that shared elements should |
| 2161 | * be transitioned with an Overlay or <code>false</code> |
| 2162 | * to transition within the normal View hierarchy. |
George Mount | c03da0e | 2014-08-22 17:04:02 -0700 | [diff] [blame] | 2163 | * @attr ref android.R.styleable#Window_windowSharedElementsUseOverlay |
George Mount | b89d5cc | 2014-08-18 16:50:50 -0700 | [diff] [blame] | 2164 | */ |
| 2165 | public void setSharedElementsUseOverlay(boolean sharedElementsUseOverlay) { } |
| 2166 | |
| 2167 | /** |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2168 | * @return the color of the status bar. |
| 2169 | */ |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 2170 | @ColorInt |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2171 | public abstract int getStatusBarColor(); |
| 2172 | |
| 2173 | /** |
John Spurlock | bc4cf00 | 2015-03-24 21:51:20 -0400 | [diff] [blame] | 2174 | * Sets the color of the status bar to {@code color}. |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2175 | * |
| 2176 | * For this to take effect, |
| 2177 | * the window must be drawing the system bar backgrounds with |
| 2178 | * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and |
| 2179 | * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_STATUS} must not be set. |
| 2180 | * |
John Spurlock | bc4cf00 | 2015-03-24 21:51:20 -0400 | [diff] [blame] | 2181 | * If {@code color} is not opaque, consider setting |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2182 | * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and |
| 2183 | * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}. |
George Mount | 238010f | 2014-06-30 17:31:17 -0700 | [diff] [blame] | 2184 | * <p> |
| 2185 | * The transitionName for the view background will be "android:status:background". |
| 2186 | * </p> |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2187 | */ |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 2188 | public abstract void setStatusBarColor(@ColorInt int color); |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2189 | |
| 2190 | /** |
| 2191 | * @return the color of the navigation bar. |
| 2192 | */ |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 2193 | @ColorInt |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2194 | public abstract int getNavigationBarColor(); |
| 2195 | |
| 2196 | /** |
| 2197 | * Sets the color of the navigation bar to {@param color}. |
| 2198 | * |
| 2199 | * For this to take effect, |
| 2200 | * the window must be drawing the system bar backgrounds with |
| 2201 | * {@link android.view.WindowManager.LayoutParams#FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS} and |
| 2202 | * {@link android.view.WindowManager.LayoutParams#FLAG_TRANSLUCENT_NAVIGATION} must not be set. |
| 2203 | * |
| 2204 | * If {@param color} is not opaque, consider setting |
| 2205 | * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and |
| 2206 | * {@link android.view.View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}. |
George Mount | 238010f | 2014-06-30 17:31:17 -0700 | [diff] [blame] | 2207 | * <p> |
| 2208 | * The transitionName for the view background will be "android:navigation:background". |
| 2209 | * </p> |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2210 | */ |
Tor Norbye | 80756e3 | 2015-03-02 09:39:27 -0800 | [diff] [blame] | 2211 | public abstract void setNavigationBarColor(@ColorInt int color); |
Adrian Roos | 217ccd2 | 2014-05-09 14:29:04 +0200 | [diff] [blame] | 2212 | |
Filip Gruszczynski | 0daf210 | 2015-09-29 08:39:07 -0700 | [diff] [blame] | 2213 | /** @hide */ |
| 2214 | public void setTheme(int resId) { |
| 2215 | } |
Filip Gruszczynski | 6325065 | 2015-11-18 14:43:01 -0800 | [diff] [blame] | 2216 | |
| 2217 | /** |
| 2218 | * Whether the caption should be displayed directly on the content rather than push the content |
| 2219 | * down. This affects only freeform windows since they display the caption. |
| 2220 | * @hide |
| 2221 | */ |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 2222 | public void setOverlayWithDecorCaptionEnabled(boolean enabled) { |
| 2223 | mOverlayWithDecorCaptionEnabled = enabled; |
Filip Gruszczynski | 6325065 | 2015-11-18 14:43:01 -0800 | [diff] [blame] | 2224 | } |
| 2225 | |
| 2226 | /** @hide */ |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 2227 | public boolean isOverlayWithDecorCaptionEnabled() { |
| 2228 | return mOverlayWithDecorCaptionEnabled; |
Filip Gruszczynski | 6325065 | 2015-11-18 14:43:01 -0800 | [diff] [blame] | 2229 | } |
Filip Gruszczynski | 9b81e40 | 2015-12-08 15:42:01 -0800 | [diff] [blame] | 2230 | |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2231 | /** @hide */ |
| 2232 | public void notifyRestrictedCaptionAreaCallback(int left, int top, int right, int bottom) { |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 2233 | if (mOnRestrictedCaptionAreaChangedListener != null) { |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2234 | mRestrictedCaptionAreaRect.set(left, top, right, bottom); |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 2235 | mOnRestrictedCaptionAreaChangedListener.onRestrictedCaptionAreaChanged( |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2236 | mRestrictedCaptionAreaRect); |
| 2237 | } |
| 2238 | } |
Filip Gruszczynski | 9b81e40 | 2015-12-08 15:42:01 -0800 | [diff] [blame] | 2239 | |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2240 | /** |
| 2241 | * Set what color should the caption controls be. By default the system will try to determine |
Wale Ogunwale | a504ca3 | 2016-01-30 16:02:13 -0800 | [diff] [blame] | 2242 | * the color from the theme. You can overwrite this by using {@link #DECOR_CAPTION_SHADE_DARK}, |
| 2243 | * {@link #DECOR_CAPTION_SHADE_LIGHT}, or {@link #DECOR_CAPTION_SHADE_AUTO}. |
| 2244 | * @see #DECOR_CAPTION_SHADE_DARK |
| 2245 | * @see #DECOR_CAPTION_SHADE_LIGHT |
| 2246 | * @see #DECOR_CAPTION_SHADE_AUTO |
Filip Gruszczynski | 3dec081 | 2015-12-09 08:42:41 -0800 | [diff] [blame] | 2247 | */ |
| 2248 | public abstract void setDecorCaptionShade(int decorCaptionShade); |
| 2249 | |
| 2250 | /** |
| 2251 | * Set the drawable that is drawn underneath the caption during the resizing. |
| 2252 | * |
| 2253 | * During the resizing the caption might not be drawn fast enough to match the new dimensions. |
| 2254 | * There is a second caption drawn underneath it that will be fast enough. By default the |
| 2255 | * caption is constructed from the theme. You can provide a drawable, that will be drawn instead |
| 2256 | * to better match your application. |
| 2257 | */ |
| 2258 | public abstract void setResizingCaptionDrawable(Drawable drawable); |
Wale Ogunwale | eb6722c | 2015-12-08 11:43:43 -0800 | [diff] [blame] | 2259 | |
| 2260 | /** |
| 2261 | * Called when the activity changes from fullscreen mode to multi-window mode and visa-versa. |
| 2262 | * @hide |
| 2263 | */ |
Andrii Kulian | 933076d | 2016-03-29 17:04:42 -0700 | [diff] [blame] | 2264 | public abstract void onMultiWindowModeChanged(); |
Jorim Jaggi | 4846ee3 | 2016-01-07 17:39:12 +0100 | [diff] [blame] | 2265 | |
| 2266 | /** |
| 2267 | * Called when the activity just relaunched. |
| 2268 | * @hide |
| 2269 | */ |
| 2270 | public abstract void reportActivityRelaunched(); |
Michael Kwan | f7964be | 2016-11-30 16:44:33 -0800 | [diff] [blame] | 2271 | |
| 2272 | /** |
| 2273 | * Called to set flag to check if the close on swipe is enabled. This will only function if |
| 2274 | * FEATURE_SWIPE_TO_DISMISS has been set. |
| 2275 | * @hide |
| 2276 | */ |
| 2277 | public void setCloseOnSwipeEnabled(boolean closeOnSwipeEnabled) { |
| 2278 | mCloseOnSwipeEnabled = closeOnSwipeEnabled; |
| 2279 | } |
| 2280 | |
| 2281 | /** |
| 2282 | * @return {@code true} if the close on swipe is enabled. |
| 2283 | * @hide |
| 2284 | */ |
| 2285 | public boolean isCloseOnSwipeEnabled() { |
| 2286 | return mCloseOnSwipeEnabled; |
| 2287 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 2288 | } |