NekoX/TMessagesProj/src/main/java/org/telegram/ui/Components/ImageUpdater.java

476 lines
22 KiB
Java
Raw Normal View History

2013-10-25 17:19:00 +02:00
/*
2019-01-23 18:03:33 +01:00
* This is the source code of Telegram for Android v. 5.x.x.
2013-10-25 17:19:00 +02:00
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
2019-01-23 18:03:33 +01:00
* Copyright Nikolai Kudashov, 2013-2018.
2013-10-25 17:19:00 +02:00
*/
package org.telegram.ui.Components;
2013-10-25 17:19:00 +02:00
2015-10-29 18:10:07 +01:00
import android.Manifest;
2013-10-25 17:19:00 +02:00
import android.app.Activity;
import android.content.Intent;
2015-10-29 18:10:07 +01:00
import android.content.pm.PackageManager;
2013-10-25 17:19:00 +02:00
import android.graphics.Bitmap;
2019-01-23 18:03:33 +01:00
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
2019-05-14 14:08:05 +02:00
import androidx.exifinterface.media.ExifInterface;
2013-10-25 17:19:00 +02:00
import android.net.Uri;
2015-10-29 18:10:07 +01:00
import android.os.Build;
import android.os.Bundle;
2013-10-25 17:19:00 +02:00
import android.provider.MediaStore;
2019-05-14 14:08:05 +02:00
import androidx.core.content.FileProvider;
2019-01-23 18:03:33 +01:00
import android.util.TypedValue;
import android.widget.TextView;
2013-10-25 17:19:00 +02:00
2015-09-24 22:52:02 +02:00
import org.telegram.messenger.AndroidUtilities;
2016-10-11 13:57:01 +02:00
import org.telegram.messenger.BuildConfig;
2015-09-24 22:52:02 +02:00
import org.telegram.messenger.ImageLoader;
2019-05-14 14:08:05 +02:00
import org.telegram.messenger.ImageLocation;
2019-01-23 18:03:33 +01:00
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LocaleController;
2015-09-24 22:52:02 +02:00
import org.telegram.messenger.MediaController;
2019-01-23 18:03:33 +01:00
import org.telegram.messenger.R;
2017-12-08 18:35:59 +01:00
import org.telegram.messenger.SendMessagesHelper;
2019-01-23 18:03:33 +01:00
import org.telegram.messenger.Utilities;
2017-03-31 01:58:05 +02:00
import org.telegram.messenger.VideoEditedInfo;
import org.telegram.tgnet.ConnectionsManager;
2015-09-24 22:52:02 +02:00
import org.telegram.tgnet.TLRPC;
2013-10-25 17:19:00 +02:00
import org.telegram.messenger.FileLoader;
2013-12-20 20:25:49 +01:00
import org.telegram.messenger.FileLog;
2015-09-24 22:52:02 +02:00
import org.telegram.messenger.NotificationCenter;
2013-10-25 17:19:00 +02:00
import org.telegram.messenger.UserConfig;
2019-01-23 18:03:33 +01:00
import org.telegram.ui.ActionBar.BottomSheet;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.PhotoAlbumPickerActivity;
import org.telegram.ui.PhotoCropActivity;
2014-11-13 21:10:14 +01:00
import org.telegram.ui.ActionBar.BaseFragment;
2019-01-23 18:03:33 +01:00
import org.telegram.ui.PhotoPickerActivity;
import org.telegram.ui.PhotoViewer;
2013-10-25 17:19:00 +02:00
import java.io.File;
import java.util.ArrayList;
2019-01-23 18:03:33 +01:00
import java.util.HashMap;
2013-10-25 17:19:00 +02:00
2018-07-30 04:07:02 +02:00
public class ImageUpdater implements NotificationCenter.NotificationCenterDelegate, PhotoCropActivity.PhotoEditActivityDelegate {
2015-04-09 20:00:14 +02:00
2018-07-30 04:07:02 +02:00
public BaseFragment parentFragment;
public ImageUpdaterDelegate delegate;
private int currentAccount = UserConfig.selectedAccount;
2019-01-23 18:03:33 +01:00
private ImageReceiver imageReceiver;
2013-10-25 17:19:00 +02:00
public String currentPicturePath;
private TLRPC.PhotoSize bigPhoto;
2019-01-23 18:03:33 +01:00
private TLRPC.PhotoSize smallPhoto;
2018-07-30 04:07:02 +02:00
public String uploadingImage;
2019-01-23 18:03:33 +01:00
private File picturePath = null;
private String finalPath;
2018-07-30 04:07:02 +02:00
private boolean clearAfterUpdate;
2019-01-23 18:03:33 +01:00
private boolean searchAvailable = true;
private boolean uploadAfterSelect = true;
2013-10-25 17:19:00 +02:00
2018-07-30 04:07:02 +02:00
public interface ImageUpdaterDelegate {
2019-01-23 18:03:33 +01:00
void didUploadPhoto(TLRPC.InputFile file, TLRPC.PhotoSize bigSize, TLRPC.PhotoSize smallSize);
default String getInitialSearchString() {
return null;
}
2013-10-25 17:19:00 +02:00
}
public void clear() {
2018-07-30 04:07:02 +02:00
if (uploadingImage != null) {
2013-10-25 17:19:00 +02:00
clearAfterUpdate = true;
} else {
parentFragment = null;
delegate = null;
}
}
2019-01-23 18:03:33 +01:00
public ImageUpdater() {
imageReceiver = new ImageReceiver(null);
}
public void openMenu(boolean hasAvatar, Runnable onDeleteAvatar) {
if (parentFragment == null || parentFragment.getParentActivity() == null) {
return;
}
BottomSheet.Builder builder = new BottomSheet.Builder(parentFragment.getParentActivity());
builder.setTitle(LocaleController.getString("ChoosePhoto", R.string.ChoosePhoto));
CharSequence[] items;
int[] icons;
if (searchAvailable) {
if (hasAvatar) {
items = new CharSequence[]{LocaleController.getString("ChooseTakePhoto", R.string.ChooseTakePhoto), LocaleController.getString("ChooseFromGallery", R.string.ChooseFromGallery), LocaleController.getString("ChooseFromSearch", R.string.ChooseFromSearch), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)};
icons = new int[]{R.drawable.menu_camera, R.drawable.profile_photos, R.drawable.menu_search, R.drawable.chats_delete};
} else {
items = new CharSequence[]{LocaleController.getString("ChooseTakePhoto", R.string.ChooseTakePhoto), LocaleController.getString("ChooseFromGallery", R.string.ChooseFromGallery), LocaleController.getString("ChooseFromSearch", R.string.ChooseFromSearch)};
icons = new int[]{R.drawable.menu_camera, R.drawable.profile_photos, R.drawable.menu_search};
}
} else {
if (hasAvatar) {
items = new CharSequence[]{LocaleController.getString("ChooseTakePhoto", R.string.ChooseTakePhoto), LocaleController.getString("ChooseFromGallery", R.string.ChooseFromGallery), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)};
icons = new int[]{R.drawable.menu_camera, R.drawable.profile_photos, R.drawable.chats_delete};
} else {
items = new CharSequence[]{LocaleController.getString("ChooseTakePhoto", R.string.ChooseTakePhoto), LocaleController.getString("ChooseFromGallery", R.string.ChooseFromGallery)};
icons = new int[]{R.drawable.menu_camera, R.drawable.profile_photos};
}
}
builder.setItems(items, icons, (dialogInterface, i) -> {
if (i == 0) {
openCamera();
} else if (i == 1) {
openGallery();
} else if (searchAvailable && i == 2) {
openSearch();
} else if (searchAvailable && i == 3 || i == 2) {
onDeleteAvatar.run();
}
});
BottomSheet sheet = builder.create();
parentFragment.showDialog(sheet);
TextView titleView = sheet.getTitleView();
2019-05-14 14:08:05 +02:00
if (titleView != null) {
titleView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
titleView.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
}
2019-01-23 18:03:33 +01:00
sheet.setItemColor(searchAvailable ? 3 : 2, Theme.getColor(Theme.key_dialogTextRed2), Theme.getColor(Theme.key_dialogRedIcon));
}
public void setSearchAvailable(boolean value) {
searchAvailable = value;
}
public void setUploadAfterSelect(boolean value) {
uploadAfterSelect = value;
}
public void openSearch() {
if (parentFragment == null) {
return;
}
final HashMap<Object, Object> photos = new HashMap<>();
final ArrayList<Object> order = new ArrayList<>();
PhotoPickerActivity fragment = new PhotoPickerActivity(0, null, photos, order, new ArrayList<>(), 1, false, null);
fragment.setDelegate(new PhotoPickerActivity.PhotoPickerActivityDelegate() {
private boolean sendPressed;
@Override
public void selectedPhotosChanged() {
}
private void sendSelectedPhotos(HashMap<Object, Object> photos, ArrayList<Object> order) {
}
@Override
public void actionButtonPressed(boolean canceled) {
if (photos.isEmpty() || delegate == null || sendPressed || canceled) {
return;
}
sendPressed = true;
ArrayList<SendMessagesHelper.SendingMediaInfo> media = new ArrayList<>();
for (int a = 0; a < order.size(); a++) {
Object object = photos.get(order.get(a));
SendMessagesHelper.SendingMediaInfo info = new SendMessagesHelper.SendingMediaInfo();
media.add(info);
if (object instanceof MediaController.SearchImage) {
MediaController.SearchImage searchImage = (MediaController.SearchImage) object;
if (searchImage.imagePath != null) {
info.path = searchImage.imagePath;
} else {
info.searchImage = searchImage;
}
info.caption = searchImage.caption != null ? searchImage.caption.toString() : null;
info.entities = searchImage.entities;
info.masks = !searchImage.stickers.isEmpty() ? new ArrayList<>(searchImage.stickers) : null;
info.ttl = searchImage.ttl;
}
}
didSelectPhotos(media);
}
});
fragment.setInitialSearchString(delegate.getInitialSearchString());
parentFragment.presentFragment(fragment);
}
private void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> photos) {
if (!photos.isEmpty()) {
SendMessagesHelper.SendingMediaInfo info = photos.get(0);
Bitmap bitmap = null;
if (info.path != null) {
bitmap = ImageLoader.loadBitmap(info.path, null, 800, 800, true);
} else if (info.searchImage != null) {
if (info.searchImage.photo != null) {
TLRPC.PhotoSize photoSize = FileLoader.getClosestPhotoSizeWithSize(info.searchImage.photo.sizes, AndroidUtilities.getPhotoSize());
if (photoSize != null) {
File path = FileLoader.getPathToAttach(photoSize, true);
finalPath = path.getAbsolutePath();
if (!path.exists()) {
path = FileLoader.getPathToAttach(photoSize, false);
if (!path.exists()) {
path = null;
}
}
if (path != null) {
bitmap = ImageLoader.loadBitmap(path.getAbsolutePath(), null, 800, 800, true);
} else {
NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.fileDidLoad);
NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.fileDidFailedLoad);
uploadingImage = FileLoader.getAttachFileName(photoSize.location);
2019-05-14 14:08:05 +02:00
imageReceiver.setImage(ImageLocation.getForPhoto(photoSize, info.searchImage.photo), null, null, "jpg", null, 1);
2019-01-23 18:03:33 +01:00
}
}
} else if (info.searchImage.imageUrl != null) {
String md5 = Utilities.MD5(info.searchImage.imageUrl) + "." + ImageLoader.getHttpUrlExtension(info.searchImage.imageUrl, "jpg");
File cacheFile = new File(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE), md5);
finalPath = cacheFile.getAbsolutePath();
if (cacheFile.exists() && cacheFile.length() != 0) {
bitmap = ImageLoader.loadBitmap(cacheFile.getAbsolutePath(), null, 800, 800, true);
} else {
uploadingImage = info.searchImage.imageUrl;
NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.httpFileDidLoad);
NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.httpFileDidFailedLoad);
imageReceiver.setImage(info.searchImage.imageUrl, null, null, "jpg", 1);
}
} else {
bitmap = null;
}
}
processBitmap(bitmap);
}
}
2013-10-25 17:19:00 +02:00
public void openCamera() {
2017-07-08 18:32:04 +02:00
if (parentFragment == null || parentFragment.getParentActivity() == null) {
return;
}
2013-10-25 17:19:00 +02:00
try {
2017-07-08 18:32:04 +02:00
if (Build.VERSION.SDK_INT >= 23 && parentFragment.getParentActivity().checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
parentFragment.getParentActivity().requestPermissions(new String[]{Manifest.permission.CAMERA}, 19);
return;
}
2013-10-25 17:19:00 +02:00
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
2015-05-21 23:27:27 +02:00
File image = AndroidUtilities.generatePicturePath();
2013-10-25 17:19:00 +02:00
if (image != null) {
2016-10-11 13:57:01 +02:00
if (Build.VERSION.SDK_INT >= 24) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile(parentFragment.getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", image));
takePictureIntent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
takePictureIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
} else {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image));
}
2013-10-25 17:19:00 +02:00
currentPicturePath = image.getAbsolutePath();
}
2014-10-01 00:36:18 +02:00
parentFragment.startActivityForResult(takePictureIntent, 13);
2013-10-25 17:19:00 +02:00
} catch (Exception e) {
2017-03-31 01:58:05 +02:00
FileLog.e(e);
2013-10-25 17:19:00 +02:00
}
}
public void openGallery() {
2018-07-30 04:07:02 +02:00
if (parentFragment == null) {
return;
}
2015-10-29 18:10:07 +01:00
if (Build.VERSION.SDK_INT >= 23 && parentFragment != null && parentFragment.getParentActivity() != null) {
if (parentFragment.getParentActivity().checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
parentFragment.getParentActivity().requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 4);
return;
}
}
2019-01-23 18:03:33 +01:00
PhotoAlbumPickerActivity fragment = new PhotoAlbumPickerActivity(1, false, false, null);
fragment.setDelegate(new PhotoAlbumPickerActivity.PhotoAlbumPickerActivityDelegate() {
@Override
2017-12-08 18:35:59 +01:00
public void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> photos) {
2019-01-23 18:03:33 +01:00
ImageUpdater.this.didSelectPhotos(photos);
}
@Override
public void startPhotoSelectActivity() {
try {
Intent photoPickerIntent = new Intent(Intent.ACTION_GET_CONTENT);
photoPickerIntent.setType("image/*");
parentFragment.startActivityForResult(photoPickerIntent, 14);
} catch (Exception e) {
2017-03-31 01:58:05 +02:00
FileLog.e(e);
}
}
});
parentFragment.presentFragment(fragment);
2013-10-25 17:19:00 +02:00
}
private void startCrop(String path, Uri uri) {
2013-10-25 17:19:00 +02:00
try {
2017-03-31 01:58:05 +02:00
LaunchActivity activity = (LaunchActivity) parentFragment.getParentActivity();
if (activity == null) {
return;
}
Bundle args = new Bundle();
if (path != null) {
args.putString("photoPath", path);
} else if (uri != null) {
args.putParcelable("photoUri", uri);
2013-10-25 17:19:00 +02:00
}
PhotoCropActivity photoCropActivity = new PhotoCropActivity(args);
photoCropActivity.setDelegate(this);
activity.presentFragment(photoCropActivity);
2013-10-25 17:19:00 +02:00
} catch (Exception e) {
2017-03-31 01:58:05 +02:00
FileLog.e(e);
2015-02-01 19:51:02 +01:00
Bitmap bitmap = ImageLoader.loadBitmap(path, uri, 800, 800, true);
2013-10-25 17:19:00 +02:00
processBitmap(bitmap);
}
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == 13) {
PhotoViewer.getInstance().setParentActivity(parentFragment.getParentActivity());
int orientation = 0;
try {
ExifInterface ei = new ExifInterface(currentPicturePath);
int exif = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
2017-03-31 01:58:05 +02:00
switch (exif) {
case ExifInterface.ORIENTATION_ROTATE_90:
orientation = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
orientation = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
orientation = 270;
break;
}
} catch (Exception e) {
2017-03-31 01:58:05 +02:00
FileLog.e(e);
}
final ArrayList<Object> arrayList = new ArrayList<>();
arrayList.add(new MediaController.PhotoEntry(0, 0, 0, currentPicturePath, orientation, false));
2019-01-23 18:03:33 +01:00
PhotoViewer.getInstance().openPhotoForSelect(arrayList, 0, PhotoViewer.SELECT_TYPE_AVATAR, new PhotoViewer.EmptyPhotoViewerProvider() {
@Override
2017-03-31 01:58:05 +02:00
public void sendButtonPressed(int index, VideoEditedInfo videoEditedInfo) {
String path = null;
MediaController.PhotoEntry photoEntry = (MediaController.PhotoEntry) arrayList.get(0);
if (photoEntry.imagePath != null) {
path = photoEntry.imagePath;
} else if (photoEntry.path != null) {
path = photoEntry.path;
}
Bitmap bitmap = ImageLoader.loadBitmap(path, null, 800, 800, true);
processBitmap(bitmap);
}
2016-10-11 13:57:01 +02:00
@Override
public boolean allowCaption() {
return false;
}
2017-12-08 18:35:59 +01:00
@Override
public boolean canScrollAway() {
return false;
}
}, null);
2015-05-21 23:27:27 +02:00
AndroidUtilities.addMediaToGallery(currentPicturePath);
2013-10-25 17:19:00 +02:00
currentPicturePath = null;
} else if (requestCode == 14) {
if (data == null || data.getData() == null) {
2013-12-20 20:25:49 +01:00
return;
}
startCrop(null, data.getData());
2013-10-25 17:19:00 +02:00
}
}
}
private void processBitmap(Bitmap bitmap) {
if (bitmap == null) {
return;
}
2019-01-23 18:03:33 +01:00
bigPhoto = ImageLoader.scaleAndSaveImage(bitmap, 800, 800, 80, false, 320, 320);
smallPhoto = ImageLoader.scaleAndSaveImage(bitmap, 150, 150, 80, false, 150, 150);
if (smallPhoto != null) {
try {
Bitmap b = BitmapFactory.decodeFile(FileLoader.getPathToAttach(smallPhoto, true).getAbsolutePath());
String key = smallPhoto.location.volume_id + "_" + smallPhoto.location.local_id + "@50_50";
ImageLoader.getInstance().putImageToCache(new BitmapDrawable(b), key);
} catch (Throwable ignore) {
2018-07-30 04:07:02 +02:00
}
2019-01-23 18:03:33 +01:00
}
bitmap.recycle();
if (bigPhoto != null) {
UserConfig.getInstance(currentAccount).saveConfig(false);
uploadingImage = FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE) + "/" + bigPhoto.location.volume_id + "_" + bigPhoto.location.local_id + ".jpg";
if (uploadAfterSelect) {
NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.FileDidUpload);
NotificationCenter.getInstance(currentAccount).addObserver(ImageUpdater.this, NotificationCenter.FileDidFailUpload);
FileLoader.getInstance(currentAccount).uploadFile(uploadingImage, false, true, ConnectionsManager.FileTypePhoto);
}
if (delegate != null) {
delegate.didUploadPhoto(null, bigPhoto, smallPhoto);
2013-10-25 17:19:00 +02:00
}
}
}
@Override
2015-10-29 18:10:07 +01:00
public void didFinishEdit(Bitmap bitmap) {
processBitmap(bitmap);
}
2013-10-25 17:19:00 +02:00
@Override
2018-07-30 04:07:02 +02:00
public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.FileDidUpload) {
2017-03-31 01:58:05 +02:00
String location = (String) args[0];
2019-05-14 14:08:05 +02:00
if (location.equals(uploadingImage)) {
2018-07-30 04:07:02 +02:00
NotificationCenter.getInstance(currentAccount).removeObserver(ImageUpdater.this, NotificationCenter.FileDidUpload);
NotificationCenter.getInstance(currentAccount).removeObserver(ImageUpdater.this, NotificationCenter.FileDidFailUpload);
2015-05-21 23:27:27 +02:00
if (delegate != null) {
2019-01-23 18:03:33 +01:00
delegate.didUploadPhoto((TLRPC.InputFile) args[1], bigPhoto, smallPhoto);
2015-05-21 23:27:27 +02:00
}
2018-07-30 04:07:02 +02:00
uploadingImage = null;
2015-05-21 23:27:27 +02:00
if (clearAfterUpdate) {
2019-01-23 18:03:33 +01:00
imageReceiver.setImageBitmap((Drawable) null);
2015-05-21 23:27:27 +02:00
parentFragment = null;
delegate = null;
}
2013-10-25 17:19:00 +02:00
}
} else if (id == NotificationCenter.FileDidFailUpload) {
2017-03-31 01:58:05 +02:00
String location = (String) args[0];
2019-05-14 14:08:05 +02:00
if (location.equals(uploadingImage)) {
2018-07-30 04:07:02 +02:00
NotificationCenter.getInstance(currentAccount).removeObserver(ImageUpdater.this, NotificationCenter.FileDidUpload);
NotificationCenter.getInstance(currentAccount).removeObserver(ImageUpdater.this, NotificationCenter.FileDidFailUpload);
uploadingImage = null;
2015-05-21 23:27:27 +02:00
if (clearAfterUpdate) {
2019-01-23 18:03:33 +01:00
imageReceiver.setImageBitmap((Drawable) null);
2015-05-21 23:27:27 +02:00
parentFragment = null;
delegate = null;
}
2013-10-25 17:19:00 +02:00
}
2019-01-23 18:03:33 +01:00
} else if (id == NotificationCenter.fileDidLoad || id == NotificationCenter.fileDidFailedLoad || id == NotificationCenter.httpFileDidLoad || id == NotificationCenter.httpFileDidFailedLoad) {
String path = (String) args[0];
2019-05-14 14:08:05 +02:00
if (path.equals(uploadingImage)) {
2019-01-23 18:03:33 +01:00
NotificationCenter.getInstance(currentAccount).removeObserver(ImageUpdater.this, NotificationCenter.fileDidLoad);
NotificationCenter.getInstance(currentAccount).removeObserver(ImageUpdater.this, NotificationCenter.fileDidFailedLoad);
NotificationCenter.getInstance(currentAccount).removeObserver(ImageUpdater.this, NotificationCenter.httpFileDidLoad);
NotificationCenter.getInstance(currentAccount).removeObserver(ImageUpdater.this, NotificationCenter.httpFileDidFailedLoad);
uploadingImage = null;
if (id == NotificationCenter.fileDidLoad || id == NotificationCenter.httpFileDidLoad) {
Bitmap bitmap = ImageLoader.loadBitmap(finalPath, null, 800, 800, true);
processBitmap(bitmap);
} else {
imageReceiver.setImageBitmap((Drawable) null);
}
}
2013-10-25 17:19:00 +02:00
}
}
}