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 17 package com.android.quickstep; 18 19 import android.content.Context; 20 21 import com.android.launcher3.R; 22 23 /** 24 * Control and get information about the gesture nav bar at the bottom of the screen, which has 25 * historically been drawn by SysUI, but is also emulated by the stashed Taskbar on large screens. 26 */ 27 public interface NavHandle { 28 29 /** 30 * Animate the nav bar being long-pressed. 31 * 32 * @param isTouchDown {@code true} if the button is starting to be pressed ({@code false} if 33 * released or canceled) 34 * @param shrink {@code true} if the handle should shrink, {@code false} if it should grow 35 * @param durationMs how long the animation should take (for the {@code isTouchDown} case, this 36 * should be the same as the amount of time to trigger a long-press) 37 */ animateNavBarLongPress(boolean isTouchDown, boolean shrink, long durationMs)38 void animateNavBarLongPress(boolean isTouchDown, boolean shrink, long durationMs); 39 40 /** @return {@code true} if this nav handle is actually the stashed taskbar */ isNavHandleStashedTaskbar()41 default boolean isNavHandleStashedTaskbar() { 42 return false; 43 } 44 45 /** @return {@code true} if this nav handle can currently accept long presses */ canNavHandleBeLongPressed()46 default boolean canNavHandleBeLongPressed() { 47 return true; 48 } 49 50 /** @return the width of this nav handle, in pixels */ getNavHandleWidth(Context context)51 default int getNavHandleWidth(Context context) { 52 return context.getResources().getDimensionPixelSize(R.dimen.navigation_home_handle_width); 53 } 54 } 55