mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Merge branch '1475-transition-name' into 'master'
Use a unique transition name for each AttachmentItem See merge request briar/briar!1028
This commit is contained in:
@@ -7,6 +7,8 @@ import android.support.annotation.Nullable;
|
|||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||||
import org.briarproject.bramble.api.sync.MessageId;
|
import org.briarproject.bramble.api.sync.MessageId;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
@@ -18,6 +20,7 @@ public class AttachmentItem implements Parcelable {
|
|||||||
private final String mimeType, extension;
|
private final String mimeType, extension;
|
||||||
private final int thumbnailWidth, thumbnailHeight;
|
private final int thumbnailWidth, thumbnailHeight;
|
||||||
private final boolean hasError;
|
private final boolean hasError;
|
||||||
|
private final long instanceId;
|
||||||
|
|
||||||
public static final Creator<AttachmentItem> CREATOR =
|
public static final Creator<AttachmentItem> CREATOR =
|
||||||
new Creator<AttachmentItem>() {
|
new Creator<AttachmentItem>() {
|
||||||
@@ -32,6 +35,8 @@ public class AttachmentItem implements Parcelable {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static final AtomicLong NEXT_INSTANCE_ID = new AtomicLong(0);
|
||||||
|
|
||||||
AttachmentItem(MessageId messageId, int width, int height, String mimeType,
|
AttachmentItem(MessageId messageId, int width, int height, String mimeType,
|
||||||
String extension, int thumbnailWidth, int thumbnailHeight,
|
String extension, int thumbnailWidth, int thumbnailHeight,
|
||||||
boolean hasError) {
|
boolean hasError) {
|
||||||
@@ -43,6 +48,7 @@ public class AttachmentItem implements Parcelable {
|
|||||||
this.thumbnailWidth = thumbnailWidth;
|
this.thumbnailWidth = thumbnailWidth;
|
||||||
this.thumbnailHeight = thumbnailHeight;
|
this.thumbnailHeight = thumbnailHeight;
|
||||||
this.hasError = hasError;
|
this.hasError = hasError;
|
||||||
|
instanceId = NEXT_INSTANCE_ID.getAndIncrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AttachmentItem(Parcel in) {
|
protected AttachmentItem(Parcel in) {
|
||||||
@@ -56,6 +62,7 @@ public class AttachmentItem implements Parcelable {
|
|||||||
thumbnailWidth = in.readInt();
|
thumbnailWidth = in.readInt();
|
||||||
thumbnailHeight = in.readInt();
|
thumbnailHeight = in.readInt();
|
||||||
hasError = in.readByte() != 0;
|
hasError = in.readByte() != 0;
|
||||||
|
instanceId = in.readLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MessageId getMessageId() {
|
public MessageId getMessageId() {
|
||||||
@@ -90,9 +97,8 @@ public class AttachmentItem implements Parcelable {
|
|||||||
return hasError;
|
return hasError;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO use counter instead, because in theory one attachment can appear in more than one messages
|
|
||||||
String getTransitionName() {
|
String getTransitionName() {
|
||||||
return String.valueOf(messageId.hashCode());
|
return String.valueOf(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -110,12 +116,13 @@ public class AttachmentItem implements Parcelable {
|
|||||||
dest.writeInt(thumbnailWidth);
|
dest.writeInt(thumbnailWidth);
|
||||||
dest.writeInt(thumbnailHeight);
|
dest.writeInt(thumbnailHeight);
|
||||||
dest.writeByte((byte) (hasError ? 1 : 0));
|
dest.writeByte((byte) (hasError ? 1 : 0));
|
||||||
|
dest.writeLong(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object o) {
|
public boolean equals(@Nullable Object o) {
|
||||||
return o instanceof AttachmentItem &&
|
return o instanceof AttachmentItem &&
|
||||||
messageId.equals(((AttachmentItem) o).messageId);
|
instanceId == ((AttachmentItem) o).instanceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class BriarDataFetcher implements DataFetcher<InputStream> {
|
|||||||
private volatile boolean cancel = false;
|
private volatile boolean cancel = false;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public BriarDataFetcher(MessagingManager messagingManager,
|
BriarDataFetcher(MessagingManager messagingManager,
|
||||||
@DatabaseExecutor Executor dbExecutor, AttachmentItem attachment) {
|
@DatabaseExecutor Executor dbExecutor, AttachmentItem attachment) {
|
||||||
this.messagingManager = messagingManager;
|
this.messagingManager = messagingManager;
|
||||||
this.dbExecutor = dbExecutor;
|
this.dbExecutor = dbExecutor;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public final class BriarModelLoader
|
|||||||
@Inject
|
@Inject
|
||||||
BriarDataFetcherFactory dataFetcherFactory;
|
BriarDataFetcherFactory dataFetcherFactory;
|
||||||
|
|
||||||
public BriarModelLoader(BriarApplication app) {
|
BriarModelLoader(BriarApplication app) {
|
||||||
app.getApplicationComponent().inject(this);
|
app.getApplicationComponent().inject(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class BriarModelLoaderFactory
|
|||||||
|
|
||||||
private final BriarApplication app;
|
private final BriarApplication app;
|
||||||
|
|
||||||
public BriarModelLoaderFactory(BriarApplication app) {
|
BriarModelLoaderFactory(BriarApplication app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,14 @@ import static android.graphics.Shader.TileMode.CLAMP;
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
@NotNullByDefault
|
@NotNullByDefault
|
||||||
public class CustomCornersTransformation extends BitmapTransformation {
|
class CustomCornersTransformation extends BitmapTransformation {
|
||||||
|
|
||||||
private static final String ID = CustomCornersTransformation.class.getName();
|
private static final String ID =
|
||||||
|
CustomCornersTransformation.class.getName();
|
||||||
|
|
||||||
private final Radii radii;
|
private final Radii radii;
|
||||||
|
|
||||||
public CustomCornersTransformation(Radii radii) {
|
CustomCornersTransformation(Radii radii) {
|
||||||
this.radii = radii;
|
this.radii = radii;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user