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 package com.android.launcher3.taskbar; 17 18 import android.view.View; 19 20 import androidx.annotation.CallSuper; 21 22 import com.android.launcher3.model.data.ItemInfoWithIcon; 23 import com.android.launcher3.model.data.WorkspaceItemInfo; 24 25 import java.util.stream.Stream; 26 27 /** 28 * Base class for providing different taskbar UI 29 */ 30 public class TaskbarUIController { 31 32 public static final TaskbarUIController DEFAULT = new TaskbarUIController(); 33 34 // Initialized in init. 35 protected TaskbarControllers mControllers; 36 37 @CallSuper init(TaskbarControllers taskbarControllers)38 protected void init(TaskbarControllers taskbarControllers) { 39 mControllers = taskbarControllers; 40 } 41 42 @CallSuper onDestroy()43 protected void onDestroy() { 44 mControllers = null; 45 } 46 isTaskbarTouchable()47 protected boolean isTaskbarTouchable() { 48 return true; 49 } 50 onStashedInAppChanged()51 protected void onStashedInAppChanged() { } 52 getAppIconsForEdu()53 public Stream<ItemInfoWithIcon> getAppIconsForEdu() { 54 return Stream.empty(); 55 } 56 onTaskbarIconLaunched(WorkspaceItemInfo item)57 public void onTaskbarIconLaunched(WorkspaceItemInfo item) { } 58 getRootView()59 public View getRootView() { 60 return mControllers.taskbarActivityContext.getDragLayer(); 61 } 62 63 /** 64 * Called when swiping from the bottom nav region in fully gestural mode. 65 * @param inProgress True if the animation started, false if we just settled on an end target. 66 */ setSystemGestureInProgress(boolean inProgress)67 public void setSystemGestureInProgress(boolean inProgress) { 68 mControllers.taskbarStashController.setSystemGestureInProgress(inProgress); 69 } 70 } 71