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";
@@ -356,13 +362,18 @@ public class DocumentLoader
return null; return null;
} }
ByteBuffer renderPage(int number, int width , int height) ByteBuffer renderPage(int number, int width , int height)
{ {
try { try {
// 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,10 +723,18 @@ public class DocumentLoader
renderProps[2].Name = "View"; renderProps[2].Name = "View";
renderProps[2].Value = new MyXController(); renderProps[2].Value = new MyXController();
t0 = System.currentTimeMillis(); if (renderable != null)
pageCount = renderable.getRendererCount(doc, renderProps); {
t1 = System.currentTimeMillis(); t0 = System.currentTimeMillis();
Log.i(TAG, "getRendererCount: " + pageCount + ", took " + ((t1-t0)-timingOverhead) + " ms"); pageCount = renderable.getRendererCount(doc, renderProps);
t1 = System.currentTimeMillis();
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);
@@ -726,7 +746,7 @@ public class DocumentLoader
protected void onProgressUpdate(Integer progress){ protected void onProgressUpdate(Integer progress){
progressView.setProgress( progress.intValue() ); progressView.setProgress( progress.intValue() );
} }
protected void onPostExecute(Integer result){ protected void onPostExecute(Integer result){
Log.i(TAG, "onPostExecute: " + result); Log.i(TAG, "onPostExecute: " + result);
if (result == -1) if (result == -1)

View File

@@ -71,33 +71,38 @@ public class FileUtilities {
private static final String getExtension(String filename) private static final String getExtension(String filename)
{ {
int nExt = filename.lastIndexOf('.'); if (filename == null)
if (nExt < 0) return "";
return ""; int nExt = filename.lastIndexOf('.');
return filename.substring(nExt); if (nExt < 0)
return "";
return filename.substring(nExt);
} }
private static final int lookupExtension(String filename) private static final int lookupExtension(String filename)
{ {
String extn = getExtension (filename); String extn = getExtension (filename);
if (!mExtnMap.containsKey(extn)) if (!mExtnMap.containsKey(extn))
return UNKNOWN; return UNKNOWN;
return mExtnMap.get (extn); return mExtnMap.get (extn);
} }
static int getType(String filename) static int getType(String filename)
{ {
int type = lookupExtension (filename); int type = lookupExtension (filename);
android.util.Log.d("debug", "extn : " + filename + " -> " + type); android.util.Log.d("debug", "extn : " + filename + " -> " + type);
return type; return type;
} }
// Filter by mode, and/or in future by filename/wildcard // Filter by mode, and/or in future by filename/wildcard
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;
@@ -105,7 +110,7 @@ public class FileUtilities {
// check extension // check extension
if (byMode != ALL) { if (byMode != ALL) {
if (mExtnMap.get (getExtension (filename)) != byMode) if (mExtnMap.get (getExtension (filename)) != byMode)
return false; return false;
} }
if (byFilename != "") { if (byFilename != "") {
// FIXME return false on a non-match // FIXME return false on a non-match

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 \