1 /* 2 * Copyright 2021 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 17 package com.android.launcher3.uioverrides.states; 18 19 import com.android.launcher3.Launcher; 20 import com.android.launcher3.views.ActivityContext; 21 import com.android.quickstep.util.SplitAnimationTimings; 22 import com.android.quickstep.views.RecentsView; 23 24 /** 25 * New Overview substate representing state where 1 app for split screen has been selected and 26 * pinned and user is selecting the second one 27 */ 28 public class SplitScreenSelectState extends OverviewState { SplitScreenSelectState(int id)29 public SplitScreenSelectState(int id) { 30 super(id); 31 } 32 33 @Override getVisibleElements(Launcher launcher)34 public int getVisibleElements(Launcher launcher) { 35 return SPLIT_PLACHOLDER_VIEW; 36 } 37 38 @Override getSplitSelectTranslation(Launcher launcher)39 public float getSplitSelectTranslation(Launcher launcher) { 40 RecentsView recentsView = launcher.getOverviewPanel(); 41 return recentsView.getSplitSelectTranslation(); 42 } 43 44 @Override getTransitionDuration(ActivityContext context, boolean isToState)45 public int getTransitionDuration(ActivityContext context, boolean isToState) { 46 if (isToState && context.getDeviceProfile().isTablet) { 47 return SplitAnimationTimings.TABLET_ENTER_DURATION; 48 } else if (isToState) { 49 return SplitAnimationTimings.PHONE_ENTER_DURATION; 50 } else { 51 return SplitAnimationTimings.ABORT_DURATION; 52 } 53 } 54 55 @Override shouldPreserveDataStateOnReapply()56 public boolean shouldPreserveDataStateOnReapply() { 57 return true; 58 } 59 } 60