[Libreoffice-commits] .: Branch 'feature/remote' - 3 commits - android/sdremote sd/source
android/sdremote/src/org/libreoffice/impressremote/TestClient.java |3 android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java |2 android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java | 105 ++ sd/source/ui/remotecontrol/DiscoveryService.cxx | 68 -- sd/source/ui/remotecontrol/DiscoveryService.hxx |9 sd/source/ui/remotecontrol/ImagePreparer.cxx |2 6 files changed, 168 insertions(+), 21 deletions(-) New commits: commit 95f27663a7428018e09a13df4ab811ffb6d8363b Author: Andrzej J.R. Hunt Date: Thu Aug 2 16:52:53 2012 +0200 Server discovery functional. Change-Id: I8642e0ea95a8d6691b76cc4d2dc1ddfbbf2b03e2 diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java index d787e34..b78a9a4 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java @@ -40,16 +40,17 @@ public class ServerFinder { if (i == aBuffer.length || !aCommand.equals("LOREMOTE_ADVERTISE")) { return; } - - for (int j = i + 1; j < aBuffer.length; j++) { - if (aPacket.getData()[j] == '\n') { - aAddress = new String(aPacket.getData(), i + 1, j, CHARSET); - } - } - - if (aAddress != null) { - System.out.println("Address is :" + aAddress + "\n"); - } + System.out.println("SF: " + aPacket.getAddress().toString()); + + // for (int j = i + 1; j < aBuffer.length; j++) { + // if (aPacket.getData()[j] == '\n') { + // aAddress = new String(aPacket.getData(), i + 1, j, CHARSET); + // } + // } + // + // if (aAddress != null) { + // System.out.println("Address is :" + aAddress + "\n"); + // } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx index 612332f..bc514d7 100644 --- a/sd/source/ui/remotecontrol/DiscoveryService.cxx +++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx @@ -67,6 +67,8 @@ void DiscoveryService::replyTo( sockaddr_in& rAddr ) // OStringBuffer aBuffer( "LOREMOTE_ADVERTISE\n" ); // aBuffer.append( aAddrString ).append( "\n" ); // mSocket.sendTo( rAddr, aBuffer.getStr(), aBuffer.getLength() ); +OString aMessage("LOREMOTE_ADVERTISE\n"); +sendto( mSocket, aMessage.getStr(), aMessage.getLength(), 0, (sockaddr*) &rAddr, sizeof(rAddr) ); } void DiscoveryService::execute() commit 3d68126411374261b904b3b8bfce552fd6d796b7 Author: Andrzej J.R. Hunt Date: Thu Aug 2 16:40:31 2012 +0200 Multicast listening now working. Change-Id: Icae91b26f1142d7f25d6e38af4f951be26d9b22a diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx index 2d2b367..612332f 100644 --- a/sd/source/ui/remotecontrol/DiscoveryService.cxx +++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx @@ -15,6 +15,16 @@ #include "DiscoveryService.hxx" +#ifdef WIN32 + #include + typedef int socklen_t; +#else + #include + #include + #include + #include +#endif + using namespace osl; using namespace rtl; using namespace sd; @@ -22,9 +32,25 @@ using namespace std; DiscoveryService::DiscoveryService() : -Thread( "sd::DiscoveryService" ), -mSocket() +Thread( "sd::DiscoveryService" ) +// mSocket() { +mSocket = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ); + +sockaddr_in aAddr; +aAddr.sin_family = AF_INET; +aAddr.sin_addr.s_addr = htonl(INADDR_ANY); +aAddr.sin_port = htons( PORT_DISCOVERY ); + +bind( mSocket, (sockaddr*) &aAddr, sizeof(sockaddr_in) ); + +struct ip_mreq multicastRequest; + +multicastRequest.imr_multiaddr.s_addr = inet_addr( "239.0.0.1" ); +multicastRequest.imr_interface.s_addr = htonl(INADDR_ANY); + +setsockopt( mSocket, IPPROTO_IP, IP_ADD_MEMBERSHI
[Libreoffice-commits] .: Branch 'feature/remote' - 3 commits - android/sdremote sd/source
android/sdremote/res/layout/fragment_presentation.xml |8 android/sdremote/res/menu/actionbar_presentation.xml | 17 + android/sdremote/res/values/strings.xml |6 android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java | 51 + android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java | 16 - android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java | 90 -- android/sdremote/src/org/libreoffice/impressremote/TestClient.java |1 android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java | 10 + android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java |3 android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java | 66 ++- android/sdremote/src/pl/polidea/coverflow/CoverFlow.java |2 sd/source/ui/remotecontrol/ImagePreparer.cxx |2 12 files changed, 234 insertions(+), 38 deletions(-) New commits: commit 2c777ebfa6c6a3fea0cbad7ebc8baf4ad44ae907 Author: Andrzej J.R. Hunt Date: Tue Jul 24 21:24:26 2012 +0200 Added basic actionbar code, improved cover flow scaling. Change-Id: I68dcbf2449ed61f06503442a3621cccb97f1e697 diff --git a/android/sdremote/res/layout/fragment_presentation.xml b/android/sdremote/res/layout/fragment_presentation.xml index 53e7737..2d17759 100644 --- a/android/sdremote/res/layout/fragment_presentation.xml +++ b/android/sdremote/res/layout/fragment_presentation.xml @@ -13,10 +13,7 @@ android:layout_marginTop="5dip" coverflow:imageHeight="150dip" coverflow:imageWidth="180dip" - coverflow:withReflection="false" /> - +android:layout_height="wrap_content" /> \ No newline at end of file diff --git a/android/sdremote/res/menu/actionbar_presentation.xml b/android/sdremote/res/menu/actionbar_presentation.xml new file mode 100644 index 000..020fae1 --- /dev/null +++ b/android/sdremote/res/menu/actionbar_presentation.xml @@ -0,0 +1,17 @@ + +http://schemas.android.com/apk/res/android"; > + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index 668d073..c677dcb 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -2,7 +2,11 @@ LibreOffice Remote -Hello world! Settings PresentationActivity +Handle to resize view. +Blank Screen +Options +HH:mm +h:m:ss \ No newline at end of file diff --git a/android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java b/android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java index 44ef183..33ea95c 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ActionBarManager.java @@ -8,11 +8,62 @@ */ package org.libreoffice.impressremote; +import org.libreoffice.impressremote.communication.CommunicationService; + +import android.content.Context; +import android.os.Handler; +import android.text.format.DateFormat; +import android.view.Menu; + /** * Used to manage the action bar whenever a presentation is running. * */ public class ActionBarManager { + private Context mContext; + private Menu mMenu; + private CommunicationService mCommunicationService; + + /* +* True if the timer is being used as a timer, false if we are showing a +* clock. +*/ + private boolean mTimerOn = false; + + public ActionBarManager(Context aContext, Menu aMenu, + CommunicationService aCommunicationService) { + mContext = aContext; + mMenu = aMenu; + mCommunicationService = aCommunicationService; + timerHandler.removeCallbacks(timerUpdateThread); + timerHandler.postDelayed(timerUpdateThread, 50); + } + + private Handler timerHandler = new Handler(); + + private Thread timerUpdateThread = new Thread() { + + @Override + public void run() { + // invalidateOptionsMenu(); + CharSequence aTimeString; + long aTime = mCommunicationService.getSlideShow().getTimer() + .getTimeMillis(); + if (mTimerOn) { + aTimeString = DateFormat.format(mContext.getResources() + .getString(R.string.actionbar_timerformat), +