simplify thumbnails

This commit is contained in:
B. Petersen
2019-05-13 14:30:06 +02:00
parent a59f6fd69b
commit 226d8492f7
24 changed files with 3 additions and 83 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 888 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

-3
View File
@@ -91,9 +91,6 @@
<attr name="dialog_alert_icon" format="reference" />
<attr name="dialog_background_color" format="reference|color" />
<attr name="conversation_icon_attach_audio" format="reference"/>
<attr name="conversation_icon_attach_video" format="reference" />
<attr name="contact_selection_push_user" format="reference|color" />
<attr name="contact_selection_lay_user" format="reference|color" />
<attr name="contact_selection_label_text" format="reference|color" />
-6
View File
@@ -205,9 +205,6 @@
<item name="menu_save_icon">@drawable/ic_save_white_24dp</item>
<item name="menu_reply_icon">@drawable/ic_reply_white_24dp</item>
<item name="conversation_icon_attach_audio">@drawable/ic_audio_light</item>
<item name="conversation_icon_attach_video">@drawable/ic_video_light</item>
<item name="reminder_header_background">#ff1d85d7</item>
<item name="pref_icon_tint">@color/delta_primary_dark</item>
@@ -359,9 +356,6 @@
<item name="menu_save_icon">@drawable/ic_save_white_24dp</item>
<item name="menu_reply_icon">@drawable/ic_reply_white_24dp</item>
<item name="conversation_icon_attach_audio">@drawable/ic_audio_dark</item>
<item name="conversation_icon_attach_video">@drawable/ic_video_dark</item>
<item name="reminder_header_background">@color/delta_primary_dark</item>
<item name="pref_icon_tint">@color/core_white</item>
@@ -227,10 +227,10 @@ public class ThumbnailView extends FrameLayout {
public ListenableFuture<Boolean> setImageResource(@NonNull GlideRequests glideRequests, @NonNull Slide slide,
int naturalWidth, int naturalHeight)
{
if (slide.getThumbnailUri() != null && slide.hasPlayOverlay())
{
if (slide.hasPlayOverlay()) {
this.playOverlay.setVisibility(View.VISIBLE);
} else {
}
else {
this.playOverlay.setVisibility(View.GONE);
}
@@ -289,10 +289,6 @@ public class ThumbnailView extends FrameLayout {
request.into(new GlideDrawableListeningTarget(image, result));
}
}
else if (slide.hasPlaceholder())
{
buildPlaceholderGlideRequest(glideRequests, slide).into(new GlideBitmapListeningTarget(image, result));
}
else
{
glideRequests.clear(image);
@@ -324,12 +320,6 @@ public class ThumbnailView extends FrameLayout {
slide = null;
}
private RequestBuilder buildPlaceholderGlideRequest(@NonNull GlideRequests glideRequests, @NonNull Slide slide) {
return applySizing(glideRequests.asBitmap()
.load(slide.getPlaceholderRes(getContext().getTheme()))
.diskCacheStrategy(DiskCacheStrategy.NONE), new FitCenter());
}
private GlideRequest applySizing(@NonNull GlideRequest request, @NonNull BitmapTransformation fitting) {
int[] size = new int[2];
fillTargetDimensions(size, dimens, bounds);
@@ -59,11 +59,6 @@ public class AudioSlide extends Slide {
return null;
}
@Override
public boolean hasPlaceholder() {
return true;
}
@Override
public boolean hasImage() {
return true;
@@ -73,15 +68,4 @@ public class AudioSlide extends Slide {
public boolean hasAudio() {
return true;
}
@NonNull
@Override
public String getContentDescription() {
return context.getString(R.string.audio);
}
@Override
public @DrawableRes int getPlaceholderRes(Theme theme) {
return ResUtil.getDrawableRes(theme, R.attr.conversation_icon_attach_audio);
}
}
@@ -47,11 +47,6 @@ public class ImageSlide extends Slide {
super(context, constructAttachmentFromUri(context, uri, MediaUtil.IMAGE_JPEG, size, width, height, uri, null, false));
}
@Override
public @DrawableRes int getPlaceholderRes(Theme theme) {
return 0;
}
@Override
public @Nullable Uri getThumbnailUri() {
return getUri();
@@ -61,10 +56,4 @@ public class ImageSlide extends Slide {
public boolean hasImage() {
return true;
}
@NonNull
@Override
public String getContentDescription() {
return context.getString(R.string.image);
}
}
@@ -17,11 +17,4 @@ public class MmsSlide extends ImageSlide {
public MmsSlide(@NonNull Context context, @NonNull Attachment attachment) {
super(context, attachment);
}
@NonNull
@Override
public String getContentDescription() {
return "MMS";
}
}
@@ -102,8 +102,6 @@ public abstract class Slide {
return false;
}
public @NonNull String getContentDescription() { return ""; }
public Attachment asAttachment() {
return attachment;
}
@@ -112,14 +110,6 @@ public abstract class Slide {
return attachment.getTransferState();
}
public @DrawableRes int getPlaceholderRes(Theme theme) {
throw new AssertionError("getPlaceholderRes() called for non-drawable slide");
}
public boolean hasPlaceholder() {
return false;
}
public boolean hasPlayOverlay() {
return false;
}
@@ -61,18 +61,6 @@ public class VideoSlide extends Slide {
return true;
}
@Override
public boolean hasPlaceholder() {
return true;
}
@Override
public @DrawableRes int getPlaceholderRes(Theme theme) {
// the placeholder is shown when a video is staged before sending.
// TODO: VIDEO: not needed, we should show the normal thumbnail plus transparent play or edit buttons
return ResUtil.getDrawableRes(theme, R.attr.conversation_icon_attach_video);
}
@Override
public boolean hasImage() {
return true;
@@ -82,9 +70,4 @@ public class VideoSlide extends Slide {
public boolean hasVideo() {
return true;
}
@NonNull @Override
public String getContentDescription() {
return context.getString(R.string.video);
}
}