Kaydet (Commit) a518d5a4 authored tarafından Miklos Vajna's avatar Miklos Vajna

android: open csv files in Calc

Change-Id: I17b9c4f9d40db46fe6f1be8f1a3ecaee4946454c
üst 54510b3b
......@@ -77,6 +77,7 @@
<!-- OTHER -->
<data android:mimeType="text/csv"/>
<data android:mimeType="text/comma-separated-values"/>
<data android:mimeType="application/vnd.ms-works" />
<data android:mimeType="application/vnd.apple.keynote" />
<data android:mimeType="application/x-abiword" />
......
......@@ -171,7 +171,14 @@ public class LibreOfficeMainActivity extends ActionBarActivity {
InputStream inputStream = null;
try {
inputStream = contentResolver.openInputStream(getIntent().getData());
mTempFile = File.createTempFile("LibreOffice", null, this.getCacheDir());
// CSV files need a .csv suffix to be opened in Calc.
String suffix = null;
String intentType = getIntent().getType();
// K-9 mail uses the first, GMail uses the second variant.
if ("text/comma-separated-values".equals(intentType) || "text/csv".equals(intentType))
suffix = ".csv";
mTempFile = File.createTempFile("LibreOffice", suffix, this.getCacheDir());
OutputStream outputStream = new FileOutputStream(mTempFile);
byte[] buffer = new byte[4096];
......
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