Make the expander flag in MediaAdapter a boolean
Historical reasons had it as a reference. This reference is not necessary now
This commit is contained in:
parent
8f76a2be25
commit
126760692f
@ -49,18 +49,18 @@ public class MediaAdapter extends CursorAdapter implements FilterQueryProvider {
|
||||
private Uri mStore;
|
||||
private String[] mFields;
|
||||
private String[] mFieldKeys;
|
||||
private View.OnClickListener mExpanderListener;
|
||||
private boolean mExpandable;
|
||||
private String[] mLimiter;
|
||||
private CharSequence mConstraint;
|
||||
|
||||
public MediaAdapter(Context context, Uri store, String[] fields, String[] fieldKeys, View.OnClickListener expanderListener)
|
||||
public MediaAdapter(Context context, Uri store, String[] fields, String[] fieldKeys, boolean expandable)
|
||||
{
|
||||
super(context, null, true);
|
||||
|
||||
mStore = store;
|
||||
mFields = fields;
|
||||
mFieldKeys = fieldKeys;
|
||||
mExpanderListener = expanderListener;
|
||||
mExpandable = expandable;
|
||||
|
||||
setFilterQueryProvider(this);
|
||||
|
||||
@ -146,7 +146,7 @@ public class MediaAdapter extends CursorAdapter implements FilterQueryProvider {
|
||||
|
||||
public final boolean hasExpanders()
|
||||
{
|
||||
return mExpanderListener != null;
|
||||
return mExpandable;
|
||||
}
|
||||
|
||||
public final void setLimiter(String[] limiter)
|
||||
@ -207,7 +207,7 @@ public class MediaAdapter extends CursorAdapter implements FilterQueryProvider {
|
||||
int expanderHeight;
|
||||
int textHeight;
|
||||
|
||||
if (mExpanderListener != null)
|
||||
if (mExpandable)
|
||||
expanderHeight = mExpander.getHeight() + (int)mTextSize;
|
||||
else
|
||||
expanderHeight = 0;
|
||||
@ -240,7 +240,7 @@ public class MediaAdapter extends CursorAdapter implements FilterQueryProvider {
|
||||
paint.setTextSize(mTextSize);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
if (mExpanderListener != null) {
|
||||
if (mExpandable) {
|
||||
width -= padding * 3 + mExpander.getWidth();
|
||||
canvas.drawBitmap(mExpander, width + padding * 2, (height - mExpander.getHeight()) / 2, paint);
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import android.provider.MediaStore;
|
||||
public class SongMediaAdapter extends MediaAdapter {
|
||||
public SongMediaAdapter(Context context)
|
||||
{
|
||||
super(context, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, SONG_FIELDS, SONG_FIELD_KEYS, null);
|
||||
super(context, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, SONG_FIELDS, SONG_FIELD_KEYS, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,12 +71,12 @@ public class SongSelector extends Dialog implements AdapterView.OnItemClickListe
|
||||
return (MediaAdapter)getList(tab).getAdapter();
|
||||
}
|
||||
|
||||
private void initializeList(int id, Uri store, String[] fields, String[] fieldKeys, View.OnClickListener expanderListener)
|
||||
private void initializeList(int id, Uri store, String[] fields, String[] fieldKeys)
|
||||
{
|
||||
ListView view = (ListView)findViewById(id);
|
||||
view.setOnItemClickListener(this);
|
||||
view.setOnCreateContextMenuListener(this);
|
||||
view.setAdapter(new MediaAdapter(getContext(), store, fields, fieldKeys, expanderListener));
|
||||
view.setAdapter(new MediaAdapter(getContext(), store, fields, fieldKeys, true));
|
||||
}
|
||||
|
||||
public SongSelector(Context context)
|
||||
@ -109,8 +109,8 @@ public class SongSelector extends Dialog implements AdapterView.OnItemClickListe
|
||||
new Handler().post(new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
initializeList(R.id.artist_list, MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, MediaAdapter.ARTIST_FIELDS, MediaAdapter.ARTIST_FIELD_KEYS, SongSelector.this);
|
||||
initializeList(R.id.album_list, MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, MediaAdapter.ALBUM_FIELDS, MediaAdapter.ALBUM_FIELD_KEYS,SongSelector.this);
|
||||
initializeList(R.id.artist_list, MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, MediaAdapter.ARTIST_FIELDS, MediaAdapter.ARTIST_FIELD_KEYS);
|
||||
initializeList(R.id.album_list, MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, MediaAdapter.ALBUM_FIELDS, MediaAdapter.ALBUM_FIELD_KEYS);
|
||||
|
||||
ListView view = (ListView)findViewById(R.id.song_list);
|
||||
view.setOnItemClickListener(SongSelector.this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user