本文整理匯總了Java中org.videolan.vlc.gui.audio.MediaComparators類的典型用法代碼示例。如果您正苦於以下問題:Java MediaComparators類的具體用法?Java MediaComparators怎麽用?Java MediaComparators使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MediaComparators類屬於org.videolan.vlc.gui.audio包,在下文中一共展示了MediaComparators類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: sortList
import org.videolan.vlc.gui.audio.MediaComparators; //導入依賴的package包/類
public void sortList(){
ArrayList<MediaWrapper> files = new ArrayList<MediaWrapper>(), dirs = new ArrayList<MediaWrapper>();
for (Object item : mMediaList){
if (item instanceof MediaWrapper) {
MediaWrapper media = (MediaWrapper) item;
if (media.getType() == MediaWrapper.TYPE_DIR)
dirs.add(media);
else
files.add(media);
}
}
if (dirs.isEmpty() && files.isEmpty())
return;
mMediaList.clear();
if (!dirs.isEmpty()) {
Collections.sort(dirs, MediaComparators.byName);
mMediaList.addAll(dirs);
}
if (!files.isEmpty()) {
Collections.sort(files, MediaComparators.byName);
mMediaList.addAll(files);
}
notifyDataSetChanged();
}
示例2: setShuffleMode
import org.videolan.vlc.gui.audio.MediaComparators; //導入依賴的package包/類
private void setShuffleMode(boolean shuffle) {
if (mService == null)
return;
mShuffling = shuffle;
mShuffle.setImageResource(shuffle ? R.drawable.ic_shuffle_on :
R.drawable.ic_shuffle);
ArrayList<MediaWrapper> medias = (ArrayList<MediaWrapper>) mService.getMedias();
if (shuffle){
Collections.shuffle(medias);
} else {
Collections.sort(medias, MediaComparators.byTrackNumber);
}
mService.load(medias, 0);
mAdapter.updateList(medias);
update();
}
示例3: sortList
import org.videolan.vlc.gui.audio.MediaComparators; //導入依賴的package包/類
public void sortList(){
ArrayList<MediaWrapper> files = new ArrayList<MediaWrapper>(), dirs = new ArrayList<MediaWrapper>();
for (Object item : mMediaList){
if (item instanceof MediaWrapper) {
MediaWrapper media = (MediaWrapper) item;
if (media.getType() == MediaWrapper.TYPE_DIR)
dirs.add(media);
else
files.add(media);
}
}
Collections.sort(dirs, MediaComparators.byName);
Collections.sort(files, MediaComparators.byName);
mMediaList.clear();
mMediaList.addAll(dirs);
mMediaList.addAll(files);
mAdapter.clear();
mAdapter.addAll(0, mMediaList);
mAdapter.notifyArrayItemRangeChanged(0, mMediaList.size());
}
示例4: sort
import org.videolan.vlc.gui.audio.MediaComparators; //導入依賴的package包/類
private void sort(){
VLCApplication.runBackground(new Runnable() {
@Override
public void run() {
mMediaItemMap = new TreeMap<>(mMediaItemMap); //sort sections
for (ListItem item : mMediaItemMap.values()) {
Collections.sort(item.mediaList, MediaComparators.byName);
}
mHandler.sendEmptyMessage(UPDATE_DISPLAY);
}
});
}
示例5: onPostExecute
import org.videolan.vlc.gui.audio.MediaComparators; //導入依賴的package包/類
@Override
protected void onPostExecute(String title) {
((BrowserActivity)getActivity()).showProgress(false);
setTitle(title);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
ListItem listItem = (ListItem) item;
Intent intent;
if (CATEGORY_ARTISTS == mCategory) {
intent = new Intent(mContext, VerticalGridActivity.class);
intent.putExtra(MainTvActivity.BROWSER_TYPE, MainTvActivity.HEADER_CATEGORIES);
intent.putExtra(AUDIO_CATEGORY, CATEGORY_ALBUMS);
intent.putExtra(MEDIA_SECTION, FILTER_ARTIST);
intent.putExtra(AUDIO_FILTER, listItem.mediaList.get(0).getArtist());
} else if (CATEGORY_GENRES == mCategory) {
intent = new Intent(mContext, VerticalGridActivity.class);
intent.putExtra(MainTvActivity.BROWSER_TYPE, MainTvActivity.HEADER_CATEGORIES);
intent.putExtra(AUDIO_CATEGORY, CATEGORY_ALBUMS);
intent.putExtra(MEDIA_SECTION, FILTER_GENRE);
intent.putExtra(AUDIO_FILTER, listItem.mediaList.get(0).getGenre());
} else {
if (CATEGORY_ALBUMS == mCategory)
Collections.sort(listItem.mediaList, MediaComparators.byTrackNumber);
intent = new Intent(mContext, AudioPlayerActivity.class);
intent.putExtra(AudioPlayerActivity.MEDIA_LIST, listItem.mediaList);
}
startActivity(intent);
}
});
}
示例6: onPostExecute
import org.videolan.vlc.gui.audio.MediaComparators; //導入依賴的package包/類
@Override
protected void onPostExecute(String title) {
((BrowserActivityInterface)getActivity()).showProgress(false);
setTitle(title);
setOnItemViewClickedListener(new OnItemViewClickedListener() {
@Override
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
RowPresenter.ViewHolder rowViewHolder, Row row) {
ListItem listItem = (ListItem) item;
Intent intent;
if (CATEGORY_ARTISTS == mCategory) {
intent = new Intent(mContext, VerticalGridActivity.class);
intent.putExtra(MainTvActivity.BROWSER_TYPE, MainTvActivity.HEADER_CATEGORIES);
intent.putExtra(AUDIO_CATEGORY, CATEGORY_ALBUMS);
intent.putExtra(MEDIA_SECTION, FILTER_ARTIST);
intent.putExtra(AUDIO_FILTER, listItem.mediaList.get(0).getArtist());
} else if (CATEGORY_GENRES == mCategory) {
intent = new Intent(mContext, VerticalGridActivity.class);
intent.putExtra(MainTvActivity.BROWSER_TYPE, MainTvActivity.HEADER_CATEGORIES);
intent.putExtra(AUDIO_CATEGORY, CATEGORY_ALBUMS);
intent.putExtra(MEDIA_SECTION, FILTER_GENRE);
intent.putExtra(AUDIO_FILTER, listItem.mediaList.get(0).getGenre());
} else {
intent = new Intent(mContext, AudioPlayerActivity.class);
if (CATEGORY_ALBUMS == mCategory) {
Collections.sort(listItem.mediaList, MediaComparators.byTrackNumber);
intent.putExtra(AudioPlayerActivity.MEDIA_LIST, listItem.mediaList);
} else {
int position = 0;
String location = listItem.mediaList.get(0).getLocation();
for (int i = 0 ; i< audioList.size() ; ++i) {
if (TextUtils.equals(location, audioList.get(i).getLocation())) {
position = i;
break;
}
}
intent.putExtra(AudioPlayerActivity.MEDIA_LIST, audioList);
intent.putExtra(AudioPlayerActivity.MEDIA_POSITION, position);
}
}
startActivity(intent);
}
});
}