@Test @SmallTest @SdkSuppress(minSdkVersion = Build.VERSION_CODES.LOLLIPOP) public void testGetDurationWithValidMetaData() { int widthForTest = 1; int heightForTest = 1; Bitmap bitmapForTesting = Bitmap.createBitmap(widthForTest, heightForTest, Bitmap.Config.ARGB_8888); Long durationForTeting = 45L; String mediaTitle = "media title"; String albumName = "album name"; String artistName = "artist name"; createMediaMetaData(bitmapForTesting, durationForTeting, mediaTitle, albumName, artistName); assertEquals((Long) mMediaControllerAdapter.getDuration(), durationForTeting); }
@Override public long getDuration() { if (mController.getMetadata() == null) { return 0; } return (int) mController.getMetadata().getLong( MediaMetadataCompat.METADATA_KEY_DURATION); }
MediaControllerAdapter extends PlayerAdapter { @Override public long getDuration() { if (mController.getMetadata() == null) { return 0; } return (int) mController.getMetadata().getLong( MediaMetadataCompat.METADATA_KEY_DURATION); } }
MediaControllerAdapter extends PlayerAdapter { @Override public long getDuration() { if (mController.getMetadata() == null) { return 0; } return (int) mController.getMetadata().getLong( MediaMetadataCompat.METADATA_KEY_DURATION); } MediaControllerAdapter(MediaControllerCompat controller); }
MediaControllerAdapter extends PlayerAdapter { @Override public long getDuration() { if (mController.getMetadata() == null) { return 0; } return (int) mController.getMetadata().getLong( MediaMetadataCompat.METADATA_KEY_DURATION); } MediaControllerAdapter(MediaControllerCompat controller); MediaControllerCompat getMediaController(); @Override void play(); @Override void pause(); @Override void seekTo(long positionInMs); @Override void next(); @Override void previous(); @Override void fastForward(); @Override void rewind(); @Override void setRepeatAction(int repeatActionIndex); @Override void setShuffleAction(int shuffleActionIndex); @Override boolean isPlaying(); @Override long getCurrentPosition(); @Override long getBufferedPosition(); CharSequence getMediaTitle(); CharSequence getMediaSubtitle(); Drawable getMediaArt(Context context); @Override long getDuration(); @Override void onAttachedToHost(PlaybackGlueHost host); @Override void onDetachedFromHost(); @Override void setProgressUpdatingEnabled(boolean enabled); @Override long getSupportedActions(); }
MediaControllerAdapter extends PlayerAdapter { @Override public long getDuration() { if (mController.getMetadata() == null) { return 0; } return (int) mController.getMetadata().getLong( MediaMetadataCompat.METADATA_KEY_DURATION); } MediaControllerAdapter(MediaControllerCompat controller); MediaControllerCompat getMediaController(); @Override void play(); @Override void pause(); @Override void seekTo(long positionInMs); @Override void next(); @Override void previous(); @Override void fastForward(); @Override void rewind(); @Override void setRepeatAction(int repeatActionIndex); @Override void setShuffleAction(int shuffleActionIndex); @Override boolean isPlaying(); @Override long getCurrentPosition(); @Override long getBufferedPosition(); CharSequence getMediaTitle(); CharSequence getMediaSubtitle(); Drawable getMediaArt(Context context); @Override long getDuration(); @Override void onAttachedToHost(PlaybackGlueHost host); @Override void onDetachedFromHost(); @Override void setProgressUpdatingEnabled(boolean enabled); @Override long getSupportedActions();  }