diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-11-22 15:53:35 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-11-22 15:56:58 +0100 |
commit | a3b8cfa65c7883295cd899e71fd2979958a880ce (patch) | |
tree | f58620a6bd5e3da2b39b79f00b7ffb8465dcbbd2 /android | |
parent | d90d76fdeae2553639d19d2286ef454b9a336688 (diff) |
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
Diffstat (limited to 'android')
-rw-r--r-- | android/experimental/DocumentLoader/src/org/libreoffice/android/examples/DocumentLoader.java | 15 |
1 files changed, 4 insertions, 11 deletions
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 3ee60ac11e09..fcf9fae0116c 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); } |