2015-10-12 18:25:05 -07:00
|
|
|
package org.thoughtcrime.securesms.attachments;
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.support.annotation.NonNull;
|
2016-12-11 13:37:27 -08:00
|
|
|
import android.support.annotation.Nullable;
|
2015-10-12 18:25:05 -07:00
|
|
|
|
|
|
|
public class UriAttachment extends Attachment {
|
|
|
|
|
2016-12-11 13:37:27 -08:00
|
|
|
private final @NonNull Uri dataUri;
|
|
|
|
private final @Nullable Uri thumbnailUri;
|
2015-10-12 18:25:05 -07:00
|
|
|
|
2017-03-28 12:05:30 -07:00
|
|
|
public UriAttachment(@NonNull Uri uri, @NonNull String contentType, int transferState, long size,
|
2018-11-08 23:33:37 -08:00
|
|
|
@Nullable String fileName, boolean voiceNote, boolean quote, @Nullable String caption)
|
2017-03-28 12:05:30 -07:00
|
|
|
{
|
2018-11-08 23:33:37 -08:00
|
|
|
this(uri, uri, contentType, transferState, size, 0, 0, fileName, null, voiceNote, quote, caption);
|
2015-10-12 18:25:05 -07:00
|
|
|
}
|
|
|
|
|
2016-12-11 13:37:27 -08:00
|
|
|
public UriAttachment(@NonNull Uri dataUri, @Nullable Uri thumbnailUri,
|
2018-03-20 11:27:11 -07:00
|
|
|
@NonNull String contentType, int transferState, long size, int width, int height,
|
2017-05-11 22:46:35 -07:00
|
|
|
@Nullable String fileName, @Nullable String fastPreflightId,
|
2018-11-08 23:33:37 -08:00
|
|
|
boolean voiceNote, boolean quote, @Nullable String caption)
|
2015-10-12 18:25:05 -07:00
|
|
|
{
|
2018-11-08 23:33:37 -08:00
|
|
|
super(contentType, transferState, size, fileName, null, null, null, null, fastPreflightId, voiceNote, width, height, quote, caption);
|
2015-10-12 18:25:05 -07:00
|
|
|
this.dataUri = dataUri;
|
|
|
|
this.thumbnailUri = thumbnailUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@NonNull
|
|
|
|
public Uri getDataUri() {
|
|
|
|
return dataUri;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-12-11 13:37:27 -08:00
|
|
|
@Nullable
|
2015-10-12 18:25:05 -07:00
|
|
|
public Uri getThumbnailUri() {
|
|
|
|
return thumbnailUri;
|
|
|
|
}
|
2015-10-21 15:32:29 -07:00
|
|
|
|
|
|
|
@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();
|
|
|
|
}
|
2015-10-12 18:25:05 -07:00
|
|
|
}
|