diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-10-22 21:23:44 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-10-22 21:23:44 +0200 |
commit | e42c9a515c127e1106a43a62b6aee1e492813f2b (patch) | |
tree | e6527b0d0d429d6f342ab2af56fcc91d6a191849 /src/main/java/de/pixart/messenger/ui | |
parent | 8fd5796fd18af4cb4741781b9b39c02b86ad4534 (diff) |
bring back animated gif view in MediaViewer
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java b/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java index a8285d594..a0464956d 100644 --- a/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java +++ b/src/main/java/de/pixart/messenger/ui/MediaViewerActivity.java @@ -42,6 +42,7 @@ import de.pixart.messenger.R; import de.pixart.messenger.persistance.FileBackend; import de.pixart.messenger.utils.ExifHelper; import de.pixart.messenger.utils.MimeUtils; +import pl.droidsonroids.gif.GifImageView; import static de.pixart.messenger.persistance.FileBackend.close; @@ -49,6 +50,7 @@ public class MediaViewerActivity extends XmppActivity { Integer oldOrientation; SubsamplingScaleImageView mImage; + GifImageView mGIF; FullscreenVideoLayout mVideo; ImageView mFullscreenbutton; Uri mFileUri; @@ -96,6 +98,7 @@ public class MediaViewerActivity extends XmppActivity { getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_media_viewer); mImage = findViewById(R.id.message_image_view); + mGIF = findViewById(R.id.message_gif_view); mVideo = findViewById(R.id.message_video_view); mFullscreenbutton = findViewById(R.id.vcv_img_fullscreen); fab = findViewById(R.id.fab); @@ -236,6 +239,8 @@ public class MediaViewerActivity extends XmppActivity { } private void DisplayImage(final File file, final Uri FileUri) { + boolean gif = false; + gif = "image/gif".equalsIgnoreCase(getMimeType(file.toString())); BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(new File(file.getPath()).getAbsolutePath(), options); @@ -246,9 +251,14 @@ public class MediaViewerActivity extends XmppActivity { if (useAutoRotateScreen()) { rotateScreen(width, height, rotation); } - mImage.setVisibility(View.VISIBLE); try { - mImage.setImage(ImageSource.uri(FileUri)); + if (gif) { + mGIF.setVisibility(View.VISIBLE); + mGIF.setImageURI(FileUri); + } else { + mImage.setVisibility(View.VISIBLE); + mImage.setImage(ImageSource.uri(FileUri)); + } } catch (Exception e) { Toast.makeText(this, getString(R.string.error_file_corrupt), Toast.LENGTH_LONG).show(); e.printStackTrace(); |