formatting and whitespace

Change-Id: Icc086404a2ef32a38e972da9158f6156fdf74ef2
Reviewed-on: https://gerrit.libreoffice.org/23363
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
This commit is contained in:
Alexandru Moscu 2016-03-18 21:46:11 +02:00 committed by Markus Mohrhard
parent c0737674ad
commit c9c78dc1a5

View File

@ -138,7 +138,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
Log.d(LOGTAG, "SCHEME_CONTENT: getPath(): " + getIntent().getData().getPath()); Log.d(LOGTAG, "SCHEME_CONTENT: getPath(): " + getIntent().getData().getPath());
} else { } else {
// TODO: can't open the file // TODO: can't open the file
Log.e(LOGTAG, "couldn't create temporary file from "+getIntent().getData()); Log.e(LOGTAG, "couldn't create temporary file from " + getIntent().getData());
} }
} else if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_FILE)) { } else if (getIntent().getData().getScheme().equals(ContentResolver.SCHEME_FILE)) {
mInputFile = new File(getIntent().getData().getPath()); mInputFile = new File(getIntent().getData().getPath());
@ -203,7 +203,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
try { try {
AssetFileDescriptor assetFD = contentResolver.openAssetFileDescriptor(getIntent().getData(), "r"); AssetFileDescriptor assetFD = contentResolver.openAssetFileDescriptor(getIntent().getData(), "r");
if (assetFD == null) { if (assetFD == null) {
Log.e(LOGTAG, "couldn't create assetfiledescriptor from "+getIntent().getDataString()); Log.e(LOGTAG, "couldn't create assetfiledescriptor from " + getIntent().getDataString());
return false; return false;
} }
inputChannel = assetFD.createInputStream().getChannel(); inputChannel = assetFD.createInputStream().getChannel();
@ -215,7 +215,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
while (bytesTransferred < inputChannel.size()) { while (bytesTransferred < inputChannel.size()) {
bytesTransferred += outputChannel.transferFrom(inputChannel, bytesTransferred, inputChannel.size()); bytesTransferred += outputChannel.transferFrom(inputChannel, bytesTransferred, inputChannel.size());
} }
Log.e(LOGTAG, "Success copying "+bytesTransferred+ " bytes"); Log.e(LOGTAG, "Success copying " + bytesTransferred + " bytes");
return true; return true;
} finally { } finally {
if (inputChannel != null) inputChannel.close(); if (inputChannel != null) inputChannel.close();
@ -336,7 +336,7 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
if (isFinishing()) { // Not an orientation change if (isFinishing()) { // Not an orientation change
if (mTempFile != null) { if (mTempFile != null) {
//noinspection ResultOfMethodCallIgnored // noinspection ResultOfMethodCallIgnored
mTempFile.delete(); mTempFile.delete();
} }
} }
@ -560,9 +560,9 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
boolean res = true; boolean res = true;
for (String file : files) { for (String file : files) {
String[] dirOrFile = assetManager.list(fromAssetPath+"/"+file); String[] dirOrFile = assetManager.list(fromAssetPath + "/" + file);
if ( dirOrFile.length == 0) { if ( dirOrFile.length == 0) {
//noinspection ResultOfMethodCallIgnored // noinspection ResultOfMethodCallIgnored
new File(targetDir).mkdirs(); new File(targetDir).mkdirs();
res &= copyAsset(assetManager, res &= copyAsset(assetManager,
fromAssetPath + "/" + file, fromAssetPath + "/" + file,
@ -588,14 +588,14 @@ public class LibreOfficeMainActivity extends AppCompatActivity {
source = Channels.newChannel(assetManager.open(fromAssetPath)); source = Channels.newChannel(assetManager.open(fromAssetPath));
dest = new FileOutputStream(toPath).getChannel(); dest = new FileOutputStream(toPath).getChannel();
long bytesTransferred = 0; long bytesTransferred = 0;
// might not copy all at once, so make sure everything gets copied.... // might not copy all at once, so make sure everything gets copied....
ByteBuffer buffer = ByteBuffer.allocate(4096); ByteBuffer buffer = ByteBuffer.allocate(4096);
while (source.read(buffer)>0) { while (source.read(buffer) > 0) {
buffer.flip(); buffer.flip();
bytesTransferred += dest.write(buffer); bytesTransferred += dest.write(buffer);
buffer.clear(); buffer.clear();
} }
Log.v(LOGTAG, "Success copying "+fromAssetPath+" to "+toPath + " bytes: "+bytesTransferred); Log.v(LOGTAG, "Success copying " + fromAssetPath + " to " + toPath + " bytes: " + bytesTransferred);
return true; return true;
} finally { } finally {
if (dest != null) dest.close(); if (dest != null) dest.close();