mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-27 22:38:53 +00:00
committed by
Moxie Marlinspike
parent
b7badec752
commit
0b62cf372b
@@ -41,12 +41,12 @@ public class AudioSlide extends Slide {
|
||||
public AudioSlide(Context context, Uri uri) throws IOException, MediaTooLargeException {
|
||||
super(context, constructPartFromUri(context, uri));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasImage() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasAudio() {
|
||||
return true;
|
||||
@@ -69,15 +69,15 @@ public class AudioSlide extends Slide {
|
||||
|
||||
public static PduPart constructPartFromUri(Context context, Uri uri) throws IOException, MediaTooLargeException {
|
||||
PduPart part = new PduPart();
|
||||
|
||||
|
||||
if (getMediaSize(context, uri) > MAX_MESSAGE_SIZE)
|
||||
throw new MediaTooLargeException("Audio track larger than size maximum.");
|
||||
|
||||
|
||||
Cursor cursor = null;
|
||||
|
||||
|
||||
try {
|
||||
cursor = context.getContentResolver().query(uri, new String[]{Audio.Media.MIME_TYPE}, null, null, null);
|
||||
|
||||
|
||||
if (cursor != null && cursor.moveToFirst())
|
||||
part.setContentType(cursor.getString(0).getBytes());
|
||||
else
|
||||
@@ -90,7 +90,7 @@ public class AudioSlide extends Slide {
|
||||
part.setDataUri(uri);
|
||||
part.setContentId((System.currentTimeMillis()+"").getBytes());
|
||||
part.setName(("Audio" + System.currentTimeMillis()).getBytes());
|
||||
|
||||
|
||||
return part;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user