summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-11-17 10:34:20 +0100
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-12-04 23:04:26 +0100
commit3056d24503240ae14f9c4ffe11730b78ac910980 (patch)
tree5ab7efb394fd88b637a72cda88961bc49607c06e /android
parent4924ae7046cc6ea5a4eb9c06b1f76f1ae881d32b (diff)
android: extract gathering document info into postLoad method
Change-Id: Id90680d3b207973b55927add1c91111268bb2a48
Diffstat (limited to 'android')
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java53
1 files changed, 28 insertions, 25 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index 1bc649958b6d..d4531d1e6a95 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -60,36 +60,39 @@ public class LOKitTileProvider implements TileProvider {
Log.i(LOGTAG, "====> mDocument = " + mDocument);
if (checkDocument()) {
- int parts = mDocument.getParts();
- Log.i(LOGTAG, "Document parts: " + parts);
-
- LibreOfficeMainActivity.mAppContext.getDocumentPartView().clear();
-
- if (parts > 1) {
- for (int i = 0; i < parts; i++) {
- String partName = mDocument.getPartName(i);
- if (partName.isEmpty()) {
- partName = getGenericPartName(i);
- }
- Log.i(LOGTAG, "Document part " + i + " name:'" + partName + "'");
-
- mDocument.setPart(i);
- final DocumentPartView partView = new DocumentPartView(i, partName, thumbnail(128));
- LibreOfficeMainActivity.mAppContext.getDocumentPartView().add(partView);
- }
- }
+ postLoad();
+ mIsReady = true;
+ }
+ }
- mDocument.setPart(0);
+ public void postLoad() {
+ int parts = mDocument.getParts();
+ Log.i(LOGTAG, "Document parts: " + parts);
- LOKitShell.getMainHandler().post(new Runnable() {
- @Override
- public void run() {
- LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdpater().notifyDataSetChanged();
+ LibreOfficeMainActivity.mAppContext.getDocumentPartView().clear();
+
+ if (parts > 1) {
+ for (int i = 0; i < parts; i++) {
+ String partName = mDocument.getPartName(i);
+ if (partName.isEmpty()) {
+ partName = getGenericPartName(i);
}
- });
+ Log.i(LOGTAG, "Document part " + i + " name:'" + partName + "'");
- mIsReady = true;
+ mDocument.setPart(i);
+ final DocumentPartView partView = new DocumentPartView(i, partName, thumbnail(128));
+ LibreOfficeMainActivity.mAppContext.getDocumentPartView().add(partView);
+ }
}
+
+ mDocument.setPart(0);
+
+ LOKitShell.getMainHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ LibreOfficeMainActivity.mAppContext.getDocumentPartViewListAdpater().notifyDataSetChanged();
+ }
+ });
}
private String getGenericPartName(int i) {