summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorArtur Dryomov <artur.dryomov@gmail.com>2013-09-14 16:47:00 +0300
committerArtur Dryomov <artur.dryomov@gmail.com>2013-09-14 19:38:45 +0300
commit4c7ad3859a27ae5376a24dcfca291670b86e3367 (patch)
tree977c1e61c85b3ccf09072508ad8b29be074c1bc5 /android
parent2436d8c9bc296d64a98c6b1bcbecb66d42f15aab (diff)
Fix slide notes loading.
* Allow dynamic loading. * Show notes only when they belong to the current slide. Change-Id: I30dd73c9a1c9ac8533b830d908276aa6234aa7ce
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java27
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java1
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/Timer.java16
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java25
4 files changed, 49 insertions, 20 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
index 45fe40add314..defd6a0cfcaa 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
@@ -115,6 +115,7 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
mCommunicationService = aServiceBinder.getService();
startSlideShow();
+ resumeTimer();
}
private void startSlideShow() {
@@ -126,10 +127,20 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
mCommunicationService.getCommandsTransmitter().startPresentation();
}
+ private void resumeTimer() {
+ if (!isServiceBound()) {
+ return;
+ }
+
+ mCommunicationService.getSlideShow().getTimer().resume();
+ }
+
@Override
protected void onStart() {
super.onStart();
+ resumeTimer();
+
registerIntentsReceiver();
}
@@ -242,13 +253,13 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
aTimer.start();
}
- private void resumeTimer() {
- mCommunicationService.getSlideShow().getTimer().resume();
- }
-
private void changeTimer(int aMinutesLength) {
Timer aTimer = mCommunicationService.getSlideShow().getTimer();
+ if (aTimer.isTimeUp()) {
+ aTimer.reset();
+ }
+
aTimer.setMinutesLength(aMinutesLength);
}
@@ -429,7 +440,7 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
DialogFragment aTimerDialog = buildTimerEditingDialog(aTimer);
aTimerDialog.show(getSupportFragmentManager(), TimerEditingDialog.TAG);
- aTimer.pause();
+ pauseTimer();
}
private DialogFragment buildTimerEditingDialog(Timer aTimer) {
@@ -505,15 +516,9 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
return;
}
- stopTimer();
-
unbindService();
}
- private void stopTimer() {
- mCommunicationService.getSlideShow().getTimer().stop();
- }
-
private void unbindService() {
unbindService(this);
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
index cbeacd6bfe5f..0db8b4166a52 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/CommunicationService.java
@@ -196,6 +196,7 @@ public class CommunicationService extends Service implements Runnable, MessagesL
@Override
public void onSlideShowFinish() {
+ mTimer.stop();
mSlideShow = new SlideShow(mTimer);
Intent aIntent = Intents.buildSlideShowStoppedIntent();
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Timer.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Timer.java
index 9efc42e66fa9..4e13910ef6ad 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Timer.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Timer.java
@@ -66,16 +66,22 @@ public class Timer implements Runnable {
mPassedMinutes++;
}
+ public void stop() {
+ pause();
+ reset();
+ }
+
public void pause() {
- stop();
+ mTimerHandler.removeCallbacks(this);
}
- public void resume() {
- start();
+ public void reset() {
+ mTotalMinutes = 0;
+ mPassedMinutes = 0;
}
- public void stop() {
- mTimerHandler.removeCallbacks(this);
+ public void resume() {
+ start();
}
public boolean isTimeUp() {
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
index aba2e21055ef..46929770987c 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
@@ -144,13 +144,17 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
return;
}
- if (areSlideNotesAvailable(aSlideIndex)) {
- showSlideNotes(aSlideIndex);
- scrollSlideNotes();
+ if (!isSlideVisible(aSlideIndex)) {
+ return;
}
- else {
+
+ if (!areSlideNotesAvailable(aSlideIndex)) {
hideSlideNotes();
+ return;
}
+
+ showSlideNotes(aSlideIndex);
+ scrollSlideNotes();
}
private boolean isSlideNotesLayoutAvailable() {
@@ -159,6 +163,10 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
return aSlideNotesLayout != null;
}
+ private boolean isSlideVisible(int aSlideIndex) {
+ return aSlideIndex == getSlidesPager().getCurrentItem();
+ }
+
private boolean areSlideNotesAvailable(int aSlideIndex) {
String aSlideNotes = mCommunicationService.getSlideShow().getSlideNotes(aSlideIndex);
@@ -243,6 +251,14 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
int aSlideIndex = aIntent.getIntExtra(Intents.Extras.SLIDE_INDEX, 0);
mSlidesPagerFragment.refreshSlide(aSlideIndex);
+ return;
+ }
+
+ if (Intents.Actions.SLIDE_NOTES.equals(aIntent.getAction())) {
+ int aSlideIndex = aIntent.getIntExtra(Intents.Extras.SLIDE_INDEX, 0);
+
+ mSlidesPagerFragment.setUpSlideNotes(aSlideIndex);
+ return;
}
}
}
@@ -253,6 +269,7 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
aIntentFilter.addAction(Intents.Actions.SLIDE_SHOW_STOPPED);
aIntentFilter.addAction(Intents.Actions.SLIDE_CHANGED);
aIntentFilter.addAction(Intents.Actions.SLIDE_PREVIEW);
+ aIntentFilter.addAction(Intents.Actions.SLIDE_NOTES);
return aIntentFilter;
}