Please use resources strings instead of hardcoded ones.<br><br><div class="gmail_quote">On Sun, Apr 15, 2012 at 7:50 PM, Edward Wang <span dir="ltr"><<a href="mailto:git@videolan.org">git@videolan.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">android | branch: master | Edward Wang <<a href="mailto:edward.c.wang@compdigitec.com">edward.c.wang@compdigitec.com</a>> | Sun Apr 15 19:40:38 2012 +0200| [092dcc27c525014d295af2513b3f2dfc9a2df0c0] | committer: Jean-Baptiste Kempf<br>
<br>
Add open MRL feature in menu<br>
<br>
Signed-off-by: Jean-Baptiste Kempf <<a href="mailto:jb@videolan.org">jb@videolan.org</a>><br>
<br>
> <a href="http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=092dcc27c525014d295af2513b3f2dfc9a2df0c0" target="_blank">http://git.videolan.org/gitweb.cgi/android.git/?a=commit;h=092dcc27c525014d295af2513b3f2dfc9a2df0c0</a><br>
---<br>
<br>
vlc-android/res/menu/media_library.xml | 5 +++-<br>
vlc-android/res/values/strings.xml | 1 +<br>
vlc-android/src/org/videolan/vlc/AudioService.java | 5 +++<br>
.../src/org/videolan/vlc/gui/MainActivity.java | 27 ++++++++++++++++++++<br>
4 files changed, 37 insertions(+), 1 deletions(-)<br>
<br>
diff --git a/vlc-android/res/menu/media_library.xml b/vlc-android/res/menu/media_library.xml<br>
index 00f3daf..6296da3 100644<br>
--- a/vlc-android/res/menu/media_library.xml<br>
+++ b/vlc-android/res/menu/media_library.xml<br>
@@ -25,6 +25,9 @@<br>
android:id="@+id/ml_menu_about"<br>
android:icon="@android:drawable/ic_menu_info_details"<br>
android:title="@string/about" /><br>
-<br>
+ <item<br>
+ android:id="@+id/ml_menu_open_mrl"<br>
+ android:icon="@android:drawable/ic_btn_speak_now"<br>
+ android:title="@string/open_mrl" /><br>
<br>
</menu><br>
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml<br>
index ac7c2f1..48083cc 100644<br>
--- a/vlc-android/res/values/strings.xml<br>
+++ b/vlc-android/res/values/strings.xml<br>
@@ -80,4 +80,5 @@<br>
<string name="track_text">Subtitles track</string><br>
<string name="track_text_info">Codec: %1$s\nLanguage: %2$s</string><br>
<string name="track_unknown">Unknown track</string><br>
+ <string name="open_mrl">Open MRL</string><br>
</resources><br>
diff --git a/vlc-android/src/org/videolan/vlc/AudioService.java b/vlc-android/src/org/videolan/vlc/AudioService.java<br>
index bac9e7f..af5cfc1 100644<br>
--- a/vlc-android/src/org/videolan/vlc/AudioService.java<br>
+++ b/vlc-android/src/org/videolan/vlc/AudioService.java<br>
@@ -463,6 +463,7 @@ public class AudioService extends Service {<br>
@Override<br>
public void load(List<String> mediaPathList, int position)<br>
throws RemoteException {<br>
+ Log.v(TAG, "Loading position " + ((Integer)position).toString() + " in " + mediaPathList.toString());<br>
mEventManager.addHandler(mEventHandler);<br>
mMediaList.clear();<br>
mPrevious.clear();<br>
@@ -470,6 +471,10 @@ public class AudioService extends Service {<br>
for (int i = 0; i < mediaPathList.size(); i++) {<br>
String path = mediaPathList.get(i);<br>
Media media = db.getMedia(AudioService.this, path);<br>
+ if(media == null) {<br>
+ Log.v(TAG, "Creating on-the-fly Media object for " + path);<br>
+ media = new Media(AudioService.this, path, false);<br>
+ }<br>
mMediaList.add(media);<br>
}<br>
<br>
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java<br>
index 2660948..3868d41 100644<br>
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java<br>
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java<br>
@@ -20,6 +20,8 @@<br>
<br>
package org.videolan.vlc.gui;<br>
<br>
+import java.util.ArrayList;<br>
+<br>
import org.videolan.vlc.AudioServiceController;<br>
import org.videolan.vlc.LibVLC;<br>
import org.videolan.vlc.MediaLibrary;<br>
@@ -33,10 +35,12 @@ import org.videolan.vlc.widget.AudioMiniPlayer;<br>
<br>
import android.app.Activity;<br>
import android.app.ActivityGroup;<br>
+import android.app.AlertDialog;<br>
import android.app.Dialog;<br>
import android.app.TabActivity;<br>
import android.content.BroadcastReceiver;<br>
import android.content.Context;<br>
+import android.content.DialogInterface;<br>
import android.content.Intent;<br>
import android.content.IntentFilter;<br>
import android.content.SharedPreferences;<br>
@@ -53,6 +57,7 @@ import android.view.View;<br>
import android.view.View.OnClickListener;<br>
import android.widget.Button;<br>
import android.widget.CheckBox;<br>
+import android.widget.EditText;<br>
import android.widget.ImageButton;<br>
import android.widget.ProgressBar;<br>
import android.widget.TabHost;<br>
@@ -232,6 +237,28 @@ public class MainActivity extends TabActivity {<br>
case R.id.ml_menu_refresh:<br>
MediaLibrary.getInstance(this).loadMediaItems(this);<br>
break;<br>
+ case R.id.ml_menu_open_mrl:<br>
+ AlertDialog.Builder b = new AlertDialog.Builder(this);<br>
+ final EditText input = new EditText(this);<br>
+ b.setTitle("Resource MRL");<br>
+ b.setMessage("Enter MRL (media resource locator): e.g. rtsp:// or http://");<br>
+ b.setView(input);<br>
+ b.setPositiveButton("Open", new DialogInterface.OnClickListener() {<br>
+ public void onClick(DialogInterface dialog, int button) {<br>
+ AudioServiceController c = AudioServiceController.getInstance();<br>
+ ArrayList<String> media = new ArrayList<String>();<br>
+ media.add(input.getText().toString());<br>
+ c.append(media);<br>
+ }<br>
+ }<br>
+ );<br>
+ b.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {<br>
+ @Override<br>
+ public void onClick(DialogInterface arg0, int arg1) {<br>
+ return;<br>
+ }});<br>
+ b.show();<br>
+ break;<br>
}<br>
return super.onOptionsItemSelected(item);<br>
}<br>
<br>
_______________________________________________<br>
Android mailing list<br>
<a href="mailto:Android@videolan.org">Android@videolan.org</a><br>
<a href="http://mailman.videolan.org/listinfo/android" target="_blank">http://mailman.videolan.org/listinfo/android</a><br>
</blockquote></div><br>