1 /* 2 * Copyright (C) 2024 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.wm.shell.draganddrop.anim 18 19 import android.graphics.Rect 20 import com.android.wm.shell.draganddrop.SplitDragPolicy 21 22 /** 23 * Contains the animation props to represent a single state of drop targets. 24 * When the user is dragging, we'd be going between different HoverAnimProps 25 */ 26 data class HoverAnimProps( 27 var target: SplitDragPolicy.Target, 28 val transX: Float, 29 val transY: Float, 30 val scaleX: Float, 31 val scaleY: Float, 32 /** 33 * Pass in null to indicate this target cannot be hovered over for this given animation/ 34 * state 35 * 36 * TODO: There's some way we can probably use the existing translation/scaling values 37 * to take [.target]'s hitRect and scale that so we don't have to take in a separate 38 * hoverRect in the CTOR. Have to make sure the pivots match since view's pivot in the 39 * center of the view and rect's pivot at 0, 0 if unspecified. 40 * The two may also not be correlated, but worth investigating 41 * 42 */ 43 var hoverRect: Rect? 44 ) { 45 toStringnull46 override fun toString(): String { 47 return ("targetId: " + target 48 + " translationX: " + transX 49 + " translationY: " + transY 50 + " scaleX: " + scaleX 51 + " scaleY: " + scaleY 52 + " hoverRect: " + hoverRect) 53 } 54 }