From b6327a9095b9a5a94230ea91e96e38dc1b2df843 Mon Sep 17 00:00:00 2001 From: NudeDude Date: Sun, 9 Jun 2019 17:15:35 +0200 Subject: [PATCH] video bug fix --- app/proguard-rules.pro | 8 +---- .../nuclearfog/twidda/window/MediaViewer.java | 35 ++++++------------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 18964b20..4efaa5ba 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -25,10 +25,4 @@ #-renamesourcefileattribute SourceFile -dontwarn twitter4j.** --keep class twitter4j.** {*;} - -#-dontwarn javax.** -#-keep class javax.** {*;} - -#-dontwarn org.conscrypt** -#-keep class org.conscrypt** {*;} \ No newline at end of file +-keep class twitter4j.** {*;} \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/window/MediaViewer.java b/app/src/main/java/org/nuclearfog/twidda/window/MediaViewer.java index 5d7e2378..95d0ab47 100644 --- a/app/src/main/java/org/nuclearfog/twidda/window/MediaViewer.java +++ b/app/src/main/java/org/nuclearfog/twidda/window/MediaViewer.java @@ -36,8 +36,6 @@ import java.util.Locale; import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE; import static android.content.pm.PackageManager.PERMISSION_GRANTED; -import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_END; -import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_START; import static android.media.MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START; import static android.view.View.INVISIBLE; import static android.view.View.VISIBLE; @@ -155,10 +153,9 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen break; case VIDEO: - if (Build.VERSION.SDK_INT >= 17) - video_progress.setVisibility(VISIBLE); case ANGIF: case VIDEO_STORAGE: + video_progress.setVisibility(VISIBLE); videoView.start(); break; } @@ -218,25 +215,16 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen case VIDEO: case VIDEO_STORAGE: - if (Build.VERSION.SDK_INT >= 17) - mp.setOnInfoListener(new OnInfoListener() { - @Override - public boolean onInfo(MediaPlayer mp, int what, int extra) { - switch (what) { - case MEDIA_INFO_VIDEO_RENDERING_START: - video_progress.setVisibility(INVISIBLE); - return true; - - case MEDIA_INFO_BUFFERING_START: - case MEDIA_INFO_BUFFERING_END: - video_progress.setVisibility(VISIBLE); - return true; - - default: - return false; - } + mp.setOnInfoListener(new OnInfoListener() { + @Override + public boolean onInfo(MediaPlayer mp, int what, int extra) { + if (what == MEDIA_INFO_VIDEO_RENDERING_START) { + video_progress.setVisibility(INVISIBLE); + return true; } - }); + return false; + } + }); videoController.show(0); mp.seekTo(lastPos); mp.start(); @@ -245,9 +233,6 @@ public class MediaViewer extends AppCompatActivity implements OnImageClickListen } - - - public void setImage(Bitmap image) { float ratio = image.getWidth() / (float) width; int destHeight = (int) (image.getHeight() / ratio);