diff options
author | Iain Billett <iainbillett@gmail.com> | 2012-07-25 17:43:54 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-07 15:23:54 +0100 |
commit | cbddf975d3a52e34b9b9773789e2ff3a4954c4a8 (patch) | |
tree | 8c6a319ccae7638521ed1050007f9f6da9b95b99 /android/experimental | |
parent | d5fdc95225528682c90b7fa92f4c66d5bfc98dd9 (diff) |
Added methods to check if a file has a thumbnail.
Change-Id: I362ff20d8768be1dffbf857e442fbc30822079a7
Diffstat (limited to 'android/experimental')
-rw-r--r-- | android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java b/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java index df440e51f65f..71e67c1df3fc 100644 --- a/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java +++ b/android/experimental/LibreOffice4Android/src/org/libreoffice/ui/FileUtilities.java @@ -194,6 +194,24 @@ public class FileUtilities { } return; } + + static boolean hasThumbnail(File file) + { + String filename = file.getName(); + if( lookupExtension( filename ) == DOC ) // only do this for docs for now + { + // Will need another method to check if Thumb is up-to-date - or extend this one? + if( new File( file.getParent() , getThumbnailName( file ) ).isFile() ) + return true; + return false; // If it's a document with no thumb + } + return true; + } + + static String getThumbnailName( File file ) + { + return "." + file.getName().split("[.]")[0] + ".png" ; + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |