Merge "Align OverviewActionsView for 3 button taskbar" into sc-v2-dev

This commit is contained in:
Vinit Nayak 2021-11-02 05:37:45 +00:00 committed by Android (Google) Code Review
commit ac24e7f6f0
3 changed files with 44 additions and 12 deletions

View File

@ -234,6 +234,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) {
@ -430,14 +438,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);