1 /* 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 */ 16 package com.android.launcher3.uioverrides.states; 17 18 import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; 19 20 import com.android.launcher3.Launcher; 21 import com.android.launcher3.LauncherState; 22 import com.android.launcher3.R; 23 import com.android.launcher3.util.Themes; 24 import com.android.launcher3.views.ActivityContext; 25 26 /** 27 * Definition for overview state 28 */ 29 public class OverviewState extends LauncherState { 30 OverviewState(int id)31 public OverviewState(int id) { 32 super(id, LAUNCHER_STATE_OVERVIEW, FLAG_DISABLE_RESTORE); 33 } 34 35 @Override getTransitionDuration(ActivityContext context, boolean isToState)36 public int getTransitionDuration(ActivityContext context, boolean isToState) { 37 return 250; 38 } 39 newBackgroundState(int id)40 public static OverviewState newBackgroundState(int id) { 41 return new OverviewState(id); 42 } 43 newSwitchState(int id)44 public static OverviewState newSwitchState(int id) { 45 return new OverviewState(id); 46 } 47 48 /** 49 * New Overview substate that represents the overview in modal mode (one task shown on its own) 50 */ newModalTaskState(int id)51 public static OverviewState newModalTaskState(int id) { 52 return new OverviewState(id); 53 } 54 55 /** 56 * New Overview substate that represents the overview in modal mode (one task shown on its own) 57 */ newSplitSelectState(int id)58 public static OverviewState newSplitSelectState(int id) { 59 return new OverviewState(id); 60 } 61 62 @Override getWorkspaceScrimColor(Launcher launcher)63 public int getWorkspaceScrimColor(Launcher launcher) { 64 return Themes.getAttrColor(launcher, R.attr.overviewScrimColor); 65 } 66 } 67