diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index e5696e53..e9eaf5a9 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -80,7 +80,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 21 - versionCode 403 - versionName "2.1.0" + versionCode 405 + versionName "2.1.1" } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/SecretChatHelper.java b/TMessagesProj/src/main/java/org/telegram/android/SecretChatHelper.java index 857a28c5..9f360df5 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/SecretChatHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/android/SecretChatHelper.java @@ -650,6 +650,7 @@ public class SecretChatHelper { if (req == null || chat.auth_key == null || chat instanceof TLRPC.TL_encryptedChatRequested || chat instanceof TLRPC.TL_encryptedChatWaiting) { return; } + SendMessagesHelper.getInstance().putToSendingMessages(newMsgObj); Utilities.stageQueue.postRunnable(new Runnable() { @Override public void run() { @@ -797,6 +798,7 @@ public class SecretChatHelper { if (newMsgObj.media instanceof TLRPC.TL_messageMediaVideo) { SendMessagesHelper.getInstance().stopVideoService(attachPath); } + SendMessagesHelper.getInstance().removeFromSendingMessages(newMsgObj.id); } }); } @@ -812,6 +814,7 @@ public class SecretChatHelper { if (newMsgObj.media instanceof TLRPC.TL_messageMediaVideo) { SendMessagesHelper.getInstance().stopVideoService(newMsgObj.attachPath); } + SendMessagesHelper.getInstance().removeFromSendingMessages(newMsgObj.id); } }); } @@ -1174,8 +1177,8 @@ public class SecretChatHelper { if (serviceMessage.action.key_fingerprint == fingerprint) { chat.future_auth_key = authKey; chat.future_key_fingerprint = fingerprint; - MessagesStorage.getInstance().updateEncryptedChat(chat); + sendCommitKeyMessage(chat, null); } else { chat.future_auth_key = new byte[256]; chat.future_key_fingerprint = 0; @@ -1183,8 +1186,6 @@ public class SecretChatHelper { MessagesStorage.getInstance().updateEncryptedChat(chat); sendAbortKeyMessage(chat, null, serviceMessage.action.exchange_id); } - - sendCommitKeyMessage(chat, null); } else { chat.future_auth_key = new byte[256]; chat.future_key_fingerprint = 0; diff --git a/TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java index e5771710..6d77a342 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java @@ -38,6 +38,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter private TLRPC.ChatParticipants currentChatInfo = null; private HashMap> delayedMessages = new HashMap>(); private HashMap unsentMessages = new HashMap(); + private HashMap sendingMessages = new HashMap(); private class DelayedMessage { public TLObject sendRequest; @@ -77,6 +78,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter public void cleanUp() { delayedMessages.clear(); unsentMessages.clear(); + sendingMessages.clear(); currentChatInfo = null; } @@ -309,6 +311,16 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionResend) { + } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionCommitKey) { + SecretChatHelper.getInstance().sendCommitKeyMessage(encryptedChat, messageObject.messageOwner); + } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionAbortKey) { + SecretChatHelper.getInstance().sendAbortKeyMessage(encryptedChat, messageObject.messageOwner, 0); + } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionRequestKey) { + SecretChatHelper.getInstance().sendRequestKeyMessage(encryptedChat, messageObject.messageOwner); + } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionAcceptKey) { + SecretChatHelper.getInstance().sendAcceptKeyMessage(encryptedChat, messageObject.messageOwner); + } else if (messageObject.messageOwner.action.encryptedAction instanceof TLRPC.TL_decryptedMessageActionNoop) { + SecretChatHelper.getInstance().sendNoopMessage(encryptedChat, messageObject.messageOwner); } return true; } @@ -1072,7 +1084,20 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter }); } + protected void putToSendingMessages(TLRPC.Message message) { + sendingMessages.put(message.id, message); + } + + protected void removeFromSendingMessages(int mid) { + sendingMessages.remove(mid); + } + + public boolean isSendingMessage(int mid) { + return sendingMessages.containsKey(mid); + } + private void performSendMessageRequest(final TLObject req, final TLRPC.Message newMsgObj, final String originalPath) { + putToSendingMessages(newMsgObj); ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { @Override public void run(TLObject response, TLRPC.TL_error error) { @@ -1131,6 +1156,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter } NotificationCenter.getInstance().postNotificationName(NotificationCenter.messageReceivedByServer, oldId, (isBroadcast ? oldId : newMsgObj.id), newMsgObj); processSentMessage(oldId); + removeFromSendingMessages(oldId); } }); if (newMsgObj.media instanceof TLRPC.TL_messageMediaVideo) { @@ -1149,6 +1175,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter if (newMsgObj.media instanceof TLRPC.TL_messageMediaVideo) { stopVideoService(newMsgObj.attachPath); } + removeFromSendingMessages(newMsgObj.id); } }); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java index f7e44667..6a7b6582 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java @@ -112,7 +112,7 @@ public class Utilities { private native static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, int offset, int length); public static void aesIgeEncryption(ByteBuffer buffer, byte[] key, byte[] iv, boolean encrypt, boolean changeIv, int offset, int length) { - aesIgeEncryption(buffer, key, changeIv ? iv : (byte [])iv.clone(), encrypt, offset, length); + aesIgeEncryption(buffer, key, changeIv ? iv : iv.clone(), encrypt, offset, length); } public static Integer parseInt(String value) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java index 5a9d53fb..177a42ea 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/ActionBarLayout.java @@ -614,6 +614,11 @@ public class ActionBarLayout extends FrameLayout { public void onAnimationEnd(Object animation) { onAnimationEndCheck(false); } + + @Override + public void onAnimationCancel(Object animation) { + onAnimationEndCheck(false); + } }); currentAnimation.start(); } else { @@ -638,6 +643,11 @@ public class ActionBarLayout extends FrameLayout { public void onAnimationEnd(Object animation) { onAnimationEndCheck(false); } + + @Override + public void onAnimationCancel(Object animation) { + onAnimationEndCheck(false); + } }); currentAnimation.start(); } @@ -747,6 +757,11 @@ public class ActionBarLayout extends FrameLayout { public void onAnimationEnd(Object animation) { onAnimationEndCheck(false); } + + @Override + public void onAnimationCancel(Object animation) { + onAnimationEndCheck(false); + } }); currentAnimation.start(); } @@ -784,6 +799,11 @@ public class ActionBarLayout extends FrameLayout { public void onAnimationEnd(Object animation) { onAnimationEndCheck(false); } + + @Override + public void onAnimationCancel(Object animation) { + onAnimationEndCheck(false); + } }); currentAnimation.start(); } else { 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 bd53d1c6..5ac37a1c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java @@ -25,6 +25,7 @@ import android.view.SoundEffectConstants; import org.telegram.android.AndroidUtilities; import org.telegram.android.ImageLoader; import org.telegram.android.LocaleController; +import org.telegram.android.SendMessagesHelper; import org.telegram.messenger.ConnectionsManager; import org.telegram.messenger.FileLoader; import org.telegram.android.MediaController; @@ -335,6 +336,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD private void didPressedButton(boolean animated) { if (buttonState == 0) { cancelLoading = false; + radialProgress.setProgress(0, false); if (currentMessageObject.type == 1) { if (currentMessageObject.imagePreview != null) { photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, new BitmapDrawable(currentMessageObject.imagePreview), currentPhotoObject.photoOwner.size, false); @@ -675,6 +677,9 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD buttonState = 1; radialProgress.setBackground(getDrawableForCurrentState(), true, animated); Float progress = FileLoader.getInstance().getFileProgress(currentMessageObject.messageOwner.attachPath); + if (progress == null && SendMessagesHelper.getInstance().isSendingMessage(currentMessageObject.messageOwner.id)) { + progress = 1.0f; + } radialProgress.setProgress(progress != null ? progress : 0, false); invalidate(); } @@ -702,8 +707,8 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD Float progress = FileLoader.getInstance().getFileProgress(fileName); setProgress = progress != null ? progress : 0; } - radialProgress.setBackground(getDrawableForCurrentState(), progressVisible, animated); radialProgress.setProgress(setProgress, false); + radialProgress.setBackground(getDrawableForCurrentState(), progressVisible, animated); invalidate(); } else { MediaController.getInstance().removeLoadingFileObserver(this); @@ -925,7 +930,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD public void onProgressDownload(String fileName, float progress) { radialProgress.setProgress(progress, true); if (buttonState != 1) { - updateButtonState(true); + updateButtonState(false); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 508f34ba..b7ae8fce 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -2345,7 +2345,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not dayArr.remove(obj); if (dayArr.isEmpty()) { messagesByDays.remove(obj.dateKey); - messages.remove(index); + if (index >= 0 && index < messages.size()) { //TODO fix it + messages.remove(index); + } } updated = true; } @@ -2681,6 +2683,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not @Override public void onPause() { super.onPause(); + if (menuItem != null) { + menuItem.closeSubMenu(); + } chatActivityEnterView.hideEmojiPopup(); paused = true; NotificationsController.getInstance().setOpennedDialogId(0); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java index 01cbcdc0..52c7c67f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatActivityEnterView.java @@ -30,6 +30,7 @@ import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; +import android.widget.PopupWindow; import android.widget.TextView; import org.telegram.android.AndroidUtilities; @@ -50,6 +51,8 @@ import org.telegram.ui.AnimationCompat.ObjectAnimatorProxy; import org.telegram.ui.AnimationCompat.ViewProxy; import org.telegram.messenger.ApplicationLoader; +import java.lang.reflect.Field; + public class ChatActivityEnterView implements NotificationCenter.NotificationCenterDelegate, SizeNotifierRelativeLayout.SizeNotifierRelativeLayoutDelegate { public static interface ChatActivityEnterViewDelegate { @@ -61,6 +64,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen private EditText messsageEditText; private ImageButton sendButton; + private PopupWindow emojiPopup; private ImageView emojiButton; private EmojiView emojiView; private TextView recordTimeText; @@ -76,9 +80,6 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen private int runningAnimationType; private int audioInterfaceState; - private WindowManager.LayoutParams windowLayoutParams; - private boolean showingEmoji; - private int keyboardHeight; private int keyboardHeightLand; private boolean keyboardVisible; @@ -127,7 +128,6 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen if (sizeNotifierRelativeLayout != null) { sizeNotifierRelativeLayout.delegate = null; } - removeEmojiWindow(); } public void setContainerView(Activity activity, View containerView) { @@ -164,14 +164,14 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen emojiButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - showEmojiPopup(!showingEmoji); + showEmojiPopup(emojiPopup == null || !emojiPopup.isShowing()); } }); messsageEditText.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View view, int i, KeyEvent keyEvent) { - if (i == 4 && !keyboardVisible && showingEmoji) { + if (i == 4 && !keyboardVisible && emojiPopup != null && emojiPopup.isShowing()) { if (keyEvent.getAction() == 1) { showEmojiPopup(false); } @@ -187,7 +187,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen messsageEditText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if (showingEmoji) { + if (emojiPopup != null && emojiPopup.isShowing()) { showEmojiPopup(false); } } @@ -609,9 +609,8 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen } private void showEmojiPopup(boolean show) { - showingEmoji = show; if (show) { - if (emojiView == null) { + if (emojiPopup == null) { if (parentActivity == null) { return; } @@ -636,16 +635,17 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen } } }); + emojiPopup = new PopupWindow(emojiView); - windowLayoutParams = new WindowManager.LayoutParams(); - windowLayoutParams.gravity = Gravity.BOTTOM | Gravity.LEFT; if (Build.VERSION.SDK_INT >= 21) { - windowLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; - } else { - windowLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL; - windowLayoutParams.token = parentActivity.getWindow().getDecorView().getWindowToken(); + try { + Field field = PopupWindow.class.getDeclaredField("mWindowLayoutType"); + field.setAccessible(true); + field.set(emojiPopup, WindowManager.LayoutParams.TYPE_SYSTEM_ERROR); + } catch (Exception e) { + /* ignored */ + } } - windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; } int currentHeight; WindowManager wm = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Activity.WINDOW_SERVICE); @@ -661,19 +661,13 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen } else { currentHeight = keyboardHeight; } - windowLayoutParams.height = currentHeight; - windowLayoutParams.width = AndroidUtilities.displaySize.x; - - try { - if (emojiView.getParent() != null) { - wm.removeViewImmediate(emojiView); - } - } catch (Exception e) { - FileLog.e("tmessages", e); + emojiPopup.setHeight(View.MeasureSpec.makeMeasureSpec(currentHeight, View.MeasureSpec.EXACTLY)); + if (sizeNotifierRelativeLayout != null) { + emojiPopup.setWidth(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, View.MeasureSpec.EXACTLY)); } try { - wm.addView(emojiView, windowLayoutParams); + emojiPopup.showAtLocation(parentActivity.getWindow().getDecorView(), Gravity.BOTTOM | Gravity.LEFT, 0, 0); } catch (Exception e) { FileLog.e("tmessages", e); return; @@ -692,7 +686,9 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen if (emojiButton != null) { emojiButton.setImageResource(R.drawable.ic_msg_panel_smiles); } - removeEmojiWindow(); + if (emojiPopup != null) { + emojiPopup.dismiss(); + } if (sizeNotifierRelativeLayout != null) { sizeNotifierRelativeLayout.post(new Runnable() { public void run() { @@ -704,22 +700,8 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen } } - private void removeEmojiWindow() { - if (emojiView == null) { - return; - } - try { - if (emojiView.getParent() != null) { - WindowManager wm = (WindowManager) ApplicationLoader.applicationContext.getSystemService(Context.WINDOW_SERVICE); - wm.removeViewImmediate(emojiView); - } - } catch (Exception e) { - FileLog.e("tmessages", e); - } - } - public void hideEmojiPopup() { - if (showingEmoji) { + if (emojiPopup != null && emojiPopup.isShowing()) { showEmojiPopup(false); } } @@ -780,7 +762,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen } public boolean isEmojiPopupShowing() { - return showingEmoji; + return emojiPopup != null && emojiPopup.isShowing(); } public void addToAttachLayout(View view) { @@ -820,23 +802,24 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen } } - if (showingEmoji) { + if (emojiPopup != null && emojiPopup.isShowing()) { int newHeight = 0; if (rotation == Surface.ROTATION_270 || rotation == Surface.ROTATION_90) { newHeight = keyboardHeightLand; } else { newHeight = keyboardHeight; } - if (windowLayoutParams.width != AndroidUtilities.displaySize.x || windowLayoutParams.height != newHeight) { - windowLayoutParams.width = AndroidUtilities.displaySize.x; - windowLayoutParams.height = newHeight; - wm.updateViewLayout(emojiView, windowLayoutParams); + final WindowManager.LayoutParams layoutParams = (WindowManager.LayoutParams) emojiPopup.getContentView().getLayoutParams(); + if (layoutParams.width != AndroidUtilities.displaySize.x || layoutParams.height != newHeight) { + layoutParams.width = AndroidUtilities.displaySize.x; + layoutParams.height = newHeight; + wm.updateViewLayout(emojiPopup.getContentView(), layoutParams); if (!keyboardVisible) { sizeNotifierRelativeLayout.post(new Runnable() { @Override public void run() { if (sizeNotifierRelativeLayout != null) { - sizeNotifierRelativeLayout.setPadding(0, 0, 0, windowLayoutParams.height); + sizeNotifierRelativeLayout.setPadding(0, 0, 0, layoutParams.height); sizeNotifierRelativeLayout.requestLayout(); } } @@ -849,7 +832,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen keyboardVisible = height > 0; if (keyboardVisible && sizeNotifierRelativeLayout.getPaddingBottom() > 0) { showEmojiPopup(false); - } else if (!keyboardVisible && keyboardVisible != oldValue && showingEmoji) { + } else if (!keyboardVisible && keyboardVisible != oldValue && emojiPopup != null && emojiPopup.isShowing()) { showEmojiPopup(false); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index 4b59bcec..66cccfb5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -585,7 +585,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa String scheme = data.getScheme(); if (scheme != null) { if ((scheme.equals("http") || scheme.equals("https"))) { - String host = data.getHost(); + String host = data.getHost().toLowerCase(); if (host.equals("telegram.me")) { String path = data.getPath(); if (path != null && path.length() >= 6) { @@ -593,7 +593,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa } } } else if (scheme.equals("tg")) { - String url = data.toString(); + String url = data.toString().toLowerCase(); if (url.startsWith("tg:resolve") || url.startsWith("tg://resolve")) { url = url.replace("tg:resolve", "tg://telegram.org").replace("tg://resolve", "tg://telegram.org"); data = Uri.parse(url); @@ -730,7 +730,13 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa args.putString("selectAlertStringGroup", LocaleController.getString("SendMessagesToGroup", R.string.SendMessagesToGroup)); MessagesActivity fragment = new MessagesActivity(args); fragment.setDelegate(this); - actionBarLayout.presentFragment(fragment, false, true, true); + boolean removeLast = false; + if (AndroidUtilities.isTablet()) { + removeLast = layersActionBarLayout.fragmentsStack.size() > 0 && layersActionBarLayout.fragmentsStack.get(layersActionBarLayout.fragmentsStack.size() - 1) instanceof MessagesActivity; + } else { + removeLast = actionBarLayout.fragmentsStack.size() > 1 && actionBarLayout.fragmentsStack.get(actionBarLayout.fragmentsStack.size() - 1) instanceof MessagesActivity; + } + actionBarLayout.presentFragment(fragment, removeLast, true, true); pushOpened = true; if (PhotoViewer.getInstance().isVisible()) { PhotoViewer.getInstance().closePhoto(false); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 4d32b700..8c4ef8b3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -1744,7 +1744,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat NotificationCenter.getInstance().removeObserver(this, NotificationCenter.userPhotosLoaded); ConnectionsManager.getInstance().cancelRpcsForClassGuid(classGuid); - isVisible = false; isActionBarVisible = false; if (velocityTracker != null) { @@ -1922,6 +1921,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } private void onPhotoClosed(PlaceProviderObject object) { + isVisible = false; disableShowCheck = true; currentMessageObject = null; currentFileLocation = null; @@ -1935,9 +1935,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat centerImage.setImageBitmap((Bitmap)null); leftImage.setImageBitmap((Bitmap)null); rightImage.setImageBitmap((Bitmap)null); - if (object != null) { - object.imageReceiver.setVisible(true, true); - } containerView.post(new Runnable() { @Override public void run() { @@ -1957,6 +1954,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } placeProvider = null; disableShowCheck = false; + if (object != null) { + object.imageReceiver.setVisible(true, true); + } } public boolean isVisible() {