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.intentresolver.widget 18 19 import android.view.View 20 21 interface ImagePreviewView { setTransitionElementStatusCallbacknull22 fun setTransitionElementStatusCallback(callback: TransitionElementStatusCallback?) 23 fun getTransitionView(): View? 24 25 /** 26 * [ImagePreviewView] progressively prepares views for shared element transition and reports 27 * each successful preparation with [onTransitionElementReady] call followed by closing 28 * [onAllTransitionElementsReady] invocation. Thus the overall invocation pattern is zero or 29 * more [onTransitionElementReady] calls followed by the final [onAllTransitionElementsReady] 30 * call. 31 */ 32 interface TransitionElementStatusCallback { 33 /** 34 * Invoked when a view for a shared transition animation element is ready i.e. the image is 35 * loaded and the view is laid out. 36 * 37 * @param name shared element name. 38 */ 39 fun onTransitionElementReady(name: String) 40 41 /** 42 * Indicates that all supported transition elements have been reported with 43 * [onTransitionElementReady]. 44 */ 45 fun onAllTransitionElementsReady() 46 } 47 } 48