From: <Rol...@us...> - 2010-12-06 12:47:36
|
Revision: 4011 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4011&view=rev Author: Rollsroyc3 Date: 2010-12-06 12:47:28 +0000 (Mon, 06 Dec 2010) Log Message: ----------- Removed Paths: ------------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MediaPlayerControl.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDbHandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDbXmlHandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDirHandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDirectoryXmlHandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveHandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_01.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Settings.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/httpHandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicAlbum.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicArtist.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicResults.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicSong.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicTab.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaying.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplayingXmlHandler.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplayinghandler.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/Android/MediaPortalRemote/src/mediaportal/remote/picturesfullscreen.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/setup.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/splash.java Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MediaPlayerControl.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MediaPlayerControl.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MediaPlayerControl.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,44 +0,0 @@ -package mediaportal.remote; - -import java.io.IOException; - -import android.media.MediaPlayer; - -public class mediaplayercontrol { - - private static mediaplayercontrol instance; - private static MediaPlayer mp; - - public static mediaplayercontrol getinstance() { - if (mp == null) - mp = new MediaPlayer(); - if (instance == null) - instance = new mediaplayercontrol(); - return instance; - } - - public void Stop() - { - mp.stop(); - } - public void Play(String Path) - { - - try { -// mp.stop(); - - mp.setDataSource(Path); - mp.prepare(); - mp.start(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - } - -} Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/MusicDir.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.util.ArrayList; -import mediaportal.remote.R; -import mediaportal.remote.receivedirectoryxmlhandler.DirItems; -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.os.Handler; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.BaseAdapter; -import android.widget.GridView; -import android.widget.ImageView; -import android.widget.TextView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.Toast; - -public class musicdir extends Activity { - - private Handler mHandler = new Handler(); - private String actualDir = ""; - private static ArrayList<receivedirectoryxmlhandler.DirItems> musicList; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.music); - - mHandler.removeCallbacks(mUpdateTimeTask); - 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) { - - // TextView tv = (TextView) v.findViewById(R.id.icon_text); - // ImageView - ImageView iv = (ImageView) v.findViewById(R.id.icon_image); - musicItem music = (musicItem) iv.getTag(); - - if (music.typ == "item") { - // Picturesfullscreen.selectedPicture = position - 1; - // Intent myIntent = new Intent(MusicDir.this, - // Picturesfullscreen.class); - // startActivityForResult(myIntent, 0); - } - - if (music.typ == "folder") { - actualDir += music.title + "/"; - - mHandler.removeCallbacks(mUpdateTimeTask); - mHandler.postDelayed(mUpdateTimeTask, 0); - } - - if (music.typ == "oneup") { - if (actualDir.endsWith("/")) - actualDir = actualDir.substring(0, - actualDir.length() - 1); - - int x = actualDir.lastIndexOf("/"); - if (x >= 0) { - actualDir = actualDir.substring(0, x + 1); - } else - actualDir = ""; - - mHandler.removeCallbacks(mUpdateTimeTask); - mHandler.postDelayed(mUpdateTimeTask, 0); - } - - } - }); - } - - @Override - public void onStart() { - super.onStart(); - - // mHandler.removeCallbacks(mUpdateTimeTask); - // mHandler.postDelayed(mUpdateTimeTask, 100); - } - - private Runnable mUpdateTimeTask = new Runnable() { - public void run() { - update(); - } - }; - - private void update() { - - Log.d("update music dir", "do update folder : " + actualDir); - - receivedirhandler h = receivedirhandler.getinstance(); - musicList = h.getMusicDir(actualDir); - - if (musicList.size() == 0) { - Toast.makeText(musicdir.this, "TIME OUT SERVER", Toast.LENGTH_SHORT) - .show(); - } else { - GridView gridview = (GridView) findViewById(R.id.music_grid); - gridview.invalidateViews(); - } - } - - public class ImageAdapter2 extends BaseAdapter { - private Context mContext; - public static final int ACTIVITY_CREATE = 10; - - public ImageAdapter2(Context c) { - mContext = c; - } - - public int getCount() { - if (musicList != null) - return musicList.size() + 1; - else - return 0; - } - - public Object getItem(int position) { - return null; - } - - public long getItemId(int position) { - return 0; - } - - // @Override - // create a new ImageView for each item referenced by the Adapter - public View getView(int position, View convertView, ViewGroup parent) { - View v; - if (convertView == null) { // if it's not recycled, initialize some - // attributes - - if (position > 0) { - position = position - 1; - - DirItems item1 = musicList.get(position); - - String txtName = item1.File; - Boolean isFolder = item1.isFolder; - - LayoutInflater li = LayoutInflater.from(mContext); - v = li.inflate(R.layout.icon, null); - - 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); - - 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); - } - - } else { - v = convertView; - } - - return v; - } - } - - public class musicItem { - public String title; - public String typ; - } - -} Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.io.IOException; - -import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.params.HttpConnectionParams; -import org.apache.http.params.HttpParams; - -public class postwebserver { - - public String httpServer = ""; - public String httpPort = ""; - - public postwebserver(String Server, String Port) { - httpServer = Server; - httpPort = Port; - } - - public boolean Post(String Data) { - - boolean result = false; - try { - HttpParams httpParameters = new BasicHttpParams(); - HttpConnectionParams.setConnectionTimeout(httpParameters, 5000); - HttpConnectionParams.setSoTimeout(httpParameters, 5000); - - DefaultHttpClient httpclient = new DefaultHttpClient(httpParameters); - HttpPost httppost = new HttpPost("http://" + httpServer + ":" - + httpPort); - - StringEntity se = new StringEntity(Data, "UTF-8"); - se.setContentType("application/atom+xml"); - - httppost.setEntity(se); - - @SuppressWarnings("unused") - HttpResponse response; - response = httpclient.execute(httppost); - - result = true; - } catch (ClientProtocolException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - return result; - } -} Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDbHandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDbHandler.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDbHandler.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import mediaportal.remote.receivedbxmlhandler.DbItems; - -public class receivedbhandler { - - private static receivedbhandler instance; - - public int selectedMusic; - - public static receivedbhandler getinstance() { - if (instance == null) - instance = new receivedbhandler(); - return instance; - } - - public ArrayList<DbItems> GetAlbums() { - return fetchData("album.xml"); - } - - public ArrayList<DbItems> GetArtist() { - return fetchData("artist.xml"); - } - - public ArrayList<DbItems> GetSongs() { - return fetchData("song.xml"); - } - - public ArrayList<DbItems> GetSongsByArtist(String Artist) { - return fetchData("song.xml?artist=" + Artist); - } - - private ArrayList<DbItems> fetchData(String Data) { - - receivedbxmlhandler handler = new receivedbxmlhandler(); - receivehandler hand = new receivehandler(handler); - - try { - Data = URLEncoder.encode(Data, "UTF-8"); - } catch (UnsupportedEncodingException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - hand.readValues("/db_music/" + Data); - return handler.DbList; - } -} Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDbXmlHandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDbXmlHandler.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDbXmlHandler.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.util.ArrayList; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -public class receivedbxmlhandler extends DefaultHandler { - Boolean currentElement = false; - String currentValue = null; - - public ArrayList<DbItems> DbList = new ArrayList<DbItems>(); - - public static class DbItems - { - public String Title = ""; - public String Artist= ""; - public String Album= ""; - public String AlbumArtist= ""; - public String Track= ""; - public String Rating= ""; - public String Filename= ""; - } - private DbItems currentDbItem; - - /** - * Called when tag starts ( example:- <name>AndroidPeople</name> -- <name> ) - */ - @Override - public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException { - currentElement = true; - - currentValue = ""; - if (localName == "Database")DbList = new ArrayList<DbItems>(); - if (localName == "Item")currentDbItem = new DbItems(); - } - - /** - * Called when tag closing ( example:- <name>AndroidPeople</name> -- </name> ) - */ - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - - currentElement = false; - - /** set value */ - if (localName == "Artist") {currentDbItem.Artist =currentValue;} - if (localName == "Title") {currentDbItem.Title =currentValue;} - if (localName == "Album") {currentDbItem.Album =currentValue;} - if (localName == "AlbumArtist") {currentDbItem.AlbumArtist =currentValue;} - if (localName == "Track") {currentDbItem.Track =currentValue;} - if (localName == "Rating") {currentDbItem.Rating =currentValue;} - if (localName == "Filename") {currentDbItem.Filename =currentValue;} - - if (localName == "Item")DbList.add(currentDbItem); - } - - /** - * Called to get tag characters ( example:- <name>AndroidPeople</name> -- to get - * AndroidPeople Character ) - */ - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - if (currentElement) { - currentValue = new String(ch, start, length); - currentElement = false; - } - - } - -} \ No newline at end of file Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDirHandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDirHandler.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDirHandler.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.util.ArrayList; -import mediaportal.remote.receivedirectoryxmlhandler.DirItems; - -public class receivedirhandler { - - private static receivedirhandler instance; - private static String actualDir; - - public static receivedirhandler getinstance() { - if (instance == null) - instance = new receivedirhandler(); - return instance; - } - - public ArrayList<DirItems> getMusicDir(String Dir) { - - return fetchData("/music/" + Dir); - } - - public ArrayList<DirItems> getPictureDir(String Dir) { - - return fetchData("/pictures/" + Dir); - } - - public ArrayList<DirItems> gotodir(String dir) { - actualDir += "/" + dir; - return fetchData(actualDir); - } - - public ArrayList<DirItems> oneup() { - int x = actualDir.lastIndexOf("/"); - if (x >= 0) { - actualDir = actualDir.substring(0, x); - } - return fetchData(actualDir); - } - - private ArrayList<DirItems> fetchData(String Data) { - - receivedirectoryxmlhandler handler = new receivedirectoryxmlhandler(); - receivehandler hand = new receivehandler(handler); - hand.readValues(Data); - - return handler.DirList; - } -} Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDirectoryXmlHandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDirectoryXmlHandler.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveDirectoryXmlHandler.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.util.ArrayList; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -import android.graphics.Bitmap; - -public class receivedirectoryxmlhandler extends DefaultHandler { - Boolean currentElement = false; - String currentValue = null; - - public ArrayList<DirItems> DirList = new ArrayList<DirItems>(); - - public static class DirItems - { - public boolean isFolder = false; - public String File= ""; - public Bitmap Picture = null; - } - private DirItems currentdirItem; - - /** - * Called when tag starts ( example:- <name>AndroidPeople</name> -- <name> ) - */ - @Override - public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException { - currentElement = true; - - currentValue = ""; - if (localName == "Directory") {DirList = new ArrayList<DirItems>(); } - if (localName == "Folder") {currentdirItem = new DirItems(); } - if (localName == "File") {currentdirItem = new DirItems(); } - } - - /** - * Called when tag closing ( example:- <name>AndroidPeople</name> -- </name> ) - */ - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - - currentElement = false; - - /** set value */ - if (localName == "Folder") { - currentdirItem.isFolder = true; - currentdirItem.File = currentValue; - DirList.add(currentdirItem); - } - if (localName == "File") { - currentdirItem.isFolder = false; - currentdirItem.File = currentValue; - DirList.add(currentdirItem); - } - } - - /** - * Called to get tag characters ( example:- <name>AndroidPeople</name> -- to get - * AndroidPeople Character ) - */ - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - if (currentElement) { - currentValue = new String(ch, start, length); - currentElement = false; - } - - } - -} \ No newline at end of file Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveHandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveHandler.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/ReceiveHandler.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; - -public class receivehandler { - - private org.xml.sax.ContentHandler _handler; - - public receivehandler(org.xml.sax.ContentHandler Handler) { - _handler = Handler; - } - - public void readValues(String Url) - { - String fileUrl = "http://" + Settings.Server + ":" + Settings.Port + Url; - - URL myFileUrl = null; - try { - myFileUrl = new URL(fileUrl); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - try { - HttpURLConnection conn = (HttpURLConnection) myFileUrl - .openConnection(); - conn.setConnectTimeout(5000); - conn.setReadTimeout(10000); - conn.setDoInput(true); - conn.connect(); - - InputStream is = conn.getInputStream(); - - SAXParserFactory spf = SAXParserFactory.newInstance(); - SAXParser sp = null; - try { - sp = spf.newSAXParser(); - } catch (ParserConfigurationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SAXException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - XMLReader reader = null; - try { - reader = sp.getXMLReader(); - } catch (SAXException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - reader.setContentHandler((org.xml.sax.ContentHandler) _handler); - try { - reader.parse(new InputSource(is)); - } catch (SAXException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - is.close(); - sp.reset(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - } - -} Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_01.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_01.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_01.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,240 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.io.IOException; -import java.io.InputStream; - -import mediaportal.remote.R; - -import android.app.Activity; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.res.AssetManager; -import android.os.Bundle; -import android.view.GestureDetector; -import android.view.MotionEvent; -import android.view.View; -import android.view.GestureDetector.OnGestureListener; -import android.widget.Button; - -public class remote_01 extends Activity implements OnGestureListener { - - public static final String PREFS_PRIVATE = "PREFS_MP_REMOTE"; - private String HttpServer = ""; - private String HttpPort = ""; - - private GestureDetector gestureScanner; - private static final int SWIPE_MIN_DISTANCE = 120; - private static final int SWIPE_MAX_OFF_PATH = 250; - private static final int SWIPE_THRESHOLD_VELOCITY = 200; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.remote01); - - gestureScanner = new GestureDetector(this); - - SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE, - MODE_PRIVATE); - - HttpServer = settings.getString("Server", "192.168.0.30"); - HttpPort = settings.getString("Port", "8200"); - - Button can = (Button) findViewById(R.id.btnBack); - can.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("previousMenu"); - } - }); - - Button menu = (Button) findViewById(R.id.btnMenu); - menu.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("contextMenu"); - } - }); - - Button home = (Button) findViewById(R.id.btnHome); - home.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("parentDir"); - } - }); - - Button info = (Button) findViewById(R.id.btnInfo); - info.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("showInfo"); - } - }); - - Button left = (Button) findViewById(R.id.btnLeft); - left.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("moveLeft"); - } - }); - - Button right = (Button) findViewById(R.id.btnRight); - right.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("moveRight"); - } - }); - - Button up = (Button) findViewById(R.id.btnUp); - up.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("moveUp"); - } - }); - - Button down = (Button) findViewById(R.id.btnDown); - down.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("moveDown"); - } - }); - - Button ok = (Button) findViewById(R.id.btnOk); - ok.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("selectItem"); - } - }); - - Button play = (Button) findViewById(R.id.btnPlay); - play.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("play"); - } - }); - - Button pause = (Button) findViewById(R.id.btnPause); - pause.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("pause"); - } - }); - - Button stop = (Button) findViewById(R.id.btnStop); - stop.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("stop"); - } - }); - - Button skipForw = (Button) findViewById(R.id.btnSkipForw); - skipForw.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("nextItem"); - } - }); - - Button skipBack = (Button) findViewById(R.id.btnSkipBack); - skipBack.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("prevItem"); - } - }); - - Button fForw = (Button) findViewById(R.id.btnFForw); - fForw.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("forward"); - } - }); - - Button fBackw = (Button) findViewById(R.id.btnFBack); - fBackw.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("rewind"); - } - }); - } - - public void PostCommand(String button) { - - postwebserver post = new postwebserver(HttpServer, HttpPort); - - AssetManager assetManager = getAssets(); - String xml = ""; - - try { - InputStream inputStream = null; - inputStream = assetManager.open("cmd_" + button + ".xml"); - - int x = inputStream.read(); - - while (x != -1) { - xml = xml + (char) x; - x = inputStream.read(); - } - post.Post(xml); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public boolean onTouchEvent(MotionEvent me) { - return gestureScanner.onTouchEvent(me); - } - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, - float velocityY) { - try { - if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) - return false; - // right to left swipe - if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE - && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { - Intent myIntent = new Intent(this, remote_02.class); - startActivityForResult(myIntent, 0); - - } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE - && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { - - } - } catch (Exception e) { - // nothing - } - return false; - } - - public boolean onDown(MotionEvent arg0) { - return true; - } - public void onLongPress(MotionEvent arg0) { - } - public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, - float arg3) { - return false; - } - public void onShowPress(MotionEvent arg0) { - } - public boolean onSingleTapUp(MotionEvent arg0) { - return false; - } -} \ No newline at end of file Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.io.IOException; -import java.io.InputStream; -import mediaportal.remote.R; -import android.app.Activity; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.res.AssetManager; -import android.os.Bundle; -import android.view.GestureDetector; -import android.view.MotionEvent; -import android.view.View; -import android.view.GestureDetector.OnGestureListener; -import android.widget.Button; - -public class remote_02 extends Activity implements OnGestureListener { - - public static final String PREFS_PRIVATE = "PREFS_MP_REMOTE"; - private String HttpServer = ""; - private String HttpPort = ""; - - private GestureDetector gestureScanner; - private static final int SWIPE_MIN_DISTANCE = 120; - private static final int SWIPE_MAX_OFF_PATH = 250; - private static final int SWIPE_THRESHOLD_VELOCITY = 200; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.remote02); - - gestureScanner = new GestureDetector(this); - - SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE, - MODE_PRIVATE); - - HttpServer = settings.getString("Server", "192.168.0.30"); - HttpPort = settings.getString("Port", "8200"); - - Button btnVolumeUp = (Button) findViewById(R.id.btnVolumeUp); - btnVolumeUp.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("volumeUp"); - } - }); - Button btnVolumeDown = (Button) findViewById(R.id.btnVolumeDown); - btnVolumeDown.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("volumeDown"); - } - }); - Button btnVolumeMute = (Button) findViewById(R.id.btnVolumeMute); - btnVolumeMute.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("volumeMute"); - } - }); - - Button btnChannelUp = (Button) findViewById(R.id.btnChannelUp); - btnChannelUp.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("nextChannel"); - } - }); - Button btnChannelDown = (Button) findViewById(R.id.btnChannelDown); - btnChannelDown.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("prevChannel"); - } - }); - - Button btnExit = (Button) findViewById(R.id.btnExit); - btnExit.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("exit"); - } - }); - Button btnSuspend = (Button) findViewById(R.id.btnSuspend); - btnSuspend.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("suspend"); - } - }); - Button btnHibernate = (Button) findViewById(R.id.btnHibernate); - btnHibernate.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("hibernate"); - } - }); - Button btnRestart = (Button) findViewById(R.id.btnRestart); - btnRestart.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("restart"); - } - }); - Button btnShutOff = (Button) findViewById(R.id.btnShutOff); - btnShutOff.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("shutoff"); - } - }); - - Button btnWakeOnLan = (Button) findViewById(R.id.btnWakeOnLan); - btnWakeOnLan.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - PostCommand("wakeonlan"); - } - }); - } - - - public void PostCommand(String button) { - - postwebserver post = new postwebserver(HttpServer, HttpPort); - - AssetManager assetManager = getAssets(); - String xml = ""; - - try { - InputStream inputStream = null; - inputStream = assetManager.open("cmd_" + button + ".xml"); - - int x = inputStream.read(); - - while (x != -1) { - xml = xml + (char) x; - x = inputStream.read(); - } - post.Post(xml); - } catch (IOException e) { - e.printStackTrace(); - } - } - - @Override - public boolean onTouchEvent(MotionEvent me) { - return gestureScanner.onTouchEvent(me); - } - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, - float velocityY) { - try { - if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH) - return false; - // right to left swipe - if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE - && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { - - - } else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE - && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) { - Intent myIntent = new Intent(this, remote_01.class); - startActivityForResult(myIntent, 0); - } - } catch (Exception e) { - // nothing - } - return false; - } - - public boolean onDown(MotionEvent arg0) { - return true; - } - public void onLongPress(MotionEvent arg0) { - } - public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, - float arg3) { - return false; - } - public void onShowPress(MotionEvent arg0) { - } - public boolean onSingleTapUp(MotionEvent arg0) { - return false; - } -} \ No newline at end of file Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Settings.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Settings.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Settings.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -public class Settings{ - - public static String Server = "192.168.0.30"; - public static String Port = "8200"; - public static String MacId = "11-22-33-44-55-66"; - -} Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/httpHandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/httpHandler.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/httpHandler.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,116 +0,0 @@ -package mediaportal.remote; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; - -import org.apache.http.util.ByteArrayBuffer; - -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.os.Environment; - -public class httphandler { - - String extStorageDirectory; - - public httphandler() { - - } - - public InputStream openHttpConnection(String urlStr) { - InputStream in = null; - int resCode = -1; - - try { - URL url = new URL(urlStr); - URLConnection urlConn = url.openConnection(); - - if (!(urlConn instanceof HttpURLConnection)) { - throw new IOException("URL is not an Http URL"); - } - - HttpURLConnection httpConn = (HttpURLConnection) urlConn; - httpConn.setAllowUserInteraction(false); - httpConn.setInstanceFollowRedirects(true); - httpConn.setRequestMethod("GET"); - httpConn.connect(); - resCode = httpConn.getResponseCode(); - - if (resCode == HttpURLConnection.HTTP_OK) { - in = httpConn.getInputStream(); - } - - } catch (MalformedURLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - return in; - } - - public Bitmap DownloadImage(String urlStr) { - - final String url = urlStr; - Bitmap bitmap = null; - - InputStream in = null; - - try { - in = openHttpConnection(url); - bitmap = BitmapFactory.decodeStream(in); - if (in != null) - in.close(); - } catch (IOException e1) { - e1.printStackTrace(); - } - - return bitmap; - } - - public void DownloadFile() { - extStorageDirectory = Environment.getExternalStorageDirectory() - .toString(); - - try { - InputStream in = openHttpConnection("http://"+ Settings.Server + ":" + Settings.Port + - "/music/Clementi_Sonatina_Op.36_No.1_Movement_1.mp3"); - - // BufferedInputStream bis = new BufferedInputStream(in); - ByteArrayBuffer baf = new ByteArrayBuffer(50); - //int current = 0; - - byte[] bb = new byte[1024]; - int l = in.read(bb, 0, 1024); - - while (l > -0) { - baf.append(bb, 0, l); - l = in.read(bb, 0, 1024); - } - - OutputStream outStream = null; - File file = new File(extStorageDirectory, "test.mp3"); - - outStream = new FileOutputStream(file); - outStream.write(baf.toByteArray()); - outStream.flush(); - outStream.close(); - - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - -} Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.io.IOException; - -import mediaportal.remote.R; -import android.app.Activity; -import android.content.Intent; -import android.content.SharedPreferences; -import android.media.MediaPlayer; -import android.os.Bundle; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.*; - -public class main extends Activity { - - private static final String PREFS_PRIVATE = "PREFS_MP_REMOTE"; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.main); - - SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE, - MODE_PRIVATE); - - Settings.Server = settings.getString("Server", "192.168.0.30"); - Settings.Port = settings.getString("Port", "8200"); - Settings.MacId = settings.getString("MacId", "11-22-33-44-55-66"); - - Toast.makeText(getBaseContext(), "Press 'menu' for settings", - Toast.LENGTH_LONG).show(); - - Button btnPictures = (Button) findViewById(R.id.MainButton1); - btnPictures.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - Intent myIntent = new Intent(view.getContext(), pictures.class); - startActivityForResult(myIntent, 0); - } - }); - - Button btnMusic = (Button) findViewById(R.id.MainButton2); - btnMusic.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - Intent myIntent = new Intent(view.getContext(), musictab.class); - startActivityForResult(myIntent, 0); - } - }); - - Button btnVideo = (Button) findViewById(R.id.MainButton3); - btnVideo.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - MediaPlayer mp = new MediaPlayer(); - try { - String p = "http://" - + Settings.Server - + ":" - + Settings.Port - + "/music/" - + "laserkraft_3d_-_nein_mann.mp3"; - mp.setDataSource(p); - mp.prepare(); - mp.start(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - }); - - Button btnRemote = (Button) findViewById(R.id.MainButton4); - btnRemote.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - Intent myIntent = new Intent(view.getContext(), remote_01.class); - startActivityForResult(myIntent, 0); - } - }); - - Button btnNowPlaying = (Button) findViewById(R.id.MainButton5); - btnNowPlaying.setOnClickListener(new View.OnClickListener() { - public void onClick(View view) { - Intent myIntent = new Intent(view.getContext(), - nowplaying.class); - startActivityForResult(myIntent, 0); - } - }); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - menu.add(0, 111, 0, "Settings"); - menu.add(0, 112, 0, "Exit"); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case 111: - Intent myIntent = new Intent(this, setup.class); - startActivityForResult(myIntent, 0); - return true; - case 112: - this.finish(); - return true; - } - return true; - } -} \ No newline at end of file Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicAlbum.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicAlbum.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicAlbum.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.util.ArrayList; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.os.Bundle; -import android.os.Handler; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.BaseAdapter; -import android.widget.ListView; -import android.widget.TextView; -import android.widget.Toast; - -public class musicalbum extends Activity { - - private Handler mHandler = new Handler(); - - private static ArrayList<receivedbxmlhandler.DbItems> albumList; - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.music_album); - - ListView l1 = (ListView) findViewById(R.id.list_album); - l1.setAdapter(new EfficientAdapter(musicalbum.this)); - - ColorDrawable divcolor = new ColorDrawable(Color.DKGRAY); - l1.setDivider(divcolor); - l1.setDividerHeight(2); - - l1.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { - public boolean onItemLongClick(AdapterView<?> arg0, View arg1, - int arg2, long arg3) { - // TODO Auto-generated method stub - return false; - } - }); - } - - @Override - public void onStart() { - super.onStart(); - - mHandler.removeCallbacks(mUpdateTimeTask); - mHandler.postDelayed(mUpdateTimeTask, 100); - } - - private Runnable mUpdateTimeTask = new Runnable() { - public void run() { - update(); - } - }; - - private void update() { - - Log.d("update album", "do update"); - - receivedbhandler handler = receivedbhandler.getinstance(); - albumList = handler.GetAlbums(); - - if (albumList.size() == 0) { - Toast.makeText(musicalbum.this, "TIME OUT SERVER", - Toast.LENGTH_LONG).show(); - } - - ListView l1 = (ListView) findViewById(R.id.list_album); - l1.invalidateViews(); - } - - private static class EfficientAdapter extends BaseAdapter { - - private LayoutInflater mInflater; - - public EfficientAdapter(Context context) { - mInflater = LayoutInflater.from(context); - } - - public int getCount() { - if (albumList != null) - return albumList.size(); - else - return 0; - } - - public Object getItem(int position) { - return position; - } - - public long getItemId(int position) { - return position; - } - - public View getView(int position, View convertView, ViewGroup parent) { - ViewHolder holder; - - if (convertView == null) { - convertView = mInflater.inflate(R.layout.list_item, null); - holder = new ViewHolder(); - holder.text = (TextView) convertView - .findViewById(R.id.TextView01); - holder.text2 = (TextView) convertView - .findViewById(R.id.TextView02); - - convertView.setTag(holder); - } else { - holder = (ViewHolder) convertView.getTag(); - } - - receivedbxmlhandler.DbItems item = albumList.get(position); - - holder.text.setText(String.valueOf(position + 1)); - holder.text2.setText(item.Album + " - " + item.Artist); - - convertView.setBackgroundColor((position & 1) == 1 ? Color.WHITE - : Color.LTGRAY); - - return convertView; - } - - static class ViewHolder { - TextView text; - TextView text2; - } - } - -} \ No newline at end of file Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicArtist.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicArtist.java 2010-12-06 12:45:19 UTC (rev 4010) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/musicArtist.java 2010-12-06 12:47:28 UTC (rev 4011) @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2005-2010 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -package mediaportal.remote; - -import java.util.ArrayList; -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.graphics.Color; -import android.graphics.drawable.ColorDrawable; -import android.os.Bundle; -import android.os.Handler; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.BaseAdapter; -import android.widget.ListView; -import android.widget.TextView; -import android.widget.Toast; - -public class musicartist extends Activity{ - - public static final String PREFS_PRIVATE = "PREFS_MP_REMOTE"; - private Handler mHandler = new Handler(); - - private static ArrayList<receivedbxmlhandler.DbItems> artistList; - - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.music_artist); - - ListView l1 = (ListView) findViewById(R.id.list_artist); - l1.setAdapter(new EfficientAdapter(musicartist.this)); - - l1.setOnItemClickListener(new AdapterView.OnItemClickListener() - { - //@override - public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, - long arg3) { - - receivedbxmlhandler.DbItems item = artistList.get(arg2); - musicresults.Select = item.Artist; - Intent myIntent = new Intent(arg1.getContext(), musicresults.class); - startActivityForResult(myIntent, 0); - } - } - ); - - ColorDrawable divcolor = new ColorDrawable(Color.DKGRAY); - l1.setDivider(divcolor); - l1.setDividerHeight(2); - } - - @Override - public void onStart() { - super.onStart(); - - mHandler.removeCallbacks(mUpdateTimeTask); - mHandler.postDelayed(mUpdateTimeTask, 100); - } - private Runnable mUpdateTimeTask = new Runnable() { - public void run() { - update(); - } - }; - - private void update() { - - Log.d("update artist", "do update"); - - receivedbhandler handler = receivedbhandler .getinstance(); - artistList = handler.GetArtist(); - - if (artistList.size() == 0) { - Toast.makeText(musicartist.this, "TIME OUT SERVER", - Toast.LENGTH_LONG).show(); - } - - ListView l1 = (ListView) findViewById(R.id.list_artist); - l1.invalidateViews(); - } - - private static class Efficie... [truncated message content] |