mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Reorganize taskbar controllers
Organize existing properties as follows: - TaskbarViewController contains properties affecting TaskbarView (though child icons are still supplied by TaskbarHotseatController) - TaskbarDragLayerController contains properties related to TaskbarDragLayer itself - Renamed NavbarButtonUiController to NavbarButtonsViewController, following the pattern of TaskbarViewController and TaskbarDragLayerController - TaskbarControllers contains the different controllers to make it easier to construct, initialize, destroy, and pass them around - Removed TaskbarIconController as its responsibilities were moved to more specific controllers Test: compiles and runs, manually tested Bug: 187353581 Change-Id: Idccd95d47117101bf9617e5532a5b87635d2b8f6
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.launcher3.taskbar.contextual.RotationButtonController;
|
||||
|
||||
/**
|
||||
* Hosts various taskbar controllers to facilitate passing between one another.
|
||||
*/
|
||||
public class TaskbarControllers {
|
||||
|
||||
public final TaskbarActivityContext taskbarActivityContext;
|
||||
public final TaskbarDragController taskbarDragController;
|
||||
public final TaskbarNavButtonController navButtonController;
|
||||
public final NavbarButtonsViewController navbarButtonsViewController;
|
||||
public final RotationButtonController rotationButtonController;
|
||||
public final TaskbarDragLayerController taskbarDragLayerController;
|
||||
public final TaskbarViewController taskbarViewController;
|
||||
|
||||
/** Do not store this controller, as it may change at runtime. */
|
||||
@NonNull public TaskbarUIController uiController = TaskbarUIController.DEFAULT;
|
||||
|
||||
public TaskbarControllers(TaskbarActivityContext taskbarActivityContext,
|
||||
TaskbarDragController taskbarDragController,
|
||||
TaskbarNavButtonController navButtonController,
|
||||
NavbarButtonsViewController navbarButtonsViewController,
|
||||
RotationButtonController rotationButtonController,
|
||||
TaskbarDragLayerController taskbarDragLayerController,
|
||||
TaskbarViewController taskbarViewController) {
|
||||
this.taskbarActivityContext = taskbarActivityContext;
|
||||
this.taskbarDragController = taskbarDragController;
|
||||
this.navButtonController = navButtonController;
|
||||
this.navbarButtonsViewController = navbarButtonsViewController;
|
||||
this.rotationButtonController = rotationButtonController;
|
||||
this.taskbarDragLayerController = taskbarDragLayerController;
|
||||
this.taskbarViewController = taskbarViewController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes all controllers. Note that controllers can now reference each other through this
|
||||
* TaskbarControllers instance, but should be careful to only access things that were created
|
||||
* in constructors for now, as some controllers may still be waiting for init().
|
||||
*/
|
||||
public void init() {
|
||||
navbarButtonsViewController.init(this);
|
||||
if (taskbarActivityContext.canShowNavButtons()) {
|
||||
rotationButtonController.init();
|
||||
}
|
||||
taskbarDragLayerController.init(this);
|
||||
taskbarViewController.init(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up all controllers.
|
||||
*/
|
||||
public void onDestroy() {
|
||||
uiController.onDestroy();
|
||||
rotationButtonController.onDestroy();
|
||||
taskbarDragLayerController.onDestroy();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user