summaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorArtur Dryomov <artur.dryomov@gmail.com>2013-08-03 15:30:16 +0300
committerArtur Dryomov <artur.dryomov@gmail.com>2013-08-03 19:02:00 +0300
commitef5342c677e2d28f46401dac02fc5a3d4c0c1bd0 (patch)
tree0c46cc3da211c7ba023efa70ae26e11ff1ae8b1b /android
parentMove computer creation layout to scroll view. (diff)
downloadcore-ef5342c677e2d28f46401dac02fc5a3d4c0c1bd0.tar.gz
core-ef5342c677e2d28f46401dac02fc5a3d4c0c1bd0.zip
Fix updating of all slides even it is not necessary.
Change-Id: I6f7937296915a7cff71d9d9ee491736a0c2c31be
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java2
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java28
2 files changed, 28 insertions, 2 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java b/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java
index 02097d27a743..be6f84fcc974 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesPagerAdapter.java
@@ -85,7 +85,7 @@ public class SlidesPagerAdapter extends PagerAdapter {
@Override
public int getItemPosition(Object aObject) {
- // TODO: think about it, seems like a hack
+ // There seems no other way to update slides with notifyDataSetChanged.
return POSITION_NONE;
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
index 838245a0d35b..0c2280102afc 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
@@ -200,7 +200,9 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
}
if (Intents.Actions.SLIDE_PREVIEW.equals(aIntent.getAction())) {
- mSlidesPagerFragment.refreshSlidesPager();
+ int aSlideIndex = aIntent.getIntExtra(Intents.Extras.SLIDE_INDEX, 0);
+
+ mSlidesPagerFragment.refreshSlide(aSlideIndex);
}
}
}
@@ -221,6 +223,30 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
return LocalBroadcastManager.getInstance(aContext);
}
+ private void refreshSlide(int aSlideIndex) {
+ // Refresh only loaded slides to avoid images blinking on large slides count.
+ // There is no way to invalidate only a certain slide.
+
+ int aCurrentSlideIndex = mCommunicationService.getSlideShow().getCurrentSlideIndex();
+
+ if (aSlideIndex == aCurrentSlideIndex) {
+ refreshSlidesPager();
+ return;
+ }
+
+ int aSlidesOffscreenCount = getSlidesPager().getOffscreenPageLimit();
+
+ if (aSlideIndex < aCurrentSlideIndex - aSlidesOffscreenCount) {
+ return;
+ }
+
+ if (aSlideIndex > aCurrentSlideIndex + aSlidesOffscreenCount) {
+ return;
+ }
+
+ refreshSlidesPager();
+ }
+
private void refreshSlidesPager() {
getSlidesPager().getAdapter().notifyDataSetChanged();
}