Last active
September 4, 2017 23:04
-
-
Save kingargyle/3081152c351fae124b3bf2355a0f5873 to your computer and use it in GitHub Desktop.
A ShadowSubtitleView for use with Exoplayer Simple View and Robolectric.
This file contains hidden or 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
// A shadow for the ExoPlayer Subtitle View for use with Robolectric. Allows the view to inflate on any API level | |
// Add it to the config annotation (shadows = ShadowSubtitleView.class). | |
import com.google.android.exoplayer2.text.CaptionStyleCompat; | |
import com.google.android.exoplayer2.ui.SubtitleView; | |
import org.robolectric.annotation.Implementation; | |
import org.robolectric.annotation.Implements; | |
import org.robolectric.annotation.RealObject; | |
import org.robolectric.shadows.ShadowView; | |
@Implements(SubtitleView.class) | |
public class ShadowSubtitleView extends ShadowView { | |
@RealObject private SubtitleView subtitleView; | |
boolean setUserDefaultTextSize = false; | |
@Implementation public void setUserDefaultTextSize() { | |
setUserDefaultTextSize = true; | |
} | |
public boolean isSetUserDefaultTextSizeCalled() { | |
return setUserDefaultTextSize; | |
} | |
@Implementation public void setUserDefaultStyle() { | |
subtitleView.setStyle(CaptionStyleCompat.DEFAULT); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment