Remove dead http-code.

This commit is contained in:
B. Petersen
2017-03-31 19:34:49 +02:00
parent cff6b6bba7
commit cf2ea4cc56
7 changed files with 14 additions and 710 deletions
@@ -1,358 +0,0 @@
/*******************************************************************************
*
* Messenger Android Frontend
* (C) 2013-2016 Nikolai Kudashov
* (C) 2017 Björn Petersen
* Contact: r10s@b44t.com, http://b44t.com
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see http://www.gnu.org/licenses/ .
*
******************************************************************************/
package com.b44t.messenger;
import java.io.RandomAccessFile;
import java.io.File;
import java.util.ArrayList;
public class FileLoadOperation {
private static class RequestInfo {
private int dummy;
}
private final static int stateIdle = 0;
private final static int stateDownloading = 1;
private final static int stateFailed = 2;
private final static int stateFinished = 3;
private final static int downloadChunkSize = 1024 * 32;
private final static int downloadChunkSizeBig = 1024 * 128;
private final static int maxDownloadRequests = 4;
private final static int maxDownloadRequestsBig = 2;
private final static int bigFileSizeFrom = 1024 * 1024;
private int datacenter_id;
private TLRPC.InputFileLocation location;
private volatile int state = stateIdle;
private int downloadedBytes;
private int totalBytesCount;
private int bytesCountPadding;
private FileLoadOperationDelegate delegate;
private int currentDownloadChunkSize;
private int currentMaxDownloadRequests;
private int renameRetryCount;
private int nextDownloadOffset;
private ArrayList<RequestInfo> requestInfos;
private ArrayList<RequestInfo> delayedRequestInfos;
private File cacheFileTemp;
private File cacheFileFinal;
private String ext;
private RandomAccessFile fileOutputStream;
private RandomAccessFile fiv;
private File storePath;
private File tempPath;
private boolean isForceRequest;
public interface FileLoadOperationDelegate {
void didFinishLoadingFile(FileLoadOperation operation, File finalFile);
void didFailedLoadingFile(FileLoadOperation operation, int state);
void didChangedLoadProgress(FileLoadOperation operation, float progress);
}
public FileLoadOperation(TLRPC.FileLocation photoLocation, String extension, int size) {
if (photoLocation instanceof TLRPC.TL_fileLocation) {
location = new TLRPC.TL_inputFileLocation();
location.volume_id = photoLocation.volume_id;
location.local_id = photoLocation.local_id;
datacenter_id = photoLocation.dc_id;
}
totalBytesCount = size;
ext = extension != null ? extension : "jpg";
}
public FileLoadOperation(TLRPC.Document documentLocation) {
try {
if (documentLocation instanceof TLRPC.TL_document) {
location = new TLRPC.TL_inputDocumentFileLocation();
location.id = documentLocation.id;
location.access_hash = documentLocation.access_hash;
datacenter_id = documentLocation.dc_id;
}
totalBytesCount = documentLocation.size;
ext = FileLoader.getDocumentFileName(documentLocation);
int idx;
if (ext == null || (idx = ext.lastIndexOf('.')) == -1) {
ext = "";
} else {
ext = ext.substring(idx);
}
if (ext.length() <= 1) {
if (documentLocation.mime_type != null) {
switch (documentLocation.mime_type) {
case "video/mp4":
ext = ".mp4";
break;
case "audio/ogg":
ext = ".ogg";
break;
default:
ext = "";
break;
}
} else {
ext = "";
}
}
} catch (Exception e) {
FileLog.e("messenger", e);
state = stateFailed;
cleanup();
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
}
});
}
}
public void setForceRequest(boolean forceRequest) {
isForceRequest = forceRequest;
}
public boolean isForceRequest() {
return isForceRequest;
}
public void setPaths(File store, File temp) {
storePath = store;
tempPath = temp;
}
public void start() {
if (state != stateIdle) {
return;
}
currentDownloadChunkSize = totalBytesCount >= bigFileSizeFrom ? downloadChunkSizeBig : downloadChunkSize;
currentMaxDownloadRequests = totalBytesCount >= bigFileSizeFrom ? maxDownloadRequestsBig : maxDownloadRequests;
requestInfos = new ArrayList<>(currentMaxDownloadRequests);
delayedRequestInfos = new ArrayList<>(currentMaxDownloadRequests - 1);
state = stateDownloading;
if (location == null) {
cleanup();
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
}
});
return;
}
String fileNameFinal;
String fileNameTemp;
if (location.volume_id != 0 && location.local_id != 0) {
fileNameTemp = location.volume_id + "_" + location.local_id + ".temp";
fileNameFinal = location.volume_id + "_" + location.local_id + "." + ext;
if (datacenter_id == Integer.MIN_VALUE || location.volume_id == Integer.MIN_VALUE || datacenter_id == 0) {
cleanup();
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
}
});
return;
}
} else {
fileNameTemp = datacenter_id + "_" + location.id + ".temp";
fileNameFinal = datacenter_id + "_" + location.id + ext;
if (datacenter_id == 0 || location.id == 0) {
cleanup();
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
}
});
return;
}
}
cacheFileFinal = new File(storePath, fileNameFinal);
boolean exist = cacheFileFinal.exists();
if (exist && totalBytesCount != 0 && totalBytesCount != cacheFileFinal.length()) {
cacheFileFinal.delete();
}
if (!cacheFileFinal.exists()) {
cacheFileTemp = new File(tempPath, fileNameTemp);
if (cacheFileTemp.exists()) {
downloadedBytes = (int) cacheFileTemp.length();
nextDownloadOffset = downloadedBytes = downloadedBytes / currentDownloadChunkSize * currentDownloadChunkSize;
}
if (BuildVars.DEBUG_VERSION) {
FileLog.d("messenger", "start loading file to temp = " + cacheFileTemp + " final = " + cacheFileFinal);
}
try {
fileOutputStream = new RandomAccessFile(cacheFileTemp, "rws");
if (downloadedBytes != 0) {
fileOutputStream.seek(downloadedBytes);
}
} catch (Exception e) {
FileLog.e("messenger", e);
}
if (fileOutputStream == null) {
cleanup();
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
}
});
return;
}
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
if (totalBytesCount != 0 && downloadedBytes == totalBytesCount) {
try {
onFinishLoadingFile();
} catch (Exception e) {
delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
}
} else {
startDownloadRequest();
}
}
});
} else {
try {
onFinishLoadingFile();
} catch (Exception e) {
delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
}
}
}
public void cancel() {
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
if (state == stateFinished || state == stateFailed) {
return;
}
state = stateFailed;
cleanup();
delegate.didFailedLoadingFile(FileLoadOperation.this, 1);
}
});
}
private void cleanup() {
try {
if (fileOutputStream != null) {
try {
fileOutputStream.getChannel().close();
} catch (Exception e) {
FileLog.e("messenger", e);
}
fileOutputStream.close();
fileOutputStream = null;
}
} catch (Exception e) {
FileLog.e("messenger", e);
}
try {
if (fiv != null) {
fiv.close();
fiv = null;
}
} catch (Exception e) {
FileLog.e("messenger", e);
}
if (delayedRequestInfos != null) {
delayedRequestInfos.clear();
}
}
private void onFinishLoadingFile() throws Exception {
if (state != stateDownloading) {
return;
}
state = stateFinished;
cleanup();
if (cacheFileTemp != null) {
boolean renameResult = cacheFileTemp.renameTo(cacheFileFinal);
if (!renameResult) {
if (BuildVars.DEBUG_VERSION) {
FileLog.e("messenger", "unable to rename temp = " + cacheFileTemp + " to final = " + cacheFileFinal + " retry = " + renameRetryCount);
}
renameRetryCount++;
if (renameRetryCount < 3) {
state = stateDownloading;
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public void run() {
try {
onFinishLoadingFile();
} catch (Exception e) {
delegate.didFailedLoadingFile(FileLoadOperation.this, 0);
}
}
}, 200);
return;
}
cacheFileFinal = cacheFileTemp;
}
}
if (BuildVars.DEBUG_VERSION) {
FileLog.e("messenger", "finished downloading file to " + cacheFileFinal);
}
delegate.didFinishLoadingFile(FileLoadOperation.this, cacheFileFinal);
}
private void startDownloadRequest() {
if (state != stateDownloading || totalBytesCount > 0 && nextDownloadOffset >= totalBytesCount || requestInfos.size() + delayedRequestInfos.size() >= currentMaxDownloadRequests) {
return;
}
int count = 1;
if (totalBytesCount > 0) {
count = Math.max(0, currentMaxDownloadRequests - requestInfos.size() - delayedRequestInfos.size());
}
for (int a = 0; a < count; a++) {
if (totalBytesCount > 0 && nextDownloadOffset >= totalBytesCount) {
break;
}
nextDownloadOffset += currentDownloadChunkSize;
final RequestInfo requestInfo = new RequestInfo();
requestInfos.add(requestInfo);
}
}
public void setDelegate(FileLoadOperationDelegate delegate) {
this.delegate = delegate;
}
}
@@ -48,18 +48,6 @@ public class FileLoader {
public static final int MEDIA_DIR_CACHE = 4;
private HashMap<Integer, File> mediaDirs = null;
private volatile DispatchQueue fileLoaderQueue = new DispatchQueue("fileUploadQueue");
private LinkedList<FileLoadOperation> loadOperationQueue = new LinkedList<>();
private LinkedList<FileLoadOperation> audioLoadOperationQueue = new LinkedList<>();
private LinkedList<FileLoadOperation> photoLoadOperationQueue = new LinkedList<>();
private ConcurrentHashMap<String, FileLoadOperation> loadOperationPaths = new ConcurrentHashMap<>();
private FileLoaderDelegate delegate = null;
private int currentLoadOperationsCount = 0;
private int currentAudioLoadOperationsCount = 0;
private int currentPhotoLoadOperationsCount = 0;
private static volatile FileLoader Instance = null;
@@ -95,257 +83,12 @@ public class FileLoader {
return dir;
}
public void cancelLoadFile(TLRPC.Document document) {
cancelLoadFile(document, null, null);
}
public void cancelLoadFile(TLRPC.PhotoSize photo) {
cancelLoadFile(null, photo.location, null);
}
public void cancelLoadFile(TLRPC.FileLocation location, String ext) {
cancelLoadFile(null, location, ext);
}
private void cancelLoadFile(final TLRPC.Document document, final TLRPC.FileLocation location, final String locationExt) {
if (location == null && document == null) {
return;
}
fileLoaderQueue.postRunnable(new Runnable() {
@Override
public void run() {
String fileName = null;
if (location != null) {
fileName = getAttachFileName(location, locationExt);
} else if (document != null) {
fileName = getAttachFileName(document);
}
if (fileName == null) {
return;
}
FileLoadOperation operation = loadOperationPaths.remove(fileName);
if (operation != null) {
if (MessageObject.isVoiceDocument(document)) {
audioLoadOperationQueue.remove(operation);
} else if (location != null) {
photoLoadOperationQueue.remove(operation);
} else {
loadOperationQueue.remove(operation);
}
operation.cancel();
}
}
});
}
public boolean isLoadingFile(final String fileName) {
final Semaphore semaphore = new Semaphore(0);
final Boolean[] result = new Boolean[1];
fileLoaderQueue.postRunnable(new Runnable() {
@Override
public void run() {
result[0] = loadOperationPaths.containsKey(fileName);
semaphore.release();
}
});
try {
semaphore.acquire();
} catch (Exception e) {
FileLog.e("messenger", e);
}
return result[0];
}
public void loadFile(TLRPC.PhotoSize photo, String ext, boolean cacheOnly) {
loadFile(null, photo.location, ext, photo.size, false, cacheOnly || (photo != null && photo.size == 0 || photo.location.key != null));
}
public void loadFile(TLRPC.Document document, boolean force, boolean cacheOnly) {
loadFile(document, null, null, 0, force, cacheOnly || document != null && document.key != null);
}
public void loadFile(TLRPC.FileLocation location, String ext, int size, boolean cacheOnly) {
loadFile(null, location, ext, size, true, cacheOnly || size == 0 || (location != null && location.key != null));
}
private void loadFile(final TLRPC.Document document, final TLRPC.FileLocation location, final String locationExt, final int locationSize, final boolean force, final boolean cacheOnly) {
fileLoaderQueue.postRunnable(new Runnable() {
@Override
public void run() {
String fileName = null;
if (location != null) {
fileName = getAttachFileName(location, locationExt);
} else if (document != null) {
fileName = getAttachFileName(document);
}
if (fileName == null || fileName.contains("" + Integer.MIN_VALUE)) {
return;
}
FileLoadOperation operation;
operation = loadOperationPaths.get(fileName);
if (operation != null) {
if (force) {
LinkedList<FileLoadOperation> downloadQueue;
if (MessageObject.isVoiceDocument(document)) {
downloadQueue = audioLoadOperationQueue;
} else if (location != null) {
downloadQueue = photoLoadOperationQueue;
} else {
downloadQueue = loadOperationQueue;
}
if (downloadQueue != null) {
int index = downloadQueue.indexOf(operation);
if (index != -1) {
downloadQueue.remove(index);
downloadQueue.add(0, operation);
operation.setForceRequest(true);
}
}
}
return;
}
File tempDir = getDirectory(MEDIA_DIR_CACHE);
File storeDir = tempDir;
int type = MEDIA_DIR_CACHE;
if (location != null) {
operation = new FileLoadOperation(location, locationExt, locationSize);
type = MEDIA_DIR_IMAGE;
} else if (document != null) {
operation = new FileLoadOperation(document);
if (MessageObject.isVoiceDocument(document)) {
type = MEDIA_DIR_AUDIO;
} else if (MessageObject.isVideoDocument(document)) {
type = MEDIA_DIR_VIDEO;
} else {
type = MEDIA_DIR_DOCUMENT;
}
}
if (!cacheOnly) {
storeDir = getDirectory(type);
}
operation.setPaths(storeDir, tempDir);
final String finalFileName = fileName;
final int finalType = type;
loadOperationPaths.put(fileName, operation);
operation.setDelegate(new FileLoadOperation.FileLoadOperationDelegate() {
@Override
public void didFinishLoadingFile(FileLoadOperation operation, File finalFile) {
if (delegate != null) {
delegate.fileDidLoaded(finalFileName, finalFile, finalType);
}
checkDownloadQueue(document, location, finalFileName);
}
@Override
public void didFailedLoadingFile(FileLoadOperation operation, int canceled) {
checkDownloadQueue(document, location, finalFileName);
if (delegate != null) {
delegate.fileDidFailedLoad(finalFileName, canceled);
}
}
@Override
public void didChangedLoadProgress(FileLoadOperation operation, float progress) {
if (delegate != null) {
delegate.fileLoadProgressChanged(finalFileName, progress);
}
}
});
int maxCount = force ? 3 : 1;
if (type == MEDIA_DIR_AUDIO) {
if (currentAudioLoadOperationsCount < maxCount) {
currentAudioLoadOperationsCount++;
operation.start();
} else {
if (force) {
audioLoadOperationQueue.add(0, operation);
} else {
audioLoadOperationQueue.add(operation);
}
}
} else if (location != null) {
if (currentPhotoLoadOperationsCount < maxCount) {
currentPhotoLoadOperationsCount++;
operation.start();
} else {
if (force) {
photoLoadOperationQueue.add(0, operation);
} else {
photoLoadOperationQueue.add(operation);
}
}
} else {
if (currentLoadOperationsCount < maxCount) {
currentLoadOperationsCount++;
operation.start();
} else {
if (force) {
loadOperationQueue.add(0, operation);
} else {
loadOperationQueue.add(operation);
}
}
}
}
});
}
private void checkDownloadQueue(final TLRPC.Document document, final TLRPC.FileLocation location, final String arg1) {
fileLoaderQueue.postRunnable(new Runnable() {
@Override
public void run() {
loadOperationPaths.remove(arg1);
FileLoadOperation operation;
if (MessageObject.isVoiceDocument(document)) {
currentAudioLoadOperationsCount--;
if (!audioLoadOperationQueue.isEmpty()) {
operation = audioLoadOperationQueue.get(0);
int maxCount = operation.isForceRequest() ? 3 : 1;
if (currentAudioLoadOperationsCount < maxCount) {
operation = audioLoadOperationQueue.poll();
if (operation != null) {
currentAudioLoadOperationsCount++;
operation.start();
}
}
}
} else if (location != null) {
currentPhotoLoadOperationsCount--;
if (!photoLoadOperationQueue.isEmpty()) {
operation = photoLoadOperationQueue.get(0);
int maxCount = operation.isForceRequest() ? 3 : 1;
if (currentPhotoLoadOperationsCount < maxCount) {
operation = photoLoadOperationQueue.poll();
if (operation != null) {
currentPhotoLoadOperationsCount++;
operation.start();
}
}
}
} else {
currentLoadOperationsCount--;
if (!loadOperationQueue.isEmpty()) {
operation = loadOperationQueue.get(0);
int maxCount = operation.isForceRequest() ? 3 : 1;
if (currentLoadOperationsCount < maxCount) {
operation = loadOperationQueue.poll();
if (operation != null) {
currentLoadOperationsCount++;
operation.start();
}
}
}
}
}
});
return false;
}
public void setDelegate(FileLoaderDelegate delegate) {
this.delegate = delegate;
}
public static String getMessageFileName(TLRPC.Message message) {
@@ -865,9 +865,9 @@ public class ImageLoader {
imageReceiverArray.clear();
if (location != null) {
if (location instanceof TLRPC.FileLocation) {
FileLoader.getInstance().cancelLoadFile((TLRPC.FileLocation) location, ext);
//FileLoader.getInstance().cancelLoadFile((TLRPC.FileLocation) location, ext);
} else if (location instanceof TLRPC.Document) {
FileLoader.getInstance().cancelLoadFile((TLRPC.Document) location);
//FileLoader.getInstance().cancelLoadFile((TLRPC.Document) location);
}
}
if (cacheTask != null) {
@@ -1363,9 +1363,9 @@ public class ImageLoader {
if (httpLocation == null) {
if (imageLocation instanceof TLRPC.FileLocation) {
TLRPC.FileLocation location = (TLRPC.FileLocation) imageLocation;
FileLoader.getInstance().loadFile(location, ext, size, size == 0 || location.key != null || cacheOnly);
//FileLoader.getInstance().loadFile(location, ext, size, size == 0 || location.key != null || cacheOnly);
} else if (imageLocation instanceof TLRPC.Document) {
FileLoader.getInstance().loadFile((TLRPC.Document) imageLocation, true, cacheOnly);
//FileLoader.getInstance().loadFile((TLRPC.Document) imageLocation, true, cacheOnly);
}
} else {
String file = Utilities.MD5(httpLocation);
@@ -102,93 +102,12 @@ public class StickersAdapter extends RecyclerView.Adapter implements Notificatio
File f = FileLoader.getPathToAttach(document.thumb, "webp", true);
if (!f.exists()) {
stickersToLoad.add(FileLoader.getAttachFileName(document.thumb, "webp"));
FileLoader.getInstance().loadFile(document.thumb.location, "webp", 0, true);
//FileLoader.getInstance().loadFile(document.thumb.location, "webp", 0, true);
}
}
return stickersToLoad.isEmpty();
}
public void loadStikersForEmoji(CharSequence emoji) {
boolean search = emoji != null && emoji.length() > 0 && emoji.length() <= 14;
if (search) {
int length = emoji.length();
for (int a = 0; a < length; a++) {
if (a < length - 1 && emoji.charAt(a) == 0xD83C && emoji.charAt(a + 1) >= 0xDFFB && emoji.charAt(a + 1) <= 0xDFFF) {
emoji = TextUtils.concat(emoji.subSequence(0, a), emoji.subSequence(a + 2, emoji.length()));
break;
} else if (emoji.charAt(a) == 0xfe0f) {
emoji = TextUtils.concat(emoji.subSequence(0, a), emoji.subSequence(a + 1, emoji.length()));
length--;
}
}
lastSticker = emoji.toString();
HashMap<String, ArrayList<TLRPC.Document>> allStickers = getAllStickers();
if (allStickers != null) {
ArrayList<TLRPC.Document> newStickers = allStickers.get(lastSticker);
if (stickers != null && newStickers == null) {
if (visible) {
delegate.needChangePanelVisibility(false);
visible = false;
}
} else {
stickers = newStickers != null && !newStickers.isEmpty() ? new ArrayList<>(newStickers) : null;
if (stickers != null) {
if (Math.abs(recentLoadDate - System.currentTimeMillis()) > 10 * 1000) {
recentLoadDate = System.currentTimeMillis();
try {
String str = mContext.getSharedPreferences("emoji", Activity.MODE_PRIVATE).getString("stickers2", "");
String[] args = str.split(",");
for (int a = 0; a < args.length; a++) {
if (args[a].length() == 0) {
continue;
}
long id = Utilities.parseLong(args[a]);
if (id != 0) {
newRecentStickers.add(id);
}
}
} catch (Exception e) {
FileLog.e("messenger", e);
}
}
if (!newRecentStickers.isEmpty()) {
Collections.sort(stickers, new Comparator<TLRPC.Document>() {
@Override
public int compare(TLRPC.Document lhs, TLRPC.Document rhs) {
int idx1 = newRecentStickers.indexOf(lhs.id);
int idx2 = newRecentStickers.indexOf(rhs.id);
if (idx1 > idx2) {
return -1;
} else if (idx1 < idx2) {
return 1;
}
return 0;
}
});
}
}
checkStickerFilesExistAndDownload();
delegate.needChangePanelVisibility(stickers != null && !stickers.isEmpty() && stickersToLoad.isEmpty());
notifyDataSetChanged();
visible = true;
}
}
}
if (!search) {
if (visible && stickers != null) {
visible = false;
delegate.needChangePanelVisibility(false);
}
}
}
public void clearStickers() {
lastSticker = null;
stickers = null;
stickersToLoad.clear();
notifyDataSetChanged();
}
@Override
public int getItemCount() {
return stickers != null ? stickers.size() : 0;
@@ -4109,9 +4109,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (file == null) {
if (download) {
if (!FileLoader.getInstance().isLoadingFile(currentFileNames[0])) {
FileLoader.getInstance().loadFile(currentMessageObject.getDocument(), true, false);
//FileLoader.getInstance().loadFile(currentMessageObject.getDocument(), true, false);
} else {
FileLoader.getInstance().cancelLoadFile(currentMessageObject.getDocument());
//FileLoader.getInstance().cancelLoadFile(currentMessageObject.getDocument());
}
}
} else {
@@ -342,11 +342,11 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent
doneButton.setEnabled(false);
loadingSize = size;
selectedColor = 0;
FileLoader.getInstance().loadFile(size, null, true);
//FileLoader.getInstance().loadFile(size, null, true);
backgroundImage.setBackgroundColor(0);
} else {
if (loadingFile != null) {
FileLoader.getInstance().cancelLoadFile(loadingSize);
//FileLoader.getInstance().cancelLoadFile(loadingSize);
}
loadingFileObject = null;
loadingFile = null;
@@ -362,7 +362,7 @@ public class WallpapersActivity extends BaseFragment implements NotificationCent
}
} else {
if (loadingFile != null) {
FileLoader.getInstance().cancelLoadFile(loadingSize);
//FileLoader.getInstance().cancelLoadFile(loadingSize);
}
if (selectedBackground == 1000001) {
backgroundImage.setImageResource(R.drawable.background_hd);