mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Convert AttachmentTable and models to kotlin.
This commit is contained in:
committed by
Alex Hart
parent
888a40a5c4
commit
3554f82ea3
@@ -323,7 +323,7 @@ public class AttachmentManager {
|
||||
result.set(true);
|
||||
} else {
|
||||
Attachment attachment = slide.asAttachment();
|
||||
result.deferTo(thumbnail.setImageResource(glideRequests, slide, false, true, attachment.getWidth(), attachment.getHeight()));
|
||||
result.deferTo(thumbnail.setImageResource(glideRequests, slide, false, true, attachment.width, attachment.height));
|
||||
removableMediaView.display(thumbnail, mediaType == SlideFactory.MediaType.IMAGE);
|
||||
}
|
||||
|
||||
@@ -546,7 +546,7 @@ public class AttachmentManager {
|
||||
MediaIntentFactory.UNKNOWN_TIMESTAMP,
|
||||
slide.getUri(),
|
||||
slide.getContentType(),
|
||||
slide.asAttachment().getSize(),
|
||||
slide.asAttachment().size,
|
||||
slide.getCaption().orElse(null),
|
||||
false,
|
||||
false,
|
||||
|
||||
@@ -14,7 +14,7 @@ public class GifSlide extends ImageSlide {
|
||||
|
||||
public GifSlide(Attachment attachment) {
|
||||
super(attachment);
|
||||
this.borderless = attachment.isBorderless();
|
||||
this.borderless = attachment.borderless;
|
||||
}
|
||||
|
||||
public GifSlide(Context context, Uri uri, long size, int width, int height) {
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ImageSlide extends Slide {
|
||||
|
||||
public ImageSlide(@NonNull Attachment attachment) {
|
||||
super(attachment);
|
||||
this.borderless = attachment.isBorderless();
|
||||
this.borderless = attachment.borderless;
|
||||
}
|
||||
|
||||
public ImageSlide(Context context, Uri uri, long size, int width, int height, @Nullable BlurHash blurHash) {
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class MediaConstraints {
|
||||
|
||||
public boolean isSatisfied(@NonNull Context context, @NonNull Attachment attachment) {
|
||||
try {
|
||||
long size = attachment.getSize();
|
||||
long size = attachment.size;
|
||||
if (size > getMaxAttachmentSize()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PartAuthority {
|
||||
case PART_ROW:
|
||||
Attachment attachment = SignalDatabase.attachments().getAttachment(new PartUriParser(uri).getPartId());
|
||||
|
||||
if (attachment != null) return attachment.getFileName();
|
||||
if (attachment != null) return attachment.fileName;
|
||||
else return null;
|
||||
case PERSISTENT_ROW:
|
||||
return DeprecatedPersistentBlobProvider.getFileName(context, uri);
|
||||
@@ -115,7 +115,7 @@ public class PartAuthority {
|
||||
case PART_ROW:
|
||||
Attachment attachment = SignalDatabase.attachments().getAttachment(new PartUriParser(uri).getPartId());
|
||||
|
||||
if (attachment != null) return attachment.getSize();
|
||||
if (attachment != null) return attachment.size;
|
||||
else return null;
|
||||
case PERSISTENT_ROW:
|
||||
return DeprecatedPersistentBlobProvider.getFileSize(context, uri);
|
||||
@@ -133,7 +133,7 @@ public class PartAuthority {
|
||||
case PART_ROW:
|
||||
Attachment attachment = SignalDatabase.attachments().getAttachment(new PartUriParser(uri).getPartId());
|
||||
|
||||
if (attachment != null) return attachment.getContentType();
|
||||
if (attachment != null) return attachment.contentType;
|
||||
else return null;
|
||||
case PERSISTENT_ROW:
|
||||
return DeprecatedPersistentBlobProvider.getMimeType(context, uri);
|
||||
@@ -151,7 +151,7 @@ public class PartAuthority {
|
||||
case PART_ROW:
|
||||
Attachment attachment = SignalDatabase.attachments().getAttachment(new PartUriParser(uri).getPartId());
|
||||
|
||||
if (attachment != null) return attachment.isVideoGif();
|
||||
if (attachment != null) return attachment.videoGif;
|
||||
else return false;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class Slide {
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return attachment.getContentType();
|
||||
return attachment.contentType;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -69,21 +69,21 @@ public abstract class Slide {
|
||||
|
||||
@NonNull
|
||||
public Optional<String> getCaption() {
|
||||
return Optional.ofNullable(attachment.getCaption());
|
||||
return Optional.ofNullable(attachment.caption);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Optional<String> getFileName() {
|
||||
return Optional.ofNullable(attachment.getFileName());
|
||||
return Optional.ofNullable(attachment.fileName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getFastPreflightId() {
|
||||
return attachment.getFastPreflightId();
|
||||
return attachment.fastPreflightId;
|
||||
}
|
||||
|
||||
public long getFileSize() {
|
||||
return attachment.getSize();
|
||||
return attachment.size;
|
||||
}
|
||||
|
||||
public boolean hasImage() {
|
||||
@@ -117,7 +117,7 @@ public abstract class Slide {
|
||||
}
|
||||
|
||||
public boolean isVideoGif() {
|
||||
return hasVideo() && attachment.isVideoGif();
|
||||
return hasVideo() && attachment.videoGif;
|
||||
}
|
||||
|
||||
public @NonNull String getContentDescription(@NonNull Context context) { return ""; }
|
||||
@@ -136,7 +136,7 @@ public abstract class Slide {
|
||||
}
|
||||
|
||||
public int getTransferState() {
|
||||
return attachment.getTransferState();
|
||||
return attachment.transferState;
|
||||
}
|
||||
|
||||
public @DrawableRes int getPlaceholderRes(Theme theme) {
|
||||
@@ -144,7 +144,7 @@ public abstract class Slide {
|
||||
}
|
||||
|
||||
public @Nullable BlurHash getPlaceholderBlur() {
|
||||
return attachment.getBlurHash();
|
||||
return attachment.blurHash;
|
||||
}
|
||||
|
||||
public boolean hasPlaceholder() {
|
||||
|
||||
@@ -23,12 +23,12 @@ public class StickerSlide extends Slide {
|
||||
|
||||
public StickerSlide(@NonNull Attachment attachment) {
|
||||
super(attachment);
|
||||
this.stickerLocator = Objects.requireNonNull(attachment.getSticker());
|
||||
this.stickerLocator = Objects.requireNonNull(attachment.stickerLocator);
|
||||
}
|
||||
|
||||
public StickerSlide(Context context, Uri uri, long size, @NonNull StickerLocator stickerLocator, @NonNull String contentType) {
|
||||
super(constructAttachmentFromUri(context, uri, contentType, size, WIDTH, HEIGHT, true, null, null, stickerLocator, null, null, false, false, false, false));
|
||||
this.stickerLocator = Objects.requireNonNull(attachment.getSticker());
|
||||
this.stickerLocator = Objects.requireNonNull(attachment.stickerLocator);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,6 +52,6 @@ public class StickerSlide extends Slide {
|
||||
}
|
||||
|
||||
public @Nullable String getEmoji() {
|
||||
return stickerLocator.getEmoji();
|
||||
return stickerLocator.emoji;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user