mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-24 02:25:19 +00:00
Set the right extension on saving an attachment
This commit is contained in:
parent
8d115562f0
commit
73b1e3f3d4
@ -39,6 +39,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
import android.webkit.MimeTypeMap;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.contacts.ContactIdentityManager;
|
import org.thoughtcrime.securesms.contacts.ContactIdentityManager;
|
||||||
import org.thoughtcrime.securesms.contacts.ContactPhotoFactory;
|
import org.thoughtcrime.securesms.contacts.ContactPhotoFactory;
|
||||||
@ -387,9 +388,14 @@ public class ConversationItem extends LinearLayout {
|
|||||||
outputDirectory = new File(sdCard.getAbsolutePath() + File.separator + "Music");
|
outputDirectory = new File(sdCard.getAbsolutePath() + File.separator + "Music");
|
||||||
else
|
else
|
||||||
outputDirectory = new File(sdCard.getAbsolutePath() + File.separator + "Pictures");
|
outputDirectory = new File(sdCard.getAbsolutePath() + File.separator + "Pictures");
|
||||||
|
|
||||||
outputDirectory.mkdirs();
|
outputDirectory.mkdirs();
|
||||||
return File.createTempFile("textsecure", ".attach", outputDirectory);
|
|
||||||
|
MimeTypeMap mimeTypeMap = MimeTypeMap.getSingleton();
|
||||||
|
String extension = mimeTypeMap.getExtensionFromMimeType(slide.getContentType());
|
||||||
|
if (extension == null)
|
||||||
|
extension = "attach";
|
||||||
|
|
||||||
|
return File.createTempFile("textsecure", "." + extension, outputDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveToSdCard() {
|
private void saveToSdCard() {
|
||||||
|
Loading…
Reference in New Issue
Block a user