From 2308e02178a9a3304b92d62509a17ab3c2b774fe Mon Sep 17 00:00:00 2001 From: Slavi Petrov Date: Fri, 3 Apr 2020 12:40:44 +0300 Subject: [PATCH 1/3] Bump Gradle Plugin version to 3.6.2 --- dependencies.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies.gradle b/dependencies.gradle index 87f67dd..d06c7d4 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -20,7 +20,7 @@ ext.versions = [ buildTools : '28.0.3', publishVersion : '1.1.6', publishVersionCode: 1, - gradlePlugin : '3.6.1', + gradlePlugin : '3.6.2', bintrayPlugin : '1.8.4', mavenPlugin : '1.4.1', From bf6e292436ac2ddcb51f50ea2f4f4ea67784a876 Mon Sep 17 00:00:00 2001 From: Slavi Petrov Date: Fri, 3 Apr 2020 15:25:58 +0300 Subject: [PATCH 2/3] Fix app crash related to setting the drawable color filter on lower Android versions than Q --- .../devlabs/fullscreenvideoview/VideoControllerView.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/bg/devlabs/fullscreenvideoview/VideoControllerView.java b/library/src/main/java/bg/devlabs/fullscreenvideoview/VideoControllerView.java index 29c3e6a..2f63ba7 100644 --- a/library/src/main/java/bg/devlabs/fullscreenvideoview/VideoControllerView.java +++ b/library/src/main/java/bg/devlabs/fullscreenvideoview/VideoControllerView.java @@ -24,7 +24,9 @@ import android.graphics.BlendMode; import android.graphics.BlendModeColorFilter; import android.graphics.Color; +import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; @@ -568,7 +570,12 @@ private void setProgressBarDrawablesColors() { } private void setColorFilter(@NonNull Drawable drawable, int color) { - drawable.setColorFilter(new BlendModeColorFilter(color, BlendMode.SRC_ATOP)); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + drawable.setColorFilter(new BlendModeColorFilter(color, BlendMode.SRC_ATOP)); + } else { + //noinspection deprecation + drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); + } } /** From 045d62ccdeb6c784e631083bd7882aa12d400bbb Mon Sep 17 00:00:00 2001 From: Slavi Petrov Date: Wed, 17 Feb 2021 14:47:49 +0200 Subject: [PATCH 3/3] Change color filter version check with BlendModeColorFilterCompat --- dependencies.gradle | 1 + library/build.gradle | 1 + .../VideoControllerView.java | 22 ++++++++++--------- .../ActionBarActivity.kt | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index d06c7d4..320fcd4 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -24,6 +24,7 @@ ext.versions = [ bintrayPlugin : '1.8.4', mavenPlugin : '1.4.1', + core : '1.3.2', appcompat : '1.1.0', material : '1.1.0', constraintLayout : '1.1.3', diff --git a/library/build.gradle b/library/build.gradle index 8a7ba6c..7021e94 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -36,6 +36,7 @@ android { } dependencies { + implementation "androidx.core:core:$versions.core" implementation "androidx.appcompat:appcompat:$versions.appcompat" implementation "com.google.android.material:material:$versions.material" implementation "androidx.constraintlayout:constraintlayout:$versions.constraintLayout" diff --git a/library/src/main/java/bg/devlabs/fullscreenvideoview/VideoControllerView.java b/library/src/main/java/bg/devlabs/fullscreenvideoview/VideoControllerView.java index 2f63ba7..35e8547 100644 --- a/library/src/main/java/bg/devlabs/fullscreenvideoview/VideoControllerView.java +++ b/library/src/main/java/bg/devlabs/fullscreenvideoview/VideoControllerView.java @@ -21,12 +21,8 @@ import android.app.Activity; import android.content.Context; import android.content.res.TypedArray; -import android.graphics.BlendMode; -import android.graphics.BlendModeColorFilter; import android.graphics.Color; -import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; -import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; @@ -41,6 +37,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.content.ContextCompat; +import androidx.core.graphics.BlendModeColorFilterCompat; +import androidx.core.graphics.BlendModeCompat; import java.util.Locale; @@ -570,12 +568,16 @@ private void setProgressBarDrawablesColors() { } private void setColorFilter(@NonNull Drawable drawable, int color) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - drawable.setColorFilter(new BlendModeColorFilter(color, BlendMode.SRC_ATOP)); - } else { - //noinspection deprecation - drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); - } +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + drawable.setColorFilter( + BlendModeColorFilterCompat.createBlendModeColorFilterCompat( + color, BlendModeCompat.SRC_ATOP + ) + ); +// } else { +// //noinspection deprecation +// drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP); +// } } /** diff --git a/sample/src/main/java/bg/devlabs/fullscreenvideoviewsample/ActionBarActivity.kt b/sample/src/main/java/bg/devlabs/fullscreenvideoviewsample/ActionBarActivity.kt index d0223f2..e16ebbd 100644 --- a/sample/src/main/java/bg/devlabs/fullscreenvideoviewsample/ActionBarActivity.kt +++ b/sample/src/main/java/bg/devlabs/fullscreenvideoviewsample/ActionBarActivity.kt @@ -44,7 +44,7 @@ class ActionBarActivity : AppCompatActivity() { val videoPath = "https://bit.ly/2wUgyUw" fullscreenVideoView.videoUrl(videoPath) - .progressBarColor(R.color.colorAccent) +// .progressBarColor(R.color.colorAccent) .landscapeOrientation(LandscapeOrientation.SENSOR) .portraitOrientation(PortraitOrientation.DEFAULT) .thumbnail(R.drawable.video_thumbnail)