Hide App Chip for smaller app in 90:10 flex split
Bug: 384110883 Test: Tested with both halves made smaller, large screen and small (phone has other existing bugs). Lanscape and portrait. Flag: com.android.wm.shell.enable_flexible_two_app_split Change-Id: Ib6508c7b3192cc47fc8406cdf68c826bed29de5f
This commit is contained in:
@@ -38,6 +38,7 @@ import com.android.quickstep.util.RecentsOrientedState
|
||||
import com.android.quickstep.util.SplitSelectStateController
|
||||
import com.android.systemui.shared.recents.model.Task
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper
|
||||
import com.android.wm.shell.Flags.enableFlexibleTwoAppSplit
|
||||
import com.android.wm.shell.shared.split.SplitScreenConstants.PersistentSnapPosition
|
||||
|
||||
/**
|
||||
@@ -52,6 +53,9 @@ import com.android.wm.shell.shared.split.SplitScreenConstants.PersistentSnapPosi
|
||||
*/
|
||||
class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
TaskView(context, attrs, type = TaskViewType.GROUPED) {
|
||||
|
||||
private val MINIMUM_RATIO_TO_SHOW_ICON = 0.2f
|
||||
|
||||
// TODO(b/336612373): Support new TTV for GroupedTaskView
|
||||
var splitBoundsConfig: SplitConfigurationOptions.SplitBounds? = null
|
||||
private set
|
||||
@@ -176,14 +180,32 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
|
||||
private fun updateIconPlacement() {
|
||||
val splitBoundsConfig = splitBoundsConfig ?: return
|
||||
val taskIconHeight = container.deviceProfile.overviewTaskIconSizePx
|
||||
val deviceProfile = container.deviceProfile
|
||||
val taskIconHeight = deviceProfile.overviewTaskIconSizePx
|
||||
val isRtl = layoutDirection == LAYOUT_DIRECTION_RTL
|
||||
val inSplitSelection = getThisTaskCurrentlyInSplitSelection() != INVALID_TASK_ID
|
||||
|
||||
if (enableFlexibleTwoAppSplit()) {
|
||||
val topLeftTaskPercent =
|
||||
if (deviceProfile.isLeftRightSplit) splitBoundsConfig.leftTaskPercent
|
||||
else splitBoundsConfig.topTaskPercent
|
||||
val bottomRightTaskPercent = 1 - topLeftTaskPercent
|
||||
taskContainers[0]
|
||||
.iconView
|
||||
.setFlexSplitAlpha(
|
||||
if (topLeftTaskPercent < MINIMUM_RATIO_TO_SHOW_ICON) 0f else 1f
|
||||
)
|
||||
taskContainers[1]
|
||||
.iconView
|
||||
.setFlexSplitAlpha(
|
||||
if (bottomRightTaskPercent < MINIMUM_RATIO_TO_SHOW_ICON) 0f else 1f
|
||||
)
|
||||
}
|
||||
|
||||
if (enableOverviewIconMenu()) {
|
||||
val groupedTaskViewSizes =
|
||||
pagedOrientationHandler.getGroupedTaskViewSizes(
|
||||
container.deviceProfile,
|
||||
deviceProfile,
|
||||
splitBoundsConfig,
|
||||
layoutParams.width,
|
||||
layoutParams.height,
|
||||
@@ -197,7 +219,7 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
layoutParams.height,
|
||||
layoutParams.width,
|
||||
isRtl,
|
||||
container.deviceProfile,
|
||||
deviceProfile,
|
||||
splitBoundsConfig,
|
||||
inSplitSelection,
|
||||
)
|
||||
@@ -211,7 +233,7 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
|
||||
measuredHeight,
|
||||
measuredWidth,
|
||||
isRtl,
|
||||
container.deviceProfile,
|
||||
deviceProfile,
|
||||
splitBoundsConfig,
|
||||
inSplitSelection,
|
||||
)
|
||||
|
||||
@@ -56,10 +56,12 @@ public class IconAppChipView extends FrameLayout implements TaskViewIcon {
|
||||
private static final int MENU_BACKGROUND_REVEAL_DURATION = 417;
|
||||
private static final int MENU_BACKGROUND_HIDE_DURATION = 333;
|
||||
|
||||
private static final int NUM_ALPHA_CHANNELS = 3;
|
||||
private static final int NUM_ALPHA_CHANNELS = 4;
|
||||
private static final int INDEX_CONTENT_ALPHA = 0;
|
||||
private static final int INDEX_COLOR_FILTER_ALPHA = 1;
|
||||
private static final int INDEX_MODAL_ALPHA = 2;
|
||||
/** Used to hide the app chip for 90:10 flex split. */
|
||||
private static final int INDEX_MINIMUM_RATIO_ALPHA = 3;
|
||||
|
||||
private final MultiValueAlpha mMultiValueAlpha;
|
||||
|
||||
@@ -348,6 +350,11 @@ public class IconAppChipView extends FrameLayout implements TaskViewIcon {
|
||||
mMultiValueAlpha.get(INDEX_MODAL_ALPHA).setValue(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlexSplitAlpha(float alpha) {
|
||||
mMultiValueAlpha.get(INDEX_MINIMUM_RATIO_ALPHA).setValue(alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDrawableWidth() {
|
||||
return mIconView == null ? 0 : mIconView.getDrawableWidth();
|
||||
|
||||
@@ -133,6 +133,10 @@ class IconView : View, TaskViewIcon {
|
||||
multiValueAlpha[INDEX_MODAL_ALPHA].setValue(alpha)
|
||||
}
|
||||
|
||||
override fun setFlexSplitAlpha(alpha: Float) {
|
||||
multiValueAlpha[INDEX_FLEX_SPLIT_ALPHA].setValue(alpha)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tint color of the icon, useful for scrimming or dimming.
|
||||
*
|
||||
@@ -178,8 +182,9 @@ class IconView : View, TaskViewIcon {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val NUM_ALPHA_CHANNELS = 2
|
||||
private const val NUM_ALPHA_CHANNELS = 3
|
||||
private const val INDEX_CONTENT_ALPHA = 0
|
||||
private const val INDEX_MODAL_ALPHA = 1
|
||||
private const val INDEX_FLEX_SPLIT_ALPHA = 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,11 @@ public interface TaskViewIcon {
|
||||
*/
|
||||
void setModalAlpha(float alpha);
|
||||
|
||||
/**
|
||||
* Sets the opacity of the view for flex split state.
|
||||
*/
|
||||
void setFlexSplitAlpha(float alpha);
|
||||
|
||||
/**
|
||||
* Returns this icon view's drawable.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user