1 /* 2 * Copyright (C) 2020 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.states; 17 18 import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; 19 20 import android.content.Context; 21 22 import androidx.core.graphics.ColorUtils; 23 24 import com.android.launcher3.Launcher; 25 import com.android.launcher3.LauncherState; 26 import com.android.launcher3.R; 27 import com.android.launcher3.util.Themes; 28 29 /** 30 * Scale down workspace/hotseat to hint at going to either overview (on pause) or first home screen. 31 */ 32 public class HintState extends LauncherState { 33 34 private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE | FLAG_DISABLE_RESTORE 35 | FLAG_HAS_SYS_UI_SCRIM; 36 HintState(int id)37 public HintState(int id) { 38 this(id, LAUNCHER_STATE_HOME); 39 } 40 HintState(int id, int statsLogOrdinal)41 public HintState(int id, int statsLogOrdinal) { 42 super(id, statsLogOrdinal, STATE_FLAGS); 43 } 44 45 @Override getTransitionDuration(Context context)46 public int getTransitionDuration(Context context) { 47 return 80; 48 } 49 50 @Override getDepthUnchecked(Context context)51 protected float getDepthUnchecked(Context context) { 52 return 0.15f; 53 } 54 55 @Override getWorkspaceScrimColor(Launcher launcher)56 public int getWorkspaceScrimColor(Launcher launcher) { 57 return ColorUtils.setAlphaComponent( 58 Themes.getAttrColor(launcher, R.attr.overviewScrimColor), 100); 59 } 60 61 @Override getWorkspaceScaleAndTranslation(Launcher launcher)62 public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) { 63 return new ScaleAndTranslation(0.92f, 0, 0); 64 } 65 } 66