|
@@ -45,12 +45,12 @@ public class ShareHelper {
|
|
|
|
|
|
public static void saveImg(Context context, String base64, ResultCallBack resultCallBack) {
|
|
|
Observable.create(new ObservableOnSubscribe<File>() {
|
|
|
- @Override
|
|
|
- public void subscribe(ObservableEmitter<File> emitter) throws Exception {
|
|
|
- File file = saveImgToLocalFile(base64);
|
|
|
- emitter.onNext(file);
|
|
|
- }
|
|
|
- }).subscribeOn(Schedulers.newThread())
|
|
|
+ @Override
|
|
|
+ public void subscribe(ObservableEmitter<File> emitter) throws Exception {
|
|
|
+ File file = saveImgToLocalFile(base64);
|
|
|
+ emitter.onNext(file);
|
|
|
+ }
|
|
|
+ }).subscribeOn(Schedulers.newThread())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(new Observer<File>() {
|
|
|
@Override
|
|
@@ -93,12 +93,12 @@ public class ShareHelper {
|
|
|
|
|
|
public static void saveImg(Context context, Bitmap bitmap, ResultCallBack resultCallBack) {
|
|
|
Observable.create(new ObservableOnSubscribe<File>() {
|
|
|
- @Override
|
|
|
- public void subscribe(ObservableEmitter<File> emitter) throws Exception {
|
|
|
- File file = saveImageToGallery(bitmap);
|
|
|
- emitter.onNext(file);
|
|
|
- }
|
|
|
- }).subscribeOn(Schedulers.newThread())
|
|
|
+ @Override
|
|
|
+ public void subscribe(ObservableEmitter<File> emitter) throws Exception {
|
|
|
+ File file = saveImageToGallery(bitmap);
|
|
|
+ emitter.onNext(file);
|
|
|
+ }
|
|
|
+ }).subscribeOn(Schedulers.newThread())
|
|
|
.observeOn(AndroidSchedulers.mainThread())
|
|
|
.subscribe(new Observer<File>() {
|
|
|
@Override
|
|
@@ -177,7 +177,33 @@ public class ShareHelper {
|
|
|
void onResult(boolean isSuccess);
|
|
|
}
|
|
|
|
|
|
+ public static void parseShareContactData(File file, Intent data) {
|
|
|
+ if (data == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String targetId = data.getStringExtra("targetId");
|
|
|
+ int conversationValue = data.getIntExtra("conversation", -1);
|
|
|
+ if (file != null) {
|
|
|
+ if (!file.exists()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ IMShareHelper.toShare(file, targetId, ChatGroupHelper.isGroupConversation(conversationValue), new IMShareHelper.ResultCallBack() {
|
|
|
+ @Override
|
|
|
+ public void onResult(boolean isSuccess) {
|
|
|
+ if (isSuccess) {
|
|
|
+ ToastUtil.getInstance().showShort("分享成功");
|
|
|
+ } else {
|
|
|
+ ToastUtil.getInstance().showShort("分享失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public static void parseShareContactData(String base64, Intent data) {
|
|
|
+ if (data == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
String targetId = data.getStringExtra("targetId");
|
|
|
int conversationValue = data.getIntExtra("conversation", -1);
|
|
|
if (!TextUtils.isEmpty(base64)) {
|