Commit 8e95fd6c authored by fallenstardust's avatar fallenstardust

支持分享jpg图片

parent ae187ac6
...@@ -35,17 +35,21 @@ public class ShareFileActivity extends Activity { ...@@ -35,17 +35,21 @@ public class ShareFileActivity extends Activity {
String ext = intent.getStringExtra(IrrlichtBridge.EXTRA_SHARE_TYPE); String ext = intent.getStringExtra(IrrlichtBridge.EXTRA_SHARE_TYPE);
//TODO //TODO
String sharePath = ""; String sharePath = "";
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (ext.equals("yrp")) { if (ext.equals("yrp")) {
sharePath = AppsSettings.get().getReplayDir() + "/" + title; sharePath = AppsSettings.get().getReplayDir() + "/" + title;
shareIntent.setType("*/*");
} else if (ext.equals("lua")) { } else if (ext.equals("lua")) {
sharePath = AppsSettings.get().getSingleDir() + "/" + title; sharePath = AppsSettings.get().getSingleDir() + "/" + title;
shareIntent.setType("*/*");
} else if (ext.equals(("jpg"))) {
sharePath = AppsSettings.get().getCardImagePath() + "/" + title;
shareIntent.setType("image/jpeg");
} }
File shareFile = new File(sharePath); File shareFile = new File(sharePath);
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, FileUtils.toUri(this, shareFile)); shareIntent.putExtra(Intent.EXTRA_STREAM, FileUtils.toUri(this, shareFile));
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shareIntent.setType("*/*");//此处可发送多种文件
try { try {
startActivity(Intent.createChooser(shareIntent, getString(R.string.send))); startActivity(Intent.createChooser(shareIntent, getString(R.string.send)));
} catch (Exception e) { } catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment