Align OverviewActionsView for 3 button taskbar

Bug: 189807374
Change-Id: I028ae31b98e28bc372f0148a28755d067fe50678
This commit is contained in:
Vinit Nayak 2021-11-01 13:08:14 -07:00
parent c29f5441da
commit 97d64ea8a1
3 changed files with 44 additions and 12 deletions

View File

@ -226,6 +226,14 @@ public class NavbarButtonsViewController {
mPropertyHolders.forEach(StatePropertyHolder::endAnimation);
}
public void onDestroy() {
mPropertyHolders.clear();
mControllers.rotationButtonController.unregisterListeners();
if (mFloatingRotationButton != null) {
mFloatingRotationButton.hide();
}
}
private void initButtons(ViewGroup navContainer, ViewGroup endContainer,
TaskbarNavButtonController navButtonController) {
@ -422,14 +430,6 @@ public class NavbarButtonsViewController {
return mFloatingRotationButtonBounds.contains((int) ev.getX(), (int) ev.getY());
}
public void onDestroy() {
mPropertyHolders.clear();
mControllers.rotationButtonController.unregisterListeners();
if (mFloatingRotationButton != null) {
mFloatingRotationButton.hide();
}
}
private class RotationButtonListener implements RotationButton.RotationButtonUpdatesCallback {
@Override
public void onVisibilityChanged(boolean isVisible) {

View File

@ -16,6 +16,8 @@
package com.android.quickstep.views;
import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Rect;
@ -30,6 +32,7 @@ import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.R;
import com.android.launcher3.uioverrides.ApiWrapper;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.SysUINavigationMode;
@ -146,7 +149,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
public void setInsets(Rect insets) {
mInsets.set(insets);
updateVerticalMargin(SysUINavigationMode.getMode(getContext()));
updateHorizontalPadding();
updatePaddingAndTranslations();
}
public void updateHiddenFlags(@ActionsHiddenFlags int visibilityFlags, boolean enable) {
@ -189,8 +192,37 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
return mMultiValueAlpha.getProperty(INDEX_FULLSCREEN_ALPHA);
}
private void updateHorizontalPadding() {
setPadding(mInsets.left, 0, mInsets.right, 0);
/**
* Aligns OverviewActionsView vertically with and offsets horizontal position based on
* 3 button nav container in taskbar.
*/
private void updatePaddingAndTranslations() {
boolean alignFor3ButtonTaskbar = mDp.isTaskbarPresent &&
SysUINavigationMode.getMode(getContext()) == THREE_BUTTONS;
if (alignFor3ButtonTaskbar) {
// Add extra horizontal spacing
int additionalPadding = ApiWrapper.getHotseatEndOffset(getContext());
if (isLayoutRtl()) {
setPadding(mInsets.left + additionalPadding, 0, mInsets.right, 0);
} else {
setPadding(mInsets.left, 0, mInsets.right + additionalPadding, 0);
}
// Align vertically, using taskbar height + mDp.taskbarOffsetY() to guestimate
// where the button nav top is
View startActionView = findViewById(R.id.action_buttons);
int marginBottom = getOverviewActionsBottomMarginPx(
SysUINavigationMode.getMode(getContext()), mDp);
int actionsTop = (mDp.heightPx - marginBottom - mInsets.bottom);
int navTop = mDp.heightPx - (mDp.taskbarSize + mDp.getTaskbarOffsetY());
int transY = navTop - actionsTop
+ ((mDp.taskbarSize - startActionView.getHeight()) / 2);
setTranslationY(transY);
} else {
setPadding(mInsets.left, 0, mInsets.right, 0);
setTranslationX(0);
setTranslationY(0);
}
}
/** Updates vertical margins for different navigation mode or configuration changes. */

View File

@ -1094,7 +1094,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
for (int i = 0; i < taskCount; i++) {
View v = getTaskViewAt(i);
if (!(v instanceof GroupedTaskView)) {
return;
continue;
}
GroupedTaskView gtv = (GroupedTaskView) v;
gtv.onTaskListVisibilityChanged(false);