Java Code Examples for org.chromium.chrome.browser.share.ShareHelper#shareImage()

The following examples show how to use org.chromium.chrome.browser.share.ShareHelper#shareImage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContextMenuHelper.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Share image triggered with the current context menu directly with a specific app.
 * @param name The {@link ComponentName} of the app to share the image directly with.
 */
public void shareImageDirectly(@Nullable final ComponentName name) {
    if (mNativeContextMenuHelper == 0) return;
    Callback<byte[]> callback = new Callback<byte[]>() {
        @Override
        public void onResult(byte[] result) {
            WebContents webContents = nativeGetJavaWebContents(mNativeContextMenuHelper);
            WindowAndroid windowAndroid = webContents.getTopLevelNativeWindow();

            Activity activity = windowAndroid.getActivity().get();
            if (activity == null) return;

            ShareHelper.shareImage(activity, result, name);
        }
    };
    nativeRetrieveImage(mNativeContextMenuHelper, callback, MAX_SHARE_DIMEN_PX);
}
 
Example 2
Source File: ContextMenuHelper.java    From delion with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void onShareImageReceived(
        WindowAndroid windowAndroid, byte[] jpegImageData) {
    Activity activity = windowAndroid.getActivity().get();
    if (activity == null) return;

    ShareHelper.shareImage(activity, jpegImageData);
}
 
Example 3
Source File: ContextMenuHelper.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
@CalledByNative
private void onShareImageReceived(
        WindowAndroid windowAndroid, byte[] jpegImageData) {
    Activity activity = windowAndroid.getActivity().get();
    if (activity == null) return;

    ShareHelper.shareImage(activity, jpegImageData);
}