diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-08-14 10:28:47 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-14 10:29:35 +0100 |
commit | 318590b2900ff01ac36bb0bab84ddb69ffa0f9c9 (patch) | |
tree | cfef24882194cce015c8a4192b1b64ab74fc44d4 /android/experimental/LibreOffice4Android | |
parent | 5da2e40292e420dc48da7ea5aef29c96a1127140 (diff) |
android: recover from un-thumb-nail-able documents without crashing
Diffstat (limited to 'android/experimental/LibreOffice4Android')
3 files changed, 12 insertions, 4 deletions
diff --git a/android/experimental/LibreOffice4Android/Makefile b/android/experimental/LibreOffice4Android/Makefile index 3a49c7dfe734..0bfbf3b87315 100644 --- a/android/experimental/LibreOffice4Android/Makefile +++ b/android/experimental/LibreOffice4Android/Makefile @@ -244,4 +244,5 @@ build-ant: copy-stuff properties run: # /data/local/tmp/sample-document.odt - adb shell am start -n $(APP_PACKAGE)/.ui.LibreOfficeUIActivity -e input /assets/test1.odt -e lo-main-delay 20 +# add -e lo-strace to strace + adb shell am start -n $(APP_PACKAGE)/.ui.LibreOfficeUIActivity -e lo-strace -e input /assets/test1.odt diff --git a/android/experimental/LibreOffice4Android/jni/Application.mk b/android/experimental/LibreOffice4Android/jni/Application.mk deleted file mode 100644 index a11b28debc0c..000000000000 --- a/android/experimental/LibreOffice4Android/jni/Application.mk +++ /dev/null @@ -1,2 +0,0 @@ -APP_ABI := armeabi-v7a -APP_PLATFORM := android-14 diff --git a/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java b/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java index a4d03369dd90..7c824f8429d2 100644 --- a/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java +++ b/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/LibreOfficeUIActivity.java @@ -132,7 +132,7 @@ public class LibreOfficeUIActivity extends SherlockActivity implements ActionBar //Set the "home" - top level - directory. homeDirectory = new File(Environment.getExternalStorageDirectory(),"LibreOffice"); homeDirectory.mkdirs(); - currentDirectory = homeDirectory; + currentDirectory = homeDirectory; //Load default settings @@ -819,6 +819,9 @@ class ListItemAdapter implements ListAdapter{ toolkit = (XToolkit2) UnoRuntime.queryInterface(XToolkit2.class, toolkitService); renderable = (XRenderable) UnoRuntime.queryInterface(XRenderable.class, doc); + if (renderable == null) + // some serious error with the rendering backend + return new Integer(0); // Set up dummySmallDevice and use it to find out the number // of pages ("renderers"). @@ -851,6 +854,12 @@ class ListItemAdapter implements ListAdapter{ } protected void onPostExecute(Integer result){ + + if (renderable == null) { + Log.i(TAG, "Document is un-renderable"); + return; // TODO: check if this falls-back to a sensible image + } + int widthInPx = dpToPx( 100 ); int heightInPx = dpToPx( (int)( 100*Math.sqrt(2) ) ); ByteBuffer bb = renderPage( 0 , widthInPx , heightInPx); |