Merge "Add icon to desktop tile in overview" into tm-qpr-dev am: 90d0019447 am: 201e4d39c7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21359254 Change-Id: If1296cf7ecdf87a0c0764feda7132525e99bdff7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
b0dd2ffb30
4 files changed
+80
-23
No files matched your search
@@ -24,6 +24,8 @@ import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITIO
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.RoundRectShape;
|
||||
import android.os.SystemProperties;
|
||||
@@ -31,14 +33,16 @@ import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.touch.PagedOrientationHandler;
|
||||
import com.android.launcher3.util.RunnableList;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
@@ -87,7 +91,7 @@ public class DesktopTaskView extends TaskView {
|
||||
|
||||
private final ArrayList<CancellableTask<?>> mPendingThumbnailRequests = new ArrayList<>();
|
||||
|
||||
private ShapeDrawable mBackground;
|
||||
private View mBackgroundView;
|
||||
|
||||
public DesktopTaskView(Context context) {
|
||||
this(context, null);
|
||||
@@ -104,14 +108,28 @@ public class DesktopTaskView extends TaskView {
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
|
||||
mBackgroundView = findViewById(R.id.background);
|
||||
|
||||
int topMarginPx =
|
||||
mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
|
||||
FrameLayout.LayoutParams params = (LayoutParams) mBackgroundView.getLayoutParams();
|
||||
params.topMargin = topMarginPx;
|
||||
mBackgroundView.setLayoutParams(params);
|
||||
|
||||
float[] outerRadii = new float[8];
|
||||
Arrays.fill(outerRadii, getTaskCornerRadius());
|
||||
RoundRectShape shape = new RoundRectShape(outerRadii, null, null);
|
||||
mBackground = new ShapeDrawable(shape);
|
||||
mBackground.setTint(getResources().getColor(android.R.color.system_neutral2_300,
|
||||
ShapeDrawable background = new ShapeDrawable(shape);
|
||||
background.setTint(getResources().getColor(android.R.color.system_neutral2_300,
|
||||
getContext().getTheme()));
|
||||
// TODO(b/244348395): this should be wallpaper
|
||||
setBackground(mBackground);
|
||||
mBackgroundView.setBackground(background);
|
||||
|
||||
Drawable icon = getResources().getDrawable(R.drawable.ic_desktop, getContext().getTheme());
|
||||
Drawable iconBackground = getResources().getDrawable(R.drawable.bg_circle,
|
||||
getContext().getTheme());
|
||||
mIconView.setDrawable(new LayerDrawable(new Drawable[]{iconBackground, icon}));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -252,20 +270,9 @@ public class DesktopTaskView extends TaskView {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientationState(RecentsOrientedState orientationState) {
|
||||
// TODO(b/249371338): this copies logic from TaskView
|
||||
PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
|
||||
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
protected void setThumbnailOrientation(RecentsOrientedState orientationState) {
|
||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||
|
||||
LayoutParams iconParams = (LayoutParams) mIconView.getLayoutParams();
|
||||
|
||||
int thumbnailTopMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
|
||||
int taskIconHeight = deviceProfile.overviewTaskIconSizePx;
|
||||
int taskMargin = deviceProfile.overviewTaskMarginPx;
|
||||
|
||||
orientationHandler.setTaskIconParams(iconParams, taskMargin, taskIconHeight,
|
||||
thumbnailTopMargin, isRtl);
|
||||
|
||||
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
|
||||
snapshotParams.topMargin = thumbnailTopMargin;
|
||||
@@ -374,6 +381,9 @@ public class DesktopTaskView extends TaskView {
|
||||
|
||||
setMeasuredDimension(containerWidth, containerHeight);
|
||||
|
||||
int thumbnailTopMarginPx = mActivity.getDeviceProfile().overviewTaskThumbnailTopMarginPx;
|
||||
containerHeight -= thumbnailTopMarginPx;
|
||||
|
||||
int thumbnails = mSnapshotViewMap.size();
|
||||
if (thumbnails == 0) {
|
||||
return;
|
||||
@@ -416,6 +426,8 @@ public class DesktopTaskView extends TaskView {
|
||||
}
|
||||
int taskX = (int) (positionInParent.x * scaleWidth);
|
||||
int taskY = (int) (positionInParent.y * scaleHeight);
|
||||
// move task down by margin size
|
||||
taskY += thumbnailTopMarginPx;
|
||||
thumbnailView.setX(taskX);
|
||||
thumbnailView.setY(taskY);
|
||||
|
||||
@@ -439,9 +451,9 @@ public class DesktopTaskView extends TaskView {
|
||||
mFullscreenProgress = progress;
|
||||
if (mFullscreenProgress > 0) {
|
||||
// Don't show background while we are transitioning to/from fullscreen
|
||||
setBackground(null);
|
||||
mBackgroundView.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
setBackground(mBackground);
|
||||
mBackgroundView.setVisibility(VISIBLE);
|
||||
}
|
||||
for (int i = 0; i < mSnapshotViewMap.size(); i++) {
|
||||
TaskThumbnailView thumbnailView = mSnapshotViewMap.valueAt(i);
|
||||
|
||||
@@ -996,6 +996,11 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
}
|
||||
|
||||
public void setOrientationState(RecentsOrientedState orientationState) {
|
||||
setIconOrientation(orientationState);
|
||||
setThumbnailOrientation(orientationState);
|
||||
}
|
||||
|
||||
protected void setIconOrientation(RecentsOrientedState orientationState) {
|
||||
PagedOrientationHandler orientationHandler = orientationState.getOrientationHandler();
|
||||
boolean isRtl = getLayoutDirection() == LAYOUT_DIRECTION_RTL;
|
||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||
@@ -1016,6 +1021,11 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
int iconDrawableSize = isGridTask ? deviceProfile.overviewTaskIconDrawableSizeGridPx
|
||||
: deviceProfile.overviewTaskIconDrawableSizePx;
|
||||
mIconView.setDrawableSize(iconDrawableSize, iconDrawableSize);
|
||||
}
|
||||
|
||||
protected void setThumbnailOrientation(RecentsOrientedState orientationState) {
|
||||
DeviceProfile deviceProfile = mActivity.getDeviceProfile();
|
||||
int thumbnailTopMargin = deviceProfile.overviewTaskThumbnailTopMarginPx;
|
||||
|
||||
LayoutParams snapshotParams = (LayoutParams) mSnapshotView.getLayoutParams();
|
||||
snapshotParams.topMargin = thumbnailTopMargin;
|
||||
|
||||
Reference in new issue
Block a user