Merge "Add split placeholder view above OverviewScrim" into sc-dev

This commit is contained in:
TreeHugger Robot 2021-04-06 02:34:19 +00:00 committed by Android (Google) Code Review
commit e77fc9cc25
8 changed files with 34 additions and 29 deletions

View File

@ -19,8 +19,7 @@
android:id="@+id/split_placeholder"
android:layout_width="match_parent"
android:layout_height="@dimen/split_placeholder_size"
android:background="@android:color/white"
android:alpha=".8"
android:background="@android:color/darker_gray"
android:visibility="gone" />
<com.android.quickstep.views.LauncherRecentsView

View File

@ -92,6 +92,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
private final TaskbarStateHandler mTaskbarStateHandler = new TaskbarStateHandler(this);
// Will be updated when dragging from taskbar.
private @Nullable DragOptions mNextWorkspaceDragOptions = null;
private SplitPlaceholderView mSplitPlaceholderView;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -215,12 +216,12 @@ public abstract class BaseQuickstepLauncher extends Launcher
SysUINavigationMode.INSTANCE.get(this).updateMode();
mActionsView = findViewById(R.id.overview_actions_view);
SplitPlaceholderView splitPlaceholderView = findViewById(R.id.split_placeholder);
mSplitPlaceholderView = findViewById(R.id.split_placeholder);
RecentsView overviewPanel = (RecentsView) getOverviewPanel();
splitPlaceholderView.init(
mSplitPlaceholderView.init(
new SplitSelectStateController(SystemUiProxy.INSTANCE.get(this))
);
overviewPanel.init(mActionsView, splitPlaceholderView);
overviewPanel.init(mActionsView, mSplitPlaceholderView);
mActionsView.updateVerticalMargin(SysUINavigationMode.getMode(this));
mAppTransitionManager = new QuickstepTransitionManager(this);
@ -256,6 +257,10 @@ public abstract class BaseQuickstepLauncher extends Launcher
return (T) mActionsView;
}
public SplitPlaceholderView getSplitPlaceholderView() {
return mSplitPlaceholderView;
}
@Override
protected void closeOpenViews(boolean animate) {
super.closeOpenViews(animate);

View File

@ -116,6 +116,11 @@ public abstract class BaseRecentsViewStateController<T extends RecentsView>
config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR));
setter.setFloat(scrim, SCRIM_MULTIPLIER, 1f,
config.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR));
if (toState.areElementsVisible(mLauncher, LauncherState.SPLIT_PLACHOLDER_VIEW)) {
scrim.updateStableScrimmedView(mLauncher.getSplitPlaceholderView());
} else {
scrim.updateStableScrimmedView(mLauncher.getOverviewPanel());
}
setter.setFloat(
mRecentsView, getTaskModalnessProperty(),

View File

@ -113,7 +113,7 @@ public final class RecentsViewStateController extends
ANIM_OVERVIEW_ACTIONS_FADE, LINEAR));
float splitPlaceholderAlpha = state.areElementsVisible(mLauncher, SPLIT_PLACHOLDER_VIEW) ?
1 : 0;
0.7f : 0;
propertySetter.setFloat(mRecentsView.getSplitPlaceholder(), ALPHA_FLOAT,
splitPlaceholderAlpha, LINEAR);
}

View File

@ -66,6 +66,13 @@ public class OverviewScrim extends Scrim {
mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel();
}
/**
* @param view The view we want the scrim to be behind
*/
public void updateStableScrimmedView(View view) {
mStableScrimmedView = view;
}
public void updateCurrentScrimmedView(ViewGroup root) {
// Find the lowest view that is at or above the view we want to show the scrim behind.
mCurrentScrimmedView = mStableScrimmedView;

View File

@ -24,7 +24,6 @@ import static com.android.launcher3.touch.SingleAxisSwipeDetector.HORIZONTAL;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_SIDE;
import android.content.res.Resources;
import android.graphics.PointF;
@ -45,7 +44,7 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.util.OverScroller;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class LandscapePagedViewHandler implements PagedOrientationHandler {
@ -308,15 +307,10 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
@Override
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
List<SplitPositionOption> options = new ArrayList<>(2);
// Add left/right options where left => position top, right => position bottom
options.add(new SplitPositionOption(
// Add "left" side of phone which is actually the top
return Collections.singletonList(new SplitPositionOption(
R.drawable.ic_split_screen, R.string.split_screen_position_left,
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
options.add(new SplitPositionOption(
R.drawable.ic_split_screen, R.string.split_screen_position_right,
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE));
return options;
}
@Override

View File

@ -306,16 +306,17 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
@Override
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
List<SplitPositionOption> options = new ArrayList<>(2);
List<SplitPositionOption> options = new ArrayList<>(1);
// TODO: Add in correct icons
if (dp.isLandscape) { // or seascape
if (dp.isSeascape()) { // or seascape
// Add left/right options
options.add(new SplitPositionOption(
R.drawable.ic_split_screen, R.string.split_screen_position_right,
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
} else if (dp.isLandscape) {
options.add(new SplitPositionOption(
R.drawable.ic_split_screen, R.string.split_screen_position_left,
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
options.add(new SplitPositionOption(
R.drawable.ic_split_screen, R.string.split_screen_position_right,
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE));
} else {
// Only add top option
options.add(new SplitPositionOption(

View File

@ -20,7 +20,6 @@ import static com.android.launcher3.touch.SingleAxisSwipeDetector.HORIZONTAL;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_MAIN;
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_TYPE_SIDE;
import android.content.res.Resources;
import android.graphics.PointF;
@ -33,7 +32,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
@ -96,15 +95,10 @@ public class SeascapePagedViewHandler extends LandscapePagedViewHandler {
@Override
public List<SplitPositionOption> getSplitPositionOptions(DeviceProfile dp) {
List<SplitPositionOption> options = new ArrayList<>(2);
// Add left/right options where left => position bottom, right => position top
options.add(new SplitPositionOption(
R.drawable.ic_split_screen, R.string.split_screen_position_left,
STAGE_POSITION_BOTTOM_OR_RIGHT, STAGE_TYPE_SIDE));
options.add(new SplitPositionOption(
// Add "right" option which is actually the top
return Collections.singletonList(new SplitPositionOption(
R.drawable.ic_split_screen, R.string.split_screen_position_right,
STAGE_POSITION_TOP_OR_LEFT, STAGE_TYPE_MAIN));
return options;
}
/* ---------- The following are only used by TaskViewTouchHandler. ---------- */