[Libreoffice-commits] .: android/experimental
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 22 06:57:13 PST 2012
android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 15 ++--------
1 file changed, 4 insertions(+), 11 deletions(-)
New commits:
commit a3b8cfa65c7883295cd899e71fd2979958a880ce
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Nov 22 15:53:35 2012 +0100
android: clean up no longer needed onSaveInstanceState()
It could not be used to save whole objects, so get rid of it and use
onRetainNonConfigurationInstance() exclusively.
Change-Id: I7cc3951b60a054b5b2488b49791b58707dc8a68b
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 3ee60ac..fcf9fae 100644
--- a/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
+++ b/android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java
@@ -870,6 +870,8 @@ public class DocumentLoader
public int pageCount;
public XRenderable renderable;
public String input;
+ // This is not updated constantly, just in onRetainNonConfigurationInstance()
+ public int currentPageNumber;
}
static void dumpUNOObject(String objectName, Object object)
@@ -933,16 +935,10 @@ public class DocumentLoader
}
@Override
- public void onSaveInstanceState(Bundle savedInstance)
- {
- super.onSaveInstanceState(savedInstance);
- savedInstance.putInt("currentPageNumber", ((PageViewer)flipper.getCurrentView()).currentPageNumber);
- }
-
- @Override
public Object onRetainNonConfigurationInstance() {
ArrayList ret = new ArrayList(2);
ret.add(bootstrapContext);
+ documentContext.currentPageNumber = ((PageViewer)flipper.getCurrentView()).currentPageNumber;
ret.add(documentContext);
return ret;
}
@@ -1089,10 +1085,7 @@ public class DocumentLoader
matchParent = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
- int currentPageNumber = 0;
- if (savedInstanceState != null)
- currentPageNumber = savedInstanceState.getInt("currentPageNumber");
- goToPage(currentPageNumber);
+ goToPage(documentContext.currentPageNumber);
setContentView(flipper);
}
More information about the Libreoffice-commits
mailing list