mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-26 01:17:21 +00:00
50 lines
1.4 KiB
Java
50 lines
1.4 KiB
Java
package org.thoughtcrime.securesms.attachments;
|
|
|
|
import android.net.Uri;
|
|
import android.support.annotation.NonNull;
|
|
import android.support.annotation.Nullable;
|
|
|
|
public class UriAttachment extends Attachment {
|
|
|
|
private final @NonNull Uri dataUri;
|
|
private final @Nullable Uri thumbnailUri;
|
|
|
|
public UriAttachment(@NonNull Uri uri, @NonNull String contentType, int transferState, long size,
|
|
@Nullable String fileName, boolean voiceNote)
|
|
{
|
|
this(uri, uri, contentType, transferState, size, fileName, null, voiceNote);
|
|
}
|
|
|
|
public UriAttachment(@NonNull Uri dataUri, @Nullable Uri thumbnailUri,
|
|
@NonNull String contentType, int transferState, long size,
|
|
@Nullable String fileName, @Nullable String fastPreflightId,
|
|
boolean voiceNote)
|
|
{
|
|
super(contentType, transferState, size, fileName, null, null, null, null, fastPreflightId, voiceNote);
|
|
this.dataUri = dataUri;
|
|
this.thumbnailUri = thumbnailUri;
|
|
}
|
|
|
|
@Override
|
|
@NonNull
|
|
public Uri getDataUri() {
|
|
return dataUri;
|
|
}
|
|
|
|
@Override
|
|
@Nullable
|
|
public Uri getThumbnailUri() {
|
|
return thumbnailUri;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object other) {
|
|
return other != null && other instanceof UriAttachment && ((UriAttachment) other).dataUri.equals(this.dataUri);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return dataUri.hashCode();
|
|
}
|
|
}
|