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 android.content.Context; 19 20 import com.android.launcher3.Launcher; 21 import com.android.launcher3.LauncherState; 22 import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; 23 24 /** 25 * Scale down workspace/hotseat to hint at going to either overview (on pause) or first home screen. 26 */ 27 public class HintState extends LauncherState { 28 29 private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE | FLAG_DISABLE_RESTORE 30 | FLAG_HAS_SYS_UI_SCRIM; 31 HintState(int id)32 public HintState(int id) { 33 super(id, ContainerType.DEFAULT_CONTAINERTYPE, STATE_FLAGS); 34 } 35 36 @Override getTransitionDuration(Context context)37 public int getTransitionDuration(Context context) { 38 return 80; 39 } 40 41 @Override getDepthUnchecked(Context context)42 protected float getDepthUnchecked(Context context) { 43 return 0.15f; 44 } 45 46 @Override getOverviewScrimAlpha(Launcher launcher)47 public float getOverviewScrimAlpha(Launcher launcher) { 48 return 0.4f; 49 } 50 51 @Override getWorkspaceScaleAndTranslation(Launcher launcher)52 public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) { 53 return new ScaleAndTranslation(0.92f, 0, 0); 54 } 55 56 @Override getQsbScaleAndTranslation(Launcher launcher)57 public ScaleAndTranslation getQsbScaleAndTranslation(Launcher launcher) { 58 // Treat the QSB as part of the hotseat so they move together. 59 return getHotseatScaleAndTranslation(launcher); 60 } 61 } 62