2017-01-20 23:26:17 +00:00
|
|
|
package org.thoughtcrime.securesms.attachments;
|
|
|
|
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.support.annotation.Nullable;
|
|
|
|
|
|
|
|
import org.thoughtcrime.securesms.database.AttachmentDatabase;
|
|
|
|
import org.thoughtcrime.securesms.database.MmsDatabase;
|
|
|
|
|
|
|
|
public class MmsNotificationAttachment extends Attachment {
|
|
|
|
|
|
|
|
public MmsNotificationAttachment(int status, long size) {
|
2017-05-12 05:46:35 +00:00
|
|
|
super("application/mms", getTransferStateFromStatus(status), size, null, null, null, null, null, null, false);
|
2017-01-20 23:26:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public Uri getDataUri() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@Override
|
|
|
|
public Uri getThumbnailUri() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static int getTransferStateFromStatus(int status) {
|
|
|
|
if (status == MmsDatabase.Status.DOWNLOAD_INITIALIZED ||
|
|
|
|
status == MmsDatabase.Status.DOWNLOAD_NO_CONNECTIVITY)
|
|
|
|
{
|
|
|
|
return AttachmentDatabase.TRANSFER_PROGRESS_AUTO_PENDING;
|
|
|
|
} else if (status == MmsDatabase.Status.DOWNLOAD_CONNECTING) {
|
|
|
|
return AttachmentDatabase.TRANSFER_PROGRESS_STARTED;
|
|
|
|
} else {
|
|
|
|
return AttachmentDatabase.TRANSFER_PROGRESS_FAILED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|