Commit 80f6cbab authored by Geoffrey Métais's avatar Geoffrey Métais

Remove useless list

parent 49b62f4c
......@@ -27,6 +27,7 @@ import android.content.SharedPreferences;
import android.media.AudioManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Parcelable;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
......@@ -67,6 +68,7 @@ import org.videolan.vlc.util.Strings;
import org.videolan.vlc.util.Util;
import org.videolan.vlc.widget.AudioMediaSwitcher.AudioMediaSwitcherListener;
import java.util.ArrayList;
import java.util.List;
public class AudioPlayer extends Fragment implements IAudioPlayer, View.OnClickListener {
......@@ -229,7 +231,7 @@ public class AudioPlayer extends Fragment implements IAudioPlayer, View.OnClickL
mSongsList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> av, View v, int p, long id) {
mAudioController.load(mSongsListAdapter.getItems(), p);
mAudioController.playIndex(p);
}
});
mSongsList.setOnItemLongClickListener(new OnItemLongClickListener() {
......@@ -608,7 +610,7 @@ public class AudioPlayer extends Fragment implements IAudioPlayer, View.OnClickL
FragmentManager fm = getActivity().getSupportFragmentManager();
SavePlaylist savePlaylistDialog = new SavePlaylist();
Bundle args = new Bundle();
args.putParcelableArrayList(SavePlaylist.KEY_TRACKS, mSongsListAdapter.getItems());
args.putParcelableArrayList(SavePlaylist.KEY_TRACKS, (ArrayList<MediaWrapper>) mAudioController.getMedias());
savePlaylistDialog.setArguments(args);
savePlaylistDialog.show(fm, "fragment_save_playlist");
break;
......
......@@ -47,7 +47,6 @@ import java.util.List;
public class AudioPlaylistAdapter extends ArrayAdapter<MediaWrapper> {
private ArrayList<MediaWrapper> mMediaList;
private int mCurrentIndex;
private Context mContext;
private int mAlignMode;
......@@ -55,30 +54,11 @@ public class AudioPlaylistAdapter extends ArrayAdapter<MediaWrapper> {
public AudioPlaylistAdapter(Context context) {
super(context, 0);
mContext = context;
mMediaList = new ArrayList<MediaWrapper>();
mCurrentIndex = -1;
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
mAlignMode = Integer.valueOf(preferences.getString("audio_title_alignment", "0"));
}
@Override
public void add(MediaWrapper m) {
mMediaList.add(m);
super.add(m);
}
@Override
public void remove(MediaWrapper m) {
mMediaList.remove(m);
super.remove(m);
}
@Override
public void clear() {
mMediaList.clear();
super.clear();
}
public void setCurrentIndex(int currentIndex) {
mCurrentIndex = currentIndex;
}
......@@ -161,23 +141,18 @@ public class AudioPlaylistAdapter extends ArrayAdapter<MediaWrapper> {
public List<String> getLocation(int position) {
List<String> locations = new ArrayList<String>();
if (position >= 0 && position < mMediaList.size())
locations.add(mMediaList.get(position).getLocation());
if (position >= 0 && position < getCount())
locations.add(getItem(position).getLocation());
return locations;
}
public List<String> getLocations() {
List<String> locations = new ArrayList<String>();
for (int i = 0; i < mMediaList.size(); i++) {
locations.add(mMediaList.get(i).getLocation());
}
for (int i = 0 ; i < getCount() ; ++i)
locations.add(getItem(i).getLocation());
return locations;
}
public ArrayList<MediaWrapper> getItems(){
return mMediaList;
}
static class ViewHolder {
int position;
TextView title;
......
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