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


Java MediaItem类代码示例

本文整理汇总了Java中android.media.browse.MediaBrowser.MediaItem的典型用法代码示例。如果您正苦于以下问题:Java MediaItem类的具体用法?Java MediaItem怎么用?Java MediaItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: newInstance

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
static Object newInstance(List<MediaItem> itemList) {
    ReflectiveOperationException e;
    Object result = null;
    try {
        result = sConstructor.newInstance(new Object[]{itemList});
    } catch (InstantiationException e2) {
        e = e2;
        e.printStackTrace();
        return result;
    } catch (IllegalAccessException e3) {
        e = e3;
        e.printStackTrace();
        return result;
    } catch (InvocationTargetException e4) {
        e = e4;
        e.printStackTrace();
        return result;
    }
    return result;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:ParceledListSliceAdapterApi21.java

示例2: onLoadChildren

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onLoadChildren(@NonNull final String parentMediaId, @NonNull final Result<List<MediaItem>> result) {
    result.detach();

    switch (parentMediaId) {
        case BROWSER_ROOT:
            onLoadRoot(result);
            break;
        case DOWNLOADS_ROOT:
            onLoadDownloads(result);
            break;
        case PLAYLIST_ROOT:
            onLoadPlaylist(result);
            break;
        default:
            onLoadPodcast(result, parentMediaId);
            break;
    }
}
 
开发者ID:salema,项目名称:Podcatcher-Deluxe-Android-Studio,代码行数:20,代码来源:PodcastBrowserService.java

示例3: onLoadDownloads

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

        @Override
        protected Void doInBackground(Void... params) {
            // Build list of downloaded episodes
            final List<Episode> downloads = episodeManager.getDownloads();
            for (Episode download : downloads)
                items.add(episodeToMediaItem(download));

            return null;
        }

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

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

示例4: onLoadPlaylist

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

        @Override
        protected Void doInBackground(Void... params) {
            // Build list of episodes in playlist
            final List<Episode> playlist = episodeManager.getPlaylist();
            for (Episode episode : playlist)
                items.add(episodeToMediaItem(episode));

            return null;
        }

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

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

示例5: onLoadChildren

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onLoadChildren(@NonNull final String parentMediaId, @NonNull final Result<List<MediaItem>> result) {
    result.detach();

    switch (parentMediaId) {
        case BROWSER_ROOT:
            onLoadRoot(result);
            break;
        case DOWNLOADS_ROOT:
            onLoadDownloads(result);
            break;
        default:
            onLoadPodcast(result, parentMediaId);
            break;
    }
}
 
开发者ID:salema,项目名称:Podcatcher-Deluxe-Android-Studio,代码行数:17,代码来源:PodcastBrowserService.java

示例6: getMediaItem

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
public void getMediaItem(String mediaId, final ResultReceiver receiver) {
    ReflectiveOperationException e;
    try {
        final String KEY_MEDIA_ITEM = (String) MediaBrowserService.class.getDeclaredField("KEY_MEDIA_ITEM").get(null);
        this.mServiceImpl.getMediaItem(mediaId, new ItemCallback() {
            public void onItemLoaded(int resultCode, Bundle resultData, Parcel itemParcel) {
                if (itemParcel != null) {
                    itemParcel.setDataPosition(0);
                    resultData.putParcelable(KEY_MEDIA_ITEM, (MediaItem) MediaItem.CREATOR.createFromParcel(itemParcel));
                    itemParcel.recycle();
                }
                receiver.send(resultCode, resultData);
            }
        });
    } catch (IllegalAccessException e2) {
        e = e2;
        Log.i(MediaBrowserServiceCompatApi23.TAG, "Failed to get KEY_MEDIA_ITEM via reflection", e);
    } catch (NoSuchFieldException e3) {
        e = e3;
        Log.i(MediaBrowserServiceCompatApi23.TAG, "Failed to get KEY_MEDIA_ITEM via reflection", e);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:MediaBrowserServiceCompatApi23.java

示例7: onLoadChildren

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onLoadChildren(@NonNull final String parentMediaId,
                           @NonNull final Result<List<MediaItem>> result) {
    if (!mMusicProvider.isInitialized()) {
        // Use result.detach to allow calling result.sendResult from another thread:
        result.detach();

        mMusicProvider.retrieveMediaAsync(new MusicProvider.Callback() {
            @Override
            public void onMusicCatalogReady(boolean success) {
                if (success) {
                    loadChildrenImpl(parentMediaId, result);
                } else {
                    updatePlaybackState(getString(R.string.error_no_metadata));
                    result.sendResult(Collections.<MediaItem>emptyList());
                }
            }
        });

    } else {
        // If our music catalog is already loaded/cached, load them into result immediately
        loadChildrenImpl(parentMediaId, result);
    }
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:25,代码来源:MusicService.java

示例8: onChildrenLoaded

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onChildrenLoaded(@NonNull String parentId,
                             @NonNull List<MediaBrowser.MediaItem> children) {
    mListRowAdapter.clear();
    for (MediaBrowser.MediaItem item : children) {
        mListRowAdapter.add(item);
    }
    mListRowAdapter.notifyArrayItemRangeChanged(0, children.size());
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:10,代码来源:TvBrowseFragment.java

示例9: onItemClicked

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
                          RowPresenter.ViewHolder rowViewHolder, Row row) {

    getActivity().getMediaController().getTransportControls()
            .playFromMediaId(((MediaItem) item).getMediaId(), null);

    Intent intent = new Intent(getActivity(), TvPlaybackActivity.class);
    Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(
            getActivity(),
            ((ImageCardView) itemViewHolder.view).getMainImageView(),
            TvVerticalGridActivity.SHARED_ELEMENT_NAME).toBundle();

    getActivity().startActivity(intent, bundle);
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:16,代码来源:TvVerticalGridFragment.java

示例10: onChildrenLoaded

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onChildrenLoaded(@NonNull String parentId, @NonNull List<MediaItem> children) {
    mAdapter.clear();
    for (int i = 0; i < children.size(); i++) {
        MediaItem item = children.get(i);
        if (!item.isPlayable()) {
            LogHelper.e(TAG, "Cannot show non-playable items. Ignoring ", item.getMediaId());
        } else {
            mAdapter.add(item);
        }
    }
    mAdapter.notifyArrayItemRangeChanged(0, children.size());
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:14,代码来源:TvVerticalGridFragment.java

示例11: onLoadChildren

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onLoadChildren(final String parentMediaId, final Result<List<MediaItem>> result) {
    if (!mMusicProvider.isInitialized()) {
        // Use result.detach to allow calling result.sendResult from another thread:
        result.detach();

        mMusicProvider.retrieveMediaAsync(new MusicProvider.Callback() {
            @Override
            public void onMusicCatalogReady(boolean success) {
                if (success) {
                    loadChildrenImpl(parentMediaId, result);
                } else {
                    updatePlaybackState(getString(R.string.error_no_metadata));
                    result.sendResult(Collections.<MediaItem>emptyList());
                }
            }
        });

    } else {
        // If our music catalog is already loaded/cached, load them into result immediately
        loadChildrenImpl(parentMediaId, result);
    }
}
 
开发者ID:ErNaveen,项目名称:UniversalMusicPlayer,代码行数:24,代码来源:MusicService.java

示例12: episodeToMediaItem

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的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

示例13: onItemLoaded

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
public void onItemLoaded(MediaItem item) {
    Parcel parcel = Parcel.obtain();
    item.writeToParcel(parcel, 0);
    this.mItemCallback.onItemLoaded(parcel);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:6,代码来源:MediaBrowserCompatApi23.java

示例14: onLoadChildren

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onLoadChildren(final String parentMediaId, final Result<List<MediaItem>> result) {
    result.sendResult(LocalMusicSource.getMediaItems());
}
 
开发者ID:smitzey,项目名称:AndroidAutoTourGuide,代码行数:5,代码来源:MuziKarMusicService.java

示例15: onLoadChildren

import android.media.browse.MediaBrowser.MediaItem; //导入依赖的package包/类
@Override
public void onLoadChildren(final String parentMediaId, final Result<List<MediaItem>> result) {
    result.sendResult(new ArrayList<MediaItem>());
}
 
开发者ID:smitzey,项目名称:AndroidAutoTourGuide,代码行数:5,代码来源:MyMusicService.java


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