android: fewer exceptions, and more debug output on null renderables

cleanup some library mentions
This commit is contained in:
Michael Meeks
2012-08-03 21:07:43 +01:00
parent 69207d1f69
commit 5f09718dba
4 changed files with 46 additions and 27 deletions

View File

@@ -21,11 +21,9 @@ copy-stuff:
# #
for F in $(strip \ for F in $(strip \
analysislo \ analysislo \
avmedialo \
basebmplo \ basebmplo \
basegfxlo \ basegfxlo \
bootstrap.uno \ bootstrap.uno \
canvastoolslo \
chartcontrollerlo \ chartcontrollerlo \
chartcorelo \ chartcorelo \
comphelpgcc3 \ comphelpgcc3 \
@@ -34,7 +32,6 @@ copy-stuff:
datelo \ datelo \
dbaxmllo \ dbaxmllo \
dbtoolslo \ dbtoolslo \
drawinglayerlo \
embobj \ embobj \
evtattlo \ evtattlo \
expwrap.uno \ expwrap.uno \

View File

@@ -279,6 +279,12 @@ public class DocumentLoader
// Use dummySmallDevice with no scale of offset just to find out // Use dummySmallDevice with no scale of offset just to find out
// the paper size of this page. // the paper size of this page.
Log.i( TAG , "Render( " + Integer.toString( number ) + " )"); Log.i( TAG , "Render( " + Integer.toString( number ) + " )");
if (renderable == null) {
Log.i( TAG , "no renderable");
return null;
}
PropertyValue renderProps[] = new PropertyValue[3]; PropertyValue renderProps[] = new PropertyValue[3];
renderProps[0] = new PropertyValue(); renderProps[0] = new PropertyValue();
renderProps[0].Name = "IsPrinter"; renderProps[0].Name = "IsPrinter";
@@ -363,6 +369,11 @@ public class DocumentLoader
// Use dummySmallDevice with no scale of offset just to find out // Use dummySmallDevice with no scale of offset just to find out
// the paper size of this page. // the paper size of this page.
if (renderable == null) {
Log.i( TAG , "no renderable to render page ( " + Integer.toString(number) + " )" );
return null;
}
PropertyValue renderProps[] = new PropertyValue[3]; PropertyValue renderProps[] = new PropertyValue[3];
renderProps[0] = new PropertyValue(); renderProps[0] = new PropertyValue();
renderProps[0].Name = "IsPrinter"; renderProps[0].Name = "IsPrinter";
@@ -686,7 +697,8 @@ public class DocumentLoader
doc = componentLoader.loadComponentFromURL(url, "_blank", 0, loadProps); doc = componentLoader.loadComponentFromURL(url, "_blank", 0, loadProps);
publishProgress( new Integer( 33 )); publishProgress( new Integer( 33 ));
long t1 = System.currentTimeMillis(); long t1 = System.currentTimeMillis();
Log.i(TAG, "Loading took " + ((t1-t0)-timingOverhead) + " ms"); Log.i(TAG, "Loading took " + ((t1-t0)-timingOverhead) + " ms => " +
(doc == null ? "null" : "have") + "document");
Object toolkitService = mcf.createInstanceWithContext Object toolkitService = mcf.createInstanceWithContext
("com.sun.star.awt.Toolkit", context); ("com.sun.star.awt.Toolkit", context);
@@ -711,11 +723,19 @@ public class DocumentLoader
renderProps[2].Name = "View"; renderProps[2].Name = "View";
renderProps[2].Value = new MyXController(); renderProps[2].Value = new MyXController();
if (renderable != null)
{
t0 = System.currentTimeMillis(); t0 = System.currentTimeMillis();
pageCount = renderable.getRendererCount(doc, renderProps); pageCount = renderable.getRendererCount(doc, renderProps);
t1 = System.currentTimeMillis(); t1 = System.currentTimeMillis();
Log.i(TAG, "getRendererCount: " + pageCount + ", took " + ((t1-t0)-timingOverhead) + " ms"); Log.i(TAG, "getRendererCount: " + pageCount + ", took " + ((t1-t0)-timingOverhead) + " ms");
} }
else
{
pageCount = 1; // hack
Log.i(TAG, "no / null renderable interface!");
}
}
catch (Exception e) { catch (Exception e) {
e.printStackTrace(System.err); e.printStackTrace(System.err);
finish(); finish();

View File

@@ -71,6 +71,8 @@ public class FileUtilities {
private static final String getExtension(String filename) private static final String getExtension(String filename)
{ {
if (filename == null)
return "";
int nExt = filename.lastIndexOf('.'); int nExt = filename.lastIndexOf('.');
if (nExt < 0) if (nExt < 0)
return ""; return "";
@@ -96,8 +98,11 @@ public class FileUtilities {
static private boolean doAccept(String filename, int byMode, String byFilename) static private boolean doAccept(String filename, int byMode, String byFilename)
{ {
android.util.Log.d("debug", "doAccept : " + filename + " mode " + byMode + " byFilename " + byFilename); android.util.Log.d("debug", "doAccept : " + filename + " mode " + byMode + " byFilename " + byFilename);
if (byMode == ALL && byFilename == ""){ if (filename == null)
if( filename.startsWith(".")){//ignore hidden files return false;
if (byMode == ALL && byFilename == "") {
if( filename.startsWith(".")) {//ignore hidden files
return false; return false;
} }
return true; return true;

View File

@@ -93,14 +93,11 @@ copy-stuff: buildrcs
# #
for F in $(strip \ for F in $(strip \
analysislo \ analysislo \
avmedialo \
basebmplo \ basebmplo \
basegfxlo \ basegfxlo \
bootstrap.uno \ bootstrap.uno \
canvastoolslo \
comphelpgcc3 \ comphelpgcc3 \
cppcanvaslo \ cppcanvaslo \
drawinglayerlo \
embobj \ embobj \
expwrap.uno \ expwrap.uno \
fileacc \ fileacc \