[Libreoffice-commits] .: android/experimental
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Nov 13 05:26:11 PST 2012
android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 16 ++++++++--
1 file changed, 13 insertions(+), 3 deletions(-)
New commits:
commit 677ca1d59618c592786292ac275497e0ce753604
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Nov 13 13:35:55 2012 +0100
android: remember displayed page during rotation in DocumentLoader
Change-Id: I1948dcc76026e4c906407932aa67371e5e9e8bb6
diff --git a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
index 8c9a713..806fcab 100644
--- a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
+++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
@@ -917,6 +917,13 @@ public class DocumentLoader
}
@Override
+ public void onSaveInstanceState(Bundle savedInstance)
+ {
+ super.onSaveInstanceState(savedInstance);
+ savedInstance.putInt("currentPageNumber", ((PageViewer)flipper.getCurrentView()).currentPageNumber);
+ }
+
+ @Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
@@ -978,11 +985,14 @@ public class DocumentLoader
matchParent = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
- flipper.addView(new PageViewer(0), 0, matchParent);
+ int currentPageNumber = 0;
+ if (savedInstanceState != null)
+ currentPageNumber = savedInstanceState.getInt("currentPageNumber");
+ flipper.addView(new PageViewer(currentPageNumber), 0, matchParent);
for (int i = 0; i < PAGECACHE_PLUSMINUS; i++)
- flipper.addView(new PageViewer(i+1), i+1, matchParent);
+ flipper.addView(new PageViewer(currentPageNumber+i+1), i+1, matchParent);
for (int i = 0; i < PAGECACHE_PLUSMINUS; i++)
- flipper.addView(new PageViewer(-1), PAGECACHE_PLUSMINUS + i+1, matchParent);
+ flipper.addView(new PageViewer(currentPageNumber+(i*-1)-1), PAGECACHE_PLUSMINUS + i+1, matchParent);
setContentView(flipper);
}
More information about the Libreoffice-commits
mailing list