Change slide show operations related to its starting.
Do not start a slide show when it is already started. Change-Id: I2cd1df48c07f60ddedb63f93973a0bda029bbd3f
This commit is contained in:
@@ -118,6 +118,11 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startSlideShow() {
|
private void startSlideShow() {
|
||||||
|
if (mCommunicationService.getSlideShow().isRunning()) {
|
||||||
|
setUpSlideShowInformation();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mCommunicationService.getTransmitter().startPresentation();
|
mCommunicationService.getTransmitter().startPresentation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -186,6 +186,7 @@ public class CommunicationService extends Service implements Runnable, MessagesL
|
|||||||
public void onSlideShowStart(int aSlidesCount, int aCurrentSlideIndex) {
|
public void onSlideShowStart(int aSlidesCount, int aCurrentSlideIndex) {
|
||||||
mSlideShow = new SlideShow(mTimer);
|
mSlideShow = new SlideShow(mTimer);
|
||||||
mSlideShow.setSlidesCount(aSlidesCount);
|
mSlideShow.setSlidesCount(aSlidesCount);
|
||||||
|
mSlideShow.setRunning(true);
|
||||||
|
|
||||||
Intent aIntent = Intents.buildSlideShowRunningIntent();
|
Intent aIntent = Intents.buildSlideShowRunningIntent();
|
||||||
LocalBroadcastManager.getInstance(this).sendBroadcast(aIntent);
|
LocalBroadcastManager.getInstance(this).sendBroadcast(aIntent);
|
||||||
|
@@ -12,6 +12,8 @@ import android.util.SparseArray;
|
|||||||
|
|
||||||
|
|
||||||
public class SlideShow {
|
public class SlideShow {
|
||||||
|
private boolean mRunning;
|
||||||
|
|
||||||
private int mSlidesCount;
|
private int mSlidesCount;
|
||||||
private int mCurrentSlideIndex;
|
private int mCurrentSlideIndex;
|
||||||
|
|
||||||
@@ -21,13 +23,23 @@ public class SlideShow {
|
|||||||
private final Timer mTimer;
|
private final Timer mTimer;
|
||||||
|
|
||||||
public SlideShow(Timer aTimer) {
|
public SlideShow(Timer aTimer) {
|
||||||
this.mSlidesCount = 0;
|
mRunning = false;
|
||||||
this.mCurrentSlideIndex = 0;
|
|
||||||
|
|
||||||
this.mSlidePreviewsBytes = new SparseArray<byte[]>();
|
mSlidesCount = 0;
|
||||||
this.mSlideNotes = new SparseArray<String>();
|
mCurrentSlideIndex = 0;
|
||||||
|
|
||||||
this.mTimer = aTimer;
|
mSlidePreviewsBytes = new SparseArray<byte[]>();
|
||||||
|
mSlideNotes = new SparseArray<String>();
|
||||||
|
|
||||||
|
mTimer = aTimer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRunning(boolean aRunning) {
|
||||||
|
mRunning = aRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRunning() {
|
||||||
|
return mRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSlidesCount(int aSlidesCount) {
|
public void setSlidesCount(int aSlidesCount) {
|
||||||
|
@@ -132,7 +132,9 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int aPosition) {
|
public void onPageSelected(int aPosition) {
|
||||||
mCommunicationService.getTransmitter().setCurrentSlide(aPosition);
|
if (mCommunicationService.getSlideShow().getCurrentSlideIndex() != aPosition) {
|
||||||
|
mCommunicationService.getTransmitter().setCurrentSlide(aPosition);
|
||||||
|
}
|
||||||
|
|
||||||
setUpSlideNotes(aPosition);
|
setUpSlideNotes(aPosition);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user