From 1cda12c76abed7c7d9c30d74158bcacdf192a4c5 Mon Sep 17 00:00:00 2001 From: DrKLO Date: Thu, 12 Jun 2014 23:55:13 +0400 Subject: [PATCH] Bug fixes --- TMessagesProj/build.gradle | 2 +- .../telegram/messenger/FileLoadOperation.java | 5 +- .../telegram/messenger/MediaController.java | 8 ++- .../org/telegram/ui/Cells/ChatAudioCell.java | 2 +- .../org/telegram/ui/Cells/ChatBaseCell.java | 5 +- .../org/telegram/ui/Cells/ChatMediaCell.java | 2 +- .../org/telegram/ui/Cells/ChatOrUserCell.java | 2 +- .../org/telegram/ui/Cells/DialogCell.java | 5 +- .../java/org/telegram/ui/ChatActivity.java | 60 +++++++++++++++---- .../java/org/telegram/ui/LaunchActivity.java | 4 +- .../org/telegram/ui/PhotoPickerActivity.java | 15 +++-- .../java/org/telegram/ui/PhotoViewer.java | 19 ++++-- .../telegram/ui/Views/BackupImageView.java | 29 +-------- .../org/telegram/ui/Views/ImageReceiver.java | 25 ++++---- .../res/layout/photo_picker_photo_layout.xml | 22 ++++--- .../src/main/res/values-ar/strings.xml | 1 + .../src/main/res/values-de/strings.xml | 1 + .../src/main/res/values-es/strings.xml | 27 +++++---- .../src/main/res/values-it/strings.xml | 1 + .../src/main/res/values-nl/strings.xml | 1 + TMessagesProj/src/main/res/values/strings.xml | 1 + 21 files changed, 136 insertions(+), 101 deletions(-) diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 21e7db2b..0bd72d74 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -81,7 +81,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 247 + versionCode 248 versionName "1.5.0" } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java index 180bb201..b3b641bf 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/FileLoadOperation.java @@ -12,6 +12,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Build; import android.provider.MediaStore; +import android.util.Log; import org.telegram.ui.ApplicationLoader; @@ -265,7 +266,7 @@ public class FileLoadOperation { } opts.inDither = false; if (mediaIdFinal != null) { - image = MediaStore.Images.Thumbnails.getThumbnail(ApplicationLoader.applicationContext.getContentResolver(), mediaIdFinal, MediaStore.Images.Thumbnails.MINI_KIND, opts); + image = MediaStore.Images.Thumbnails.getThumbnail(ApplicationLoader.applicationContext.getContentResolver(), mediaIdFinal, MediaStore.Images.Thumbnails.MINI_KIND, null); } if (image == null) { FileInputStream is = new FileInputStream(cacheFileFinal); @@ -277,7 +278,7 @@ public class FileLoadOperation { cacheFileFinal.delete(); } } else { - if (filter != null && image != null) { + if (filter != null) { float bitmapW = image.getWidth(); float bitmapH = image.getHeight(); if (bitmapW != w_filter && bitmapW > w_filter) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java index 3cdcc025..fbb85295 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MediaController.java @@ -1578,7 +1578,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel } public static void loadGalleryPhotosAlbums(final int guid) { - Utilities.globalQueue.postRunnable(new Runnable() { + new Thread(new Runnable() { @Override public void run() { final ArrayList albumsSorted = new ArrayList(); @@ -1606,6 +1606,10 @@ public class MediaController implements NotificationCenter.NotificationCenterDel long dateTaken = cursor.getLong(dateColumn); int orientation = cursor.getInt(orientationColumn); + if (path == null || path.isEmpty()) { + continue; + } + PhotoEntry photoEntry = new PhotoEntry(bucketId, imageId, dateTaken, path, orientation); if (allPhotosAlbum == null) { @@ -1650,6 +1654,6 @@ public class MediaController implements NotificationCenter.NotificationCenterDel } }); } - }); + }).start(); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java index d50c274f..10d5c1cd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java @@ -65,7 +65,7 @@ public class ChatAudioCell extends ChatBaseCell implements SeekBar.SeekBarDelega TAG = MediaController.getInstance().generateObserverTag(); avatarImage = new ImageReceiver(); - avatarImage.parentView = new WeakReference(this); + avatarImage.parentView = this; seekBar = new SeekBar(context); seekBar.delegate = this; progressView = new ProgressView(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java index da1731a1..1cfbccf2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java @@ -20,7 +20,6 @@ import android.text.TextUtils; import android.view.HapticFeedbackConstants; import android.view.MotionEvent; import android.view.SoundEffectConstants; -import android.view.View; import android.view.ViewConfiguration; import org.telegram.messenger.LocaleController; @@ -31,8 +30,6 @@ import org.telegram.messenger.Utilities; import org.telegram.objects.MessageObject; import org.telegram.ui.Views.ImageReceiver; -import java.lang.ref.WeakReference; - public class ChatBaseCell extends BaseCell { public static interface ChatBaseCellDelegate { @@ -149,7 +146,7 @@ public class ChatBaseCell extends BaseCell { init(); media = isMedia; avatarImage = new ImageReceiver(); - avatarImage.parentView = new WeakReference(this); + avatarImage.parentView = this; } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java index 552f17f9..708c6f09 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java @@ -102,7 +102,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD TAG = MediaController.getInstance().generateObserverTag(); photoImage = new ImageReceiver(); - photoImage.parentView = new WeakReference(this); + photoImage.parentView = this; progressView = new ProgressView(); progressView.setProgressColors(0x802a2a2a, 0xffffffff); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java index a092f8b7..856f24d2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java @@ -97,7 +97,7 @@ public class ChatOrUserCell extends BaseCell { if (avatarImage == null) { avatarImage = new ImageReceiver(); - avatarImage.parentView = new WeakReference(this); + avatarImage.parentView = this; } if (cellLayout == null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index 88dcaac0..496c13f1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -16,7 +16,6 @@ import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; -import android.view.View; import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.messenger.LocaleController; @@ -30,8 +29,6 @@ import org.telegram.messenger.Utilities; import org.telegram.objects.MessageObject; import org.telegram.ui.Views.ImageReceiver; -import java.lang.ref.WeakReference; - public class DialogCell extends BaseCell { private static TextPaint namePaint; private static TextPaint nameEncryptedPaint; @@ -134,7 +131,7 @@ public class DialogCell extends BaseCell { if (avatarImage == null) { avatarImage = new ImageReceiver(); - avatarImage.parentView = new WeakReference(this); + avatarImage.parentView = this; } if (cellLayout == null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 54f42fd6..55f1208c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -450,18 +450,18 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa Intent pickIntent = new Intent(); pickIntent.setType("video/*"); pickIntent.setAction(Intent.ACTION_GET_CONTENT); - pickIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, (long)(1024 * 1024 * 1000)); + pickIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, (long) (1024 * 1024 * 1000)); Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); File video = Utilities.generateVideoPath(); if (video != null) { - if(android.os.Build.VERSION.SDK_INT > 16) { + if (android.os.Build.VERSION.SDK_INT > 16) { takeVideoIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(video)); } - takeVideoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, (long)(1024 * 1024 * 1000)); + takeVideoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, (long) (1024 * 1024 * 1000)); currentPicturePath = video.getAbsolutePath(); } Intent chooserIntent = Intent.createChooser(pickIntent, ""); - chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { takeVideoIntent }); + chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[]{takeVideoIntent}); getParentActivity().startActivityForResult(chooserIntent, 2); } catch (Exception e) { @@ -514,11 +514,11 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa str += messageObject.messageOwner.message; } if (str.length() != 0) { - if(android.os.Build.VERSION.SDK_INT < 11) { - android.text.ClipboardManager clipboard = (android.text.ClipboardManager)ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); + if (android.os.Build.VERSION.SDK_INT < 11) { + android.text.ClipboardManager clipboard = (android.text.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(str); } else { - android.content.ClipboardManager clipboard = (android.content.ClipboardManager)ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); + android.content.ClipboardManager clipboard = (android.content.ClipboardManager) ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE); android.content.ClipData clip = android.content.ClipData.newPlainText("label", str); clipboard.setPrimaryClip(clip); } @@ -1721,6 +1721,48 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa } } + public void processSendingPhotos(ArrayList paths, ArrayList uris) { + if (paths == null && uris == null || paths != null && paths.isEmpty() || uris != null && uris.isEmpty()) { + return; + } + final ArrayList pathsCopy = new ArrayList(); + final ArrayList urisCopy = new ArrayList(); + if (paths != null) { + pathsCopy.addAll(paths); + } + if (uris != null) { + urisCopy.addAll(uris); + } + new Thread(new Runnable() { + @Override + public void run() { + int count = !pathsCopy.isEmpty() ? pathsCopy.size() : urisCopy.size(); + String path = null; + Uri uri = null; + for (int a = 0; a < count; a++) { + if (!pathsCopy.isEmpty()) { + path = pathsCopy.get(a); + } else if (!urisCopy.isEmpty()) { + uri = urisCopy.get(a); + } + final TLRPC.TL_photo photo = MessagesController.getInstance().generatePhotoSizes(path, uri); + Utilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + if (photo != null) { + MessagesController.getInstance().sendMessage(photo, dialog_id); + if (chatListView != null) { + chatListView.setSelection(messages.size() + 1); + } + scrollToTopOnResume = true; + } + } + }); + } + } + }).start(); + } + public void processSendingDocument(String documentFilePath) { if (documentFilePath == null || documentFilePath.length() == 0) { return; @@ -2679,9 +2721,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa @Override public void didSelectPhotos(ArrayList photos) { - for (String path : photos) { - processSendingPhoto(path, null); - } + processSendingPhotos(photos, null); } @Override diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 465a097e..c876df8c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -501,9 +501,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen fragment.processSendingDocument(documentPath); } if (imagesPathArray != null) { - for (Uri path : imagesPathArray) { - fragment.processSendingPhoto(null, path); - } + fragment.processSendingPhotos(null, imagesPathArray); } if (documentsPathArray != null) { for (String path : documentsPathArray) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java index 949c85da..5a69f2f2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoPickerActivity.java @@ -61,6 +61,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen private TextView doneButtonTextView; private TextView doneButtonBadgeTextView; private int itemWidth = 100; + private boolean sendPressed = false; private PhotoPickerActivityDelegate delegate; @@ -162,7 +163,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen } } }); - if (loading && albumsSorted != null && albumsSorted.isEmpty()) { + if (loading && (albumsSorted == null || albumsSorted != null && albumsSorted.isEmpty())) { progressView.setVisibility(View.VISIBLE); listView.setEmptyView(null); } else { @@ -213,6 +214,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen if (listAdapter != null) { listAdapter.notifyDataSetChanged(); } + loading = false; } } else if (id == MessagesController.closeChats) { removeSelfFromStack(); @@ -351,9 +353,10 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen } private void sendSelectedPhotos() { - if (selectedPhotos.isEmpty() || delegate == null) { + if (selectedPhotos.isEmpty() || delegate == null || sendPressed) { return; } + sendPressed = true; ArrayList photos = new ArrayList(); for (HashMap.Entry entry : selectedPhotos.entrySet()) { MediaController.PhotoEntry photoEntry = entry.getValue(); @@ -385,6 +388,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen if (getParentActivity() == null) { return; } + int position = listView.getFirstVisiblePosition(); WindowManager manager = (WindowManager)ApplicationLoader.applicationContext.getSystemService(Activity.WINDOW_SERVICE); int rotation = manager.getDefaultDisplay().getRotation(); @@ -405,6 +409,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen listView.setColumnWidth(itemWidth); listAdapter.notifyDataSetChanged(); + listView.setSelection(position); } private void updateSelectedCount() { @@ -492,7 +497,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen MediaController.AlbumEntry albumEntry = albumsSorted.get(i); BackupImageView imageView = (BackupImageView)view.findViewById(R.id.media_photo_image); if (albumEntry.coverPhoto != null && albumEntry.coverPhoto.path != null) { - imageView.setImage("thumb://" + albumEntry.coverPhoto.imageId + ":" + albumEntry.coverPhoto.path, "150_150", R.drawable.nophotos); + imageView.setImage("thumb://" + albumEntry.coverPhoto.imageId + ":" + albumEntry.coverPhoto.path, null, R.drawable.nophotos); } else { imageView.setImageResource(R.drawable.nophotos); } @@ -509,7 +514,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen if (view == null) { LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = li.inflate(R.layout.photo_picker_photo_layout, viewGroup, false); - ImageView checkImageView = (ImageView)view.findViewById(R.id.photo_check); + View checkImageView = view.findViewById(R.id.photo_check_frame); checkImageView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -534,7 +539,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen imageView.setTag(i); view.setTag(i); if (photoEntry.path != null) { - imageView.setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, "100_100", R.drawable.nophotos); + imageView.setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, null, R.drawable.nophotos); } else { imageView.setImageResource(R.drawable.nophotos); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 43cef317..b4c834e3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -66,7 +66,6 @@ import org.telegram.ui.Views.ClippingImageView; import org.telegram.ui.Views.ImageReceiver; import java.io.File; -import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -630,7 +629,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat dateTextView.setLayoutParams(layoutParams); pickerView = parentActivity.getLayoutInflater().inflate(R.layout.photo_picker_bottom_layout, null); - bottomLayout.addView(pickerView); + containerView.addView(pickerView); Button cancelButton = (Button)pickerView.findViewById(R.id.cancel_button); cancelButton.setOnClickListener(new View.OnClickListener() { @Override @@ -652,6 +651,12 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } }); + layoutParams = (FrameLayout.LayoutParams)pickerView.getLayoutParams(); + layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT; + layoutParams.height = Utilities.dp(48); + layoutParams.gravity = Gravity.BOTTOM; + pickerView.setLayoutParams(layoutParams); + cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase()); doneButtonTextView = (TextView)doneButton.findViewById(R.id.done_button_text); doneButtonTextView.setText(LocaleController.getString("Send", R.string.Send).toUpperCase()); @@ -674,9 +679,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat gestureDetector = new GestureDetector(containerView.getContext(), this); gestureDetector.setOnDoubleTapListener(this); - centerImage.parentView = new WeakReference(containerView); - leftImage.parentView = new WeakReference(containerView); - rightImage.parentView = new WeakReference(containerView); + centerImage.parentView = containerView; + leftImage.parentView = containerView; + rightImage.parentView = containerView; currentOverlay = new OverlayView(containerView.getContext()); containerView.addView(currentOverlay); @@ -1075,6 +1080,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat imagesArrLocals.addAll(photos); setImageIndex(index, true); pickerView.setVisibility(View.VISIBLE); + bottomLayout.setVisibility(View.GONE); + canShowBottom = false; updateSelectedCount(); } @@ -1456,6 +1463,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat velocityTracker.recycle(); velocityTracker = null; } + ConnectionsManager.getInstance().cancelRpcsForClassGuid(classGuid); final PlaceProviderObject object = placeProvider.getPlaceForPhoto(currentMessageObject, currentFileLocation, currentIndex); @@ -1464,6 +1472,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat animationInProgress = 1; animatingImageView.setVisibility(View.VISIBLE); + containerView.invalidate(); AnimatorSet animatorSet = new AnimatorSet(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/BackupImageView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/BackupImageView.java index a16a5dab..598b4e50 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/BackupImageView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/BackupImageView.java @@ -41,7 +41,7 @@ public class BackupImageView extends View { private void init() { imageReceiver = new ImageReceiver(); - imageReceiver.parentView = new WeakReference(this); + imageReceiver.parentView = this; } public void setImage(TLRPC.FileLocation path, String filter, int placeholder) { @@ -98,31 +98,4 @@ public class BackupImageView extends View { imageReceiver.imageH = getHeight(); imageReceiver.draw(canvas, 0, 0, imageReceiver.imageW, imageReceiver.imageH); } - - /* - - public void setImageResourceMy(int resId) { - if (ignoreLayout) { - makeRequest = false; - } - super.setImageResource(resId); - if (ignoreLayout) { - makeRequest = true; - } - } - - - - public void setImageBitmapMy(Bitmap bitmap) { - if (ignoreLayout) { - makeRequest = false; - } - super.setImageBitmap(bitmap); - if (ignoreLayout) { - makeRequest = true; - } - } - - @Override - */ } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/ImageReceiver.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/ImageReceiver.java index 1cc3f821..77b73196 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/ImageReceiver.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/ImageReceiver.java @@ -21,8 +21,6 @@ import org.telegram.messenger.FileLoader; import org.telegram.messenger.FileLog; import org.telegram.messenger.Utilities; -import java.lang.ref.WeakReference; - public class ImageReceiver { private TLRPC.FileLocation last_path = null; private String last_httpUrl = null; @@ -33,7 +31,7 @@ public class ImageReceiver { private boolean isPlaceholder = false; private Drawable currentImage = null; public Integer TAG = null; - public WeakReference parentView = null; + public View parentView = null; public int imageX = 0, imageY = 0, imageW = 0, imageH = 0; public Rect drawRegion = new Rect(); private boolean isVisible = true; @@ -94,10 +92,16 @@ public class ImageReceiver { if (img == null) { isPlaceholder = true; FileLoader.getInstance().loadImage(path, httpUrl, this, filter, true, size); + if (parentView != null) { + parentView.invalidate(); + } } else { selfSetting = true; setImageBitmap(img, currentPath); selfSetting = false; + if (parentView != null) { + parentView.invalidate(); + } } } @@ -108,12 +112,8 @@ public class ImageReceiver { isPlaceholder = false; FileLoader.getInstance().incrementUseCount(currentPath); currentImage = new BitmapDrawable(null, bitmap); - if (!selfSetting && parentView != null && parentView.get() != null) { - if (imageW != 0) { - parentView.get().invalidate(imageX, imageY, imageX + imageW, imageY + imageH); - } else { - parentView.get().invalidate(); - } + if (!selfSetting && parentView != null) { + parentView.invalidate(); } } @@ -246,11 +246,8 @@ public class ImageReceiver { return; } isVisible = value; - if (invalidate) { - View parent = parentView.get(); - if (parent != null) { - parent.invalidate(); - } + if (invalidate && parentView != null) { + parentView.invalidate(); } } diff --git a/TMessagesProj/src/main/res/layout/photo_picker_photo_layout.xml b/TMessagesProj/src/main/res/layout/photo_picker_photo_layout.xml index 7f4721d9..a0a6f914 100644 --- a/TMessagesProj/src/main/res/layout/photo_picker_photo_layout.xml +++ b/TMessagesProj/src/main/res/layout/photo_picker_photo_layout.xml @@ -14,13 +14,21 @@ android:layout_width="fill_parent" android:id="@+id/photo_frame"/> - + android:id="@+id/photo_check_frame"> + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-ar/strings.xml b/TMessagesProj/src/main/res/values-ar/strings.xml index a2ba53e4..4c1873ca 100644 --- a/TMessagesProj/src/main/res/values-ar/strings.xml +++ b/TMessagesProj/src/main/res/values-ar/strings.xml @@ -294,6 +294,7 @@ الألبوم All Photos No photos yet + Sending photos... %1$d of %2$d التالي diff --git a/TMessagesProj/src/main/res/values-de/strings.xml b/TMessagesProj/src/main/res/values-de/strings.xml index b6f10a09..ef402ee8 100644 --- a/TMessagesProj/src/main/res/values-de/strings.xml +++ b/TMessagesProj/src/main/res/values-de/strings.xml @@ -294,6 +294,7 @@ Galerie All Photos No photos yet + Sending photos... %1$d of %2$d Weiter diff --git a/TMessagesProj/src/main/res/values-es/strings.xml b/TMessagesProj/src/main/res/values-es/strings.xml index c0b33d94..e9f1cfa3 100644 --- a/TMessagesProj/src/main/res/values-es/strings.xml +++ b/TMessagesProj/src/main/res/values-es/strings.xml @@ -94,7 +94,7 @@ Mensaje Escribe un mensaje Descargar - Elegidos: %d + Seleccionado: %d COMPARTIR MI INFORMACIÓN DE CONTACTO AÑADIR A CONTACTOS %s te ha invitado a un chat secreto. @@ -112,7 +112,7 @@ Eliminar esta conversación DESLIZA PARA CANCELAR Guardar en descargas - Aplicar fichero de localización + Aplicar archivo de traducción Chat secreto solicitado @@ -247,7 +247,7 @@ SOPORTE Fondo de chat MENSAJES - Enviar con ‘Enter’ + Enviar con \'Intro\' Cerrar todas las otras sesiones DESCARGA AUTOMÁTICA DE FOTOS DESCARGA AUTOMÁTICA DE AUDIO @@ -257,12 +257,12 @@ Un contacto se unió a Telegram PEBBLE Idioma - Por favor, ten en cuenta que el Soporte de Telegram está hecho por voluntarios. Intentamos responder lo antes posible, pero puede tomar un tiempo.
]]>Por favor, echa un vistazo a las Preguntas Frecuentes de Telegram]]>: tiene importantes Soluciones a problemas]]> y respuestas para la mayoría de las preguntas.
+ Por favor, ten en cuenta que el Soporte de Telegram está hecho por voluntarios. Intentamos responder lo antes posible, pero puede tomar un tiempo.
]]>Por favor, echa un vistazo a las Preguntas Frecuentes de Telegram]]>: tienen importantes soluciones a problemas]]> y respuestas para la mayoría de las preguntas.
Preguntar Preguntas frecuentes https://telegram.org/faq/es - ¿Eliminar localización? - Fichero de localización incorrecto + ¿Eliminar traducción? + Archivo de traducción incorrecto Activado Desactivado Servicio de notificaciones @@ -294,6 +294,7 @@ Galería All Photos No photos yet + Sending photos... %1$d of %2$d Siguiente @@ -333,7 +334,7 @@ Creaste el grupo un1 te expulsó un1 te añadió - Este mensaje no está soportado en tu versión de Telegram. + Este mensaje no lo admite tu versión de Telegram. Actualiza la app para verlo: http://telegram.org/update Foto Vídeo Ubicación @@ -370,12 +371,12 @@ Basada en la nube Privada Bienvenidos a la era de la mensajería rápida y segura. - Telegram]]> entrega mensajes más rápido que cualquier otra aplicación. - Telegram]]> es gratis para siempre. Sin publicidad. Sin cuotas de suscripción. - Telegram]]> mantiene tus mensajes a salvo del ataque de hackers. - Telegram]]> no tiene límites en el tamaño de tus chats y archivos. - Telegram]]> te permite acceder a tus mensajes desde múltiples dispositivos. - Los mensajes de Telegram]]> están fuertemente cifrados y se pueden autodestruir. + Telegram]]> entrega mensajes más rápido que]]>cualquier otra aplicación. + Telegram]]> es gratis para siempre. Sin publicidad.]]>Sin cuotas de suscripción. + Telegram]]> mantiene tus mensajes]]>a salvo del ataque de hackers. + Telegram]]> no tiene límites en el tamaño de tus]]>chats y archivos. + Telegram]]> te permite acceder a tus mensajes]]>desde múltiples dispositivos. + Los mensajes de Telegram]]> están fuertemente]]>cifrados y se pueden autodestruir. Empieza a conversar diff --git a/TMessagesProj/src/main/res/values-it/strings.xml b/TMessagesProj/src/main/res/values-it/strings.xml index d502fbee..bfb76874 100644 --- a/TMessagesProj/src/main/res/values-it/strings.xml +++ b/TMessagesProj/src/main/res/values-it/strings.xml @@ -294,6 +294,7 @@ Galleria All Photos No photos yet + Sending photos... %1$d of %2$d Avanti diff --git a/TMessagesProj/src/main/res/values-nl/strings.xml b/TMessagesProj/src/main/res/values-nl/strings.xml index a621b358..8b9211a4 100644 --- a/TMessagesProj/src/main/res/values-nl/strings.xml +++ b/TMessagesProj/src/main/res/values-nl/strings.xml @@ -294,6 +294,7 @@ Galerij All Photos No photos yet + Sending photos... %1$d of %2$d Volgende diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index 92586205..4347b564 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -294,6 +294,7 @@ Gallery All Photos No photos yet + Sending photos... %1$d of %2$d Next