mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-06 02:46:57 +00:00
Disabling overview actions when thumbnail is not loaded.
Bug: 160331177 Change-Id: I05eaec7d6f2e3f2ba71d8148a4e97dcf5a1522c6
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.quickstep;
|
||||
import static android.view.Surface.ROTATION_0;
|
||||
|
||||
import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
|
||||
import static com.android.quickstep.views.OverviewActionsView.DISABLED_NO_THUMBNAIL;
|
||||
import static com.android.quickstep.views.OverviewActionsView.DISABLED_ROTATED;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -146,26 +147,29 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
||||
*/
|
||||
public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix,
|
||||
boolean rotated) {
|
||||
final boolean isAllowedByPolicy = thumbnail.isRealSnapshot;
|
||||
getActionsView().updateDisabledFlags(DISABLED_NO_THUMBNAIL, thumbnail == null);
|
||||
|
||||
getActionsView().updateDisabledFlags(DISABLED_ROTATED, rotated);
|
||||
if (thumbnail != null) {
|
||||
getActionsView().updateDisabledFlags(DISABLED_ROTATED, rotated);
|
||||
final boolean isAllowedByPolicy = thumbnail.isRealSnapshot;
|
||||
|
||||
getActionsView().setCallbacks(new OverlayUICallbacks() {
|
||||
@Override
|
||||
public void onShare() {
|
||||
if (isAllowedByPolicy) {
|
||||
mImageApi.startShareActivity();
|
||||
} else {
|
||||
showBlockedByPolicyMessage();
|
||||
getActionsView().setCallbacks(new OverlayUICallbacks() {
|
||||
@Override
|
||||
public void onShare() {
|
||||
if (isAllowedByPolicy) {
|
||||
mImageApi.startShareActivity();
|
||||
} else {
|
||||
showBlockedByPolicyMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onScreenshot() {
|
||||
saveScreenshot(task);
|
||||
}
|
||||
});
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
public void onScreenshot() {
|
||||
saveScreenshot(task);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,12 +70,14 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
|
||||
|
||||
@IntDef(flag = true, value = {
|
||||
DISABLED_SCROLLING,
|
||||
DISABLED_ROTATED})
|
||||
DISABLED_ROTATED,
|
||||
DISABLED_NO_THUMBNAIL})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ActionsDisabledFlags { }
|
||||
|
||||
public static final int DISABLED_SCROLLING = 1 << 0;
|
||||
public static final int DISABLED_ROTATED = 1 << 1;
|
||||
public static final int DISABLED_NO_THUMBNAIL = 1 << 2;
|
||||
|
||||
private static final int INDEX_CONTENT_ALPHA = 0;
|
||||
private static final int INDEX_VISIBILITY_ALPHA = 1;
|
||||
|
||||
@@ -357,7 +357,7 @@ public class TaskThumbnailView extends View implements PluginListener<OverviewSc
|
||||
}
|
||||
|
||||
private void updateOverlay() {
|
||||
if (mOverlayEnabled && mBitmapShader != null && mThumbnailData != null) {
|
||||
if (mOverlayEnabled) {
|
||||
mOverlay.initOverlay(mTask, mThumbnailData, mPreviewPositionHelper.mMatrix,
|
||||
mPreviewPositionHelper.mIsOrientationChanged);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user