1 /* 2 * Copyright (C) 2023 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.quickstep.util 18 19 import com.android.app.animation.Interpolators 20 21 /** Timings for the app pair launch animation. */ 22 abstract class AppPairLaunchTimings : SplitAnimationTimings { 23 protected abstract val STAGED_RECT_SLIDE_DURATION: Int 24 25 // Common timings that apply to app pair launches on any type of device getStagedRectSlideStartnull26 override fun getStagedRectSlideStart() = 0 27 override fun getStagedRectSlideEnd() = stagedRectSlideStart + STAGED_RECT_SLIDE_DURATION 28 override fun getPlaceholderFadeInStart() = 0 29 override fun getPlaceholderFadeInEnd() = 0 30 override fun getPlaceholderIconFadeInStart() = 0 31 override fun getPlaceholderIconFadeInEnd() = 0 32 33 private val iconFadeStart: Int 34 get() = getStagedRectSlideEnd() 35 private val iconFadeEnd: Int 36 get() = iconFadeStart + 83 37 private val appRevealStart: Int 38 get() = getStagedRectSlideEnd() + 67 39 private val appRevealEnd: Int 40 get() = appRevealStart + 217 41 private val cellSplitStart: Int 42 get() = (getStagedRectSlideEnd() * 0.83f).toInt() 43 private val cellSplitEnd: Int 44 get() = cellSplitStart + 500 45 46 override fun getStagedRectXInterpolator() = Interpolators.EMPHASIZED_COMPLEMENT 47 override fun getStagedRectYInterpolator() = Interpolators.EMPHASIZED 48 override fun getStagedRectScaleXInterpolator() = Interpolators.EMPHASIZED 49 override fun getStagedRectScaleYInterpolator() = Interpolators.EMPHASIZED 50 override fun getCellSplitInterpolator() = Interpolators.EMPHASIZED 51 override fun getIconFadeInterpolator() = Interpolators.LINEAR 52 53 override fun getCellSplitStartOffset(): Float { 54 return cellSplitStart.toFloat() / getDuration() 55 } getCellSplitEndOffsetnull56 override fun getCellSplitEndOffset(): Float { 57 return cellSplitEnd.toFloat() / getDuration() 58 } getIconFadeStartOffsetnull59 override fun getIconFadeStartOffset(): Float { 60 return iconFadeStart.toFloat() / getDuration() 61 } getIconFadeEndOffsetnull62 override fun getIconFadeEndOffset(): Float { 63 return iconFadeEnd.toFloat() / getDuration() 64 } getAppRevealStartOffsetnull65 override fun getAppRevealStartOffset(): Float { 66 return appRevealStart.toFloat() / getDuration() 67 } getAppRevealEndOffsetnull68 override fun getAppRevealEndOffset(): Float { 69 return appRevealEnd.toFloat() / getDuration() 70 } getDurationnull71 abstract override fun getDuration(): Int 72 } 73