mirror of https://github.com/NekoX-Dev/NekoX.git
Fix gif loading
This commit is contained in:
parent
0de6577a2b
commit
3bd6fa8257
|
@ -29,10 +29,15 @@ public class FileLoader extends BaseController {
|
||||||
|
|
||||||
public interface FileLoaderDelegate {
|
public interface FileLoaderDelegate {
|
||||||
void fileUploadProgressChanged(String location, long uploadedSize, long totalSize, boolean isEncrypted);
|
void fileUploadProgressChanged(String location, long uploadedSize, long totalSize, boolean isEncrypted);
|
||||||
|
|
||||||
void fileDidUploaded(String location, TLRPC.InputFile inputFile, TLRPC.InputEncryptedFile inputEncryptedFile, byte[] key, byte[] iv, long totalFileSize);
|
void fileDidUploaded(String location, TLRPC.InputFile inputFile, TLRPC.InputEncryptedFile inputEncryptedFile, byte[] key, byte[] iv, long totalFileSize);
|
||||||
|
|
||||||
void fileDidFailedUpload(String location, boolean isEncrypted);
|
void fileDidFailedUpload(String location, boolean isEncrypted);
|
||||||
|
|
||||||
void fileDidLoaded(String location, File finalFile, int type);
|
void fileDidLoaded(String location, File finalFile, int type);
|
||||||
|
|
||||||
void fileDidFailedLoad(String location, int state);
|
void fileDidFailedLoad(String location, int state);
|
||||||
|
|
||||||
void fileLoadProgressChanged(String location, long uploadedSize, long totalSize);
|
void fileLoadProgressChanged(String location, long uploadedSize, long totalSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +91,7 @@ public class FileLoader extends BaseController {
|
||||||
private ConcurrentHashMap<Integer, Object> parentObjectReferences = new ConcurrentHashMap<>();
|
private ConcurrentHashMap<Integer, Object> parentObjectReferences = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private static volatile FileLoader[] Instance = new FileLoader[UserConfig.MAX_ACCOUNT_COUNT];
|
private static volatile FileLoader[] Instance = new FileLoader[UserConfig.MAX_ACCOUNT_COUNT];
|
||||||
|
|
||||||
public static FileLoader getInstance(int num) {
|
public static FileLoader getInstance(int num) {
|
||||||
FileLoader localInstance = Instance[num];
|
FileLoader localInstance = Instance[num];
|
||||||
if (localInstance == null) {
|
if (localInstance == null) {
|
||||||
|
@ -411,15 +417,15 @@ public class FileLoader extends BaseController {
|
||||||
int index = downloadQueue.indexOf(operation);
|
int index = downloadQueue.indexOf(operation);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
downloadQueue.remove(index);
|
downloadQueue.remove(index);
|
||||||
if (operation.start()) {
|
if (operation.start()) {
|
||||||
count.put(datacenterId, count.get(datacenterId) + 1);
|
count.put(datacenterId, count.get(datacenterId) + 1);
|
||||||
}
|
}
|
||||||
if (queueType == QUEUE_TYPE_FILE) {
|
if (queueType == QUEUE_TYPE_FILE) {
|
||||||
if (operation.wasStarted() && !activeFileLoadOperation.contains(operation)) {
|
if (operation.wasStarted() && !activeFileLoadOperation.contains(operation)) {
|
||||||
pauseCurrentFileLoadOperations(operation);
|
pauseCurrentFileLoadOperations(operation);
|
||||||
activeFileLoadOperation.add(operation);
|
activeFileLoadOperation.add(operation);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pauseCurrentFileLoadOperations(operation);
|
pauseCurrentFileLoadOperations(operation);
|
||||||
operation.start();
|
operation.start();
|
||||||
|
@ -787,7 +793,7 @@ public class FileLoader extends BaseController {
|
||||||
final CountDownLatch semaphore = new CountDownLatch(1);
|
final CountDownLatch semaphore = new CountDownLatch(1);
|
||||||
final FileLoadOperation[] result = new FileLoadOperation[1];
|
final FileLoadOperation[] result = new FileLoadOperation[1];
|
||||||
fileLoaderQueue.postRunnable(() -> {
|
fileLoaderQueue.postRunnable(() -> {
|
||||||
result[0] = loadFileInternal(document, null, null, document == null && location != null ? location.location : null, location, parentObject, document == null && location != null ? "mp4" : null, document == null && location != null ? location.currentSize : 0, 1, stream, offset, priority, document == null ? 1 : 0);
|
result[0] = loadFileInternal(document, null, null, document == null && location != null ? location.location : null, location, parentObject, document == null && location != null ? "mp4" : null, document == null && location != null ? location.currentSize : 0, 1, stream, offset, priority, document == null ? 1 : 0);
|
||||||
semaphore.countDown();
|
semaphore.countDown();
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
@ -960,8 +966,10 @@ public class FileLoader extends BaseController {
|
||||||
} else {
|
} else {
|
||||||
if (MessageObject.isVoiceDocument(document)) {
|
if (MessageObject.isVoiceDocument(document)) {
|
||||||
dir = getDirectory(MEDIA_DIR_AUDIO);
|
dir = getDirectory(MEDIA_DIR_AUDIO);
|
||||||
} else if (MessageObject.isVideoDocument(document)) {
|
} else if (MessageObject.isVideoDocument(document) || MessageObject.isGifDocument(document)) {
|
||||||
dir = getDirectory(MEDIA_DIR_VIDEO);
|
dir = getDirectory(MEDIA_DIR_VIDEO);
|
||||||
|
} else if (MessageObject.isStickerDocument(document)) {
|
||||||
|
dir = getDirectory(MEDIA_DIR_CACHE);
|
||||||
} else {
|
} else {
|
||||||
dir = getDirectory(MEDIA_DIR_DOCUMENT);
|
dir = getDirectory(MEDIA_DIR_DOCUMENT);
|
||||||
}
|
}
|
||||||
|
@ -1131,9 +1139,9 @@ public class FileLoader extends BaseController {
|
||||||
TLRPC.Document document = (TLRPC.Document) attach;
|
TLRPC.Document document = (TLRPC.Document) attach;
|
||||||
if (document.mime_type != null && (
|
if (document.mime_type != null && (
|
||||||
document.mime_type.startsWith("application/x") ||
|
document.mime_type.startsWith("application/x") ||
|
||||||
document.mime_type.startsWith("audio/") ||
|
document.mime_type.startsWith("audio/") ||
|
||||||
document.mime_type.startsWith("video/") ||
|
document.mime_type.startsWith("video/") ||
|
||||||
document.mime_type.startsWith("image/"))) {
|
document.mime_type.startsWith("image/"))) {
|
||||||
String docExt = getDocumentFileName(document);
|
String docExt = getDocumentFileName(document);
|
||||||
int idx;
|
int idx;
|
||||||
if (docExt == null || (idx = docExt.lastIndexOf('.')) == -1) {
|
if (docExt == null || (idx = docExt.lastIndexOf('.')) == -1) {
|
||||||
|
|
|
@ -2347,8 +2347,10 @@ public class ImageLoader {
|
||||||
TLRPC.Document document = imageLocation.document;
|
TLRPC.Document document = imageLocation.document;
|
||||||
if (document instanceof TLRPC.TL_documentEncrypted) {
|
if (document instanceof TLRPC.TL_documentEncrypted) {
|
||||||
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), url);
|
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), url);
|
||||||
} else if (MessageObject.isVideoDocument(document)) {
|
} else if (MessageObject.isVideoDocument(document) || MessageObject.isGifDocument(document)) {
|
||||||
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_VIDEO), url);
|
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_VIDEO), url);
|
||||||
|
} else if (MessageObject.isStickerDocument(document)) {
|
||||||
|
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), url);
|
||||||
} else {
|
} else {
|
||||||
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_DOCUMENT), url);
|
cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_DOCUMENT), url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5318,6 +5318,8 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
|
|
||||||
if (user.photo != null && user.photo.dc_id != 0) {
|
if (user.photo != null && user.photo.dc_id != 0) {
|
||||||
idTextView.setText("ID: " + user_id + ", DC: " + user.photo.dc_id);
|
idTextView.setText("ID: " + user_id + ", DC: " + user.photo.dc_id);
|
||||||
|
} else if (UserObject.isUserSelf(user) && getMessagesController().thisDc > 0) {
|
||||||
|
idTextView.setText("ID: " + user.id + ", DC: " + getMessagesController().thisDc);
|
||||||
} else {
|
} else {
|
||||||
idTextView.setText("ID: " + user_id);
|
idTextView.setText("ID: " + user_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
V2RAY_CORE_VERSION="4.31.2"
|
V2RAY_CORE_VERSION="4.31.3"
|
||||||
|
|
||||||
if [ ! -x "$(command -v go)" ]; then
|
if [ ! -x "$(command -v go)" ]; then
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue