Hook up mAddDesktopButton with the API createDesktop
Add the `setOnClickListener` for the `mAddDesktopButton`,
it will call the `createDesktop` API inside SystemUiProxy
to create a new Desk inside the display that the button
resides in.
Flag: com.android.window.flags.enable_multiple_desktops_frontend
com.android.window.flags.enable_multiple_desktops_backend
Fix: 391917345
Test: Manual, make sure the callback function `createDesk` is called
after clicking the button. No real desk will be created
for now, as the backend hasn't been implemented yet.
Change-Id: I70417a1ce0963b9b3c109c3f3dffaab808212d23
This commit is contained in:
@@ -907,6 +907,7 @@ public abstract class RecentsView<
|
||||
if (DesktopModeStatus.enableMultipleDesktops(mContext)) {
|
||||
mAddDesktopButton = (AddDesktopButton) LayoutInflater.from(context).inflate(
|
||||
R.layout.overview_add_desktop_button, this, false);
|
||||
mAddDesktopButton.setOnClickListener(this::createDesk);
|
||||
}
|
||||
|
||||
mTaskViewPool = new ViewPool<>(context, this, R.layout.task, 20 /* max size */,
|
||||
@@ -4605,6 +4606,12 @@ public abstract class RecentsView<
|
||||
}
|
||||
}
|
||||
|
||||
private void createDesk(View view) {
|
||||
SystemUiProxy.INSTANCE
|
||||
.get(getContext())
|
||||
.createDesktop(mContainer.getDisplay().getDisplayId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if (isHandlingTouch() || event.getAction() != KeyEvent.ACTION_DOWN) {
|
||||
|
||||
Reference in New Issue
Block a user