/**
* 只分享圖片
*
* @param bitmap bitmap
*/
private void sharedImage(Bitmap bitmap) {
RxPermissions rxPermissions = new RxPermissions((Activity) context);
rxPermissions.request(Manifest.permission.WRITE_EXTERNAL_STORAGE).subscribe(granted -> {
if (granted) {
String imgPath = initImagePath(bitmap);
if (imgPath == null) return;
Platform.ShareParams sp = new Platform.ShareParams();
sp.setTitle(null);
sp.setText(null);
sp.setImagePath(imgPath);
sp.setShareType(Platform.SHARE_IMAGE);//設置分享為圖片類型
Platform platform = ShareSDK.getPlatform(plantName);// 要分享的平台//QQ.NAME
platform.setPlatformActionListener(mPlatformActionListener); // 設置分享事件回調
// 執行圖文分享
platform.share(sp);
} else {
//用戶拒絕的權限
}
});
}