mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-15 21:20:06 +00:00
Don't show progress if content length is unavailable
This commit is contained in:
@@ -19,7 +19,7 @@ public class ProgressInputStream extends FilterInputStream {
|
|||||||
@Override
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
int b = super.read();
|
int b = super.read();
|
||||||
if (b >= 0) {
|
if (totalBytes > 0 && b >= 0) {
|
||||||
bytesDownloaded++;
|
bytesDownloaded++;
|
||||||
Networking.mainHandler.post(() -> progress.onProgress(bytesDownloaded, totalBytes));
|
Networking.mainHandler.post(() -> progress.onProgress(bytesDownloaded, totalBytes));
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ public class ProgressInputStream extends FilterInputStream {
|
|||||||
@Override
|
@Override
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
public int read(byte[] b, int off, int len) throws IOException {
|
||||||
int sz = super.read(b, off, len);
|
int sz = super.read(b, off, len);
|
||||||
if (sz > 0) {
|
if (totalBytes > 0 && sz > 0) {
|
||||||
bytesDownloaded += sz;
|
bytesDownloaded += sz;
|
||||||
Networking.mainHandler.post(() -> progress.onProgress(bytesDownloaded, totalBytes));
|
Networking.mainHandler.post(() -> progress.onProgress(bytesDownloaded, totalBytes));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user