1 /* 2 * Copyright (C) 2022 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.systemui.media.taptotransfer.sender 18 19 import android.os.VibrationEffect 20 21 /** 22 * Represents the different possible transfer states that we could be in and the vibration effects 23 * that come with updating transfer states. 24 * 25 * @property vibrationEffect an optional vibration effect when the transfer status is changed. 26 */ 27 enum class TransferStatus( 28 val vibrationEffect: VibrationEffect? = null, 29 ) { 30 /** The transfer hasn't started yet. */ 31 NOT_STARTED( 32 vibrationEffect = 33 VibrationEffect.startComposition() 34 .addPrimitive(VibrationEffect.Composition.PRIMITIVE_CLICK, 1.0f, 0) 35 .compose() 36 ), 37 /** The transfer is currently ongoing but hasn't completed yet. */ 38 IN_PROGRESS( 39 vibrationEffect = 40 VibrationEffect.startComposition() 41 .addPrimitive(VibrationEffect.Composition.PRIMITIVE_QUICK_RISE, 1.0f, 0) 42 .addPrimitive(VibrationEffect.Composition.PRIMITIVE_CLICK, 0.7f, 70) 43 .compose(), 44 ), 45 /** The transfer has completed successfully. */ 46 SUCCEEDED, 47 /** The transfer has completed with a failure. */ 48 FAILED(vibrationEffect = VibrationEffect.get(VibrationEffect.EFFECT_DOUBLE_CLICK)), 49 /** The device is too far away to do a transfer. */ 50 TOO_FAR, 51 } 52