Created
June 14, 2015 07:34
-
-
Save adrian-bl/1135b6ae5d43bd2444be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/ch/blinkenlights/android/vanilla/VanillaMediaPlayer.java b/src/ch/blinkenlights/android/vanilla/VanillaMediaPlayer.java | |
index dce062d..2faa693 100644 | |
--- a/src/ch/blinkenlights/android/vanilla/VanillaMediaPlayer.java | |
+++ b/src/ch/blinkenlights/android/vanilla/VanillaMediaPlayer.java | |
@@ -22,6 +22,7 @@ import android.content.Context; | |
import android.content.Intent; | |
import android.media.MediaPlayer; | |
import android.media.audiofx.AudioEffect; | |
+import android.os.Build; | |
import java.io.IOException; | |
public class VanillaMediaPlayer extends MediaPlayer { | |
@@ -74,9 +75,13 @@ public class VanillaMediaPlayer extends MediaPlayer { | |
/** | |
* Sets the next media player data source | |
*/ | |
- public void setNextMediaPlayer(VanillaMediaPlayer next) { | |
- super.setNextMediaPlayer(next); | |
- mHasNextMediaPlayer = (next != null); | |
+ public void setNextMediaPlayer(VanillaMediaPlayer next) throws UnsupportedOperationException { | |
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { | |
+ super.setNextMediaPlayer(next); | |
+ mHasNextMediaPlayer = (next != null); | |
+ } else { | |
+ throw new UnsupportedOperationException("setNextMediaPlayer() is not supported on this OS revision"); | |
+ } | |
} | |
/** |
Ok, thanks for letting me know this.
But then we could as well specify TargetApi(16) on triggerGaplessUpdate: This would make lint happy as well, wouldn't it?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like this sanity check change.
I applied the patch and did a
gradle build
but it looks like you'll still need to add the@TargetApi
tag to reassure it that you've addressed the problem. Lint isn't very smart about parsing the conditional check forBuild.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN
or, depending on your style preference
As a way to learn the code, I've been fixing
Severity: Error
lint issues on my branch. None of the fixes are actual bugs so far, just changes to make Lint happy.vanilla-music/vanilla@master...trophygeek:Fix_lint_issues