forked from mirror/monocles_chat
Transferables interface needs to differentiate between 0 and null file size
This commit is contained in:
parent
f9204fc340
commit
62e675d76a
6 changed files with 13 additions and 13 deletions
|
@ -34,7 +34,7 @@ public interface Transferable {
|
|||
|
||||
int getStatus();
|
||||
|
||||
long getFileSize();
|
||||
Long getFileSize();
|
||||
|
||||
int getProgress();
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ public class TransferablePlaceholder implements Transferable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getFileSize() {
|
||||
return 0;
|
||||
public Long getFileSize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -143,6 +143,7 @@ public class HttpDownloadConnection implements Transferable {
|
|||
|
||||
private void download(final boolean interactive) {
|
||||
changeStatus(STATUS_WAITING);
|
||||
Log.d(Config.LOGTAG,"download()",new Exception());
|
||||
FileTransferExecutor.execute(new FileDownloader(interactive));
|
||||
}
|
||||
|
||||
|
@ -249,11 +250,11 @@ public class HttpDownloadConnection implements Transferable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getFileSize() {
|
||||
public Long getFileSize() {
|
||||
if (this.file != null) {
|
||||
return this.file.getExpectedSize();
|
||||
} else {
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ public class HttpUploadConnection implements Transferable, AbstractConnectionMan
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getFileSize() {
|
||||
return file == null ? 0 : file.getExpectedSize();
|
||||
public Long getFileSize() {
|
||||
return file == null ? null : file.getExpectedSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,8 @@ import android.os.PowerManager;
|
|||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import org.bouncycastle.crypto.engines.AESEngine;
|
||||
import org.bouncycastle.crypto.io.CipherInputStream;
|
||||
import org.bouncycastle.crypto.io.CipherOutputStream;
|
||||
|
@ -152,12 +154,9 @@ public class AbstractConnectionManager {
|
|||
}
|
||||
}
|
||||
|
||||
public PowerManager.WakeLock createWakeLock(final Thread thread) {
|
||||
return createWakeLock("conversations:" + thread.getName());
|
||||
}
|
||||
|
||||
public PowerManager.WakeLock createWakeLock(final String name) {
|
||||
final PowerManager powerManager = (PowerManager) mXmppConnectionService.getSystemService(Context.POWER_SERVICE);
|
||||
final PowerManager powerManager = ContextCompat.getSystemService(mXmppConnectionService, PowerManager.class);
|
||||
return powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -1258,11 +1258,11 @@ public class JingleFileTransferConnection extends AbstractJingleConnection imple
|
|||
}
|
||||
|
||||
@Override
|
||||
public long getFileSize() {
|
||||
public Long getFileSize() {
|
||||
if (this.file != null) {
|
||||
return this.file.getExpectedSize();
|
||||
} else {
|
||||
return 0;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue