blob: 16be3918916150610543c1239c4074cb890d855f [file] [log] [blame]
Sunny Goyal4c7f2152017-10-17 17:17:16 -07001/*
2 * Copyright (C) 2017 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 */
16package com.android.launcher3;
17
18import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_AUTO;
19import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS;
Tony Wickham59c69012019-06-18 16:34:37 -070020import static android.view.View.VISIBLE;
Sunny Goyal3e3f44c2017-10-23 17:14:52 -070021import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
Tony Wickham59c69012019-06-18 16:34:37 -070022
23import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE;
24import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
25import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_X;
26import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_FADE;
27import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_SCALE;
28import static com.android.launcher3.anim.Interpolators.ACCEL;
Sunny Goyal210e1742019-10-17 12:05:38 -070029import static com.android.launcher3.anim.Interpolators.ACCEL_2;
Tony Wickham59c69012019-06-18 16:34:37 -070030import static com.android.launcher3.anim.Interpolators.DEACCEL;
31import static com.android.launcher3.anim.Interpolators.DEACCEL_1_7;
32import static com.android.launcher3.anim.Interpolators.clampToProgress;
Tony Wickham4fdba142019-11-04 16:23:51 -080033import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
Sunny Goyal210e1742019-10-17 12:05:38 -070034import static com.android.launcher3.states.RotationHelper.REQUEST_NONE;
Sunny Goyalab3963d2019-05-23 00:50:08 -070035import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL;
36import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL;
Tony Wickham4fdba142019-11-04 16:23:51 -080037import static com.android.launcher3.testing.TestProtocol.HINT_STATE_ORDINAL;
Sunny Goyalab3963d2019-05-23 00:50:08 -070038import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL;
39import static com.android.launcher3.testing.TestProtocol.OVERVIEW_PEEK_STATE_ORDINAL;
40import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
41import static com.android.launcher3.testing.TestProtocol.QUICK_SWITCH_STATE_ORDINAL;
42import static com.android.launcher3.testing.TestProtocol.SPRING_LOADED_STATE_ORDINAL;
Sunny Goyal0c723352017-12-12 12:02:29 -080043
Tony Wickham04fca162020-02-05 15:06:52 -080044import android.view.View;
Sunny Goyal0c723352017-12-12 12:02:29 -080045import android.view.animation.Interpolator;
Sunny Goyalbe93f262017-10-20 17:05:27 -070046
Tony Wickham04fca162020-02-05 15:06:52 -080047import com.android.launcher3.allapps.AllAppsContainerView;
Tony Wickham59c69012019-06-18 16:34:37 -070048import com.android.launcher3.anim.AnimatorSetBuilder;
Tony Wickham4fdba142019-11-04 16:23:51 -080049import com.android.launcher3.states.HintState;
Sunny Goyalc99cb172017-10-19 16:15:09 -070050import com.android.launcher3.states.SpringLoadedState;
Tonye06fef42019-03-22 15:44:28 -050051import com.android.launcher3.uioverrides.states.AllAppsState;
52import com.android.launcher3.uioverrides.states.OverviewState;
Sunny Goyal4c7f2152017-10-17 17:17:16 -070053import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
54
Sunny Goyalcd7c0aa2017-10-19 12:36:27 -070055import java.util.Arrays;
56
Sunny Goyal4c7f2152017-10-17 17:17:16 -070057
58/**
Sunny Goyalbe93f262017-10-20 17:05:27 -070059 * Base state for various states used for the Launcher
Sunny Goyal4c7f2152017-10-17 17:17:16 -070060 */
Tony Wickhamc7203ad2020-02-03 18:36:06 -080061public abstract class LauncherState {
Sunny Goyal4c7f2152017-10-17 17:17:16 -070062
Sunny Goyal7185dd62018-03-14 17:51:49 -070063
64 /**
65 * Set of elements indicating various workspace elements which change visibility across states
66 * Note that workspace is not included here as in that case, we animate individual pages
67 */
68 public static final int NONE = 0;
Tony Wickhambd6f05e2018-03-21 08:16:33 -070069 public static final int HOTSEAT_ICONS = 1 << 0;
Sunny Goyal81b4c7b2018-03-26 12:10:31 -070070 public static final int HOTSEAT_SEARCH_BOX = 1 << 1;
Tony Wickhambd6f05e2018-03-21 08:16:33 -070071 public static final int ALL_APPS_HEADER = 1 << 2;
72 public static final int ALL_APPS_HEADER_EXTRA = 1 << 3; // e.g. app predictions
73 public static final int ALL_APPS_CONTENT = 1 << 4;
Sunny Goyal56e10192018-05-22 13:22:25 -070074 public static final int VERTICAL_SWIPE_INDICATOR = 1 << 5;
Tony Wickham66d1c2f2019-04-24 11:32:59 -070075 public static final int RECENTS_CLEAR_ALL_BUTTON = 1 << 6;
Sunny Goyal7185dd62018-03-14 17:51:49 -070076
Sunny Goyal927447e2018-05-04 13:19:29 -070077 protected static final int FLAG_MULTI_PAGE = 1 << 0;
78 protected static final int FLAG_DISABLE_ACCESSIBILITY = 1 << 1;
79 protected static final int FLAG_DISABLE_RESTORE = 1 << 2;
80 protected static final int FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED = 1 << 3;
81 protected static final int FLAG_DISABLE_PAGE_CLIPPING = 1 << 4;
82 protected static final int FLAG_PAGE_BACKGROUNDS = 1 << 5;
83 protected static final int FLAG_DISABLE_INTERACTION = 1 << 6;
84 protected static final int FLAG_OVERVIEW_UI = 1 << 7;
85 protected static final int FLAG_HIDE_BACK_BUTTON = 1 << 8;
Sunny Goyal5d1873a2018-05-08 11:10:44 -070086 protected static final int FLAG_HAS_SYS_UI_SCRIM = 1 << 9;
Sunny Goyal6c6c2f42018-03-02 14:57:46 -080087
Sunny Goyal0c723352017-12-12 12:02:29 -080088 protected static final PageAlphaProvider DEFAULT_ALPHA_PROVIDER =
89 new PageAlphaProvider(ACCEL_2) {
90 @Override
91 public float getPageAlpha(int pageIndex) {
92 return 1;
93 }
94 };
Sunny Goyalcd7c0aa2017-10-19 12:36:27 -070095
Tony Wickham4fdba142019-11-04 16:23:51 -080096 private static final LauncherState[] sAllStates = new LauncherState[8];
Sunny Goyalcd7c0aa2017-10-19 12:36:27 -070097
Sunny Goyal75c59ac2018-01-15 14:23:11 -080098 /**
99 * TODO: Create a separate class for NORMAL state.
100 */
vadimt6895e402019-02-15 16:42:14 -0800101 public static final LauncherState NORMAL = new LauncherState(NORMAL_STATE_ORDINAL,
Tony Wickhamc7203ad2020-02-03 18:36:06 -0800102 ContainerType.WORKSPACE,
Sunny Goyal5d1873a2018-05-08 11:10:44 -0700103 FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_HIDE_BACK_BUTTON |
Tony Wickhamc7203ad2020-02-03 18:36:06 -0800104 FLAG_HAS_SYS_UI_SCRIM) {
105 @Override
106 public int getTransitionDuration(Launcher launcher) {
107 // Arbitrary duration, when going to NORMAL we use the state we're coming from instead.
108 return 0;
109 }
110 };
Sunny Goyalcd7c0aa2017-10-19 12:36:27 -0700111
Sunny Goyal7185dd62018-03-14 17:51:49 -0700112 /**
113 * Various Launcher states arranged in the increasing order of UI layers
114 */
vadimt2a648aa2019-02-14 17:47:11 -0800115 public static final LauncherState SPRING_LOADED = new SpringLoadedState(
116 SPRING_LOADED_STATE_ORDINAL);
vadimt2a648aa2019-02-14 17:47:11 -0800117 public static final LauncherState ALL_APPS = new AllAppsState(ALL_APPS_STATE_ORDINAL);
Tony Wickham4fdba142019-11-04 16:23:51 -0800118 public static final LauncherState HINT_STATE = new HintState(HINT_STATE_ORDINAL);
Tony1787ee92019-03-20 12:38:35 -0500119
120 public static final LauncherState OVERVIEW = new OverviewState(OVERVIEW_STATE_ORDINAL);
121 public static final LauncherState OVERVIEW_PEEK =
122 OverviewState.newPeekState(OVERVIEW_PEEK_STATE_ORDINAL);
Tonye4c2e2b2019-03-25 10:23:39 -0500123 public static final LauncherState QUICK_SWITCH =
124 OverviewState.newSwitchState(QUICK_SWITCH_STATE_ORDINAL);
Tony1787ee92019-03-20 12:38:35 -0500125 public static final LauncherState BACKGROUND_APP =
126 OverviewState.newBackgroundState(BACKGROUND_APP_STATE_ORDINAL);
Tony Wickham6becf7c2018-04-19 11:39:34 -0700127
Sunny Goyalcd7c0aa2017-10-19 12:36:27 -0700128 public final int ordinal;
129
Sunny Goyalf9403d92017-10-18 10:55:56 -0700130 /**
131 * Used for containerType in {@link com.android.launcher3.logging.UserEventDispatcher}
132 */
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700133 public final int containerType;
134
Sunny Goyalf9403d92017-10-18 10:55:56 -0700135 /**
136 * True if the state can be persisted across activity restarts.
137 */
Sunny Goyalbc683e92017-12-06 10:25:07 -0800138 public final boolean disableRestore;
Sunny Goyalf9403d92017-10-18 10:55:56 -0700139
140 /**
141 * True if workspace has multiple pages visible.
142 */
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700143 public final boolean hasMultipleVisiblePages;
Sunny Goyalf9403d92017-10-18 10:55:56 -0700144
145 /**
146 * Accessibility flag for workspace and its pages.
147 * @see android.view.View#setImportantForAccessibility(int)
148 */
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700149 public final int workspaceAccessibilityFlag;
150
Sunny Goyalbe93f262017-10-20 17:05:27 -0700151 /**
152 * Properties related to state transition animation
153 *
154 * @see WorkspaceStateTransitionAnimation
155 */
Sunny Goyal6639a5d2018-02-28 15:09:36 -0800156 public final boolean hasWorkspacePageBackground;
Sunny Goyal6639a5d2018-02-28 15:09:36 -0800157
Sunny Goyalbe93f262017-10-20 17:05:27 -0700158 /**
Tony Wickham53370672017-12-05 10:10:55 -0800159 * True if the state allows workspace icons to be dragged.
160 */
161 public final boolean workspaceIconsCanBeDragged;
162
Sunny Goyalbc683e92017-12-06 10:25:07 -0800163 /**
164 * True if the workspace pages should not be clipped relative to the workspace bounds
165 * for this state.
166 */
167 public final boolean disablePageClipping;
168
Sunny Goyal6c6c2f42018-03-02 14:57:46 -0800169 /**
170 * True if launcher can not be directly interacted in this state;
171 */
172 public final boolean disableInteraction;
173
174 /**
175 * True if the state has overview panel visible.
176 */
177 public final boolean overviewUi;
178
Tony Wickham76cf2362018-03-20 14:13:16 -0700179 /**
180 * True if the back button should be hidden when in this state (assuming no floating views are
181 * open, launcher has window focus, etc).
182 */
183 public final boolean hideBackButton;
184
Sunny Goyal5d1873a2018-05-08 11:10:44 -0700185 public final boolean hasSysUiScrim;
186
Tony Wickhamc7203ad2020-02-03 18:36:06 -0800187 public LauncherState(int id, int containerType, int flags) {
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700188 this.containerType = containerType;
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700189
Sunny Goyal6639a5d2018-02-28 15:09:36 -0800190 this.hasWorkspacePageBackground = (flags & FLAG_PAGE_BACKGROUNDS) != 0;
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700191 this.hasMultipleVisiblePages = (flags & FLAG_MULTI_PAGE) != 0;
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700192 this.workspaceAccessibilityFlag = (flags & FLAG_DISABLE_ACCESSIBILITY) != 0
193 ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
194 : IMPORTANT_FOR_ACCESSIBILITY_AUTO;
Sunny Goyalbc683e92017-12-06 10:25:07 -0800195 this.disableRestore = (flags & FLAG_DISABLE_RESTORE) != 0;
Tony Wickham53370672017-12-05 10:10:55 -0800196 this.workspaceIconsCanBeDragged = (flags & FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED) != 0;
Sunny Goyalbc683e92017-12-06 10:25:07 -0800197 this.disablePageClipping = (flags & FLAG_DISABLE_PAGE_CLIPPING) != 0;
Sunny Goyal6c6c2f42018-03-02 14:57:46 -0800198 this.disableInteraction = (flags & FLAG_DISABLE_INTERACTION) != 0;
199 this.overviewUi = (flags & FLAG_OVERVIEW_UI) != 0;
Tony Wickham76cf2362018-03-20 14:13:16 -0700200 this.hideBackButton = (flags & FLAG_HIDE_BACK_BUTTON) != 0;
Sunny Goyal5d1873a2018-05-08 11:10:44 -0700201 this.hasSysUiScrim = (flags & FLAG_HAS_SYS_UI_SCRIM) != 0;
Sunny Goyalcd7c0aa2017-10-19 12:36:27 -0700202
203 this.ordinal = id;
204 sAllStates[id] = this;
205 }
206
207 public static LauncherState[] values() {
208 return Arrays.copyOf(sAllStates, sAllStates.length);
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700209 }
Sunny Goyalc99cb172017-10-19 16:15:09 -0700210
Tony Wickhamc7203ad2020-02-03 18:36:06 -0800211 /**
212 * @return How long the animation to this state should take (or from this state to NORMAL).
213 * @param launcher
214 */
215 public abstract int getTransitionDuration(Launcher launcher);
216
Tonybc234402019-03-19 13:30:25 -0500217 public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
218 return new ScaleAndTranslation(1, 0, 0);
Sunny Goyalc99cb172017-10-19 16:15:09 -0700219 }
220
Tonybc234402019-03-19 13:30:25 -0500221 public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) {
Tony Wickham57e489c2019-03-04 14:57:07 -0800222 // For most states, treat the hotseat as if it were part of the workspace.
223 return getWorkspaceScaleAndTranslation(launcher);
Tony4bb4b892019-03-03 15:32:12 -0800224 }
225
Tonybc234402019-03-19 13:30:25 -0500226 public ScaleAndTranslation getOverviewScaleAndTranslation(Launcher launcher) {
Sunny Goyal210e1742019-10-17 12:05:38 -0700227 return launcher.getOverviewScaleAndTranslationForNormalState();
Tony3bb5e8e2018-03-14 12:05:00 +0000228 }
229
Tony Wickham4fdba142019-11-04 16:23:51 -0800230 public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) {
231 return new ScaleAndTranslation(1, 0, 0);
232 }
233
Tony54068172019-05-12 13:24:51 -0500234 public float getOverviewFullscreenProgress() {
235 return 0;
236 }
237
Sunny Goyal3e3f44c2017-10-23 17:14:52 -0700238 public void onStateEnabled(Launcher launcher) {
239 dispatchWindowStateChanged(launcher);
240 }
Sunny Goyalc99cb172017-10-19 16:15:09 -0700241
242 public void onStateDisabled(Launcher launcher) { }
Sunny Goyalbe93f262017-10-20 17:05:27 -0700243
Sunny Goyal7185dd62018-03-14 17:51:49 -0700244 public int getVisibleElements(Launcher launcher) {
Tony Wickhambd6f05e2018-03-21 08:16:33 -0700245 if (launcher.getDeviceProfile().isVerticalBarLayout()) {
Sunny Goyal56e10192018-05-22 13:22:25 -0700246 return HOTSEAT_ICONS | VERTICAL_SWIPE_INDICATOR;
Tony Wickhambd6f05e2018-03-21 08:16:33 -0700247 }
Sunny Goyal56e10192018-05-22 13:22:25 -0700248 return HOTSEAT_ICONS | HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR;
Sunny Goyal7185dd62018-03-14 17:51:49 -0700249 }
250
Sunny Goyal228153d2018-01-04 15:35:22 -0800251 /**
252 * Fraction shift in the vertical translation UI and related properties
253 *
254 * @see com.android.launcher3.allapps.AllAppsTransitionController
255 */
256 public float getVerticalProgress(Launcher launcher) {
257 return 1f;
258 }
259
Sunny Goyal927447e2018-05-04 13:19:29 -0700260 public float getWorkspaceScrimAlpha(Launcher launcher) {
261 return 0;
262 }
263
Tony Wickhamc0880512019-07-24 17:32:08 -0700264 public float getOverviewScrimAlpha(Launcher launcher) {
265 return 0;
266 }
267
Sunny Goyal3e3f44c2017-10-23 17:14:52 -0700268 public String getDescription(Launcher launcher) {
269 return launcher.getWorkspace().getCurrentPageDescription();
270 }
271
Sunny Goyalbc683e92017-12-06 10:25:07 -0800272 public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
273 if (this != NORMAL || !launcher.getDeviceProfile().shouldFadeAdjacentWorkspaceScreens()) {
274 return DEFAULT_ALPHA_PROVIDER;
275 }
Sunny Goyal228153d2018-01-04 15:35:22 -0800276 final int centerPage = launcher.getWorkspace().getNextPage();
Sunny Goyal0c723352017-12-12 12:02:29 -0800277 return new PageAlphaProvider(ACCEL_2) {
278 @Override
279 public float getPageAlpha(int pageIndex) {
280 return pageIndex != centerPage ? 0 : 1f;
281 }
282 };
Sunny Goyalbc683e92017-12-06 10:25:07 -0800283 }
284
Sunny Goyal49bcf342018-01-11 13:59:53 -0800285 public LauncherState getHistoryForState(LauncherState previousState) {
286 // No history is supported
287 return NORMAL;
288 }
289
Sunny Goyal75c59ac2018-01-15 14:23:11 -0800290 /**
291 * Called when the start transition ends and the user settles on this particular state.
292 */
293 public void onStateTransitionEnd(Launcher launcher) {
Hyunyoung Song4bd47252018-06-05 16:26:32 -0700294 if (this == NORMAL) {
Sunny Goyal623eddd2018-03-02 12:24:41 -0800295 // Clear any rotation locks when going to normal state
296 launcher.getRotationHelper().setCurrentStateRequest(REQUEST_NONE);
Sunny Goyal75c59ac2018-01-15 14:23:11 -0800297 }
298 }
299
Sunny Goyale39690b2018-08-02 13:35:07 -0700300 public void onBackPressed(Launcher launcher) {
301 if (this != NORMAL) {
302 LauncherStateManager lsm = launcher.getStateManager();
303 LauncherState lastState = lsm.getLastState();
Sunny Goyale39690b2018-08-02 13:35:07 -0700304 lsm.goToState(lastState);
305 }
306 }
307
Tony Wickham59c69012019-06-18 16:34:37 -0700308 /**
309 * Prepares for a non-user controlled animation from fromState to this state. Preparations
310 * include:
311 * - Setting interpolators for various animations included in the state transition.
312 * - Setting some start values (e.g. scale) for views that are hidden but about to be shown.
313 */
314 public void prepareForAtomicAnimation(Launcher launcher, LauncherState fromState,
315 AnimatorSetBuilder builder) {
316 if (this == NORMAL && fromState == OVERVIEW) {
317 builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL);
318 builder.setInterpolator(ANIM_WORKSPACE_FADE, ACCEL);
319 builder.setInterpolator(ANIM_OVERVIEW_SCALE, clampToProgress(ACCEL, 0, 0.9f));
320 builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, ACCEL);
321 builder.setInterpolator(ANIM_OVERVIEW_FADE, DEACCEL_1_7);
322 Workspace workspace = launcher.getWorkspace();
323
324 // Start from a higher workspace scale, but only if we're invisible so we don't jump.
325 boolean isWorkspaceVisible = workspace.getVisibility() == VISIBLE;
326 if (isWorkspaceVisible) {
327 CellLayout currentChild = (CellLayout) workspace.getChildAt(
328 workspace.getCurrentPage());
329 isWorkspaceVisible = currentChild.getVisibility() == VISIBLE
330 && currentChild.getShortcutsAndWidgets().getAlpha() > 0;
331 }
332 if (!isWorkspaceVisible) {
333 workspace.setScaleX(0.92f);
334 workspace.setScaleY(0.92f);
335 }
336 Hotseat hotseat = launcher.getHotseat();
337 boolean isHotseatVisible = hotseat.getVisibility() == VISIBLE && hotseat.getAlpha() > 0;
338 if (!isHotseatVisible) {
339 hotseat.setScaleX(0.92f);
340 hotseat.setScaleY(0.92f);
Tony Wickham4fdba142019-11-04 16:23:51 -0800341 if (ENABLE_OVERVIEW_ACTIONS.get()) {
Tony Wickham04fca162020-02-05 15:06:52 -0800342 AllAppsContainerView qsbContainer = launcher.getAppsView();
343 View qsb = qsbContainer.getSearchView();
344 boolean qsbVisible = qsb.getVisibility() == VISIBLE && qsb.getAlpha() > 0;
345 if (!qsbVisible) {
346 qsbContainer.setScaleX(0.92f);
347 qsbContainer.setScaleY(0.92f);
348 }
Tony Wickham4fdba142019-11-04 16:23:51 -0800349 }
Tony Wickham59c69012019-06-18 16:34:37 -0700350 }
351 } else if (this == NORMAL && fromState == OVERVIEW_PEEK) {
352 // Keep fully visible until the very end (when overview is offscreen) to make invisible.
353 builder.setInterpolator(ANIM_OVERVIEW_FADE, t -> t < 1 ? 0 : 1);
354 }
355 }
356
Sunny Goyal3e3f44c2017-10-23 17:14:52 -0700357 protected static void dispatchWindowStateChanged(Launcher launcher) {
358 launcher.getWindow().getDecorView().sendAccessibilityEvent(TYPE_WINDOW_STATE_CHANGED);
359 }
Sunny Goyalbc683e92017-12-06 10:25:07 -0800360
Sunny Goyal0c723352017-12-12 12:02:29 -0800361 public static abstract class PageAlphaProvider {
Sunny Goyalbc683e92017-12-06 10:25:07 -0800362
Sunny Goyal0c723352017-12-12 12:02:29 -0800363 public final Interpolator interpolator;
364
365 public PageAlphaProvider(Interpolator interpolator) {
366 this.interpolator = interpolator;
367 }
368
369 public abstract float getPageAlpha(int pageIndex);
Sunny Goyalbc683e92017-12-06 10:25:07 -0800370 }
Tonybc234402019-03-19 13:30:25 -0500371
372 public static class ScaleAndTranslation {
373 public float scale;
374 public float translationX;
375 public float translationY;
376
377 public ScaleAndTranslation(float scale, float translationX, float translationY) {
378 this.scale = scale;
379 this.translationX = translationX;
380 this.translationY = translationY;
381 }
382 }
Sunny Goyal4c7f2152017-10-17 17:17:16 -0700383}