update Share

This commit is contained in:
2023-02-13 11:21:40 +08:00
parent 15b232f52a
commit a50a7140fd
5 changed files with 24 additions and 12 deletions

View File

@@ -21,10 +21,10 @@ public class Line extends AbsShareInterface {
@Override
public void share(ShareBuilder builder, ICallback callback) {
try {
Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getLink(), "UTF-8")));
Intent share = new Intent(Intent.ACTION_VIEW, Uri.parse("https://line.me/R/share?text=" + URLEncoder.encode(builder.getText(), "UTF-8")));
mContext.startActivity(share);
callback.onSuccess();
} catch (UnsupportedEncodingException e) {
} catch (Exception e) {
callback.onFailure();
throw new RuntimeException(e);
}

View File

@@ -40,6 +40,7 @@ public class MessengerShare extends AbsShareInterface {
@Override
public void onSuccess(Sharer.Result result) {
ToastUtil.show("Messenger分享成功:"+result.getPostId());
callback.onSuccess();
}
@Override
@@ -53,6 +54,10 @@ public class MessengerShare extends AbsShareInterface {
e.printStackTrace();
}
});
dialog.show(content);
if(dialog.canShow(content)) {
dialog.show(content);
}else{
callback.onFailure();
}
}
}

View File

@@ -14,11 +14,17 @@ public class WhatsApp extends AbsShareInterface {
@Override
public void share(ShareBuilder builder, ICallback callback) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, builder.getText());
sendIntent.setType("text/plain");
sendIntent.setPackage("com.whatsapp");
mContext.startActivity(sendIntent);
try {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, builder.getText());
sendIntent.setType("text/plain");
sendIntent.setPackage("com.whatsapp");
mContext.startActivity(sendIntent);
callback.onSuccess();
} catch (Exception e) {
callback.onFailure();
}
}
}