blob: 9bdd7a3849f490527b2d2e715115b8e8a41c7697 [file] [log] [blame]
Sunny Goyalc99cb172017-10-19 16:15:09 -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 */
Sunny Goyal85525172017-11-06 13:00:42 -080016package com.android.launcher3.uioverrides;
Sunny Goyalc99cb172017-10-19 16:15:09 -070017
18import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
Sunny Goyalc99cb172017-10-19 16:15:09 -070019
Sunny Goyalbe93f262017-10-20 17:05:27 -070020import android.view.View;
Sunny Goyalc99cb172017-10-19 16:15:09 -070021
Sunny Goyalc99cb172017-10-19 16:15:09 -070022import com.android.launcher3.Launcher;
23import com.android.launcher3.LauncherState;
Sunny Goyalc99cb172017-10-19 16:15:09 -070024import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
Sunny Goyal16764582017-11-06 16:00:34 -080025import com.android.quickstep.RecentsView;
Sunny Goyalc99cb172017-10-19 16:15:09 -070026
27/**
28 * Definition for overview state
29 */
30public class OverviewState extends LauncherState {
31
32 // The percent to shrink the workspace during overview mode
33 public static final float SCALE_FACTOR = 0.7f;
34
Sunny Goyalc4fa8c32017-11-07 12:23:58 -080035 private static final int STATE_FLAGS = FLAG_SHOW_SCRIM | FLAG_MULTI_PAGE;
Sunny Goyalc99cb172017-10-19 16:15:09 -070036
37 public OverviewState(int id) {
Sunny Goyalbe93f262017-10-20 17:05:27 -070038 super(id, ContainerType.WORKSPACE, OVERVIEW_TRANSITION_MS, 1f, STATE_FLAGS);
Sunny Goyalc99cb172017-10-19 16:15:09 -070039 }
40
41 @Override
42 public float[] getWorkspaceScaleAndTranslation(Launcher launcher) {
Sunny Goyal16764582017-11-06 16:00:34 -080043 // TODO: Find a better transition
Sunny Goyalc4fa8c32017-11-07 12:23:58 -080044 return new float[] {0f, 0};
Sunny Goyalc99cb172017-10-19 16:15:09 -070045 }
46
47 @Override
48 public void onStateEnabled(Launcher launcher) {
Sunny Goyal16764582017-11-06 16:00:34 -080049 ((RecentsView) launcher.getOverviewPanel()).setViewVisible(true);
Sunny Goyalc99cb172017-10-19 16:15:09 -070050 }
51
52 @Override
53 public void onStateDisabled(Launcher launcher) {
Sunny Goyal16764582017-11-06 16:00:34 -080054 ((RecentsView) launcher.getOverviewPanel()).setViewVisible(false);
Sunny Goyalc99cb172017-10-19 16:15:09 -070055 }
Sunny Goyalbe93f262017-10-20 17:05:27 -070056
57 @Override
58 public View getFinalFocus(Launcher launcher) {
59 return launcher.getOverviewPanel();
60 }
Sunny Goyalc99cb172017-10-19 16:15:09 -070061}