Commit 74e49bf4 authored by John Mooring's avatar John Mooring Committed by Sébastien Toque

Open the correct player depending on the media type (audio/video) when searching

Signed-off-by: Sébastien Toque's avatarSébastien Toque <xilasz@gmail.com>
parent dfaa4ef8
......@@ -200,8 +200,20 @@ public class SearchActivity extends ListActivity {
// open media in the player
Media item = (Media) getListAdapter().getItem(position - 1);
Intent intent = new Intent(this, VideoPlayerActivity.class);
intent.putExtra("filePath", item.getPath());
Intent intent;
if (item.getType() == Media.TYPE_VIDEO) {
intent = new Intent(this, VideoPlayerActivity.class);
intent.putExtra("filePath", item.getPath());
} else {
ArrayList<String> arr = new ArrayList<String>();
for (int i = 0; i < getListAdapter().getCount(); i++) {
Media audioItem = (Media) getListAdapter().getItem(i);
if (audioItem.getType() == Media.TYPE_AUDIO)
arr.add(audioItem.getPath());
}
AudioServiceController.getInstance().load(arr, arr.indexOf(item.getPath()));
intent = new Intent(this, AudioPlayerActivity.class);
}
startActivity(intent);
super.onListItemClick(l, v, position, id);
......
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