mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +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:
@@ -60,6 +60,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
private final TaskbarActivityContext mActivityContext;
|
||||
|
||||
// Initialized in init.
|
||||
private TaskbarViewController.TaskbarViewCallbacks mControllerCallbacks;
|
||||
private View.OnClickListener mIconClickListener;
|
||||
private View.OnLongClickListener mIconLongClickListener;
|
||||
|
||||
@@ -98,9 +99,10 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
mItemPadding = (mIconTouchSize - actualIconSize) / 2;
|
||||
}
|
||||
|
||||
protected void init(OnClickListener clickListener, OnLongClickListener longClickListener) {
|
||||
mIconClickListener = clickListener;
|
||||
mIconLongClickListener = longClickListener;
|
||||
protected void init(TaskbarViewController.TaskbarViewCallbacks callbacks) {
|
||||
mControllerCallbacks = callbacks;
|
||||
mIconClickListener = mControllerCallbacks.getOnClickListener();
|
||||
mIconLongClickListener = mControllerCallbacks.getOnLongClickListener();
|
||||
|
||||
int numHotseatIcons = mActivityContext.getDeviceProfile().numShownHotseatIcons;
|
||||
updateHotseatItems(new ItemInfo[numHotseatIcons]);
|
||||
@@ -200,11 +202,9 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
&& hotseatItemInfo instanceof WorkspaceItemInfo) {
|
||||
((BubbleTextView) hotseatView).applyFromWorkspaceItem(
|
||||
(WorkspaceItemInfo) hotseatItemInfo);
|
||||
hotseatView.setOnClickListener(mIconClickListener);
|
||||
hotseatView.setOnLongClickListener(mIconLongClickListener);
|
||||
setClickAndLongClickListenersForIcon(hotseatView);
|
||||
} else if (isFolder) {
|
||||
hotseatView.setOnClickListener(mIconClickListener);
|
||||
hotseatView.setOnLongClickListener(mIconLongClickListener);
|
||||
setClickAndLongClickListenersForIcon(hotseatView);
|
||||
} else {
|
||||
hotseatView.setOnClickListener(null);
|
||||
hotseatView.setOnLongClickListener(null);
|
||||
@@ -214,6 +214,14 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets OnClickListener and OnLongClickListener for the given view.
|
||||
*/
|
||||
public void setClickAndLongClickListenersForIcon(View icon) {
|
||||
icon.setOnClickListener(mIconClickListener);
|
||||
icon.setOnLongClickListener(mIconLongClickListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
int count = getChildCount();
|
||||
|
||||
Reference in New Issue
Block a user