当前位置: 首页>>代码示例>>Java>>正文


Java MediaDescription.Builder方法代码示例

本文整理汇总了Java中android.media.MediaDescription.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java MediaDescription.Builder方法的具体用法?Java MediaDescription.Builder怎么用?Java MediaDescription.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.media.MediaDescription的用法示例。


在下文中一共展示了MediaDescription.Builder方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generatePlayableMediaItem

import android.media.MediaDescription; //导入方法依赖的package包/类
private MediaBrowser.MediaItem generatePlayableMediaItem( Song song ) {
    if( song == null )
        return null;

    MediaDescription.Builder mediaDescriptionBuilder = new MediaDescription.Builder();
    mediaDescriptionBuilder.setMediaId( song.getuId() );

    if( !TextUtils.isEmpty( song.getTitle() ) )
        mediaDescriptionBuilder.setTitle( song.getTitle() );

    if( !TextUtils.isEmpty( song.getArtist() ) )
        mediaDescriptionBuilder.setSubtitle( song.getArtist() );

    if( !TextUtils.isEmpty( song.getThumbnailUrl() ) )
        mediaDescriptionBuilder.setIconUri( Uri.parse( song.getThumbnailUrl() ) );

    return new MediaBrowser.MediaItem( mediaDescriptionBuilder.build(), MediaBrowser.MediaItem.FLAG_PLAYABLE );
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:19,代码来源:AutoMediaBrowserService.java

示例2: addPlayOptions

import android.media.MediaDescription; //导入方法依赖的package包/类
private void addPlayOptions(List<MediaBrowser.MediaItem> mediaItems, String id, String idConstant) {
	Bundle playAllExtras = new Bundle();
	playAllExtras.putString(idConstant, id);

	MediaDescription.Builder playAll = new MediaDescription.Builder();
	playAll.setTitle(downloadService.getString(R.string.menu_play))
			.setMediaId("play-" + id)
			.setExtras(playAllExtras);
	mediaItems.add(new MediaBrowser.MediaItem(playAll.build(), MediaBrowser.MediaItem.FLAG_PLAYABLE));

	Bundle shuffleExtras = new Bundle();
	shuffleExtras.putString(idConstant, id);
	shuffleExtras.putBoolean(Constants.INTENT_EXTRA_NAME_SHUFFLE, true);

	MediaDescription.Builder shuffle = new MediaDescription.Builder();
	shuffle.setTitle(downloadService.getString(R.string.menu_shuffle))
			.setMediaId("shuffle-" + id)
			.setExtras(shuffleExtras);
	mediaItems.add(new MediaBrowser.MediaItem(shuffle.build(), MediaBrowser.MediaItem.FLAG_PLAYABLE));

	Bundle playLastExtras = new Bundle();
	playLastExtras.putString(idConstant, id);
	playLastExtras.putBoolean(Constants.INTENT_EXTRA_PLAY_LAST, true);

	MediaDescription.Builder playLast = new MediaDescription.Builder();
	playLast.setTitle(downloadService.getString(R.string.menu_play_last))
			.setMediaId("playLast-" + id)
			.setExtras(playLastExtras);
	mediaItems.add(new MediaBrowser.MediaItem(playLast.build(), MediaBrowser.MediaItem.FLAG_PLAYABLE));
}
 
开发者ID:popeen,项目名称:Popeens-DSub,代码行数:31,代码来源:AutoMediaBrowserService.java

示例3: generateBrowseableMediaItemByGenre

import android.media.MediaDescription; //导入方法依赖的package包/类
private MediaBrowser.MediaItem generateBrowseableMediaItemByGenre( String genre ) {
    MediaDescription.Builder mediaDescriptionBuilder = new MediaDescription.Builder();
    mediaDescriptionBuilder.setMediaId( genre );
    mediaDescriptionBuilder.setTitle( genre );
    mediaDescriptionBuilder.setIconBitmap( BitmapFactory.decodeResource( getResources(), R.drawable.folder ) );

    return new MediaBrowser.MediaItem( mediaDescriptionBuilder.build(), MediaBrowser.MediaItem.FLAG_BROWSABLE );
}
 
开发者ID:Lakkichand,项目名称:AndroidDemoProjects,代码行数:9,代码来源:AutoMediaBrowserService.java

示例4: episodeToMediaItem

import android.media.MediaDescription; //导入方法依赖的package包/类
private MediaItem episodeToMediaItem(Episode episode) {
    final Podcast podcast = episode.getPodcast();
    final MediaDescription.Builder mediaDescription = new MediaDescription.Builder()
            .setMediaId(episode.getMediaUrl())
            .setTitle(episode.getName())
            .setSubtitle(podcast.getName());

    if (podcast.hasLogoUrl())
        mediaDescription.setIconUri(Uri.parse(podcast.getLogoUrl()));

    return new MediaItem(mediaDescription.build(), MediaItem.FLAG_PLAYABLE);
}
 
开发者ID:salema,项目名称:Podcatcher-Deluxe-Android-Studio,代码行数:13,代码来源:PodcastBrowserService.java

示例5: writeToParcel

import android.media.MediaDescription; //导入方法依赖的package包/类
public final void writeToParcel(Parcel paramParcel, int paramInt)
{
  if (Build.VERSION.SDK_INT < 21)
  {
    paramParcel.writeString(this.e);
    TextUtils.writeToParcel(this.a, paramParcel, paramInt);
    TextUtils.writeToParcel(this.b, paramParcel, paramInt);
    TextUtils.writeToParcel(this.f, paramParcel, paramInt);
    paramParcel.writeParcelable(this.c, paramInt);
    paramParcel.writeParcelable(this.d, paramInt);
    paramParcel.writeBundle(this.g);
    return;
  }
  if ((this.i != null) || (Build.VERSION.SDK_INT < 21)) {}
  for (Object localObject = this.i;; localObject = this.i)
  {
    ((MediaDescription)localObject).writeToParcel(paramParcel, paramInt);
    return;
    MediaDescription.Builder localBuilder = new MediaDescription.Builder();
    String str = this.e;
    ((MediaDescription.Builder)localBuilder).setMediaId(str);
    CharSequence localCharSequence1 = this.a;
    ((MediaDescription.Builder)localBuilder).setTitle(localCharSequence1);
    CharSequence localCharSequence2 = this.b;
    ((MediaDescription.Builder)localBuilder).setSubtitle(localCharSequence2);
    CharSequence localCharSequence3 = this.f;
    ((MediaDescription.Builder)localBuilder).setDescription(localCharSequence3);
    Bitmap localBitmap = this.c;
    ((MediaDescription.Builder)localBuilder).setIconBitmap(localBitmap);
    Uri localUri1 = this.d;
    ((MediaDescription.Builder)localBuilder).setIconUri(localUri1);
    Bundle localBundle = this.g;
    ((MediaDescription.Builder)localBuilder).setExtras(localBundle);
    if (Build.VERSION.SDK_INT >= 23)
    {
      Uri localUri2 = this.h;
      ((MediaDescription.Builder)localBuilder).setMediaUri(localUri2);
    }
    this.i = ((MediaDescription.Builder)localBuilder).build();
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:42,代码来源:he.java

示例6: onLoadRoot

import android.media.MediaDescription; //导入方法依赖的package包/类
private void onLoadRoot(final Result<List<MediaItem>> result) {
    this.currentTask = new PodcastBrowserAsyncTask() {

        @Override
        protected Void doInBackground(Void... params) {
            try {
                episodeManager.blockUntilEpisodeMetadataIsLoaded();
            } catch (InterruptedException e) {
                cancel(true);
            }

            // Add Downloads entry
            if (episodeManager.getDownloadsSize() > 0)
                items.add(new MediaItem(new MediaDescription.Builder()
                        .setMediaId(DOWNLOADS_ROOT)
                        .setTitle(getString(R.string.downloads))
                        .setSubtitle(getResources().getQuantityString(R.plurals.episodes,
                                episodeManager.getDownloadsSize(), episodeManager.getDownloadsSize()))
                        .build(), MediaItem.FLAG_BROWSABLE));

            // Add Playlist entry
            if (episodeManager.getPlaylistSize() > 0)
                items.add(new MediaItem(new MediaDescription.Builder()
                        .setMediaId(PLAYLIST_ROOT)
                        .setTitle(getString(R.string.playlist))
                        .setSubtitle(getResources().getQuantityString(R.plurals.episodes,
                                episodeManager.getPlaylistSize(), episodeManager.getPlaylistSize()))
                        .build(), MediaItem.FLAG_BROWSABLE));

            // Build list of podcasts
            final List<Podcast> podcasts = podcastManager.getPodcastList();
            for (Podcast podcast : podcasts) {
                final int episodeCount = podcast.getEpisodeCount();
                final MediaDescription.Builder mediaDescription = new MediaDescription.Builder()
                        .setMediaId(podcast.getUrl())
                        .setTitle(podcast.getName())
                        .setSubtitle(episodeCount > 0 ? getResources()
                                .getQuantityString(R.plurals.episodes, episodeCount, episodeCount) : null);

                if (podcast.hasLogoUrl())
                    mediaDescription.setIconUri(Uri.parse(podcast.getLogoUrl()));

                items.add(new MediaItem(mediaDescription.build(), MediaItem.FLAG_BROWSABLE));
            }

            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            result.sendResult(items);
        }
    };

    currentTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
开发者ID:salema,项目名称:Podcatcher-Deluxe-Android-Studio,代码行数:57,代码来源:PodcastBrowserService.java

示例7: onLoadRoot

import android.media.MediaDescription; //导入方法依赖的package包/类
private void onLoadRoot(final Result<List<MediaItem>> result) {
    this.currentTask = new PodcastBrowserAsyncTask() {

        @Override
        protected Void doInBackground(Void... params) {
            try {
                episodeManager.blockUntilEpisodeMetadataIsLoaded();
            } catch (InterruptedException e) {
                cancel(true);
            }

            // Add Downloads entry
            if (episodeManager.getDownloadsSize() > 0)
                items.add(new MediaItem(new MediaDescription.Builder()
                        .setMediaId(DOWNLOADS_ROOT)
                        .setTitle(getString(R.string.downloads))
                        .setSubtitle(getResources().getQuantityString(R.plurals.episodes,
                                episodeManager.getDownloadsSize(), episodeManager.getDownloadsSize()))
                        .build(), MediaItem.FLAG_BROWSABLE));

            // Build list of podcasts
            final List<Podcast> podcasts = podcastManager.getPodcastList();
            for (Podcast podcast : podcasts) {
                final int episodeCount = podcast.getEpisodeCount();
                final MediaDescription.Builder mediaDescription = new MediaDescription.Builder()
                        .setMediaId(podcast.getUrl())
                        .setTitle(podcast.getName())
                        .setSubtitle(episodeCount > 0 ? getResources()
                                .getQuantityString(R.plurals.episodes, episodeCount, episodeCount) : null);

                if (podcast.hasLogoUrl())
                    mediaDescription.setIconUri(Uri.parse(podcast.getLogoUrl()));

                items.add(new MediaItem(mediaDescription.build(), MediaItem.FLAG_BROWSABLE));
            }

            return null;
        }

        @Override
        protected void onPostExecute(Void aVoid) {
            result.sendResult(items);
        }
    };

    currentTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
开发者ID:salema,项目名称:Podcatcher-Deluxe-Android-Studio,代码行数:48,代码来源:PodcastBrowserService.java


注:本文中的android.media.MediaDescription.Builder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。