2015-05-21 20:55:03 +02:00
|
|
|
package org.thoughtcrime.securesms.mms;
|
|
|
|
|
|
|
|
import android.content.ContentUris;
|
|
|
|
import android.net.Uri;
|
|
|
|
|
2015-10-13 03:25:05 +02:00
|
|
|
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
2015-05-21 20:55:03 +02:00
|
|
|
|
|
|
|
public class PartUriParser {
|
|
|
|
|
|
|
|
private final Uri uri;
|
|
|
|
|
|
|
|
public PartUriParser(Uri uri) {
|
|
|
|
this.uri = uri;
|
|
|
|
}
|
|
|
|
|
2015-10-13 03:25:05 +02:00
|
|
|
public AttachmentId getPartId() {
|
|
|
|
return new AttachmentId(getId(), getUniqueId());
|
2015-05-21 20:55:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private long getId() {
|
|
|
|
return ContentUris.parseId(uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
private long getUniqueId() {
|
|
|
|
return Long.parseLong(uri.getPathSegments().get(1));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|