mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Merge "[Overview Actions] Change actions view UI based on different nav modes." into ub-launcher3-rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
17d3fe81c4
@@ -56,7 +56,7 @@ public class OverviewModalTaskState extends OverviewState {
|
||||
int taskHeight = out.height();
|
||||
|
||||
float topMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
|
||||
float bottomMargin = res.getDimension(R.dimen.task_thumbnail_bottom_margin_with_actions);
|
||||
float bottomMargin = res.getDimension(R.dimen.overview_actions_top_margin);
|
||||
float newHeight = taskHeight + topMargin + bottomMargin;
|
||||
float scale = newHeight / taskHeight;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import androidx.annotation.Nullable;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
|
||||
import com.android.quickstep.SysUINavigationMode.Mode;
|
||||
import com.android.quickstep.TaskOverlayFactory.OverlayUICallbacks;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -141,4 +142,21 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
public AlphaProperty getVisibilityAlpha() {
|
||||
return mMultiValueAlpha.getProperty(INDEX_VISIBILITY_ALPHA);
|
||||
}
|
||||
|
||||
/** Updates vertical margins for different navigation mode. */
|
||||
public void updateVerticalMarginForNavModeChange(Mode mode) {
|
||||
int topMargin = getResources()
|
||||
.getDimensionPixelSize(R.dimen.overview_actions_top_margin);
|
||||
int bottomMargin = 0;
|
||||
if (mode == Mode.THREE_BUTTONS) {
|
||||
bottomMargin = getResources()
|
||||
.getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_three_button);
|
||||
} else {
|
||||
bottomMargin = getResources()
|
||||
.getDimensionPixelSize(R.dimen.overview_actions_bottom_margin_gesture);
|
||||
}
|
||||
LayoutParams params = (LayoutParams) getLayoutParams();
|
||||
params.setMargins(
|
||||
params.leftMargin, topMargin, params.rightMargin, bottomMargin);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,16 @@
|
||||
<resources>
|
||||
|
||||
<dimen name="task_thumbnail_top_margin">24dp</dimen>
|
||||
<dimen name="task_thumbnail_bottom_margin_with_actions">44dp</dimen>
|
||||
<dimen name="task_thumbnail_half_top_margin">12dp</dimen>
|
||||
<dimen name="task_thumbnail_icon_size">48dp</dimen>
|
||||
<!-- For screens without rounded corners -->
|
||||
<dimen name="task_corner_radius_small">2dp</dimen>
|
||||
|
||||
<!-- Overrideable in overlay that provides the Overview Actions. -->
|
||||
<dimen name="overview_actions_height">110dp</dimen>
|
||||
<dimen name="overview_actions_height">66dp</dimen>
|
||||
<dimen name="overview_actions_top_margin">44dp</dimen>
|
||||
<dimen name="overview_actions_bottom_margin_gesture">16dp</dimen>
|
||||
<dimen name="overview_actions_bottom_margin_three_button">8dp</dimen>
|
||||
<dimen name="overview_actions_horizontal_margin">16dp</dimen>
|
||||
|
||||
<dimen name="recents_page_spacing">10dp</dimen>
|
||||
|
||||
@@ -92,6 +92,9 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
@Override
|
||||
public void onNavigationModeChanged(Mode newMode) {
|
||||
getDragLayer().recreateControllers();
|
||||
if (mActionsView != null && isOverviewActionsEnabled()) {
|
||||
mActionsView.updateVerticalMarginForNavModeChange(newMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,13 +170,18 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
mActionsView = findViewById(R.id.overview_actions_view);
|
||||
((RecentsView) getOverviewPanel()).init(mActionsView);
|
||||
|
||||
if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(this)) {
|
||||
if (isOverviewActionsEnabled()) {
|
||||
// Overview is above all other launcher elements, including qsb, so move it to the top.
|
||||
getOverviewPanel().bringToFront();
|
||||
mActionsView.bringToFront();
|
||||
mActionsView.updateVerticalMarginForNavModeChange(SysUINavigationMode.getMode(this));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOverviewActionsEnabled() {
|
||||
return FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get() && removeShelfFromOverview(this);
|
||||
}
|
||||
|
||||
public <T extends OverviewActionsView> T getActionsView() {
|
||||
return (T) mActionsView;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
|
||||
import static com.android.quickstep.SysUINavigationMode.getMode;
|
||||
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
|
||||
import static com.android.quickstep.util.LayoutUtils.getDefaultSwipeHeight;
|
||||
|
||||
@@ -26,6 +27,7 @@ import android.graphics.Rect;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.quickstep.SysUINavigationMode.Mode;
|
||||
|
||||
/**
|
||||
* Utility class to wrap different layout behavior for Launcher and RecentsView
|
||||
@@ -136,7 +138,19 @@ public abstract class WindowSizeStrategy {
|
||||
if (showOverviewActions(context)) {
|
||||
//TODO: this needs to account for the swipe gesture height and accessibility
|
||||
// UI when shown.
|
||||
return res.getDimensionPixelSize(R.dimen.overview_actions_height);
|
||||
float actionsBottomMargin = 0;
|
||||
if (getMode(context) == Mode.THREE_BUTTONS) {
|
||||
actionsBottomMargin = res.getDimensionPixelSize(
|
||||
R.dimen.overview_actions_bottom_margin_three_button);
|
||||
} else {
|
||||
actionsBottomMargin = res.getDimensionPixelSize(
|
||||
R.dimen.overview_actions_bottom_margin_gesture);
|
||||
}
|
||||
float actionsTopMargin = res.getDimensionPixelSize(
|
||||
R.dimen.overview_actions_top_margin);
|
||||
float actionsHeight = actionsTopMargin + actionsBottomMargin
|
||||
+ res.getDimensionPixelSize(R.dimen.overview_actions_height);
|
||||
return actionsHeight;
|
||||
} else {
|
||||
return getDefaultSwipeHeight(context, dp) + dp.workspacePageIndicatorHeight
|
||||
+ res.getDimensionPixelSize(
|
||||
|
||||
Reference in New Issue
Block a user