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 package com.android.internal.widget.remotecompose.core; 17 18 import com.android.internal.widget.remotecompose.core.operations.layout.Component; 19 20 /** Interface used by objects to register for touch events */ 21 public interface TouchListener { 22 /** 23 * Called when touch down happens 24 * 25 * @param context The players context 26 * @param x the x location of the down touch 27 * @param y the y location of the down touch 28 */ touchDown(RemoteContext context, float x, float y)29 void touchDown(RemoteContext context, float x, float y); 30 31 /** 32 * called on touch up 33 * 34 * @param context the players context 35 * @param x the x location 36 * @param y the y location 37 * @param dx the x velocity when the touch up happened 38 * @param dy the y valocity when the touch up happened 39 */ touchUp(RemoteContext context, float x, float y, float dx, float dy)40 void touchUp(RemoteContext context, float x, float y, float dx, float dy); 41 42 /** 43 * Drag event (occur between down and up) 44 * 45 * @param context the players context 46 * @param x the x coord of the drag 47 * @param y the y coord of the drag 48 */ touchDrag(RemoteContext context, float x, float y)49 void touchDrag(RemoteContext context, float x, float y); 50 51 /** 52 * Called after the touch event handler is inflated 53 * 54 * @param component component it is under 55 */ setComponent(Component component)56 void setComponent(Component component); 57 } 58