From: <kro...@us...> - 2010-11-30 07:11:33
|
Revision: 3987 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3987&view=rev Author: kroko_koenig Date: 2010-11-30 07:11:25 +0000 (Tue, 30 Nov 2010) Log Message: ----------- after some real test Modified Paths: -------------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/AndroidManifest.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplayinghandler.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/Server/AndroidRemote/AndroidServer.cs trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs trunk/plugins/AndroidRemote/Server/AndroidRemote.suo Added Paths: ----------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote01.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote02.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.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 Removed Paths: ------------- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote.xml trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/remote.java Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/AndroidManifest.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/AndroidManifest.xml 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/AndroidManifest.xml 2010-11-30 07:11:25 UTC (rev 3987) @@ -2,7 +2,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="mediaportal.remote" android:versionCode="1" android:versionName="1.0"> - <application android:icon="@drawable/icon" android:theme="@android:style/Theme.NoTitleBar"> + <application android:icon="@drawable/icon" android:theme="@android:style/Theme.NoTitleBar" android:debuggable="true"> <activity android:name=".splash" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -15,7 +15,8 @@ <category android:name="android.intent.category.VIEW" /> </intent-filter> </activity> - <activity android:name=".remote"></activity> + <activity android:name=".Remote_01"></activity> + <activity android:name=".Remote_02"></activity> <activity android:name=".pictures"></activity> <activity android:name=".picturesfullscreen"></activity> <activity android:name=".music"></activity> Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/gen/mediaportal/remote/R.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -63,23 +63,23 @@ public static final int MainButton5=0x7f050009; public static final int TextView01=0x7f050003; public static final int TextView02=0x7f050004; - public static final int btnBack=0x7f050037; - public static final int btnDown=0x7f050036; - public static final int btnFBack=0x7f050024; - public static final int btnFForw=0x7f050026; - public static final int btnHome=0x7f05002d; - public static final int btnInfo=0x7f05002f; - public static final int btnLeft=0x7f050031; - public static final int btnMenu=0x7f050035; - public static final int btnOk=0x7f050032; - public static final int btnPause=0x7f05002a; - public static final int btnPlay=0x7f050025; - public static final int btnReturnSetup=0x7f05003a; - public static final int btnRight=0x7f050033; - public static final int btnSkipBack=0x7f050028; - public static final int btnSkipForw=0x7f05002b; - public static final int btnStop=0x7f050029; - public static final int btnUp=0x7f05002e; + public static final int btnBack=0x7f050038; + public static final int btnDown=0x7f050037; + public static final int btnFBack=0x7f050025; + public static final int btnFForw=0x7f050027; + public static final int btnHome=0x7f05002e; + public static final int btnInfo=0x7f050030; + public static final int btnLeft=0x7f050032; + public static final int btnMenu=0x7f050036; + public static final int btnOk=0x7f050033; + public static final int btnPause=0x7f05002b; + public static final int btnPlay=0x7f050026; + public static final int btnReturnSetup=0x7f05003b; + public static final int btnRight=0x7f050034; + public static final int btnSkipBack=0x7f050029; + public static final int btnSkipForw=0x7f05002c; + public static final int btnStop=0x7f05002a; + public static final int btnUp=0x7f05002f; public static final int full_text=0x7f050011; public static final int icon_image=0x7f050001; public static final int icon_text=0x7f050002; @@ -88,6 +88,7 @@ public static final int list_result=0x7f05000e; public static final int list_song=0x7f05000f; public static final int music_grid=0x7f05000b; + public static final int naviRemote_text=0x7f050023; public static final int now_album=0x7f050015; public static final int now_artist=0x7f05001b; public static final int now_cd=0x7f050016; @@ -102,15 +103,15 @@ public static final int now_progress=0x7f050017; public static final int now_stop=0x7f05001d; public static final int now_title=0x7f05001a; - public static final int server_ip=0x7f050038; - public static final int server_port=0x7f050039; - public static final int title=0x7f05003b; + public static final int server_ip=0x7f050039; + public static final int server_port=0x7f05003a; + public static final int title=0x7f05003c; public static final int widget0=0x7f05000a; - public static final int widget00=0x7f050023; - public static final int widget01=0x7f050027; - public static final int widget02=0x7f05002c; - public static final int widget03=0x7f050030; - public static final int widget04=0x7f050034; + public static final int widget00=0x7f050024; + public static final int widget01=0x7f050028; + public static final int widget02=0x7f05002d; + public static final int widget03=0x7f050031; + public static final int widget04=0x7f050035; public static final int widget44=0x7f050000; } public static final class layout { @@ -127,10 +128,11 @@ public static final int picturesfullscreen=0x7f03000a; public static final int playingnow=0x7f03000b; public static final int playnowlist=0x7f03000c; - public static final int remote=0x7f03000d; - public static final int setup=0x7f03000e; - public static final int splash=0x7f03000f; - public static final int title=0x7f030010; + public static final int remote01=0x7f03000d; + public static final int remote02=0x7f03000e; + public static final int setup=0x7f03000f; + public static final int splash=0x7f030010; + public static final int title=0x7f030011; } public static final class string { public static final int app_name=0x7f040001; Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote.xml 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote.xml 2010-11-30 07:11:25 UTC (rev 3987) @@ -1,142 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout - android:id="@+id/widget0" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:background="@drawable/back" - android:orientation="vertical" - xmlns:android="http://schemas.android.com/apk/res/android"> - - <LinearLayout - android:id="@+id/widget00" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - > - - <Button android:id="@+id/btnFBack" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="FBack"> - </Button> - - <Button android:id="@+id/btnPlay" - android:layout_width="160dip" - android:layout_height="60dip" - android:text="Play"> - </Button> - - <Button android:id="@+id/btnFForw" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="FForw"> - </Button> - - </LinearLayout> - - <LinearLayout - android:id="@+id/widget01" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - > - <Button android:id="@+id/btnSkipBack" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="Skp -"> - </Button> - - <Button android:id="@+id/btnStop" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="Stop"> - </Button> - - <Button android:id="@+id/btnPause" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="Pause"> - </Button> - - <Button android:id="@+id/btnSkipForw" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="Skp +"> - </Button> - - </LinearLayout> - - <LinearLayout - android:id="@+id/widget02" - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - - <Button android:id="@+id/btnHome" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="Home"> - </Button> - - <Button android:id="@+id/btnUp" - android:layout_width="160dip" - android:layout_height="60dip" - android:background="@drawable/up_icon"> - </Button> - - <Button android:id="@+id/btnInfo" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="Info"> - </Button> - - </LinearLayout> - - <LinearLayout - android:id="@+id/widget03" - android:layout_width="fill_parent" - android:layout_height="wrap_content"> - - <Button android:id="@+id/btnLeft" - android:layout_width="80dip" - android:layout_height="120dip" - android:background="@drawable/back_icon"> - </Button> - - <Button android:id="@+id/btnOk" - android:layout_width="160dip" - android:layout_height="60dip" - android:background="@drawable/accept_icon"> - </Button> - - <Button android:id="@+id/btnRight" - android:layout_width="80dip" - android:layout_height="120dip" - android:background="@drawable/next_icon"> - </Button> - </LinearLayout> - - <LinearLayout - android:id="@+id/widget04" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - > - - <Button android:id="@+id/btnMenu" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="Menu"> - </Button> - - <Button android:id="@+id/btnDown" - android:layout_width="160dip" - android:layout_height="60dip" - android:background="@drawable/down_icon"> - </Button> - - <Button android:id="@+id/btnBack" - android:layout_width="80dip" - android:layout_height="60dip" - android:text="Back"> - </Button> - - </LinearLayout> - -</LinearLayout> \ No newline at end of file Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote01.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote01.xml (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote01.xml 2010-11-30 07:11:25 UTC (rev 3987) @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + android:id="@+id/widget0" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="@drawable/back" + android:orientation="vertical" + xmlns:android="http://schemas.android.com/apk/res/android"> + + <TextView android:id="@+id/naviRemote_text" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:text="Remote 01" + android:gravity="center_horizontal" android:background="#FFFFFFFF" + android:textSize="15dip" + android:textColor="#FF000000" android:textColorHighlight="#FFFFFFFF"> + </TextView> + + <LinearLayout + android:id="@+id/widget00" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + + <Button android:id="@+id/btnFBack" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="FBack"> + </Button> + + <Button android:id="@+id/btnPlay" + android:layout_width="160dip" + android:layout_height="60dip" + android:text="Play"> + </Button> + + <Button android:id="@+id/btnFForw" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="FForw"> + </Button> + + </LinearLayout> + + <LinearLayout + android:id="@+id/widget01" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + <Button android:id="@+id/btnSkipBack" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="Skp -"> + </Button> + + <Button android:id="@+id/btnStop" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="Stop"> + </Button> + + <Button android:id="@+id/btnPause" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="Pause"> + </Button> + + <Button android:id="@+id/btnSkipForw" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="Skp +"> + </Button> + + </LinearLayout> + + <LinearLayout + android:id="@+id/widget02" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + + <Button android:id="@+id/btnHome" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="Home"> + </Button> + + <Button android:id="@+id/btnUp" + android:layout_width="160dip" + android:layout_height="60dip" + android:background="@drawable/up_icon"> + </Button> + + <Button android:id="@+id/btnInfo" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="Info"> + </Button> + + </LinearLayout> + + <LinearLayout + android:id="@+id/widget03" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + + <Button android:id="@+id/btnLeft" + android:layout_width="80dip" + android:layout_height="120dip" + android:background="@drawable/back_icon"> + </Button> + + <Button android:id="@+id/btnOk" + android:layout_width="160dip" + android:layout_height="60dip" + android:background="@drawable/accept_icon"> + </Button> + + <Button android:id="@+id/btnRight" + android:layout_width="80dip" + android:layout_height="120dip" + android:background="@drawable/next_icon"> + </Button> + </LinearLayout> + + <LinearLayout + android:id="@+id/widget04" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + + <Button android:id="@+id/btnMenu" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="Menu"> + </Button> + + <Button android:id="@+id/btnDown" + android:layout_width="160dip" + android:layout_height="60dip" + android:background="@drawable/down_icon"> + </Button> + + <Button android:id="@+id/btnBack" + android:layout_width="80dip" + android:layout_height="60dip" + android:text="Back"> + </Button> + + </LinearLayout> + +</LinearLayout> \ No newline at end of file Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote02.xml =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote02.xml (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/res/layout/remote02.xml 2010-11-30 07:11:25 UTC (rev 3987) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout + android:id="@+id/widget0" + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:background="@drawable/back" + android:orientation="vertical" + xmlns:android="http://schemas.android.com/apk/res/android"> + + <TextView android:id="@+id/naviRemote_text" android:layout_width="fill_parent" + android:layout_height="wrap_content" android:text="Menu 02" + android:gravity="center_horizontal" android:background="#FFFFFFFF" + android:textSize="15dip" + android:textColor="#FF000000" android:textColorHighlight="#FFFFFFFF"> + </TextView> + +</LinearLayout> \ No newline at end of file Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/PostWebserver.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -0,0 +1,54 @@ +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; + } +} Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_01.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_01.java (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_01.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -0,0 +1,219 @@ +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 Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Remote_02.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -0,0 +1,109 @@ +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"); + + } + + + 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 Added: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Settings.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Settings.java (rev 0) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/Settings.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -0,0 +1,11 @@ +package mediaportal.remote; + +public class Settings{ + + public static final String PREFS_PRIVATE = "PREFS_MP_REMOTE"; + + public Settings() + { + + } +} Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/main.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -36,7 +36,7 @@ Button btnRemote = (Button) findViewById(R.id.MainButton4); btnRemote.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { - Intent myIntent = new Intent(view.getContext(), remote.class); + Intent myIntent = new Intent(view.getContext(), Remote_01.class); startActivityForResult(myIntent, 0); } }); Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplayinghandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplayinghandler.java 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplayinghandler.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -65,8 +65,8 @@ HttpURLConnection conn = (HttpURLConnection) myFileUrl .openConnection(); - conn.setReadTimeout(3000); - conn.setConnectTimeout(3000); + conn.setReadTimeout(5000); + conn.setConnectTimeout(5000); conn.setDoInput(true); conn.connect(); Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylisthandler.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylisthandler.java 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/nowplaylisthandler.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -67,7 +67,7 @@ HttpURLConnection conn = (HttpURLConnection) myFileUrl .openConnection(); - conn.setConnectTimeout(3000); + conn.setConnectTimeout(5000); conn.setReadTimeout(10000); conn.setDoInput(true); Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/pictures.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -34,8 +34,7 @@ //getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title); //((TextView) findViewById(R.id.title)).setText("Pictures"); - SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE, - MODE_PRIVATE); + SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE, MODE_PRIVATE); String HttpServer = settings.getString("Server", "192.168.0.30"); String HttpPort = settings.getString("Port", "8200"); @@ -47,20 +46,6 @@ GridView gridview = (GridView) findViewById(R.id.GridView01); gridview.setAdapter(new ImageAdapter2(this)); - gridview.setOnItemSelectedListener(new OnItemSelectedListener() { - public void onItemSelected(AdapterView<?> arg0, View arg1, - int arg2, long arg3) { - ImageView iv = (ImageView) arg1.findViewById(R.id.icon_image); - picItem pic = (picItem) iv.getTag(); - - ((TextView) findViewById(R.id.title)).setText(pic.title); - } - - public void onNothingSelected(AdapterView<?> arg0) { - // TODO Auto-generated method stub - } - }); - gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Modified: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/picturesfullscreen.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/picturesfullscreen.java 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/picturesfullscreen.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -32,20 +32,12 @@ TextView txt = (TextView) findViewById(R.id.full_text); txt.setText(pic.selectedPictureName); - - /* - * imagev.setOnClickListener(new View.OnClickListener() { public void - * onClick(View view) { Intent intent = new Intent(); - * setResult(RESULT_OK, intent); finish(); } }); - */ - } @Override public boolean onTouchEvent(MotionEvent me) { return gestureScanner.onTouchEvent(me); - } - + } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { try { @@ -85,24 +77,17 @@ } public boolean onDown(MotionEvent arg0) { - // TODO Auto-generated method stub return true; } public void onLongPress(MotionEvent arg0) { - // TODO Auto-generated method stub - } public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) { - // TODO Auto-generated method stub return false; } public void onShowPress(MotionEvent arg0) { - // TODO Auto-generated method stub - } public boolean onSingleTapUp(MotionEvent arg0) { - // TODO Auto-generated method stub return false; } } \ No newline at end of file Deleted: trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/remote.java =================================================================== --- trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/remote.java 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Android/MediaPortalRemote/src/mediaportal/remote/remote.java 2010-11-30 07:11:25 UTC (rev 3987) @@ -1,200 +0,0 @@ -package mediaportal.remote; - -import java.io.IOException; -import java.io.InputStream; - -import mediaportal.remote.R; - -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.HttpClient; -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; - -import android.app.Activity; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.res.AssetManager; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; -import android.widget.Toast; - -public class remote extends Activity { - - public static final String PREFS_PRIVATE = "PREFS_MP_REMOTE"; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.remote); - - 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) { - - SharedPreferences settings = getSharedPreferences(PREFS_PRIVATE , MODE_PRIVATE); - - String HttpServer = settings.getString("Server", "192.168.0.30"); - String HttpPort = settings.getString("Port", "8200"); - - HttpParams httpParameters = new BasicHttpParams(); - HttpConnectionParams.setConnectionTimeout(httpParameters, 3000); - HttpConnectionParams.setSoTimeout(httpParameters, 3000); - - HttpClient httpclient = new DefaultHttpClient(httpParameters); - HttpPost httppost = new HttpPost("http://" + HttpServer + ":" - + HttpPort); - - try { - - AssetManager assetManager = getAssets(); - - InputStream inputStream = null; - inputStream = assetManager.open("cmd_" + button + ".xml"); - - int x = inputStream.read(); - - String xml = ""; - - while (x != -1) { - xml = xml + (char) x; - x = inputStream.read(); - } - - StringEntity se = new StringEntity(xml, "UTF-8"); - se.setContentType("application/atom+xml"); - - httppost.setEntity(se); - - // HttpResponse response; - // response = httpclient.execute(httppost); - httpclient.execute(httppost); - - } catch (ClientProtocolException e) { - Toast.makeText(remote.this, "ERROR CONNECTION SERVER", - Toast.LENGTH_LONG).show(); - e.printStackTrace(); - } catch (IOException e) { - Toast.makeText(remote.this, "TIME OUT SERVER", Toast.LENGTH_LONG) - .show(); - e.printStackTrace(); - } - } - -} \ No newline at end of file Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs =================================================================== --- trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Server/AndroidRemote/AndroidServer.cs 2010-11-30 07:11:25 UTC (rev 3987) @@ -102,18 +102,26 @@ } private static void DoAcceptSocketCallback(IAsyncResult ar) { - // get socket TcpListener listener = (TcpListener)ar.AsyncState; - Socket clientSocket = listener.EndAcceptSocket(ar); - logDebug("Listener accept connection from " + clientSocket.RemoteEndPoint.ToString()); + try + { + // get socket + Socket clientSocket = listener.EndAcceptSocket(ar); - // work on request - Request req = new Request(clientSocket); - Thread thread = new Thread(new ThreadStart(req.DoWork)); - thread.Priority = ThreadPriority.BelowNormal; - thread.Start(); + logDebug("Listener accept connection from " + clientSocket.RemoteEndPoint.ToString()); + // work on request + Request req = new Request(clientSocket); + Thread thread = new Thread(new ThreadStart(req.DoWork)); + thread.Priority = ThreadPriority.BelowNormal; + thread.Start(); + } + catch (Exception ex) + { + logDebug("Exception on DoAcceptSocketCallback : " + ex.Message); + } + // restart listener listener.BeginAcceptSocket(new AsyncCallback(DoAcceptSocketCallback), listener); } Modified: trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs =================================================================== --- trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-29 13:05:10 UTC (rev 3986) +++ trunk/plugins/AndroidRemote/Server/AndroidRemote/Request.cs 2010-11-30 07:11:25 UTC (rev 3987) @@ -71,8 +71,12 @@ AndroidServer.logDebug("receive HTTP Continue"); allMessage = allMessage + clientmessage.Substring(0, bytes); - sendMessage(socket, "HTTP/1.0 100 Continue\r\n"); - sendMessage(socket, "\r\n"); + + string msg = string.Empty; + msg += "HTTP/1.0 100 Continue\r\n"; + msg += "Proxy-Connection: close" + "\r\n"; + msg += "\r\n"; + sendMessage(socket, msg); } else { @@ -87,7 +91,7 @@ ExceuteCommand(allMessage); } - else + else if (clientmessage.Length>0) { // GET int index1 = clientmessage.IndexOf(' '); 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. |