Bug fixes

This commit is contained in:
DrKLO 2016-04-25 22:26:41 +03:00
parent fe9e23eccf
commit 1c74ed4587
14 changed files with 232 additions and 94 deletions

View file

@ -1191,8 +1191,8 @@ public class ImageLoader {
AndroidUtilities.addMediaToGallery(finalFile.toString()); AndroidUtilities.addMediaToGallery(finalFile.toString());
} }
} }
ImageLoader.this.fileDidLoaded(location, finalFile, type);
NotificationCenter.getInstance().postNotificationName(NotificationCenter.FileDidLoaded, location); NotificationCenter.getInstance().postNotificationName(NotificationCenter.FileDidLoaded, location);
ImageLoader.this.fileDidLoaded(location, finalFile, type);
} }
}); });
} }

View file

@ -1673,6 +1673,8 @@ public class MessageObject {
public void checkMediaExistance() { public void checkMediaExistance() {
File cacheFile = null; File cacheFile = null;
attachPathExists = false;
mediaExists = false;
if (type == 1) { if (type == 1) {
TLRPC.PhotoSize currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, AndroidUtilities.getPhotoSize()); TLRPC.PhotoSize currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(photoThumbs, AndroidUtilities.getPhotoSize());
if (currentPhotoObject != null) { if (currentPhotoObject != null) {

View file

@ -268,18 +268,18 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
if (file != null && media != null) { if (file != null && media != null) {
if (message.type == 0) { if (message.type == 0) {
media.file = file; media.file = file;
performSendMessageRequest(message.sendRequest, message.obj.messageOwner, message.originalPath); performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
} else if (message.type == 1) { } else if (message.type == 1) {
if (media.file == null) { if (media.file == null) {
media.file = file; media.file = file;
if (media.thumb == null && message.location != null) { if (media.thumb == null && message.location != null) {
performSendDelayedMessage(message); performSendDelayedMessage(message);
} else { } else {
performSendMessageRequest(message.sendRequest, message.obj.messageOwner, message.originalPath); performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
} }
} else { } else {
media.thumb = file; media.thumb = file;
performSendMessageRequest(message.sendRequest, message.obj.messageOwner, message.originalPath); performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
} }
} else if (message.type == 2) { } else if (message.type == 2) {
if (media.file == null) { if (media.file == null) {
@ -287,15 +287,15 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
if (media.thumb == null && message.location != null) { if (media.thumb == null && message.location != null) {
performSendDelayedMessage(message); performSendDelayedMessage(message);
} else { } else {
performSendMessageRequest(message.sendRequest, message.obj.messageOwner, message.originalPath); performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
} }
} else { } else {
media.thumb = file; media.thumb = file;
performSendMessageRequest(message.sendRequest, message.obj.messageOwner, message.originalPath); performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
} }
} else if (message.type == 3) { } else if (message.type == 3) {
media.file = file; media.file = file;
performSendMessageRequest(message.sendRequest, message.obj.messageOwner, message.originalPath); performSendMessageRequest(message.sendRequest, message.obj, message.originalPath);
} }
arr.remove(a); arr.remove(a);
a--; a--;
@ -838,6 +838,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
} }
final ArrayList<TLRPC.Message> newMsgObjArr = arr; final ArrayList<TLRPC.Message> newMsgObjArr = arr;
final ArrayList<MessageObject> newMsgArr = objArr;
final HashMap<Long, TLRPC.Message> messagesByRandomIdsFinal = messagesByRandomIds; final HashMap<Long, TLRPC.Message> messagesByRandomIdsFinal = messagesByRandomIds;
final boolean isMegagroupFinal = isMegagroup; final boolean isMegagroupFinal = isMegagroup;
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@ -875,12 +876,13 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
if (newMsgObj == null) { if (newMsgObj == null) {
continue; continue;
} }
MessageObject msgObj = newMsgArr.get(newMsgObjArr.indexOf(newMsgObj));
newMsgObjArr.remove(newMsgObj); newMsgObjArr.remove(newMsgObj);
final int oldId = newMsgObj.id; final int oldId = newMsgObj.id;
final ArrayList<TLRPC.Message> sentMessages = new ArrayList<>(); final ArrayList<TLRPC.Message> sentMessages = new ArrayList<>();
sentMessages.add(message); sentMessages.add(message);
newMsgObj.id = message.id; newMsgObj.id = message.id;
processSentMessage(newMsgObj, message, null, true); updateMediaPaths(msgObj, message, null, true);
MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() { MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -1479,7 +1481,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
reqSend.contacts = sendToPeers; reqSend.contacts = sendToPeers;
reqSend.media = new TLRPC.TL_inputMediaEmpty(); reqSend.media = new TLRPC.TL_inputMediaEmpty();
reqSend.random_id = random_ids; reqSend.random_id = random_ids;
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} else { } else {
TLRPC.TL_messages_sendMessage reqSend = new TLRPC.TL_messages_sendMessage(); TLRPC.TL_messages_sendMessage reqSend = new TLRPC.TL_messages_sendMessage();
reqSend.message = message; reqSend.message = message;
@ -1498,7 +1500,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
if (!searchLinks) { if (!searchLinks) {
reqSend.no_webpage = true; reqSend.no_webpage = true;
} }
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} }
} else { } else {
TLRPC.TL_decryptedMessage reqSend; TLRPC.TL_decryptedMessage reqSend;
@ -1694,32 +1696,32 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
reqSend = request; reqSend = request;
} }
if (type == 1) { if (type == 1) {
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} else if (type == 2) { } else if (type == 2) {
if (photo.access_hash == 0) { if (photo.access_hash == 0) {
performSendDelayedMessage(delayedMessage); performSendDelayedMessage(delayedMessage);
} else { } else {
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} }
} else if (type == 3) { } else if (type == 3) {
if (document.access_hash == 0) { if (document.access_hash == 0) {
performSendDelayedMessage(delayedMessage); performSendDelayedMessage(delayedMessage);
} else { } else {
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} }
} else if (type == 6) { } else if (type == 6) {
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} else if (type == 7) { } else if (type == 7) {
if (document.access_hash == 0 && delayedMessage != null) { if (document.access_hash == 0 && delayedMessage != null) {
performSendDelayedMessage(delayedMessage); performSendDelayedMessage(delayedMessage);
} else { } else {
performSendMessageRequest(reqSend, newMsgObj.messageOwner, originalPath); performSendMessageRequest(reqSend, newMsgObj, originalPath);
} }
} else if (type == 8) { } else if (type == 8) {
if (document.access_hash == 0) { if (document.access_hash == 0) {
performSendDelayedMessage(delayedMessage); performSendDelayedMessage(delayedMessage);
} else { } else {
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} }
} }
} else { } else {
@ -2010,7 +2012,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
if (asAdmin && reqSend.to_peer.channel_id != 0) { if (asAdmin && reqSend.to_peer.channel_id != 0) {
reqSend.broadcast = true; reqSend.broadcast = true;
} }
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} else if (type == 9) { } else if (type == 9) {
TLRPC.TL_messages_sendInlineBotResult reqSend = new TLRPC.TL_messages_sendInlineBotResult(); TLRPC.TL_messages_sendInlineBotResult reqSend = new TLRPC.TL_messages_sendInlineBotResult();
reqSend.peer = sendToPeer; reqSend.peer = sendToPeer;
@ -2027,7 +2029,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
} }
reqSend.query_id = Utilities.parseLong(params.get("query_id")); reqSend.query_id = Utilities.parseLong(params.get("query_id"));
reqSend.id = params.get("id"); reqSend.id = params.get("id");
performSendMessageRequest(reqSend, newMsgObj.messageOwner, null); performSendMessageRequest(reqSend, newMsgObj, null);
} }
} catch (Exception e) { } catch (Exception e) {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
@ -2185,7 +2187,8 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
return sendingMessages.containsKey(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 MessageObject msgObj, final String originalPath) {
final TLRPC.Message newMsgObj = msgObj.messageOwner;
putToSendingMessages(newMsgObj); putToSendingMessages(newMsgObj);
ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() { ConnectionsManager.getInstance().sendRequest(req, new RequestDelegate() {
@Override @Override
@ -2252,7 +2255,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
} }
if (message != null) { if (message != null) {
newMsgObj.id = message.id; newMsgObj.id = message.id;
processSentMessage(newMsgObj, message, originalPath, false); updateMediaPaths(msgObj, message, originalPath, false);
} else { } else {
isSentError = true; isSentError = true;
} }
@ -2329,7 +2332,8 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
}, ConnectionsManager.RequestFlagCanCompress | ConnectionsManager.RequestFlagInvokeAfter | (req instanceof TLRPC.TL_messages_sendMessage ? ConnectionsManager.RequestFlagNeedQuickAck : 0)); }, ConnectionsManager.RequestFlagCanCompress | ConnectionsManager.RequestFlagInvokeAfter | (req instanceof TLRPC.TL_messages_sendMessage ? ConnectionsManager.RequestFlagNeedQuickAck : 0));
} }
private void processSentMessage(TLRPC.Message newMsg, TLRPC.Message sentMessage, String originalPath, boolean post) { private void updateMediaPaths(MessageObject newMsgObj, TLRPC.Message sentMessage, String originalPath, boolean post) {
TLRPC.Message newMsg = newMsgObj.messageOwner;
if (sentMessage == null) { if (sentMessage == null) {
return; return;
} }
@ -2436,6 +2440,8 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter
sentMessage.attachPath = newMsg.attachPath; sentMessage.attachPath = newMsg.attachPath;
sentMessage.message = newMsg.message; sentMessage.message = newMsg.message;
} else if (!MessageObject.isVideoMessage(sentMessage)) { } else if (!MessageObject.isVideoMessage(sentMessage)) {
newMsgObj.mediaExists = newMsgObj.attachPathExists;
newMsgObj.attachPathExists = false;
newMsg.attachPath = ""; newMsg.attachPath = "";
if (originalPath != null && originalPath.startsWith("http")) { if (originalPath != null && originalPath.startsWith("http")) {
MessagesStorage.getInstance().addRecentLocalFile(originalPath, cacheFile2.toString(), newMsg.media.document); MessagesStorage.getInstance().addRecentLocalFile(originalPath, cacheFile2.toString(), newMsg.media.document);

View file

@ -13,6 +13,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
@ -28,6 +29,7 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import org.telegram.messenger.R; import org.telegram.messenger.R;
import org.telegram.messenger.AnimationCompat.AnimatorListenerAdapterProxy; import org.telegram.messenger.AnimationCompat.AnimatorListenerAdapterProxy;
@ -50,6 +52,9 @@ public class ActionBarLayout extends FrameLayout {
public class LinearLayoutContainer extends LinearLayout { public class LinearLayoutContainer extends LinearLayout {
private Rect rect = new Rect();
private boolean isKeyboardVisible;
public LinearLayoutContainer(Context context) { public LinearLayoutContainer(Context context) {
super(context); super(context);
setOrientation(VERTICAL); setOrientation(VERTICAL);
@ -87,12 +92,32 @@ public class ActionBarLayout extends FrameLayout {
public boolean hasOverlappingRendering() { public boolean hasOverlappingRendering() {
return false; return false;
} }
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
View rootView = getRootView();
getWindowVisibleDisplayFrame(rect);
int usableViewHeight = rootView.getHeight() - (rect.top != 0 ? AndroidUtilities.statusBarHeight : 0) - AndroidUtilities.getViewInset(rootView);
isKeyboardVisible = usableViewHeight - (rect.bottom - rect.top) > 0;
if (BuildVars.DEBUG_VERSION) {
FileLog.e("tmessages", "keyboard visible = " + isKeyboardVisible + " for " + this);
}
if (waitingForKeyboardCloseRunnable != null && !containerView.isKeyboardVisible && !containerViewBack.isKeyboardVisible) {
AndroidUtilities.cancelRunOnUIThread(waitingForKeyboardCloseRunnable);
waitingForKeyboardCloseRunnable.run();
waitingForKeyboardCloseRunnable = null;
}
}
} }
private static Drawable headerShadowDrawable; private static Drawable headerShadowDrawable;
private static Drawable layerShadowDrawable; private static Drawable layerShadowDrawable;
private static Paint scrimPaint; private static Paint scrimPaint;
private Runnable waitingForKeyboardCloseRunnable;
private LinearLayoutContainer containerView; private LinearLayoutContainer containerView;
private LinearLayoutContainer containerViewBack; private LinearLayoutContainer containerViewBack;
private DrawerLayoutContainer drawerLayoutContainer; private DrawerLayoutContainer drawerLayoutContainer;
@ -494,6 +519,10 @@ public class ActionBarLayout extends FrameLayout {
private void onAnimationEndCheck(boolean byCheck) { private void onAnimationEndCheck(boolean byCheck) {
onCloseAnimationEnd(false); onCloseAnimationEnd(false);
onOpenAnimationEnd(false); onOpenAnimationEnd(false);
if (waitingForKeyboardCloseRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(waitingForKeyboardCloseRunnable);
waitingForKeyboardCloseRunnable = null;
}
if (currentAnimation != null) { if (currentAnimation != null) {
if (byCheck) { if (byCheck) {
currentAnimation.cancel(); currentAnimation.cancel();
@ -514,7 +543,7 @@ public class ActionBarLayout extends FrameLayout {
} }
public boolean checkTransitionAnimation() { public boolean checkTransitionAnimation() {
if (transitionAnimationInProgress && transitionAnimationStartTime < System.currentTimeMillis() - 1000) { if (transitionAnimationInProgress && transitionAnimationStartTime < System.currentTimeMillis() - 1500) {
onAnimationEndCheck(true); onAnimationEndCheck(true);
} }
return transitionAnimationInProgress; return transitionAnimationInProgress;
@ -718,7 +747,21 @@ public class ActionBarLayout extends FrameLayout {
if (animation == null) { if (animation == null) {
ViewProxy.setAlpha(containerView, 0.0f); ViewProxy.setAlpha(containerView, 0.0f);
ViewProxy.setTranslationX(containerView, 48.0f); ViewProxy.setTranslationX(containerView, 48.0f);
startLayoutAnimation(true, true); if (containerView.isKeyboardVisible || containerViewBack.isKeyboardVisible) {
waitingForKeyboardCloseRunnable = new Runnable() {
@Override
public void run() {
FileLog.e("tmessages", "start delayed by keyboard open animation");
if (waitingForKeyboardCloseRunnable != this) {
return;
}
startLayoutAnimation(true, true);
}
};
AndroidUtilities.runOnUIThread(waitingForKeyboardCloseRunnable, 200);
} else {
startLayoutAnimation(true, true);
}
} else { } else {
if (Build.VERSION.SDK_INT > 15) { if (Build.VERSION.SDK_INT > 15) {
//containerView.setLayerType(LAYER_TYPE_HARDWARE, null); //containerView.setLayerType(LAYER_TYPE_HARDWARE, null);
@ -868,7 +911,21 @@ public class ActionBarLayout extends FrameLayout {
} }
}); });
if (animation == null) { if (animation == null) {
startLayoutAnimation(false, true); if (containerView.isKeyboardVisible || containerViewBack.isKeyboardVisible) {
waitingForKeyboardCloseRunnable = new Runnable() {
@Override
public void run() {
if (waitingForKeyboardCloseRunnable != this) {
return;
}
FileLog.e("tmessages", "start delayed by keyboard close animation");
startLayoutAnimation(false, true);
}
};
AndroidUtilities.runOnUIThread(waitingForKeyboardCloseRunnable, 200);
} else {
startLayoutAnimation(false, true);
}
} else { } else {
if (Build.VERSION.SDK_INT > 15) { if (Build.VERSION.SDK_INT > 15) {
//containerView.setLayerType(LAYER_TYPE_HARDWARE, null); //containerView.setLayerType(LAYER_TYPE_HARDWARE, null);

View file

@ -112,10 +112,7 @@ public class ActionBarMenu extends LinearLayout {
} }
public void clearItems() { public void clearItems() {
while(getChildCount() > 0) { removeAllViews();
View view = getChildAt(0);
removeView(view);
}
} }
public void onMenuButtonPressed() { public void onMenuButtonPressed() {

View file

@ -233,6 +233,9 @@ public class BottomSheet extends Dialog {
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec); int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec);
if (lastInsets != null && Build.VERSION.SDK_INT >= 21) {
width -= lastInsets.getSystemWindowInsetRight() + lastInsets.getSystemWindowInsetLeft();
}
setMeasuredDimension(width, height); setMeasuredDimension(width, height);
boolean isPortrait = width < height; boolean isPortrait = width < height;
@ -262,9 +265,6 @@ public class BottomSheet extends Dialog {
if (child.getVisibility() == GONE || child == containerView) { if (child.getVisibility() == GONE || child == containerView) {
continue; continue;
} }
if (lastInsets != null && Build.VERSION.SDK_INT >= 21) {
child.dispatchApplyWindowInsets(lastInsets);
}
measureChildWithMargins(child, MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), 0, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY), 0); measureChildWithMargins(child, MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), 0, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY), 0);
} }
} }
@ -272,15 +272,15 @@ public class BottomSheet extends Dialog {
@Override @Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) { protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (containerView != null) { if (containerView != null) {
int l = ((right - left) - containerView.getMeasuredWidth()) / 2;
int t = (bottom - top) - containerView.getMeasuredHeight(); int t = (bottom - top) - containerView.getMeasuredHeight();
if (lastInsets != null && Build.VERSION.SDK_INT >= 21) { if (lastInsets != null && Build.VERSION.SDK_INT >= 21) {
l += lastInsets.getSystemWindowInsetLeft() / 2; left += lastInsets.getSystemWindowInsetLeft();
l -= lastInsets.getSystemWindowInsetRight() / 2; right += lastInsets.getSystemWindowInsetLeft();
if (focusable) { if (focusable) {
t -= lastInsets.getSystemWindowInsetBottom(); t -= lastInsets.getSystemWindowInsetBottom();
} }
} }
int l = ((right - left) - containerView.getMeasuredWidth()) / 2;
containerView.layout(l, t, l + containerView.getMeasuredWidth(), t + getMeasuredHeight()); containerView.layout(l, t, l + containerView.getMeasuredWidth(), t + getMeasuredHeight());
} }
@ -382,6 +382,12 @@ public class BottomSheet extends Dialog {
protected boolean drawChild(Canvas canvas, View child, long drawingTime) { protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
return super.drawChild(canvas, child, drawingTime); return super.drawChild(canvas, child, drawingTime);
} }
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
FileLog.e("tmessages", "container on layout");
}
}; };
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
containerView.setFitsSystemWindows(true); containerView.setFitsSystemWindows(true);
@ -548,7 +554,7 @@ public class BottomSheet extends Dialog {
private void startRevealAnimation(final boolean open) { private void startRevealAnimation(final boolean open) {
ViewProxy.setTranslationY(containerView, 0); ViewProxy.setTranslationY(containerView, 0);
AnimatorSet animatorSet = new AnimatorSet(); final AnimatorSet animatorSet = new AnimatorSet();
View view = delegate.getRevealView(); View view = delegate.getRevealView();
if (view.getVisibility() == View.VISIBLE && ((ViewGroup) view.getParent()).getVisibility() == View.VISIBLE) { if (view.getVisibility() == View.VISIBLE && ((ViewGroup) view.getParent()).getVisibility() == View.VISIBLE) {
@ -580,6 +586,7 @@ public class BottomSheet extends Dialog {
for (int a = 0; a < 4; a++) { for (int a = 0; a < 4; a++) {
finalRevealRadius = Math.max(finalRevealRadius, (int) Math.ceil(Math.sqrt((revealX - corners[a][0]) * (revealX - corners[a][0]) + (revealY - corners[a][1]) * (revealY - corners[a][1])))); finalRevealRadius = Math.max(finalRevealRadius, (int) Math.ceil(Math.sqrt((revealX - corners[a][0]) * (revealX - corners[a][0]) + (revealY - corners[a][1]) * (revealY - corners[a][1]))));
} }
int finalRevealX = revealX <= containerView.getMeasuredWidth() ? revealX : containerView.getMeasuredWidth();
ArrayList<Animator> animators = new ArrayList<>(3); ArrayList<Animator> animators = new ArrayList<>(3);
animators.add(ObjectAnimator.ofFloat(this, "revealRadius", open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0)); animators.add(ObjectAnimator.ofFloat(this, "revealRadius", open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0));
@ -587,7 +594,7 @@ public class BottomSheet extends Dialog {
if (Build.VERSION.SDK_INT >= 21) { if (Build.VERSION.SDK_INT >= 21) {
containerView.setElevation(AndroidUtilities.dp(10)); containerView.setElevation(AndroidUtilities.dp(10));
try { try {
animators.add(ViewAnimationUtils.createCircularReveal(containerView, revealX <= containerView.getMeasuredWidth() ? revealX : containerView.getMeasuredWidth(), revealY, open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0)); animators.add(ViewAnimationUtils.createCircularReveal(containerView, finalRevealX, revealY, open ? 0 : finalRevealRadius, open ? finalRevealRadius : 0));
} catch (Exception e) { } catch (Exception e) {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} }
@ -626,7 +633,7 @@ public class BottomSheet extends Dialog {
} }
containerView.invalidate(); containerView.invalidate();
if (Build.VERSION.SDK_INT >= 11) { if (Build.VERSION.SDK_INT >= 11) {
container.setLayerType(View.LAYER_TYPE_NONE, null); containerView.setLayerType(View.LAYER_TYPE_NONE, null);
} }
if (!open) { if (!open) {
containerView.setVisibility(View.INVISIBLE); containerView.setVisibility(View.INVISIBLE);
@ -642,17 +649,20 @@ public class BottomSheet extends Dialog {
} }
private void startOpenAnimation() { private void startOpenAnimation() {
if (Build.VERSION.SDK_INT >= 20) {
container.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
if (containerView.getMeasuredHeight() == 0) { if (containerView.getMeasuredHeight() == 0) {
containerView.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.y, View.MeasureSpec.AT_MOST)); containerView.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.x, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.y, View.MeasureSpec.AT_MOST));
} }
backgroundDrawable.setAlpha(0); backgroundDrawable.setAlpha(0);
containerView.setVisibility(View.VISIBLE); containerView.setVisibility(View.VISIBLE);
if (useRevealAnimation) { if (useRevealAnimation) {
if (Build.VERSION.SDK_INT >= 20) {
containerView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
startRevealAnimation(true); startRevealAnimation(true);
} else { } else {
if (Build.VERSION.SDK_INT >= 20) {
container.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
ViewProxy.setTranslationY(containerView, containerView.getMeasuredHeight()); ViewProxy.setTranslationY(containerView, containerView.getMeasuredHeight());
backgroundDrawable.setAlpha(0); backgroundDrawable.setAlpha(0);
AnimatorSetProxy animatorSetProxy = new AnimatorSetProxy(); AnimatorSetProxy animatorSetProxy = new AnimatorSetProxy();

View file

@ -233,6 +233,8 @@ public class Theme {
public static PorterDuffColorFilter colorPressedFilter; public static PorterDuffColorFilter colorPressedFilter;
private static int currentColor; private static int currentColor;
public static Drawable attachButtonDrawables[] = new Drawable[8];
private static Paint maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private static Paint maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
public static void loadRecources(Context context) { public static void loadRecources(Context context) {
@ -329,14 +331,14 @@ public class Theme {
geoInDrawable = context.getResources().getDrawable(R.drawable.location_b); geoInDrawable = context.getResources().getDrawable(R.drawable.location_b);
geoOutDrawable = context.getResources().getDrawable(R.drawable.location_g); geoOutDrawable = context.getResources().getDrawable(R.drawable.location_g);
context.getResources().getDrawable(R.drawable.attach_camera_states); attachButtonDrawables[0] = context.getResources().getDrawable(R.drawable.attach_camera_states);
context.getResources().getDrawable(R.drawable.attach_gallery_states); attachButtonDrawables[1] = context.getResources().getDrawable(R.drawable.attach_gallery_states);
context.getResources().getDrawable(R.drawable.attach_video_states); attachButtonDrawables[2] = context.getResources().getDrawable(R.drawable.attach_video_states);
context.getResources().getDrawable(R.drawable.attach_audio_states); attachButtonDrawables[3] = context.getResources().getDrawable(R.drawable.attach_audio_states);
context.getResources().getDrawable(R.drawable.attach_file_states); attachButtonDrawables[4] = context.getResources().getDrawable(R.drawable.attach_file_states);
context.getResources().getDrawable(R.drawable.attach_contact_states); attachButtonDrawables[5] = context.getResources().getDrawable(R.drawable.attach_contact_states);
context.getResources().getDrawable(R.drawable.attach_location_states); attachButtonDrawables[6] = context.getResources().getDrawable(R.drawable.attach_location_states);
context.getResources().getDrawable(R.drawable.attach_hide_states); attachButtonDrawables[7] = context.getResources().getDrawable(R.drawable.attach_hide_states);
cornerOuter[0] = context.getResources().getDrawable(R.drawable.corner_out_tl); cornerOuter[0] = context.getResources().getDrawable(R.drawable.corner_out_tl);
cornerOuter[1] = context.getResources().getDrawable(R.drawable.corner_out_tr); cornerOuter[1] = context.getResources().getDrawable(R.drawable.corner_out_tr);

View file

@ -203,7 +203,7 @@ public class AudioSelectActivity extends BaseFragment implements NotificationCen
final ArrayList<MediaController.AudioEntry> newAudioEntries = new ArrayList<>(); final ArrayList<MediaController.AudioEntry> newAudioEntries = new ArrayList<>();
Cursor cursor = null; Cursor cursor = null;
try { try {
cursor = ApplicationLoader.applicationContext.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, MediaStore.Audio.Media.IS_MUSIC + " != 0", null, null); cursor = ApplicationLoader.applicationContext.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, MediaStore.Audio.Media.IS_MUSIC + " != 0", null, MediaStore.Audio.Media.TITLE);
int id = -2000000000; int id = -2000000000;
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
MediaController.AudioEntry audioEntry = new MediaController.AudioEntry(); MediaController.AudioEntry audioEntry = new MediaController.AudioEntry();

View file

@ -62,7 +62,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
public class ChatMessageCell extends ChatBaseCell implements SeekBar.SeekBarDelegate { public class ChatMessageCell extends ChatBaseCell implements SeekBar.SeekBarDelegate, ImageReceiver.ImageReceiverDelegate {
private final static int DOCUMENT_ATTACH_TYPE_NONE = 0; private final static int DOCUMENT_ATTACH_TYPE_NONE = 0;
private final static int DOCUMENT_ATTACH_TYPE_DOCUMENT = 1; private final static int DOCUMENT_ATTACH_TYPE_DOCUMENT = 1;
@ -202,6 +202,7 @@ public class ChatMessageCell extends ChatBaseCell implements SeekBar.SeekBarDele
super(context); super(context);
avatarDrawable = new AvatarDrawable(); avatarDrawable = new AvatarDrawable();
photoImage = new ImageReceiver(this); photoImage = new ImageReceiver(this);
photoImage.setDelegate(this);
radialProgress = new RadialProgress(this); radialProgress = new RadialProgress(this);
seekBar = new SeekBar(context); seekBar = new SeekBar(context);
seekBar.setDelegate(this); seekBar.setDelegate(this);
@ -1703,6 +1704,7 @@ public class ChatMessageCell extends ChatBaseCell implements SeekBar.SeekBarDele
} }
} }
} else if (webPage.photo != null) { } else if (webPage.photo != null) {
drawImageButton = webPage.type != null && webPage.type.equals("photo");
currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, drawImageButton ? AndroidUtilities.getPhotoSize() : maxPhotoWidth, !drawImageButton); currentPhotoObject = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, drawImageButton ? AndroidUtilities.getPhotoSize() : maxPhotoWidth, !drawImageButton);
currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 80); currentPhotoObjectThumb = FileLoader.getClosestPhotoSizeWithSize(messageObject.photoThumbs, 80);
if (currentPhotoObjectThumb == currentPhotoObject) { if (currentPhotoObjectThumb == currentPhotoObject) {
@ -3300,6 +3302,14 @@ public class ChatMessageCell extends ChatBaseCell implements SeekBar.SeekBarDele
} }
} }
@Override
public void didSetImage(ImageReceiver imageReceiver, boolean set, boolean thumb) {
if (currentMessageObject != null && set && !thumb && !currentMessageObject.mediaExists && !currentMessageObject.attachPathExists) {
currentMessageObject.mediaExists = true;
updateButtonState(true);
}
}
@Override @Override
public void onProgressDownload(String fileName, float progress) { public void onProgressDownload(String fileName, float progress) {
radialProgress.setProgress(progress, true); radialProgress.setProgress(progress, true);

View file

@ -250,7 +250,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private Runnable waitingForCharaterEnterRunnable; private Runnable waitingForCharaterEnterRunnable;
private boolean openAnimationEnded; private boolean openAnimationEnded;
private boolean attachAttachViewFirstShow = true;
private int readWithDate; private int readWithDate;
private int readWithMid; private int readWithMid;
@ -702,7 +701,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
cantDeleteMessagesCount = 0; cantDeleteMessagesCount = 0;
hasOwnBackground = true; hasOwnBackground = true;
chatAttachView = null; if (chatAttachView != null){
chatAttachView.onDestroy();
chatAttachView = null;
}
chatAttachViewSheet = null; chatAttachViewSheet = null;
Theme.loadRecources(context); Theme.loadRecources(context);
@ -876,17 +878,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} }
chatAttachView.init(ChatActivity.this); chatAttachView.init(ChatActivity.this);
if (attachAttachViewFirstShow) { showDialog(chatAttachViewSheet);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public void run() {
showDialog(chatAttachViewSheet);
}
});
attachAttachViewFirstShow = false;
} else {
showDialog(chatAttachViewSheet);
}
} else if (id == bot_help) { } else if (id == bot_help) {
SendMessagesHelper.getInstance().sendMessage("/help", dialog_id, null, null, false, chatActivityEnterView == null || chatActivityEnterView.asAdmin(), null, null, null); SendMessagesHelper.getInstance().sendMessage("/help", dialog_id, null, null, false, chatActivityEnterView == null || chatActivityEnterView.asAdmin(), null, null, null);
} else if (id == bot_settings) { } else if (id == bot_settings) {
@ -2845,11 +2837,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int totalItemCount = chatAdapter.getItemCount(); int totalItemCount = chatAdapter.getItemCount();
int checkLoadCount; int checkLoadCount;
if (scroll) { if (scroll) {
if (lastLoadIndex < 3) { checkLoadCount = 25;
checkLoadCount = 5;
} else {
checkLoadCount = 25;
}
} else { } else {
checkLoadCount = 5; checkLoadCount = 5;
} }

View file

@ -17,6 +17,7 @@ import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.TypedValue; import android.util.TypedValue;
@ -39,6 +40,7 @@ import org.telegram.messenger.support.widget.LinearLayoutManager;
import org.telegram.messenger.R; import org.telegram.messenger.R;
import org.telegram.messenger.support.widget.RecyclerView; import org.telegram.messenger.support.widget.RecyclerView;
import org.telegram.tgnet.TLRPC; import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Cells.PhotoAttachPhotoCell; import org.telegram.ui.Cells.PhotoAttachPhotoCell;
import org.telegram.ui.ChatActivity; import org.telegram.ui.ChatActivity;
import org.telegram.ui.PhotoViewer; import org.telegram.ui.PhotoViewer;
@ -97,9 +99,9 @@ public class ChatAttachView extends FrameLayout implements NotificationCenter.No
super.onMeasure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(85), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(90), MeasureSpec.EXACTLY)); super.onMeasure(MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(85), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(90), MeasureSpec.EXACTLY));
} }
public void setTextAndIcon(CharSequence text, int icon) { public void setTextAndIcon(CharSequence text, Drawable drawable) {
textView.setText(text); textView.setText(text);
imageView.setBackgroundResource(icon); imageView.setBackgroundDrawable(drawable);
} }
} }
@ -168,19 +170,9 @@ public class ChatAttachView extends FrameLayout implements NotificationCenter.No
LocaleController.getString("ChatLocation", R.string.ChatLocation), LocaleController.getString("ChatLocation", R.string.ChatLocation),
"" ""
}; };
int itemIcons[] = new int[] {
R.drawable.attach_camera_states,
R.drawable.attach_gallery_states,
R.drawable.attach_video_states,
R.drawable.attach_audio_states,
R.drawable.attach_file_states,
R.drawable.attach_contact_states,
R.drawable.attach_location_states,
R.drawable.attach_hide_states,
};
for (int a = 0; a < 8; a++) { for (int a = 0; a < 8; a++) {
AttachButton attachButton = new AttachButton(context); AttachButton attachButton = new AttachButton(context);
attachButton.setTextAndIcon(items[a], itemIcons[a]); attachButton.setTextAndIcon(items[a], Theme.attachButtonDrawables[a]);
addView(attachButton, LayoutHelper.createFrame(85, 90, Gravity.LEFT | Gravity.TOP)); addView(attachButton, LayoutHelper.createFrame(85, 90, Gravity.LEFT | Gravity.TOP));
attachButton.setTag(a); attachButton.setTag(a);
views[a] = attachButton; views[a] = attachButton;
@ -282,10 +274,8 @@ public class ChatAttachView extends FrameLayout implements NotificationCenter.No
} }
public void loadGalleryPhotos() { public void loadGalleryPhotos() {
if (MediaController.allPhotosAlbumEntry == null) { if (MediaController.allPhotosAlbumEntry == null && Build.VERSION.SDK_INT >= 21) {
if (Build.VERSION.SDK_INT >= 21) { MediaController.loadGalleryPhotosAlbums(0);
MediaController.loadGalleryPhotosAlbums(0);
}
} }
} }

View file

@ -10,6 +10,7 @@ package org.telegram.ui.Components;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.TypedValue; import android.util.TypedValue;
@ -38,6 +39,8 @@ import org.telegram.ui.ActionBar.BottomSheet;
import org.telegram.ui.ActionBar.Theme; import org.telegram.ui.ActionBar.Theme;
import java.util.HashMap; import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class WebFrameLayout extends FrameLayout { public class WebFrameLayout extends FrameLayout {
@ -52,11 +55,67 @@ public class WebFrameLayout extends FrameLayout {
private int height; private int height;
private String openUrl; private String openUrl;
private boolean hasDescription; private boolean hasDescription;
private String embedUrl;
final static Pattern youtubeIdRegex = Pattern.compile("(?:youtube(?:-nocookie)?\\.com\\/(?:[^\\/\\n\\s]+\\/\\S+\\/|(?:v|e(?:mbed)?)\\/|\\S*?[?&]v=)|youtu\\.be\\/)([a-zA-Z0-9_-]{11})");
private final String youtubeFrame = "<!DOCTYPE html><html><head><style>" +
"body { margin: 0; width:100%%; height:100%%; background-color:#000; }" +
"html { width:100%%; height:100%%; background-color:#000; }" +
".embed-container iframe," +
".embed-container object," +
" .embed-container embed {" +
" position: absolute;" +
" top: 0;" +
" left: 0;" +
" width: 100%% !important;" +
" height: 100%% !important;" +
" }" +
" </style></head><body>" +
" <div class=\"embed-container\">" +
" <div id=\"player\"></div>" +
" </div>" +
" <script src=\"https://www.youtube.com/iframe_api\"></script>" +
" <script>" +
" var player;" +
" YT.ready(function() {" +
" player = new YT.Player(\"player\", {" +
" \"width\" : \"100%%\"," +
" \"events\" : {" +
" \"onReady\" : \"onReady\"," +
" }," +
" \"videoId\" : \"%1$s\"," +
" \"height\" : \"100%%\"," +
" \"playerVars\" : {" +
" \"start\" : 0," +
" \"rel\" : 0," +
" \"showinfo\" : 0," +
" \"modestbranding\" : 1," +
" \"iv_load_policy\" : 3," +
" \"autohide\" : 1," +
" \"cc_load_policy\" : 1," +
" \"playsinline\" : 1," +
" \"controls\" : 1" +
" }" +
" });" +
" player.setSize(window.innerWidth, window.innerHeight);" +
" });" +
" function onReady(event) {" +
" player.playVideo();" +
" }" +
" window.onresize = function() {" +
" player.setSize(window.innerWidth, window.innerHeight);" +
" }" +
" </script>" +
"</body>" +
"</html>";
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
public WebFrameLayout(Context context, final BottomSheet parentDialog, String title, String descripton, String originalUrl, final String url, int w, int h) { public WebFrameLayout(Context context, final BottomSheet parentDialog, String title, String descripton, String originalUrl, final String url, int w, int h) {
super(context); super(context);
embedUrl = url;
if (embedUrl.toLowerCase().contains("youtube")) {
//embedUrl += "&enablejsapi=1";
}
hasDescription = descripton != null && descripton.length() > 0; hasDescription = descripton != null && descripton.length() > 0;
openUrl = originalUrl; openUrl = originalUrl;
width = w; width = w;
@ -162,9 +221,6 @@ public class WebFrameLayout extends FrameLayout {
progressBar = new ProgressBar(context); progressBar = new ProgressBar(context);
addView(progressBar, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 0, 0, (48 + 36 + (hasDescription ? 22 : 0)) / 2)); addView(progressBar, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 0, 0, (48 + 36 + (hasDescription ? 22 : 0)) / 2));
//TODO 16m
//TODO 14
TextView textView; TextView textView;
if (hasDescription) { if (hasDescription) {
@ -282,11 +338,31 @@ public class WebFrameLayout extends FrameLayout {
public void onOpenAnimationEnd() { public void onOpenAnimationEnd() {
HashMap<String, String> args = new HashMap<>(); HashMap<String, String> args = new HashMap<>();
args.put("Referer", "http://youtube.com"); args.put("Referer", "http://youtube.com");
boolean ok = false;
try { try {
webView.loadUrl(url, args); Uri uri = Uri.parse(openUrl);
String host = uri.getHost().toLowerCase();
if (host != null && host.endsWith("youtube.com") || host.endsWith("youtu.be")) {
Matcher matcher = youtubeIdRegex.matcher(openUrl);
String id = null;
if (matcher.find()) {
id = matcher.group(1);
}
if (id != null) {
ok = true;
webView.loadDataWithBaseURL("http://youtube.com", String.format(youtubeFrame, id), "text/html", "UTF-8", "http://youtube.com");
}
}
} catch (Exception e) { } catch (Exception e) {
FileLog.e("tmessages", e); FileLog.e("tmessages", e);
} }
if (!ok) {
try {
webView.loadUrl(embedUrl, args);
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
} }
}); });
} }

View file

@ -779,7 +779,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
group = path.replace("joinchat/", ""); group = path.replace("joinchat/", "");
} else if (path.startsWith("addstickers/")) { } else if (path.startsWith("addstickers/")) {
sticker = path.replace("addstickers/", ""); sticker = path.replace("addstickers/", "");
} else if (path.startsWith("msg/")) { } else if (path.startsWith("msg/") || path.startsWith("share/")) {
message = data.getQueryParameter("url"); message = data.getQueryParameter("url");
if (message == null) { if (message == null) {
message = ""; message = "";
@ -823,8 +823,8 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
url = url.replace("tg:addstickers", "tg://telegram.org").replace("tg://addstickers", "tg://telegram.org"); url = url.replace("tg:addstickers", "tg://telegram.org").replace("tg://addstickers", "tg://telegram.org");
data = Uri.parse(url); data = Uri.parse(url);
sticker = data.getQueryParameter("set"); sticker = data.getQueryParameter("set");
} else if (url.startsWith("tg:msg") || url.startsWith("tg://msg")) { } else if (url.startsWith("tg:msg") || url.startsWith("tg://msg") || url.startsWith("tg://share") || url.startsWith("tg:share")) {
url = url.replace("tg:msg", "tg://telegram.org").replace("tg://msg", "tg://telegram.org"); url = url.replace("tg:msg", "tg://telegram.org").replace("tg://msg", "tg://telegram.org").replace("tg://share", "tg://telegram.org").replace("tg:share", "tg://telegram.org");
data = Uri.parse(url); data = Uri.parse(url);
message = data.getQueryParameter("url"); message = data.getQueryParameter("url");
if (message == null) { if (message == null) {

View file

@ -890,7 +890,7 @@ public class LoginActivity extends BaseFragment {
if (countryState == 1) { if (countryState == 1) {
needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ChooseCountry", R.string.ChooseCountry)); needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
return; return;
} else if (countryState == 2 && !BuildVars.DEBUG_VERSION) { } else if (countryState == 2 && !BuildVars.DEBUG_VERSION && !codeField.getText().toString().equals("999")) {
needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("WrongCountry", R.string.WrongCountry)); needShowAlert(LocaleController.getString("AppName", R.string.AppName), LocaleController.getString("WrongCountry", R.string.WrongCountry));
return; return;
} }