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