|
@@ -18,8 +18,6 @@ import android.view.View;
|
|
|
import androidx.fragment.app.Fragment;
|
|
|
import androidx.fragment.app.FragmentActivity;
|
|
|
|
|
|
-import com.compdfkit.core.edit.CPDFEditManager;
|
|
|
-import com.compdfkit.core.edit.CPDFEditPage;
|
|
|
import com.compdfkit.tools.R;
|
|
|
import com.compdfkit.tools.common.contextmenu.CPDFContextMenuHelper;
|
|
|
import com.compdfkit.tools.common.contextmenu.interfaces.ContextMenuScreenShotProvider;
|
|
@@ -44,15 +42,20 @@ public class CScreenShotContextMenuView implements ContextMenuScreenShotProvider
|
|
|
exitScreenShot(helper, pageView);
|
|
|
});
|
|
|
menuView.addItem(R.string.tools_share, v -> {
|
|
|
- Bitmap bitmap = pageView.getScreenshotBitmap();
|
|
|
- if (bitmap == null){
|
|
|
+ try{
|
|
|
+ Bitmap bitmap = pageView.getScreenshotBitmap();
|
|
|
+ if (bitmap == null){
|
|
|
+ exitScreenShot(helper, pageView);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String fileName = "screenshot_"+ CDateUtil.getDataTime(CDateUtil.NORMAL_DATE_FORMAT)+".png";
|
|
|
+ String screenShotFilePath = CImageUtil.saveBitmap(pageView.getContext(), fileName, bitmap);
|
|
|
+ CFileUtils.shareFile(menuView.getContext(), pageView.getContext().getString(R.string.tools_share), "image/*", new File(screenShotFilePath));
|
|
|
+ exitScreenShot(helper, pageView);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
exitScreenShot(helper, pageView);
|
|
|
- return;
|
|
|
}
|
|
|
- String fileName = "screenshot_"+ CDateUtil.getDataTime(CDateUtil.NORMAL_DATE_FORMAT)+".png";
|
|
|
- String screenShotFilePath = CImageUtil.saveBitmap(pageView.getContext(), fileName, pageView.getScreenshotBitmap());
|
|
|
- CFileUtils.shareFile(menuView.getContext(), pageView.getContext().getString(R.string.tools_share), "image/*", new File(screenShotFilePath));
|
|
|
- exitScreenShot(helper, pageView);
|
|
|
});
|
|
|
return menuView;
|
|
|
}
|