diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-09 16:03:29 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-12-09 16:19:42 +0100 |
commit | 37280590cdb0a0654a6c618eb06f67aa48b27f31 (patch) | |
tree | 3ead1632964b3f077c8826b016ce62ecb7d7eb71 /android | |
parent | 8ad2b6f9d8169b46a71b82198ff1f73482a602e8 (diff) |
Related: fdo#85286 android: show error message given by LOK on the UI
Change-Id: Ide8e6bc7e719968bacf86572036b15c4ef834761
Diffstat (limited to 'android')
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index ec6d1d1237c3..81de8ba5bfbe 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -123,22 +123,30 @@ public class LOKitTileProvider implements TileProvider { } private boolean checkDocument() { + String error = null; + boolean ret; + if (mDocument == null || !mOffice.getError().isEmpty()) { - Log.e(LOGTAG, "Error at loading: " + mOffice.getError()); - return false; + error = "Cannot open " + mInputFile + ": " + mOffice.getError(); + ret = false; + } else { + ret = resetDocumentSize(); + if (!ret) { + error = "Document returned an invalid size or the document is empty!"; + } } - boolean result = resetDocumentSize(); - if (!result) { + if (!ret) { + final String message = error; LOKitShell.getMainHandler().post(new Runnable() { @Override public void run() { - LibreOfficeMainActivity.mAppContext.showAlertDialog("Document returned an invalid size or the document is empty!"); + LibreOfficeMainActivity.mAppContext.showAlertDialog(message); } }); } - return result; + return ret; } private boolean resetDocumentSize() { @@ -247,3 +255,5 @@ public class LOKitTileProvider implements TileProvider { resetDocumentSize(); } } + +// vim:set shiftwidth=4 softtabstop=4 expandtab: |