[Android] add "play as audio" to the video list
Sébastien Toque
git at videolan.org
Sun Feb 10 19:05:32 CET 2013
vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sun Feb 10 19:01:37 2013 +0100| [e1951cabf168768093c3f35e9a4b22ea0a5957b5] | committer: Sébastien Toque
add "play as audio" to the video list
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=e1951cabf168768093c3f35e9a4b22ea0a5957b5
---
vlc-android/res/menu/video_list.xml | 3 +++
.../src/org/videolan/vlc/gui/video/VideoGridFragment.java | 11 +++++++++++
2 files changed, 14 insertions(+)
diff --git a/vlc-android/res/menu/video_list.xml b/vlc-android/res/menu/video_list.xml
index f2400f2..3ae29e1 100644
--- a/vlc-android/res/menu/video_list.xml
+++ b/vlc-android/res/menu/video_list.xml
@@ -7,6 +7,9 @@
android:id="@+id/video_list_play_from_start"
android:title="@string/play_from_start" />
<item
+ android:id="@+id/video_list_play_audio"
+ android:title="@string/play_as_audio" />
+ <item
android:id="@+id/video_list_info"
android:title="@string/info" />
<item
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
index 33aabb7..49a0c08 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
@@ -26,6 +26,7 @@ import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import org.videolan.android.ui.SherlockGridFragment;
+import org.videolan.vlc.AudioServiceController;
import org.videolan.vlc.DatabaseManager;
import org.videolan.vlc.Media;
import org.videolan.vlc.MediaLibrary;
@@ -36,6 +37,7 @@ import org.videolan.vlc.VlcRunnable;
import org.videolan.vlc.WeakHandler;
import org.videolan.vlc.gui.CommonDialogs;
import org.videolan.vlc.gui.PreferencesActivity;
+import org.videolan.vlc.gui.audio.AudioPlayerActivity;
import org.videolan.vlc.interfaces.ISortable;
import android.annotation.TargetApi;
@@ -242,6 +244,12 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
VideoPlayerActivity.start(getActivity(), item.getLocation(), fromStart);
}
+ protected void playAudio(int position) {
+ Media item = (Media) getListAdapter().getItem(position);
+ AudioServiceController.getInstance().load(item.getLocation(), 0, false, true);
+ AudioPlayerActivity.start(getActivity());
+ }
+
private boolean handleContextItemSelected(MenuItem menu, int position) {
switch (menu.getItemId())
{
@@ -251,6 +259,9 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
case R.id.video_list_play_from_start:
playVideo(position, true);
return true;
+ case R.id.video_list_play_audio:
+ playAudio(position);
+ return true;
case R.id.video_list_info:
Intent intent = new Intent(getActivity(), MediaInfoActivity.class);
intent.putExtra("itemLocation",
More information about the Android
mailing list