use of org.chromium.chrome.browser.ChromeActivity in project AndroidChromium by JackyAndroid.
the class ScreenshotTask method create.
/**
* Prepares screenshot (possibly asynchronously) and invokes the callback when the screenshot
* is available, or collection has failed. The asynchronous path is only taken when the activity
* that is passed in is a {@link ChromeActivity}.
* The callback is always invoked asynchronously.
*/
public static void create(Activity activity, final ScreenshotTaskCallback callback) {
if (activity instanceof ChromeActivity) {
Rect rect = new Rect();
activity.getWindow().getDecorView().getRootView().getWindowVisibleDisplayFrame(rect);
createCompositorScreenshot(((ChromeActivity) activity).getWindowAndroid(), rect, callback);
return;
}
final Bitmap bitmap = prepareScreenshot(activity, null);
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
callback.onGotBitmap(bitmap);
}
});
}
Aggregations