Merge "Overview Actions - shows a message if action is blocked by policy." into ub-launcher3-rvc-dev am: 02a25be89d
Change-Id: Ied5427ad95a8a65679551fae09b158778b87f6e1
This commit is contained in:
commit
9e3797b260
|
@ -22,6 +22,7 @@ import android.content.Context;
|
|||
import android.graphics.Insets;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.launcher3.BaseActivity;
|
||||
import com.android.launcher3.BaseDraggingActivity;
|
||||
|
@ -109,16 +110,26 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
|||
public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix) {
|
||||
ImageActionsApi imageApi = new ImageActionsApi(
|
||||
mApplicationContext, mThumbnailView::getThumbnail);
|
||||
final boolean isAllowedByPolicy = thumbnail.isRealSnapshot;
|
||||
|
||||
getActionsView().setCallbacks(new OverlayUICallbacks() {
|
||||
@Override
|
||||
public void onShare() {
|
||||
imageApi.startShareActivity();
|
||||
if (isAllowedByPolicy) {
|
||||
imageApi.startShareActivity();
|
||||
} else {
|
||||
showBlockedByPolicyMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScreenshot() {
|
||||
imageApi.saveScreenshot(mThumbnailView.getThumbnail(),
|
||||
getTaskSnapshotBounds(), getTaskSnapshotInsets(), task.key.id);
|
||||
if (isAllowedByPolicy) {
|
||||
imageApi.saveScreenshot(mThumbnailView.getThumbnail(),
|
||||
getTaskSnapshotBounds(), getTaskSnapshotInsets(), task.key.id);
|
||||
} else {
|
||||
showBlockedByPolicyMessage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -152,6 +163,13 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
|
|||
// TODO: return the real insets
|
||||
return Insets.of(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
private void showBlockedByPolicyMessage() {
|
||||
Toast.makeText(
|
||||
mThumbnailView.getContext(),
|
||||
R.string.blocked_by_policy,
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -141,4 +141,6 @@
|
|||
<string name="action_share">Share</string>
|
||||
<!-- Label for a button that causes a screen shot of the current app to be taken. [CHAR_LIMIT=40] -->
|
||||
<string name="action_screenshot">Screenshot</string>
|
||||
<!-- Message shown when an action is blocked by a policy enforced by the app or the organization managing the device. [CHAR_LIMIT=NONE] -->
|
||||
<string name="blocked_by_policy">This action isn\'t allowed by the app or your organization</string>
|
||||
</resources>
|
Loading…
Reference in New Issue