Remove triggering next transitions on last slide.

The current server-side code calls finishing of a slide show multiple
times so we cannot rely on this inidicator to exit the slide show.

Change-Id: I78b11f62d45d45bcf005e6f0a36f2d632b886900
This commit is contained in:
Artur Dryomov
2013-09-05 19:12:43 +03:00
parent 3c1c51020c
commit f98a01f061

View File

@@ -257,7 +257,9 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
switch (aKeyCode) {
case KeyEvent.KEYCODE_VOLUME_UP:
mCommunicationService.getTransmitter().performNextTransition();
if (!isLastSlideDisplayed()) {
mCommunicationService.getTransmitter().performNextTransition();
}
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
@@ -275,6 +277,13 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
return preferences.getBoolean(Preferences.Keys.VOLUME_KEYS_ACTIONS);
}
private boolean isLastSlideDisplayed() {
int aCurrentSlideIndex = mCommunicationService.getSlideShow().getHumanCurrentSlideIndex();
int aSlidesCount = mCommunicationService.getSlideShow().getSlidesCount();
return aCurrentSlideIndex == aSlidesCount;
}
@Override
public boolean onKeyUp(int aKeyCode, KeyEvent aKeyEvent) {
if (!areVolumeKeysActionsRequired()) {