Commit 092dcc27 authored by Edward Wang's avatar Edward Wang Committed by Jean-Baptiste Kempf

Add open MRL feature in menu

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 8cef981e
......@@ -25,6 +25,9 @@
android:id="@+id/ml_menu_about"
android:icon="@android:drawable/ic_menu_info_details"
android:title="@string/about" />
<item
android:id="@+id/ml_menu_open_mrl"
android:icon="@android:drawable/ic_btn_speak_now"
android:title="@string/open_mrl" />
</menu>
......@@ -80,4 +80,5 @@
<string name="track_text">Subtitles track</string>
<string name="track_text_info">Codec: %1$s\nLanguage: %2$s</string>
<string name="track_unknown">Unknown track</string>
<string name="open_mrl">Open MRL</string>
</resources>
......@@ -463,6 +463,7 @@ public class AudioService extends Service {
@Override
public void load(List<String> mediaPathList, int position)
throws RemoteException {
Log.v(TAG, "Loading position " + ((Integer)position).toString() + " in " + mediaPathList.toString());
mEventManager.addHandler(mEventHandler);
mMediaList.clear();
mPrevious.clear();
......@@ -470,6 +471,10 @@ public class AudioService extends Service {
for (int i = 0; i < mediaPathList.size(); i++) {
String path = mediaPathList.get(i);
Media media = db.getMedia(AudioService.this, path);
if(media == null) {
Log.v(TAG, "Creating on-the-fly Media object for " + path);
media = new Media(AudioService.this, path, false);
}
mMediaList.add(media);
}
......
......@@ -20,6 +20,8 @@
package org.videolan.vlc.gui;
import java.util.ArrayList;
import org.videolan.vlc.AudioServiceController;
import org.videolan.vlc.LibVLC;
import org.videolan.vlc.MediaLibrary;
......@@ -33,10 +35,12 @@ import org.videolan.vlc.widget.AudioMiniPlayer;
import android.app.Activity;
import android.app.ActivityGroup;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.TabActivity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
......@@ -53,6 +57,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.TabHost;
......@@ -232,6 +237,28 @@ public class MainActivity extends TabActivity {
case R.id.ml_menu_refresh:
MediaLibrary.getInstance(this).loadMediaItems(this);
break;
case R.id.ml_menu_open_mrl:
AlertDialog.Builder b = new AlertDialog.Builder(this);
final EditText input = new EditText(this);
b.setTitle("Resource MRL");
b.setMessage("Enter MRL (media resource locator): e.g. rtsp:// or http://");
b.setView(input);
b.setPositiveButton("Open", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int button) {
AudioServiceController c = AudioServiceController.getInstance();
ArrayList<String> media = new ArrayList<String>();
media.add(input.getText().toString());
c.append(media);
}
}
);
b.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
return;
}});
b.show();
break;
}
return super.onOptionsItemSelected(item);
}
......
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