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