Commit c585b7bc authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Update streams implementation to match new API

parent a0140230
......@@ -872,7 +872,7 @@ static JNINativeMethod methods[] = {
{"nativeBanFolder", "(Ljava/lang/String;)V", (void*)banFolder },
{"nativeUnbanFolder", "(Ljava/lang/String;)V", (void*)unbanFolder },
{"nativeLastMediaPlayed", "()[Lorg/videolan/medialibrary/media/MediaWrapper;", (void*)lastMediaPLayed },
{"nativeLastStreamsPlayed", "()[Lorg/videolan/medialibrary/media/HistoryItem;", (void*)lastStreamsPlayed },
{"nativeLastStreamsPlayed", "()[Lorg/videolan/medialibrary/media/MediaWrapper;", (void*)lastStreamsPlayed },
{"nativeAddToHistory", "(Ljava/lang/String;Ljava/lang/String;)Z", (void*)addToHistory },
{"nativeClearHistory", "()Z", (void*)clearHistory },
{"nativeGetVideos", "()[Lorg/videolan/medialibrary/media/MediaWrapper;", (void*)getVideos },
......
......@@ -25,7 +25,6 @@ import org.videolan.medialibrary.interfaces.MediaUpdatedCb;
import org.videolan.medialibrary.media.Album;
import org.videolan.medialibrary.media.Artist;
import org.videolan.medialibrary.media.Genre;
import org.videolan.medialibrary.media.HistoryItem;
import org.videolan.medialibrary.media.MediaSearchAggregate;
import org.videolan.medialibrary.media.MediaWrapper;
import org.videolan.medialibrary.media.Playlist;
......@@ -311,8 +310,8 @@ public class Medialibrary {
}
@WorkerThread
public HistoryItem[] lastStreamsPlayed() {
return mIsInitiated ? nativeLastStreamsPlayed() : new HistoryItem[0];
public MediaWrapper[] lastStreamsPlayed() {
return mIsInitiated ? nativeLastStreamsPlayed() : EMPTY_COLLECTION;
}
public boolean clearHistory() {
......@@ -706,7 +705,7 @@ public class Medialibrary {
private native String[] nativeEntryPoints();
private native boolean nativeRemoveDevice(String uuid);
private native MediaWrapper[] nativeLastMediaPlayed();
private native HistoryItem[] nativeLastStreamsPlayed();
private native MediaWrapper[] nativeLastStreamsPlayed();
private native boolean nativeAddToHistory(String mrl, String title);
private native boolean nativeClearHistory();
private native MediaWrapper nativeGetMedia(long id);
......
......@@ -27,12 +27,11 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.videolan.medialibrary.media.HistoryItem;
import org.videolan.medialibrary.media.MediaWrapper;
import org.videolan.vlc.R;
class MRLAdapter extends RecyclerView.Adapter<MRLAdapter.ViewHolder> {
private HistoryItem[] mDataset;
private MediaWrapper[] mDataset;
private MediaPlayerController playerController;
interface MediaPlayerController {
......@@ -51,7 +50,7 @@ class MRLAdapter extends RecyclerView.Adapter<MRLAdapter.ViewHolder> {
@Override
public void onClick(View v) {
playerController.playMedia(mDataset[getLayoutPosition()].getMedia());
playerController.playMedia(mDataset[getLayoutPosition()]);
}
}
......@@ -60,26 +59,25 @@ class MRLAdapter extends RecyclerView.Adapter<MRLAdapter.ViewHolder> {
}
@Override
public MRLAdapter.ViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
View v = LayoutInflater.from(parent.getContext())
public MRLAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
final View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.mrl_item, parent, false);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
final HistoryItem item = mDataset[position];
holder.uriTv.setText(Uri.decode(item.getMrl()));
final MediaWrapper item = mDataset[position];
holder.uriTv.setText(Uri.decode(item.getLocation()));
holder.titleTv.setText(Uri.decode(item.getTitle()));
}
public void setList(HistoryItem[] list){
public void setList(MediaWrapper[] list){
mDataset = list;
notifyDataSetChanged();
}
public HistoryItem getItem(int position) {
public MediaWrapper getItem(int position) {
if (position >= getItemCount() || position < 0)
return null;
return mDataset[position];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment