[Libreoffice-commits] core.git: 3 commits - android/sdremote

Artur Dryomov artur.dryomov at gmail.com
Fri Sep 13 15:30:10 PDT 2013


 android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java         |    5 ++
 android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java |    1 
 android/sdremote/src/org/libreoffice/impressremote/communication/Server.java               |    9 ++++
 android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java            |   22 +++++++---
 android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java     |    1 
 android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java         |    2 
 android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java       |    4 +
 7 files changed, 37 insertions(+), 7 deletions(-)

New commits:
commit f9bee0318cb3097e7d17c5b96b2b426ddafb658c
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Sat Sep 14 01:04:16 2013 +0300

    Change slide show operations related to its starting.
    
    Do not start a slide show when it is already started.
    
    Change-Id: I2cd1df48c07f60ddedb63f93973a0bda029bbd3f

diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
index b7c9e6d..76ae2e7 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
@@ -118,6 +118,11 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
     }
 
     private void startSlideShow() {
+        if (mCommunicationService.getSlideShow().isRunning()) {
+            setUpSlideShowInformation();
+            return;
+        }
+
         mCommunicationService.getTransmitter().startPresentation();
     }
 
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index 95b54b3..ed2e5c2 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -186,6 +186,7 @@ public class CommunicationService extends Service implements Runnable, MessagesL
     public void onSlideShowStart(int aSlidesCount, int aCurrentSlideIndex) {
         mSlideShow = new SlideShow(mTimer);
         mSlideShow.setSlidesCount(aSlidesCount);
+        mSlideShow.setRunning(true);
 
         Intent aIntent = Intents.buildSlideShowRunningIntent();
         LocalBroadcastManager.getInstance(this).sendBroadcast(aIntent);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
index 1996368..99947f5 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/SlideShow.java
@@ -12,6 +12,8 @@ import android.util.SparseArray;
 
 
 public class SlideShow {
+    private boolean mRunning;
+
     private int mSlidesCount;
     private int mCurrentSlideIndex;
 
@@ -21,13 +23,23 @@ public class SlideShow {
     private final Timer mTimer;
 
     public SlideShow(Timer aTimer) {
-        this.mSlidesCount = 0;
-        this.mCurrentSlideIndex = 0;
+        mRunning = false;
+
+        mSlidesCount = 0;
+        mCurrentSlideIndex = 0;
+
+        mSlidePreviewsBytes = new SparseArray<byte[]>();
+        mSlideNotes = new SparseArray<String>();
 
-        this.mSlidePreviewsBytes = new SparseArray<byte[]>();
-        this.mSlideNotes = new SparseArray<String>();
+        mTimer = aTimer;
+    }
+
+    public void setRunning(boolean aRunning) {
+        mRunning = aRunning;
+    }
 
-        this.mTimer = aTimer;
+    public boolean isRunning() {
+        return mRunning;
     }
 
     public void setSlidesCount(int aSlidesCount) {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
index a655b33..346c79e 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
@@ -132,7 +132,9 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
 
     @Override
     public void onPageSelected(int aPosition) {
-        mCommunicationService.getTransmitter().setCurrentSlide(aPosition);
+        if (mCommunicationService.getSlideShow().getCurrentSlideIndex() != aPosition) {
+            mCommunicationService.getTransmitter().setCurrentSlide(aPosition);
+        }
 
         setUpSlideNotes(aPosition);
     }
commit 06806b93f1474962f6780e108ae1e6654ab1da0d
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Fri Sep 13 19:22:08 2013 +0300

    Change searching message delay from 10 seconds to 3.
    
    Make it more friendly for users.
    
    Change-Id: Ie77643639d4b8a15c6e5a82070f8e01c8fa5025e

diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java
index 84f305b..a35c1d6 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java
@@ -95,6 +95,7 @@ class TcpServersFinder implements ServersFinder, Runnable {
 
             DatagramPacket aSearchPacket = new DatagramPacket(
                 aSearchCommand.getBytes(), aSearchCommand.length());
+
             aSearchPacket.setAddress(
                 InetAddress.getByName(Protocol.Addresses.SERVER_SEARCH));
             aSearchPacket.setPort(Protocol.Ports.SERVER_SEARCH);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
index 3ea19ce..7cd6033 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
@@ -46,7 +46,7 @@ import org.libreoffice.impressremote.communication.Server;
 import org.libreoffice.impressremote.util.SavedStates;
 
 public class ComputersFragment extends SherlockListFragment implements ServiceConnection, Runnable {
-    private static final int SHOWING_PROGRESS_MESSAGE_DELAY_IN_SECONDS = 10;
+    private static final int SHOWING_PROGRESS_MESSAGE_DELAY_IN_SECONDS = 3;
 
     public static enum Type {
         WIFI, BLUETOOTH
commit 8fe5b478267fc5d72ccdf6b6e1563be1cacc7ac3
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Fri Sep 13 18:34:30 2013 +0300

    Add checks before return server name.
    
    Try to avoid possible NPE.
    
    Change-Id: I7e89ac38251b0840c66e36f9e0284be2073424c3

diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
index 9f1a16b..de5c41d 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Server.java
@@ -10,6 +10,7 @@ package org.libreoffice.impressremote.communication;
 
 import android.os.Parcel;
 import android.os.Parcelable;
+import android.text.TextUtils;
 
 public class Server implements Parcelable {
     private static final int SPECIAL_PARCELABLE_OBJECTS_BITMASK = 0;
@@ -45,6 +46,14 @@ public class Server implements Parcelable {
     }
 
     public String getName() {
+        if (mName == null) {
+            return mAddress;
+        }
+
+        if (TextUtils.isEmpty(mName)) {
+            return mAddress;
+        }
+
         return mName;
     }
 


More information about the Libreoffice-commits mailing list