package com.nf2m.fragment;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import com.nf2m.R;
import com.nf2m.activity.TarMediaPlayerActivity;
import com.nf2m.model.Songs;
import com.nf2m.preferences.Preferences;
import java.util.ArrayList;
//TODO buraya şarkıların sıralama kodları eklenecek
public class NowPlayingListFragment extends SongFragment {
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
Cursor cursor;
String[] selection = null;
Songs songs = new Songs(getActivity());
setNowPlayingList(true);
Preferences preferences = Preferences.newInstance(getContext());
String where = preferences.getPrefQueryWhere();
ArrayList<String> selectionArgs = preferences.getPrefQuerySelectionArgs();
String prefQueryUri = preferences.getPrefQueryUri();
if (where == null && selectionArgs == null && prefQueryUri == null) {
cursor = songs.getCursor();
} else {
if (selectionArgs != null) {
selection = selectionArgs.toArray(new String[selectionArgs.size()]);
}
cursor = songs.initCursor(Uri.parse(prefQueryUri), null, where, selection, songs.getSortOrder());
}
setWhere(where);
setSelectionArgs(selection);
initFragment(cursor, songs);
((TarMediaPlayerActivity) getActivity()).setActionBarTitle(getResources().getString(R.string.item_now_playing_list));
super.onViewCreated(view, savedInstanceState);
}
}