• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.google.android.torus.core.engine.listener
18 
19 import android.view.MotionEvent
20 import com.google.android.torus.core.engine.TorusEngine
21 
22 /**
23  * Allows to receive Touch events. The Interface must be implemented by a [TorusEngine] instance,
24  */
25 interface TorusTouchListener {
26     /**
27      * Called when a touch event has been triggered. If the engine is set as a wallpaper and the
28      * device is locked, touch events may be restricted. Only taps on the lock screen's focal area
29      * will be delivered via [onLockscreenFocalAreaTap]. See [onLockscreenFocalAreaTap] for details.
30      *
31      * @param event The new [MotionEvent].
32      */
onTouchEventnull33     fun onTouchEvent(event: MotionEvent)
34 
35     /**
36      * Called when a short tap occurs on the wallpaper's focal area on the lock screen.
37      *
38      * The wallpaper's focal area is the interactive region of the wallpaper that is not obscured by
39      * other lock screen elements. The wallpaper is scaled on the lock screen. These coordinates are
40      * relative to the unscaled wallpaper.
41      *
42      * @param x The x-coordinate of the tap, relative to the unscaled wallpaper dimensions.
43      * @param y The y-coordinate of the tap, relative to the unscaled wallpaper dimensions.
44      */
45     fun onLockscreenFocalAreaTap(x: Int, y: Int) {}
46 }
47