Skip to content

Commit

Permalink
quickstep: Remove rounded corners in split screen [2/2]
Browse files Browse the repository at this point in the history
Sahil: Adapt to a14 QPR1
adithya2306: Adapt to 15-qpr0

Change-Id: I538a3170cc271a6ee9b94e24f13a1a2a28519ad7
Signed-off-by: SahilSonar <[email protected]>
Signed-off-by: Saalim Quadri <[email protected]>
Signed-off-by: Adithya R <[email protected]>
  • Loading branch information
Dhina17 authored and NurKeinNeid committed Nov 16, 2024
1 parent 257a229 commit 8073243
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,11 @@ public void apply(TransformParams params, @Nullable SurfaceTransaction surfaceTr

float fullScreenProgress = Utilities.boundToRange(this.fullScreenProgress.value, 0, 1);
float scrollScale = this.scrollScale.value * (1f - fullScreenProgress) + fullScreenProgress;
// If the split bounds is found, then it's splitted task.
// i.e split screen.
boolean isSplitTask = mSplitBounds != null;
mCurrentFullscreenParams.setProgress(fullScreenProgress, recentsViewScale.value,
scrollScale);
scrollScale, isSplitTask);

// Apply thumbnail matrix
float taskWidth = mTaskRect.width();
Expand Down
19 changes: 17 additions & 2 deletions quickstep/src/com/android/quickstep/views/FloatingTaskView.java
Original file line number Diff line number Diff line change
Expand Up @@ -434,10 +434,13 @@ public static class FullscreenDrawParams {
public float mCurrentDrawnCornerRadius;
public float mScaleX = 1;
public float mScaleY = 1;
private boolean mFirstTimeDone = false;
private boolean haveRoundedCornersOnWindows = true;

public FullscreenDrawParams(Context context) {
mCornerRadius = TaskCornerRadius.get(context);
mWindowCornerRadius = QuickStepContract.getWindowCornerRadius(context);
haveRoundedCornersOnWindows = mWindowCornerRadius != 0f;

mCurrentDrawnCornerRadius = mCornerRadius;
}
Expand All @@ -446,8 +449,20 @@ public void updateParams(RectF bounds, float progress, float scaleX, float scale
mBounds.set(bounds);
mScaleX = scaleX;
mScaleY = scaleY;
mCurrentDrawnCornerRadius = mIsStagedTask ? mWindowCornerRadius :
Utilities.mapRange(progress, mCornerRadius, mWindowCornerRadius);
// StagedTask has two cycle of progress.
// First - When it's go up on the first split task selected.
// Second - After the second split task selection, it will go down
// to start the split screen.
// Here we want to remove the corner radius only in the second cycle.
// i.e only have to remove the corner radius at the time of starting split screen.
// Also we don't need to show the rounded corner radius progress for StagedTask
// in devices without rounded corners at the time of starting split screen.
mCurrentDrawnCornerRadius = (mIsStagedTask && (!mFirstTimeDone ||
!haveRoundedCornersOnWindows)) ? mWindowCornerRadius :
Utilities.mapRange(progress, mCornerRadius, 0f /** No corner radius */);
// If the first cycle of progress completed, change it to true.
// Or else don't change it to have intended behaviour.
mFirstTimeDone = (mIsStagedTask && progress == 1f) ? true : mFirstTimeDone;
}

public void setIsStagedTask(boolean isStagedTask) {
Expand Down
8 changes: 8 additions & 0 deletions quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ class GroupedTaskView @JvmOverloads constructor(context: Context, attrs: Attribu
}
}

override fun updateSnapshotRadius() {
updateCurrentFullscreenParams(true /* split screen */)
taskContainers.forEach {
it.thumbnailViewDeprecated.setFullscreenParams(getThumbnailFullscreenParams())
it.overlay.setFullscreenParams(getThumbnailFullscreenParams())
}
}

companion object {
private const val TAG = "GroupedTaskView"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,11 @@ private void updateThumbnailMatrix() {
mPaint.setShader(mBitmapShader);
}
getTaskView().updateCurrentFullscreenParams();
TaskView taskView = getTaskView();
// If it's the instance of GroupedTaskView, then it's splitted task.
// i.e split screen.
boolean isGroupedTaskView = (taskView instanceof GroupedTaskView);
taskView.updateCurrentFullscreenParams(isGroupedTaskView /* split screen */);
invalidate();
}

Expand Down
25 changes: 21 additions & 4 deletions quickstep/src/com/android/quickstep/views/TaskView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1494,11 +1494,22 @@ constructor(
}

protected open fun updateCurrentFullscreenParams() {
updateFullscreenParams(currentFullscreenParams)
updateFullscreenParams(currentFullscreenParams, false /* isSplitScreen */)
}

protected open fun updateCurrentFullscreenParams(isSplitScreen: Boolean) {
updateFullscreenParams(currentFullscreenParams, isSplitScreen)
}

protected fun updateFullscreenParams(fullscreenParams: FullscreenDrawParams) {
recentsView?.let { fullscreenParams.setProgress(fullscreenProgress, it.scaleX, scaleX) }
updateFullscreenParams(fullscreenParams, false /* isSplitScreen */)
}

protected fun updateFullscreenParams(fullscreenParams: FullscreenDrawParams,
isSplitScreen: Boolean) {
recentsView?.let {
fullscreenParams.setProgress(fullscreenProgress, it.scaleX, scaleX, isSplitScreen)
}
}

protected open fun getThumbnailFullscreenParams(): FullscreenDrawParams =
Expand Down Expand Up @@ -1563,6 +1574,7 @@ constructor(
var cornerRadius = 0f
private var windowCornerRadius = 0f
var currentDrawnCornerRadius = 0f
private var prevProgress = 0f

init {
updateCornerRadius(context)
Expand Down Expand Up @@ -1598,11 +1610,16 @@ constructor(
}

/** Sets the progress in range [0, 1] */
fun setProgress(fullscreenProgress: Float, parentScale: Float, taskViewScale: Float) {
fun setProgress(fullscreenProgress: Float, parentScale: Float, taskViewScale: Float,
isSplitScreen: Boolean) {
// Remove the rounded corners only in the splitted task. (i.e split screen)
val maxCornerRadius = if (isSplitScreen && (prevProgress <= fullscreenProgress))
0f else windowCornerRadius
currentDrawnCornerRadius =
Utilities.mapRange(fullscreenProgress, cornerRadius, windowCornerRadius) /
Utilities.mapRange(fullscreenProgress, cornerRadius, maxCornerRadius) /
parentScale /
taskViewScale
prevProgress = fullscreenProgress
}

override fun close() {}
Expand Down

0 comments on commit 8073243

Please sign in to comment.