mirror of
https://github.com/wrwrabbit/Partisan-Telegram-Android.git
synced 2026-04-30 21:19:33 +00:00
parent
f120800a7f
commit
dceccae0b7
487 changed files with 23032 additions and 9363 deletions
|
|
@ -16,6 +16,10 @@ public class AnimatedFileDrawableStream implements FileLoadOperationStream {
|
|||
private int lastOffset;
|
||||
private boolean waitingForLoad;
|
||||
private boolean preview;
|
||||
private boolean finishedLoadingFile;
|
||||
private String finishedFilePath;
|
||||
|
||||
private boolean ignored;
|
||||
|
||||
public AnimatedFileDrawableStream(TLRPC.Document d, Object p, int a, boolean prev) {
|
||||
document = d;
|
||||
|
|
@ -25,6 +29,14 @@ public class AnimatedFileDrawableStream implements FileLoadOperationStream {
|
|||
loadOperation = FileLoader.getInstance(currentAccount).loadStreamFile(this, document, parentObject, 0, preview);
|
||||
}
|
||||
|
||||
public boolean isFinishedLoadingFile() {
|
||||
return finishedLoadingFile;
|
||||
}
|
||||
|
||||
public String getFinishedFilePath() {
|
||||
return finishedFilePath;
|
||||
}
|
||||
|
||||
public int read(int offset, int readLength) {
|
||||
synchronized (sync) {
|
||||
if (canceled) {
|
||||
|
|
@ -37,7 +49,12 @@ public class AnimatedFileDrawableStream implements FileLoadOperationStream {
|
|||
int availableLength = 0;
|
||||
try {
|
||||
while (availableLength == 0) {
|
||||
availableLength = loadOperation.getDownloadedLengthFromOffset(offset, readLength);
|
||||
int[] result = loadOperation.getDownloadedLengthFromOffset(offset, readLength);
|
||||
availableLength = result[0];
|
||||
if (!finishedLoadingFile && result[1] != 0) {
|
||||
finishedLoadingFile = true;
|
||||
finishedFilePath = loadOperation.getCacheFileFinal().getAbsolutePath();
|
||||
}
|
||||
if (availableLength == 0) {
|
||||
if (loadOperation.isPaused() || lastOffset != offset || preview) {
|
||||
FileLoader.getInstance(currentAccount).loadStreamFile(this, document, parentObject, offset, preview);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue