Merge "Update TaskView corner radius dynamically" into udc-qpr-dev am: 2677e04510 am: 0eb2b24d68
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/24627246 Change-Id: Ib3fb4c43fd651a017746e2ff8cff17dec3eab057 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -101,9 +101,17 @@ public class DesktopTaskView extends TaskView {
|
||||
public DesktopTaskView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
mSnapshotDrawParams = new FullscreenDrawParams(
|
||||
QuickStepContract.getWindowCornerRadius(context),
|
||||
QuickStepContract.getWindowCornerRadius(context));
|
||||
mSnapshotDrawParams = new FullscreenDrawParams(context) {
|
||||
@Override
|
||||
public float computeTaskCornerRadius(Context context) {
|
||||
return QuickStepContract.getWindowCornerRadius(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float computeWindowCornerRadius(Context context) {
|
||||
return QuickStepContract.getWindowCornerRadius(context);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -71,6 +71,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.IntDef;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.app.animation.Interpolators;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
@@ -133,15 +134,17 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
|
||||
public static final int FLAG_UPDATE_ICON = 1;
|
||||
public static final int FLAG_UPDATE_THUMBNAIL = FLAG_UPDATE_ICON << 1;
|
||||
public static final int FLAG_UPDATE_CORNER_RADIUS = FLAG_UPDATE_THUMBNAIL << 1;
|
||||
|
||||
public static final int FLAG_UPDATE_ALL = FLAG_UPDATE_ICON | FLAG_UPDATE_THUMBNAIL;
|
||||
public static final int FLAG_UPDATE_ALL = FLAG_UPDATE_ICON | FLAG_UPDATE_THUMBNAIL
|
||||
| FLAG_UPDATE_CORNER_RADIUS;
|
||||
|
||||
/**
|
||||
* Used in conjunction with {@link #onTaskListVisibilityChanged(boolean, int)}, providing more
|
||||
* granularity on which components of this task require an update
|
||||
*/
|
||||
@Retention(SOURCE)
|
||||
@IntDef({FLAG_UPDATE_ALL, FLAG_UPDATE_ICON, FLAG_UPDATE_THUMBNAIL})
|
||||
@IntDef({FLAG_UPDATE_ALL, FLAG_UPDATE_ICON, FLAG_UPDATE_THUMBNAIL, FLAG_UPDATE_CORNER_RADIUS})
|
||||
public @interface TaskDataChanges {}
|
||||
|
||||
/**
|
||||
@@ -1079,6 +1082,9 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
mDigitalWellBeingToast.initialize(task);
|
||||
});
|
||||
}
|
||||
if (needsUpdate(changes, FLAG_UPDATE_CORNER_RADIUS)) {
|
||||
mCurrentFullscreenParams.updateCornerRadius(getContext());
|
||||
}
|
||||
} else {
|
||||
if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {
|
||||
mSnapshotView.setThumbnail(null, null);
|
||||
@@ -1859,19 +1865,29 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
*/
|
||||
public static class FullscreenDrawParams {
|
||||
|
||||
private final float mCornerRadius;
|
||||
private final float mWindowCornerRadius;
|
||||
private float mCornerRadius;
|
||||
private float mWindowCornerRadius;
|
||||
|
||||
public float mCurrentDrawnCornerRadius;
|
||||
|
||||
public FullscreenDrawParams(Context context) {
|
||||
this(TaskCornerRadius.get(context), QuickStepContract.getWindowCornerRadius(context));
|
||||
updateCornerRadius(context);
|
||||
}
|
||||
|
||||
FullscreenDrawParams(float cornerRadius, float windowCornerRadius) {
|
||||
mCornerRadius = cornerRadius;
|
||||
mWindowCornerRadius = windowCornerRadius;
|
||||
mCurrentDrawnCornerRadius = mCornerRadius;
|
||||
/** Recomputes the start and end corner radius for the given Context. */
|
||||
public void updateCornerRadius(Context context) {
|
||||
mCornerRadius = computeTaskCornerRadius(context);
|
||||
mWindowCornerRadius = computeWindowCornerRadius(context);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public float computeTaskCornerRadius(Context context) {
|
||||
return TaskCornerRadius.get(context);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public float computeWindowCornerRadius(Context context) {
|
||||
return QuickStepContract.getWindowCornerRadius(context);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user