1 /* 2 * Copyright (C) 2021 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.unfold; 18 19 import android.annotation.FloatRange; 20 21 import java.util.concurrent.Executor; 22 23 /** 24 * Wrapper interface for unfold transition progress provider for the Shell 25 * @see com.android.systemui.unfold.UnfoldTransitionProgressProvider 26 */ 27 public interface ShellUnfoldProgressProvider { 28 29 // This is a temporary workaround until we move the progress providers into the Shell or 30 // refactor the dependencies. TLDR, the base module depends on this provider to determine if the 31 // FullscreenUnfoldController is available, but this check can't rely on an optional component. 32 public static final ShellUnfoldProgressProvider NO_PROVIDER = 33 new ShellUnfoldProgressProvider() {}; 34 35 /** 36 * Adds a transition listener 37 */ addListener(Executor executor, UnfoldListener listener)38 default void addListener(Executor executor, UnfoldListener listener) {} 39 40 /** 41 * Listener for receiving unfold updates 42 */ 43 interface UnfoldListener { onStateChangeStarted()44 default void onStateChangeStarted() {} 45 onStateChangeProgress(@loatRangefrom = 0.0, to = 1.0) float progress)46 default void onStateChangeProgress(@FloatRange(from = 0.0, to = 1.0) float progress) {} 47 onStateChangeFinished()48 default void onStateChangeFinished() {} 49 onFoldStateChanged(boolean isFolded)50 default void onFoldStateChanged(boolean isFolded) {} 51 } 52 } 53