From: <kro...@us...> - 2010-12-11 11:49:07
|
Revision: 4029 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4029&view=rev Author: kroko_koenig Date: 2010-12-11 11:49:00 +0000 (Sat, 11 Dec 2010) Log Message: ----------- so far... Modified Paths: -------------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/readme trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylist.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylistXmlHandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylisthandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs trunk/plugins/AndroidRemote/Server/AndroidRemote.suo Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/readme =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/readme 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/readme 2010-12-11 11:49:00 UTC (rev 4029) @@ -11,6 +11,11 @@ Music section ------------- browse folders (MP shares) +browse MP database for artist,albums,songs +add title to playlist +view playlist +delete item from playlist +clear playlist Video section ------------- @@ -21,17 +26,19 @@ show actual title show actual time show actual cover +clear playlist +delete one item Remote ------ most functions as on my remote +two more buttons for subtitle / osd - Main issues ------------ -Vibration (on/off settings) -Vibration feedback +Vibration feedback (not completed) Check if WIFI is on -gesture control for pictures (swipe) +gesture control for pictures (swipe) / alertdialog save files from Android to MP if the MP has no focus the remote doesnt work (normal) +Progress is not displayed Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java 2010-12-11 11:49:00 UTC (rev 4029) @@ -44,8 +44,10 @@ private Handler mHandler = new Handler(); private String actualDir = ""; + private static ArrayList<ReceiveDirectoryXmlHandler.DirItems> musicList; - + private static ReceiveDirectoryXmlHandler.DirItems selectedItem; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -55,7 +57,7 @@ mHandler.postDelayed(mUpdateTimeTask, 100); GridView gridview = (GridView) findViewById(R.id.music_grid); - gridview.setAdapter(new ImageAdapter2(MusicDir.this)); + gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { @@ -66,14 +68,16 @@ musicItem music = (musicItem) iv.getTag(); if (music.typ == "item") { - // Picturesfullscreen.selectedPicture = position - 1; - // Intent myIntent = new Intent(MusicDir.this, - // Picturesfullscreen.class); - // startActivityForResult(myIntent, 0); + selectedItem = musicList.get(position); + PostAddFile(selectedItem.File); + + Toast.makeText(MusicDir.this, + selectedItem.File + " has been added", Toast.LENGTH_SHORT).show(); + } if (music.typ == "folder") { - actualDir += music.title + "/"; + actualDir += music.title.replaceAll(" ", "%20") + "/"; mHandler.removeCallbacks(mUpdateTimeTask); mHandler.postDelayed(mUpdateTimeTask, 0); @@ -93,17 +97,32 @@ mHandler.removeCallbacks(mUpdateTimeTask); mHandler.postDelayed(mUpdateTimeTask, 0); } - } }); } + public void PostAddFile(String Filename) { + + PostWebserver post = new PostWebserver(Settings.Server, Settings.Port); + + String xml = ""; + + xml += "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; + xml += "<message>"; + xml += "<command>ADD_MUSIC</command>"; + xml += "<filename>" + Filename + "</filename>"; + xml += "<artist></artist>"; + xml += "<title>" + Filename + "</title>"; + xml += "<duration>0</duration>"; + xml += "</message>"; + + post.Post(xml); + } + + @Override public void onStart() { super.onStart(); - - // mHandler.removeCallbacks(mUpdateTimeTask); - // mHandler.postDelayed(mUpdateTimeTask, 100); } private Runnable mUpdateTimeTask = new Runnable() { @@ -124,7 +143,7 @@ .show(); } else { GridView gridview = (GridView) findViewById(R.id.music_grid); - gridview.invalidateViews(); + gridview.setAdapter(new ImageAdapter2(this)); } } @@ -158,52 +177,51 @@ if (convertView == null) { // if it's not recycled, initialize some // attributes - if (position > 0) { - position = position - 1; + LayoutInflater li = LayoutInflater.from(mContext); + v = li.inflate(R.layout.icon, null); + } else { + v = convertView; + } - DirItems item1 = musicList.get(position); + if (position > 0) { + position = position - 1; - String txtName = item1.File; - Boolean isFolder = item1.isFolder; + DirItems item1 = musicList.get(position); - LayoutInflater li = LayoutInflater.from(mContext); - v = li.inflate(R.layout.icon, null); + String txtName = item1.File; + Boolean isFolder = item1.isFolder; - TextView tv = (TextView) v.findViewById(R.id.icon_text); - tv.setText(txtName); + TextView tv = (TextView) v.findViewById(R.id.icon_text); + tv.setText(txtName); - ImageView iv = (ImageView) v.findViewById(R.id.icon_image); - - if (isFolder) { - iv.setImageResource(R.drawable.folder); - musicItem item = new musicItem(); - item.title = txtName; - item.typ = "folder"; - iv.setTag(item); - } else { - iv.setImageResource(R.drawable.audio); - musicItem item = new musicItem(); - item.title = txtName; - item.typ = "item"; - iv.setTag(item); - } - } else { - LayoutInflater li = LayoutInflater.from(mContext); - v = li.inflate(R.layout.icon, null); + ImageView iv = (ImageView) v.findViewById(R.id.icon_image); - TextView tv = (TextView) v.findViewById(R.id.icon_text); - tv.setText(".."); - - ImageView iv = (ImageView) v.findViewById(R.id.icon_image); - iv.setImageResource(R.drawable.folderback); + if (isFolder) { + iv.setImageResource(R.drawable.folder); musicItem item = new musicItem(); - item.title = ".."; - item.typ = "oneup"; + item.title = txtName; + item.typ = "folder"; iv.setTag(item); + } else { + iv.setImageResource(R.drawable.audio); + musicItem item = new musicItem(); + item.title = txtName; + item.typ = "item"; + iv.setTag(item); } + } else { + LayoutInflater li = LayoutInflater.from(mContext); + v = li.inflate(R.layout.icon, null); - } else { - v = convertView; + TextView tv = (TextView) v.findViewById(R.id.icon_text); + tv.setText(".."); + + ImageView iv = (ImageView) v.findViewById(R.id.icon_image); + iv.setImageResource(R.drawable.folderback); + musicItem item = new musicItem(); + item.title = ".."; + item.typ = "oneup"; + iv.setTag(item); } return v; Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2010-12-11 11:49:00 UTC (rev 4029) @@ -31,6 +31,7 @@ import android.content.SharedPreferences; import android.content.res.AssetManager; import android.os.Bundle; +import android.os.Handler; import android.os.Vibrator; import android.view.View; import android.widget.*; @@ -38,7 +39,8 @@ public class main extends Activity { private static final String PREFS_PRIVATE = "PREFS_MP_REMOTE"; - + private Handler mHandler = new Handler(); + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -162,4 +164,48 @@ v.vibrate(100); } } + + @Override + public void onStart() { + super.onStart(); + + mHandler.removeCallbacks(mUpdateTimeTask); + mHandler.postDelayed(mUpdateTimeTask, 1000); + } + + @Override + public void onPause() { + super.onPause(); + + mHandler.removeCallbacks(mUpdateTimeTask); + } + + private Runnable mUpdateTimeTask = new Runnable() { + public void run() { + update(); + mHandler.postDelayed(mUpdateTimeTask, 1000); + } + }; + + private void update() { + SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE, + MODE_PRIVATE); + + String HttpServer = settings.getString("Server", "192.168.0.30"); + String HttpPort = settings.getString("Port", "8200"); + + nowplayinghandler handler = nowplayinghandler.getinstance(); + handler.setconnection(HttpServer, HttpPort); + handler.fetchdata(); + + String display = "nothing playing"; + TextView txt0 = (TextView) findViewById(R.id.main_now_playing); + + if ((nowplayinghandler.PlayerState != null) && + (!nowplayinghandler.PlayerState.equals("no player active"))) { + display = nowplayinghandler.Artist + " - " + nowplayinghandler.Title; + } + txt0.setText(display); + } + } \ No newline at end of file Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java 2010-12-11 11:49:00 UTC (rev 4029) @@ -47,7 +47,7 @@ btn1.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { - PostCommand("previous"); + PostCommand("prevItem"); } }); btn2.setOnClickListener(new View.OnClickListener() { @@ -63,7 +63,7 @@ }); btn5.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { - PostCommand("next"); + PostCommand("nextItem"); } }); btn6.setOnClickListener(new View.OnClickListener() { Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylist.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylist.java 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylist.java 2010-12-11 11:49:00 UTC (rev 4029) @@ -117,7 +117,7 @@ public void onClick(DialogInterface dialog, int item) { switch (item) { case 0: - + PostDeleteItem(selectedItem.Filename); mHandler.postDelayed(mUpdateTimeTask, 100); Toast.makeText(nowplaylist.this, selectedItem.Title + " has been deleted", Toast.LENGTH_SHORT).show(); @@ -157,7 +157,7 @@ post.Post(xml); } - public void PostAddItem(ReceiveDbXmlHandler.DbItems Item) { + public void PostDeleteItem(String Filename) { PostWebserver post = new PostWebserver(Settings.Server, Settings.Port); @@ -165,11 +165,8 @@ xml += "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; xml += "<message>"; - xml += "<command>ADD_MUSIC</command>"; - xml += "<filename>" + Item.Filename + "</filename>"; - xml += "<artist>" + Item.Artist + "</artist>"; - xml += "<title>" + Item.Title + "</title>"; - xml += "<duration>" + Item.Duration + "</duration>"; + xml += "<command>DELETE_MUSIC</command>"; + xml += "<filename>" + Filename + "</filename>"; xml += "</message>"; post.Post(xml); Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylistXmlHandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylistXmlHandler.java 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylistXmlHandler.java 2010-12-11 11:49:00 UTC (rev 4029) @@ -45,11 +45,13 @@ if (localName == "Typ") { item.Typ = currentValue; } + if (localName == "Filename") { + item.Filename = currentValue; + } if (localName == "Item") { nowplaylisthandler.PlayList.add(item); item = null; } - } /** Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylisthandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylisthandler.java 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylisthandler.java 2010-12-11 11:49:00 UTC (rev 4029) @@ -31,6 +31,7 @@ public String Duration = ""; public String Played = ""; public String Typ = ""; + public String Filename = ""; } public static nowplaylisthandler getinstance() { Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java 2010-12-11 11:49:00 UTC (rev 4029) @@ -59,6 +59,7 @@ mHandler.postDelayed(mUpdateTimeTask, 100); GridView gridview = (GridView) findViewById(R.id.GridView01); + gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs =================================================================== --- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-11 09:50:46 UTC (rev 4028) +++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-12-11 11:49:00 UTC (rev 4029) @@ -365,8 +365,28 @@ #region player if (data["command"] == "ACTION_PLAY") { - Action action = new Action(Action.ActionType.ACTION_PLAY, 0, 0); - GUIGraphicsContext.OnAction(action); + PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer; + + if (g_Player.Playing) + { + Action action = new Action(Action.ActionType.ACTION_PAUSE, 0, 0); + GUIGraphicsContext.OnAction(action); + } + else + { + if (playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_NONE) + { + playlistPlayer.CurrentPlaylistType = PlayListType.PLAYLIST_MUSIC; + + PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC); + if (playList.Count > 0) playlistPlayer.Play(0); + } + else + { + Action action = new Action(Action.ActionType.ACTION_PLAY, 0, 0); + GUIGraphicsContext.OnAction(action); + } + } } if (data["command"] == ("ACTION_STOP")) { @@ -517,6 +537,8 @@ #endregion #region playlist + + #region add a item if (data["command"] == ("ADD_MUSIC")) { // add music @@ -557,7 +579,22 @@ } } + #endregion + #region delete a item + if (data["command"] == ("DELETE_MUSIC")) + { + // deltete music + // parameter = filename + + PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer; + PlayList playList = playlistPlayer.GetPlaylist(PlayListType.PLAYLIST_MUSIC); + + playList.Remove(data["filename"]); + } + #endregion + + #region clear playlist if (data["command"] == ("REMOVE_PLAYLIST")) { // add music @@ -580,6 +617,7 @@ playList.Clear(); } + #endregion #endregion } @@ -1383,6 +1421,7 @@ msg += "<Duration>" + duration + "</Duration>\r\n"; msg += "<Played>" + played.ToString() + "</Played>\r\n"; msg += "<Typ>" + typ + "</Typ>\r\n"; + msg += "<Filename>" + file + "</Filename>\r\n"; msg += "</Item>\r\n"; } Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |