mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-14 23:18:43 +00:00
Convert PartUriParser into Kotlin.
This commit is contained in:
committed by
Greyson Parrelli
parent
b698daa4cf
commit
85408f2b12
@@ -1,28 +0,0 @@
|
||||
package org.thoughtcrime.securesms.mms;
|
||||
|
||||
import android.content.ContentUris;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
||||
|
||||
public class PartUriParser {
|
||||
|
||||
private final Uri uri;
|
||||
|
||||
public PartUriParser(Uri uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public AttachmentId getPartId() {
|
||||
return new AttachmentId(getId());
|
||||
}
|
||||
|
||||
private long getId() {
|
||||
return ContentUris.parseId(uri);
|
||||
}
|
||||
|
||||
private long getUniqueId() {
|
||||
return Long.parseLong(uri.getPathSegments().get(1));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.thoughtcrime.securesms.mms
|
||||
|
||||
import android.content.ContentUris
|
||||
import android.net.Uri
|
||||
import org.thoughtcrime.securesms.attachments.AttachmentId
|
||||
|
||||
/**
|
||||
* Parses the given [Uri] into either an [AttachmentId] or a [Long]
|
||||
*/
|
||||
class PartUriParser(private val uri: Uri) {
|
||||
val partId: AttachmentId
|
||||
get() = AttachmentId(id)
|
||||
|
||||
private val id: Long
|
||||
get() = ContentUris.parseId(uri)
|
||||
}
|
||||
Reference in New Issue
Block a user