diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-09-14 01:04:16 +0300 |
---|---|---|
committer | Artur Dryomov <artur.dryomov@gmail.com> | 2013-09-14 01:25:33 +0300 |
commit | f9bee0318cb3097e7d17c5b96b2b426ddafb658c (patch) | |
tree | 621cf51a7fc0ed3d7a97540351b0021a81abeada /android/sdremote | |
parent | 06806b93f1474962f6780e108ae1e6654ab1da0d (diff) |
Change slide show operations related to its starting.
Do not start a slide show when it is already started.
Change-Id: I2cd1df48c07f60ddedb63f93973a0bda029bbd3f
Diffstat (limited to 'android/sdremote')
4 files changed, 26 insertions, 6 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java index b7c9e6dcf4c4..76ae2e710398 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 95b54b3ffe9f..ed2e5c23c671 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 19963686b09d..99947f5c18c5 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 a655b33af670..346c79e26376 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); } |