Here is a small patch for org.jivesoftware.smackx.filetransfer.FileTransfer
The current getProgress method only returns 2 values : 0 (during the transfer) and 1 when the transfer finishes.
fileSize should be cast to double in order to return the real progress.
I also added some checks because amountWritten is init with -1 and fileSize creates an exception (divide by zero) if getProgress is called too early.
Old :
public double getProgress() {
if(amountWritten == 0) {
return 0;
}
return amountWritten / fileSize;
}
New:
public double getProgress() {
if(amountWritten <= 0 || fileSize <= 0) {
return 0;
}
return amountWritten / (double)fileSize;
}
–
Nicolas