From e8cc3bdd3ccb04d148a4c7c91b9215669a0d020d Mon Sep 17 00:00:00 2001 From: DrKLO Date: Wed, 22 Oct 2014 00:35:16 +0400 Subject: [PATCH] Different improvements --- TMessagesProj/build.gradle | 2 +- .../telegram/android/AndroidUtilities.java | 18 +- .../org/telegram/android/ImageReceiver.java | 158 +++++---- .../org/telegram/android/MediaController.java | 17 +- .../org/telegram/android/MessageObject.java | 9 +- .../telegram/android/MessagesController.java | 8 +- .../org/telegram/android/MessagesStorage.java | 18 +- .../telegram/android/NotificationCenter.java | 1 + .../telegram/android/SendMessagesHelper.java | 9 +- .../Adapters/BaseContactsSearchAdapter.java | 61 ++++ .../ui/Adapters/BaseFragmentAdapter.java | 1 + .../ui/Adapters/ContactsActivityAdapter.java | 13 +- .../ContactsActivitySearchAdapter.java | 61 +--- .../org/telegram/ui/Cells/ChatActionCell.java | 2 +- .../org/telegram/ui/Cells/ChatAudioCell.java | 2 +- .../org/telegram/ui/Cells/ChatBaseCell.java | 2 +- .../telegram/ui/Cells/ChatContactCell.java | 4 +- .../org/telegram/ui/Cells/ChatMediaCell.java | 12 +- .../org/telegram/ui/Cells/ChatOrUserCell.java | 26 +- .../org/telegram/ui/Cells/DialogCell.java | 21 +- .../java/org/telegram/ui/ChatActivity.java | 79 +++-- .../org/telegram/ui/ChatProfileActivity.java | 11 +- .../ui/ChatProfileChangeNameActivity.java | 58 +++- .../telegram/ui/CountrySelectActivity.java | 7 +- .../org/telegram/ui/GroupCreateActivity.java | 9 +- .../telegram/ui/GroupCreateFinalActivity.java | 7 +- .../org/telegram/ui/MessagesActivity.java | 312 ++++++++++-------- .../java/org/telegram/ui/PhotoViewer.java | 6 +- .../org/telegram/ui/SecretPhotoViewer.java | 2 +- .../org/telegram/ui/SettingsActivity.java | 19 +- .../ui/SettingsBlockedUsersActivity.java | 2 +- .../ui/SettingsChangeNameActivity.java | 67 +++- .../ui/SettingsChangeUsernameActivity.java | 210 +++++++++++- .../ui/SettingsNotificationsActivity.java | 17 +- .../org/telegram/ui/UserProfileActivity.java | 13 +- .../telegram/ui/Views/BackupImageView.java | 2 +- .../ui/Views/SettingsSectionLayout.java | 82 +++++ ..._light.9.png => textfield_activated.9.png} | Bin ...lo_light.9.png => textfield_default.9.png} | Bin ...o_light.9.png => textfield_disabled.9.png} | Bin ..._light.9.png => textfield_disabled2.9.png} | Bin ...lo_light.9.png => textfield_focused.9.png} | Bin ..._light.9.png => textfield_activated.9.png} | Bin ...lo_light.9.png => textfield_default.9.png} | Bin ...o_light.9.png => textfield_disabled.9.png} | Bin ..._light.9.png => textfield_disabled2.9.png} | Bin ...lo_light.9.png => textfield_focused.9.png} | Bin ..._light.9.png => textfield_activated.9.png} | Bin ...lo_light.9.png => textfield_default.9.png} | Bin ...o_light.9.png => textfield_disabled.9.png} | Bin ..._light.9.png => textfield_disabled2.9.png} | Bin ...lo_light.9.png => textfield_focused.9.png} | Bin ...holo_edit_text_light.xml => edit_text.xml} | 14 +- .../chat_profile_change_name_layout.xml | 37 --- .../src/main/res/layout-ar/messages_list.xml | 4 +- .../res/layout-ar/notification_layout.xml | 65 ---- .../layout-ar/settings_change_name_layout.xml | 59 ---- .../res/layout-ar/settings_section_layout.xml | 25 -- .../chat_profile_change_name_layout.xml | 38 --- .../src/main/res/layout/messages_list.xml | 5 +- .../main/res/layout/notification_layout.xml | 62 ---- .../layout/settings_change_name_layout.xml | 57 ---- .../res/layout/settings_section_layout.xml | 27 -- .../src/main/res/values-ar/strings.xml | 102 +++--- .../src/main/res/values-de/strings.xml | 86 ++--- .../src/main/res/values-es/strings.xml | 108 +++--- .../src/main/res/values-it/strings.xml | 86 ++--- .../src/main/res/values-ko/strings.xml | 9 +- .../src/main/res/values-nl/strings.xml | 82 ++--- .../src/main/res/values-pt-rBR/strings.xml | 92 +++--- .../src/main/res/values-pt-rPT/strings.xml | 92 +++--- .../src/main/res/values-v21/styles.xml | 2 +- TMessagesProj/src/main/res/values/strings.xml | 10 +- TMessagesProj/src/main/res/values/styles.xml | 2 +- 74 files changed, 1322 insertions(+), 1090 deletions(-) create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseContactsSearchAdapter.java create mode 100644 TMessagesProj/src/main/java/org/telegram/ui/Views/SettingsSectionLayout.java rename TMessagesProj/src/main/res/drawable-hdpi/{holo_textfield_activated_holo_light.9.png => textfield_activated.9.png} (100%) rename TMessagesProj/src/main/res/drawable-hdpi/{holo_textfield_default_holo_light.9.png => textfield_default.9.png} (100%) rename TMessagesProj/src/main/res/drawable-hdpi/{holo_textfield_disabled_focused_holo_light.9.png => textfield_disabled.9.png} (100%) rename TMessagesProj/src/main/res/drawable-hdpi/{holo_textfield_disabled_holo_light.9.png => textfield_disabled2.9.png} (100%) rename TMessagesProj/src/main/res/drawable-hdpi/{holo_textfield_focused_holo_light.9.png => textfield_focused.9.png} (100%) rename TMessagesProj/src/main/res/drawable-mdpi/{holo_textfield_activated_holo_light.9.png => textfield_activated.9.png} (100%) rename TMessagesProj/src/main/res/drawable-mdpi/{holo_textfield_default_holo_light.9.png => textfield_default.9.png} (100%) rename TMessagesProj/src/main/res/drawable-mdpi/{holo_textfield_disabled_focused_holo_light.9.png => textfield_disabled.9.png} (100%) rename TMessagesProj/src/main/res/drawable-mdpi/{holo_textfield_disabled_holo_light.9.png => textfield_disabled2.9.png} (100%) rename TMessagesProj/src/main/res/drawable-mdpi/{holo_textfield_focused_holo_light.9.png => textfield_focused.9.png} (100%) rename TMessagesProj/src/main/res/drawable-xhdpi/{holo_textfield_activated_holo_light.9.png => textfield_activated.9.png} (100%) rename TMessagesProj/src/main/res/drawable-xhdpi/{holo_textfield_default_holo_light.9.png => textfield_default.9.png} (100%) rename TMessagesProj/src/main/res/drawable-xhdpi/{holo_textfield_disabled_focused_holo_light.9.png => textfield_disabled.9.png} (100%) rename TMessagesProj/src/main/res/drawable-xhdpi/{holo_textfield_disabled_holo_light.9.png => textfield_disabled2.9.png} (100%) rename TMessagesProj/src/main/res/drawable-xhdpi/{holo_textfield_focused_holo_light.9.png => textfield_focused.9.png} (100%) rename TMessagesProj/src/main/res/drawable/{holo_edit_text_light.xml => edit_text.xml} (51%) delete mode 100644 TMessagesProj/src/main/res/layout-ar/chat_profile_change_name_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout-ar/notification_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout-ar/settings_change_name_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout-ar/settings_section_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout/chat_profile_change_name_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout/notification_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout/settings_change_name_layout.xml delete mode 100644 TMessagesProj/src/main/res/layout/settings_section_layout.xml diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index 64fb45a6..eeca3f9b 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -80,7 +80,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 361 + versionCode 362 versionName "1.9.5" } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java index 21c5bc62..b4f28c26 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/android/AndroidUtilities.java @@ -23,6 +23,8 @@ import android.view.Surface; import android.view.View; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; +import android.widget.TextView; import org.telegram.messenger.FileLog; import org.telegram.messenger.R; @@ -32,6 +34,7 @@ import org.telegram.ui.ApplicationLoader; import org.telegram.ui.Views.NumberPicker; import java.io.File; +import java.lang.reflect.Field; import java.util.Hashtable; import java.util.Locale; @@ -416,7 +419,7 @@ public class AndroidUtilities { } } - public static AlertDialog.Builder buildTTLAlert(Context context, final TLRPC.EncryptedChat encryptedChat) { + public static AlertDialog.Builder buildTTLAlert(final Context context, final TLRPC.EncryptedChat encryptedChat) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(LocaleController.getString("MessageLifetime", R.string.MessageLifetime)); final NumberPicker numberPicker = new NumberPicker(context); @@ -483,4 +486,17 @@ public class AndroidUtilities { }); return builder; } + + public static void clearCursorDrawable(EditText editText) { + if (editText == null || Build.VERSION.SDK_INT < 12) { + return; + } + try { + Field mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes"); + mCursorDrawableRes.setAccessible(true); + mCursorDrawableRes.setInt(editText, 0); + } catch (Exception e) { + FileLog.e("tmessages", e); + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java b/TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java index 26b13aa7..415bbc5e 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java +++ b/TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java @@ -9,8 +9,13 @@ package org.telegram.android; import android.graphics.Bitmap; +import android.graphics.BitmapShader; import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Paint; import android.graphics.Rect; +import android.graphics.RectF; +import android.graphics.Shader; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.view.View; @@ -36,6 +41,12 @@ public class ImageReceiver { private boolean isAspectFit = false; private boolean lastCacheOnly = false; private boolean forcePreview = false; + private int roundRadius = 0; + private BitmapShader bitmapShader = null; + private Paint roundPaint = null; + private RectF roundRect = null; + private RectF bitmapRect = null; + private Matrix shaderMatrix = null; public ImageReceiver() { @@ -66,6 +77,7 @@ public class ImageReceiver { last_httpUrl = null; last_filter = null; lastCacheOnly = false; + bitmapShader = null; last_placeholder = placeholder; last_size = 0; currentImage = null; @@ -105,6 +117,7 @@ public class ImageReceiver { last_placeholder = placeholder; last_size = size; lastCacheOnly = cacheOnly; + bitmapShader = null; if (img == null) { isPlaceholder = true; ImageLoader.getInstance().loadImage(fileLocation, httpUrl, this, size, cacheOnly); @@ -123,6 +136,11 @@ public class ImageReceiver { isPlaceholder = false; ImageLoader.getInstance().incrementUseCount(currentPath); currentImage = bitmap; + if (roundRadius != 0) { + bitmapShader = new BitmapShader(bitmap.getBitmap(), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); + roundPaint.setShader(bitmapShader); + bitmapRect.set(0, 0, bitmap.getIntrinsicWidth(), bitmap.getIntrinsicHeight()); + } if (parentView != null) { parentView.invalidate(); } @@ -142,6 +160,7 @@ public class ImageReceiver { last_httpUrl = null; last_filter = null; currentImage = null; + bitmapShader = null; last_size = 0; lastCacheOnly = false; if (parentView != null) { @@ -159,6 +178,7 @@ public class ImageReceiver { last_path = null; last_httpUrl = null; last_filter = null; + bitmapShader = null; last_size = 0; lastCacheOnly = false; if (parentView != null) { @@ -196,83 +216,92 @@ public class ImageReceiver { } } - public boolean draw(Canvas canvas, int x, int y, int w, int h) { + public boolean draw(Canvas canvas) { try { Drawable bitmapDrawable = currentImage; if (forcePreview || bitmapDrawable == null && last_placeholder != null && last_placeholder instanceof BitmapDrawable) { bitmapDrawable = last_placeholder; } if (bitmapDrawable != null) { - int bitmapW = bitmapDrawable.getIntrinsicWidth(); - int bitmapH = bitmapDrawable.getIntrinsicHeight(); - float scaleW = bitmapW / (float)w; - float scaleH = bitmapH / (float)h; - - if (isAspectFit) { - float scale = Math.max(scaleW, scaleH); - canvas.save(); - bitmapW /= scale; - bitmapH /= scale; - drawRegion.set(x + (w - bitmapW) / 2, y + (h - bitmapH) / 2, x + (w + bitmapW) / 2, y + (h + bitmapH) / 2); - bitmapDrawable.setBounds(drawRegion); - try { - bitmapDrawable.draw(canvas); - } catch (Exception e) { - if (currentPath != null) { - ImageLoader.getInstance().removeImage(currentPath); - currentPath = null; - } - setImage(last_path, last_httpUrl, last_filter, last_placeholder, last_size, lastCacheOnly); - FileLog.e("tmessages", e); - } - canvas.restore(); + if (bitmapShader != null) { + drawRegion.set(imageX, imageY, imageX + imageW, imageY + imageH); + roundRect.set(imageX, imageY, imageX + imageW, imageY + imageH); + shaderMatrix.reset(); + shaderMatrix.setScale(1.5f, 1.5f); + bitmapShader.setLocalMatrix(shaderMatrix); + canvas.drawRoundRect(roundRect, roundRadius, roundRadius, roundPaint); } else { - if (Math.abs(scaleW - scaleH) > 0.00001f) { + int bitmapW = bitmapDrawable.getIntrinsicWidth(); + int bitmapH = bitmapDrawable.getIntrinsicHeight(); + float scaleW = bitmapW / (float) imageW; + float scaleH = bitmapH / (float) imageH; + + if (isAspectFit) { + float scale = Math.max(scaleW, scaleH); canvas.save(); - canvas.clipRect(x, y, x + w, y + h); - - if (bitmapW / scaleH > w) { - bitmapW /= scaleH; - drawRegion.set(x - (bitmapW - w) / 2, y, x + (bitmapW + w) / 2, y + h); - } else { - bitmapH /= scaleW; - drawRegion.set(x, y - (bitmapH - h) / 2, x + w, y + (bitmapH + h) / 2); - } + bitmapW /= scale; + bitmapH /= scale; + drawRegion.set(imageX + (imageW - bitmapW) / 2, imageY + (imageH - bitmapH) / 2, imageX + (imageW + bitmapW) / 2, imageY + (imageH + bitmapH) / 2); bitmapDrawable.setBounds(drawRegion); - if (isVisible) { - try { - bitmapDrawable.draw(canvas); - } catch (Exception e) { - if (currentPath != null) { - ImageLoader.getInstance().removeImage(currentPath); - currentPath = null; - } - setImage(last_path, last_httpUrl, last_filter, last_placeholder, last_size, lastCacheOnly); - FileLog.e("tmessages", e); + try { + bitmapDrawable.draw(canvas); + } catch (Exception e) { + if (currentPath != null) { + ImageLoader.getInstance().removeImage(currentPath); + currentPath = null; } + setImage(last_path, last_httpUrl, last_filter, last_placeholder, last_size, lastCacheOnly); + FileLog.e("tmessages", e); } - canvas.restore(); } else { - drawRegion.set(x, y, x + w, y + h); - bitmapDrawable.setBounds(drawRegion); - if (isVisible) { - try { - bitmapDrawable.draw(canvas); - } catch (Exception e) { - if (currentPath != null) { - ImageLoader.getInstance().removeImage(currentPath); - currentPath = null; + if (Math.abs(scaleW - scaleH) > 0.00001f) { + canvas.save(); + canvas.clipRect(imageX, imageY, imageX + imageW, imageY + imageH); + + if (bitmapW / scaleH > imageW) { + bitmapW /= scaleH; + drawRegion.set(imageX - (bitmapW - imageW) / 2, imageY, imageX + (bitmapW + imageW) / 2, imageY + imageH); + } else { + bitmapH /= scaleW; + drawRegion.set(imageX, imageY - (bitmapH - imageH) / 2, imageX + imageW, imageY + (bitmapH + imageH) / 2); + } + bitmapDrawable.setBounds(drawRegion); + if (isVisible) { + try { + bitmapDrawable.draw(canvas); + } catch (Exception e) { + if (currentPath != null) { + ImageLoader.getInstance().removeImage(currentPath); + currentPath = null; + } + setImage(last_path, last_httpUrl, last_filter, last_placeholder, last_size, lastCacheOnly); + FileLog.e("tmessages", e); + } + } + + canvas.restore(); + } else { + drawRegion.set(imageX, imageY, imageX + imageW, imageY + imageH); + bitmapDrawable.setBounds(drawRegion); + if (isVisible) { + try { + bitmapDrawable.draw(canvas); + } catch (Exception e) { + if (currentPath != null) { + ImageLoader.getInstance().removeImage(currentPath); + currentPath = null; + } + setImage(last_path, last_httpUrl, last_filter, last_placeholder, last_size, lastCacheOnly); + FileLog.e("tmessages", e); } - setImage(last_path, last_httpUrl, last_filter, last_placeholder, last_size, lastCacheOnly); - FileLog.e("tmessages", e); } } } } return true; } else if (last_placeholder != null) { - drawRegion.set(x, y, x + w, y + h); + drawRegion.set(imageX, imageY, imageX + imageW, imageY + imageH); last_placeholder.setBounds(drawRegion); if (isVisible) { try { @@ -379,4 +408,19 @@ public class ImageReceiver { public void setForcePreview(boolean value) { forcePreview = value; } + + public void setRoundRadius(int value) { + roundRadius = value; + if (roundRadius != 0) { + roundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + roundRect = new RectF(); + shaderMatrix = new Matrix(); + bitmapRect = new RectF(); + } else { + roundPaint = null; + roundRect = null; + shaderMatrix = null; + bitmapRect = null; + } + } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/MediaController.java b/TMessagesProj/src/main/java/org/telegram/android/MediaController.java index acebe8a2..1464050f 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MediaController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MediaController.java @@ -38,7 +38,6 @@ import android.os.Environment; import android.os.ParcelFileDescriptor; import android.os.Vibrator; import android.provider.MediaStore; -import android.util.DisplayMetrics; import android.view.Display; import android.view.View; import android.view.WindowManager; @@ -400,6 +399,8 @@ public class MediaController implements NotificationCenter.NotificationCenterDel NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileDidLoaded); NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileLoadProgressChanged); NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileUploadProgressChanged); + NotificationCenter.getInstance().addObserver(this, NotificationCenter.messagesDeleted); + NotificationCenter.getInstance().addObserver(this, NotificationCenter.removeAllMessagesFromDialog); BroadcastReceiver networkStateReceiver = new BroadcastReceiver() { @Override @@ -900,6 +901,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel deleteLaterArray.clear(); } + @SuppressWarnings("unchecked") @Override public void didReceivedNotification(int id, Object... args) { if (id == NotificationCenter.FileDidFailedLoad) { @@ -963,6 +965,18 @@ public class MediaController implements NotificationCenter.NotificationCenterDel } listenerInProgress = false; processLaterArrays(); + } else if (id == NotificationCenter.messagesDeleted) { + if (playingMessageObject != null) { + ArrayList markAsDeletedMessages = (ArrayList)args[0]; + if (markAsDeletedMessages.contains(playingMessageObject.messageOwner.id)) { + clenupPlayer(false); + } + } + } else if (id == NotificationCenter.removeAllMessagesFromDialog) { + long did = (Long)args[0]; + if (playingMessageObject != null && playingMessageObject.getDialogId() == did) { + clenupPlayer(false); + } } } @@ -1182,6 +1196,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel } return true; } + NotificationCenter.getInstance().postNotificationName(NotificationCenter.audioDidStarted, messageObject); clenupPlayer(true); final File cacheFile = FileLoader.getPathToMessage(messageObject.messageOwner); diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/android/MessageObject.java index 54fd6579..dea61ff8 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessageObject.java @@ -607,10 +607,17 @@ public class MessageObject { messageOwner.flags &=~ TLRPC.MESSAGE_FLAG_UNREAD; } - public boolean isSecretMedia() { + public boolean isSecretPhoto() { return messageOwner instanceof TLRPC.TL_message_secret && messageOwner.media instanceof TLRPC.TL_messageMediaPhoto && messageOwner.ttl != 0 && messageOwner.ttl <= 60; } + public boolean isSecretMedia() { + return messageOwner instanceof TLRPC.TL_message_secret && + (messageOwner.media instanceof TLRPC.TL_messageMediaPhoto && messageOwner.ttl != 0 && messageOwner.ttl <= 60 || + messageOwner.media instanceof TLRPC.TL_messageMediaAudio || + messageOwner.media instanceof TLRPC.TL_messageMediaVideo); + } + public static void setIsUnread(TLRPC.Message message, boolean unread) { if (unread) { message.flags |= TLRPC.MESSAGE_FLAG_UNREAD; diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java index 722277b2..ea725695 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java @@ -3687,6 +3687,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter newMessage.media.video.key = decryptedMessage.media.key; newMessage.media.video.iv = decryptedMessage.media.iv; newMessage.media.video.mime_type = decryptedMessage.media.mime_type; + if (newMessage.ttl != 0) { + newMessage.ttl = Math.max(newMessage.media.video.duration + 1, newMessage.ttl); + } if (newMessage.media.video.mime_type == null) { newMessage.media.video.mime_type = "video/mp4"; } @@ -3733,6 +3736,9 @@ public class MessagesController implements NotificationCenter.NotificationCenter newMessage.media.audio.dc_id = message.file.dc_id; newMessage.media.audio.duration = decryptedMessage.media.duration; newMessage.media.audio.mime_type = decryptedMessage.media.mime_type; + if (newMessage.ttl != 0) { + newMessage.ttl = Math.max(newMessage.media.audio.duration + 1, newMessage.ttl); + } if (newMessage.media.audio.mime_type == null) { newMessage.media.audio.mime_type = "audio/ogg"; } @@ -3801,7 +3807,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter return null; } else if (serviceMessage.action instanceof TLRPC.TL_decryptedMessageActionReadMessages) { if (!serviceMessage.action.random_ids.isEmpty()) { - MessagesStorage.getInstance().createTaskForSecretChat(chat.id, ConnectionsManager.getInstance().getCurrentTime(), message.date, 1, serviceMessage.action.random_ids); + MessagesStorage.getInstance().createTaskForSecretChat(chat.id, ConnectionsManager.getInstance().getCurrentTime(), ConnectionsManager.getInstance().getCurrentTime(), 1, serviceMessage.action.random_ids); } } else if (serviceMessage.action instanceof TLRPC.TL_decryptedMessageActionNotifyLayer) { AndroidUtilities.RunOnUIThread(new Runnable() { diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java index 9260ba4a..31e58ea8 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java @@ -2511,8 +2511,20 @@ public class MessagesStorage { }); } - private int getMessageMediaType(TLRPC.Message message) { + private boolean canAddMessageToMedia(TLRPC.Message message) { if (message instanceof TLRPC.TL_message_secret && message.media instanceof TLRPC.TL_messageMediaPhoto && message.ttl != 0 && message.ttl <= 60) { + return false; + } else if (message.media instanceof TLRPC.TL_messageMediaPhoto || message.media instanceof TLRPC.TL_messageMediaVideo) { + return true; + } + return false; + } + + private int getMessageMediaType(TLRPC.Message message) { + if (message instanceof TLRPC.TL_message_secret && ( + message.media instanceof TLRPC.TL_messageMediaPhoto && message.ttl != 0 && message.ttl <= 60 || + message.media instanceof TLRPC.TL_messageMediaAudio || + message.media instanceof TLRPC.TL_messageMediaVideo)) { return 1; } else if (message.media instanceof TLRPC.TL_messageMediaPhoto || message.media instanceof TLRPC.TL_messageMediaVideo) { return 0; @@ -2555,7 +2567,7 @@ public class MessagesStorage { messagesIdsMap.put(message.id, dialog_id); } - if (getMessageMediaType(message) == 0) { + if (canAddMessageToMedia(message)) { if (messageMediaIds.length() > 0) { messageMediaIds.append(","); } @@ -2639,7 +2651,7 @@ public class MessagesStorage { state3.step(); } - if (getMessageMediaType(message) == 0) { + if (canAddMessageToMedia(message)) { state2.requery(); state2.bindInteger(1, messageId); state2.bindLong(2, dialog_id); diff --git a/TMessagesProj/src/main/java/org/telegram/android/NotificationCenter.java b/TMessagesProj/src/main/java/org/telegram/android/NotificationCenter.java index 2a53670a..1b989616 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/NotificationCenter.java +++ b/TMessagesProj/src/main/java/org/telegram/android/NotificationCenter.java @@ -68,6 +68,7 @@ public class NotificationCenter { public final static int screenshotTook = 50007; public final static int albumsDidLoaded = 50008; public final static int audioDidSent = 50009; + public final static int audioDidStarted = 50010; final private HashMap> observers = new HashMap>(); diff --git a/TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java b/TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java index a87c5869..bf7f6a07 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java +++ b/TMessagesProj/src/main/java/org/telegram/android/SendMessagesHelper.java @@ -597,6 +597,11 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter newMsg.to_id.user_id = encryptedChat.participant_id; } newMsg.ttl = encryptedChat.ttl; + if (newMsg.media instanceof TLRPC.TL_messageMediaAudio) { + newMsg.ttl = Math.max(encryptedChat.ttl, newMsg.media.audio.duration + 1); + } else if (newMsg.media instanceof TLRPC.TL_messageMediaVideo) { + newMsg.ttl = Math.max(encryptedChat.ttl, newMsg.media.video.duration + 1); + } } MessageObject newMsgObj = new MessageObject(newMsg, null, 2); @@ -630,7 +635,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter TLRPC.TL_decryptedMessage reqSend; if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { reqSend = new TLRPC.TL_decryptedMessage(); - reqSend.ttl = encryptedChat.ttl; + reqSend.ttl = newMsg.ttl; } else { reqSend = new TLRPC.TL_decryptedMessage_old(); reqSend.random_bytes = new byte[Math.max(1, (int) Math.ceil(Utilities.random.nextDouble() * 16))]; @@ -788,7 +793,7 @@ public class SendMessagesHelper implements NotificationCenter.NotificationCenter TLRPC.TL_decryptedMessage reqSend; if (AndroidUtilities.getPeerLayerVersion(encryptedChat.layer) >= 17) { reqSend = new TLRPC.TL_decryptedMessage(); - reqSend.ttl = encryptedChat.ttl; + reqSend.ttl = newMsg.ttl; } else { reqSend = new TLRPC.TL_decryptedMessage_old(); reqSend.random_bytes = new byte[Math.max(1, (int) Math.ceil(Utilities.random.nextDouble() * 16))]; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseContactsSearchAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseContactsSearchAdapter.java new file mode 100644 index 00000000..bc0b4f9e --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseContactsSearchAdapter.java @@ -0,0 +1,61 @@ +/* + * This is the source code of Telegram for Android v. 1.7.x. + * It is licensed under GNU GPL v. 2 or later. + * You should have received a copy of the license in this archive (see LICENSE). + * + * Copyright Nikolai Kudashov, 2013-2014. + */ + +package org.telegram.ui.Adapters; + +import org.telegram.android.AndroidUtilities; +import org.telegram.messenger.ConnectionsManager; +import org.telegram.messenger.RPCRequest; +import org.telegram.messenger.TLObject; +import org.telegram.messenger.TLRPC; + +import java.util.ArrayList; + +public class BaseContactsSearchAdapter extends BaseFragmentAdapter { + + protected ArrayList globalSearch; + private long reqId = 0; + private int lastReqId; + protected String lastFoundUsername = null; + + public void queryServerSearch(final String query) { + if (query == null || query.length() < 5) { + if (reqId != 0) { + ConnectionsManager.getInstance().cancelRpc(reqId, true); + reqId = 0; + } + globalSearch = null; + lastReqId = 0; + notifyDataSetChanged(); + return; + } + TLRPC.TL_contacts_search req = new TLRPC.TL_contacts_search(); + req.q = query; + req.limit = 50; + final int currentReqId = ++lastReqId; + reqId = ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { + @Override + public void run(final TLObject response, final TLRPC.TL_error error) { + AndroidUtilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + if (currentReqId == lastReqId) { + if (error == null) { + TLRPC.TL_contacts_found res = (TLRPC.TL_contacts_found) response; + globalSearch = res.users; + lastFoundUsername = query; + notifyDataSetChanged(); + } + } + reqId = 0; + } + }); + } + }, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors); + } +} diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseFragmentAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseFragmentAdapter.java index e148cf9c..184e06a1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseFragmentAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/BaseFragmentAdapter.java @@ -14,6 +14,7 @@ import android.view.ViewGroup; import android.widget.BaseAdapter; public class BaseFragmentAdapter extends BaseAdapter { + public void onFragmentCreate() { } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java index 78cb606e..1bc0b293 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivityAdapter.java @@ -21,6 +21,7 @@ import org.telegram.android.MessagesController; import org.telegram.messenger.R; import org.telegram.ui.Cells.ChatOrUserCell; import org.telegram.ui.Views.SectionedBaseAdapter; +import org.telegram.ui.Views.SettingsSectionLayout; import java.util.ArrayList; import java.util.HashMap; @@ -202,12 +203,10 @@ public class ContactsActivityAdapter extends SectionedBaseAdapter { if (usersAsSections) { if (section < ContactsController.getInstance().sortedUsersSectionsArray.size()) { if (convertView == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - convertView = li.inflate(R.layout.settings_section_layout, parent, false); + convertView = new SettingsSectionLayout(mContext); convertView.setBackgroundColor(0xffffffff); } - TextView textView = (TextView)convertView.findViewById(R.id.settings_section_text); - textView.setText(ContactsController.getInstance().sortedUsersSectionsArray.get(section)); + ((SettingsSectionLayout) convertView).setText(ContactsController.getInstance().sortedUsersSectionsArray.get(section)); return convertView; } } else { @@ -221,12 +220,10 @@ public class ContactsActivityAdapter extends SectionedBaseAdapter { } if (convertView == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - convertView = li.inflate(R.layout.settings_section_layout, parent, false); + convertView = new SettingsSectionLayout(mContext); convertView.setBackgroundColor(0xffffffff); } - TextView textView = (TextView)convertView.findViewById(R.id.settings_section_text); - textView.setText(ContactsController.getInstance().sortedContactsSectionsArray.get(section - 1)); + ((SettingsSectionLayout) convertView).setText(ContactsController.getInstance().sortedContactsSectionsArray.get(section - 1)); return convertView; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java index ec2e602b..b1a1f02a 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Adapters/ContactsActivitySearchAdapter.java @@ -9,17 +9,13 @@ package org.telegram.ui.Adapters; import android.content.Context; -import android.view.LayoutInflater; +import android.text.Html; import android.view.View; import android.view.ViewGroup; -import android.widget.TextView; import org.telegram.android.AndroidUtilities; import org.telegram.android.LocaleController; -import org.telegram.messenger.ConnectionsManager; import org.telegram.messenger.R; -import org.telegram.messenger.RPCRequest; -import org.telegram.messenger.TLObject; import org.telegram.messenger.TLRPC; import org.telegram.android.ContactsController; import org.telegram.messenger.FileLog; @@ -27,21 +23,19 @@ import org.telegram.android.MessagesController; import org.telegram.messenger.UserConfig; import org.telegram.messenger.Utilities; import org.telegram.ui.Cells.ChatOrUserCell; +import org.telegram.ui.Views.SettingsSectionLayout; import java.util.ArrayList; import java.util.HashMap; import java.util.Timer; import java.util.TimerTask; -public class ContactsActivitySearchAdapter extends BaseFragmentAdapter { +public class ContactsActivitySearchAdapter extends BaseContactsSearchAdapter { private Context mContext; private HashMap ignoreUsers; private ArrayList searchResult; private ArrayList searchResultNames; private Timer searchTimer; - private ArrayList globalSearch; - private long reqId = 0; - private int lastReqId; public ContactsActivitySearchAdapter(Context context, HashMap arg1) { mContext = context; @@ -52,7 +46,6 @@ public class ContactsActivitySearchAdapter extends BaseFragmentAdapter { if (query == null) { searchResult = null; searchResultNames = null; - globalSearch = null; queryServerSearch(null); notifyDataSetChanged(); } else { @@ -79,41 +72,6 @@ public class ContactsActivitySearchAdapter extends BaseFragmentAdapter { } } - private void queryServerSearch(String query) { - if (query == null || query.length() < 5) { - if (reqId != 0) { - ConnectionsManager.getInstance().cancelRpc(reqId, true); - reqId = 0; - } - globalSearch = null; - lastReqId = 0; - notifyDataSetChanged(); - return; - } - TLRPC.TL_contacts_search req = new TLRPC.TL_contacts_search(); - req.q = query; - req.limit = 50; - final int currentReqId = ++lastReqId; - reqId = ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { - @Override - public void run(final TLObject response, final TLRPC.TL_error error) { - AndroidUtilities.RunOnUIThread(new Runnable() { - @Override - public void run() { - if (currentReqId == lastReqId) { - if (error == null) { - TLRPC.TL_contacts_found res = (TLRPC.TL_contacts_found) response; - globalSearch = res.users; - notifyDataSetChanged(); - } - } - reqId = 0; - } - }); - } - }, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors); - } - private void processSearch(final String query) { AndroidUtilities.RunOnUIThread(new Runnable() { @Override @@ -220,10 +178,8 @@ public class ContactsActivitySearchAdapter extends BaseFragmentAdapter { public View getView(int i, View view, ViewGroup viewGroup) { if (i == (searchResult == null ? 0 : searchResult.size())) { if (view == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = li.inflate(R.layout.settings_section_layout, viewGroup, false); - TextView textView = (TextView)view.findViewById(R.id.settings_section_text); - textView.setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch)); + view = new SettingsSectionLayout(mContext); + ((SettingsSectionLayout) view).setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch)); } } else { if (view == null) { @@ -234,7 +190,12 @@ public class ContactsActivitySearchAdapter extends BaseFragmentAdapter { ((ChatOrUserCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1); TLRPC.User user = getItem(i); if (user != null) { - ((ChatOrUserCell) view).setData(user, null, null, i < searchResult.size() ? searchResultNames.get(i) : null, i > searchResult.size() ? "@" + user.username : null); + CharSequence username = null; + if (i > searchResult.size() && user.username != null) { + username = Html.fromHtml(String.format("@%s%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length()))); + } + + ((ChatOrUserCell) view).setData(user, null, null, i < searchResult.size() ? searchResultNames.get(i) : null, username); if (ignoreUsers != null) { if (ignoreUsers.containsKey(user.id)) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java index 7b4cae56..02849344 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatActionCell.java @@ -275,7 +275,7 @@ public class ChatActionCell extends BaseCell { backgroundDrawable.draw(canvas); if (currentMessageObject.type == 11) { - imageReceiver.draw(canvas, imageReceiver.getImageX(), imageReceiver.getImageY(), imageReceiver.getImageWidth(), imageReceiver.getImageHeight()); + imageReceiver.draw(canvas); } if (textLayout != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java index 34e8e74a..4569a709 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java @@ -393,7 +393,7 @@ public class ChatAudioCell extends ChatBaseCell implements SeekBar.SeekBarDelega } if (needAvatarImage) { - avatarImage.draw(canvas, avatarImage.getImageX(), avatarImage.getImageY(), avatarImage.getImageHeight(), avatarImage.getImageHeight()); + avatarImage.draw(canvas); } canvas.save(); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java index ebc90b2c..b3ad22bf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java @@ -430,7 +430,7 @@ public class ChatBaseCell extends BaseCell { } if (isAvatarVisible) { - avatarImage.draw(canvas, AndroidUtilities.dp(6), layoutHeight - AndroidUtilities.dp(45), AndroidUtilities.dp(42), AndroidUtilities.dp(42)); + avatarImage.draw(canvas); } Drawable currentBackgroundDrawable = null; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatContactCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatContactCell.java index 1621d812..4803d411 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatContactCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatContactCell.java @@ -207,7 +207,7 @@ public class ChatContactCell extends ChatBaseCell { } phone = PhoneFormat.getInstance().format(phone); } else { - phone = LocaleController.getString("Unknown", R.string.Unknown); + phone = LocaleController.getString("NumberUnknown", R.string.NumberUnknown); } int phoneWidth = Math.min((int) Math.ceil(phonePaint.measureText(phone)), maxWidth); stringFinal = TextUtils.ellipsize(phone.replace("\n", " "), phonePaint, phoneWidth, TextUtils.TruncateAt.END); @@ -260,7 +260,7 @@ public class ChatContactCell extends ChatBaseCell { return; } - avatarImage.draw(canvas, avatarImage.getImageX(), avatarImage.getImageY(), avatarImage.getImageWidth(), avatarImage.getImageWidth()); + avatarImage.draw(canvas); if (nameLayout != null) { canvas.save(); 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 8952b629..bd4bf6e3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java @@ -213,7 +213,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD } } } - if (imagePressed && currentMessageObject.isSecretMedia()) { + if (imagePressed && currentMessageObject.isSecretPhoto()) { imagePressed = false; } else if (result) { startCheckLongPress(); @@ -568,7 +568,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD w = timeWidthTotal; } - if (currentMessageObject.isSecretMedia()) { + if (currentMessageObject.isSecretPhoto()) { if (AndroidUtilities.isTablet()) { w = h = (int) (AndroidUtilities.getMinTabletSide() * 0.5f); } else { @@ -616,7 +616,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD photoImage.setImageBitmap(messageObject.isOut() ? placeholderOutDrawable : placeholderInDrawable); } } - photoImage.setForcePreview(messageObject.isSecretMedia()); + photoImage.setForcePreview(messageObject.isSecretPhoto()); invalidate(); } @@ -813,7 +813,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD canvas.restore(); } else { photoImage.setVisible(!PhotoViewer.getInstance().isShowingImage(currentMessageObject), false); - imageDrawn = photoImage.draw(canvas, photoImage.getImageX(), photoImage.getImageY(), photoWidth, photoHeight); + imageDrawn = photoImage.draw(canvas); drawTime = photoImage.getVisible(); } @@ -873,7 +873,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD currentButtonDrawable.draw(canvas); } - if (buttonState == -1 && currentMessageObject.isSecretMedia()) { + if (buttonState == -1 && currentMessageObject.isSecretPhoto()) { int drawable = 5; if (currentMessageObject.messageOwner.destroyTime != 0) { if (currentMessageObject.isOut()) { @@ -912,7 +912,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD infoLayout.draw(canvas); canvas.restore(); } - } else if (infoLayout != null && (buttonState == 1 || buttonState == 0 || buttonState == 3 || currentMessageObject.isSecretMedia())) { + } else if (infoLayout != null && (buttonState == 1 || buttonState == 0 || buttonState == 3 || currentMessageObject.isSecretPhoto())) { infoPaint.setColor(0xffffffff); setDrawableBounds(mediaBackgroundDrawable, photoImage.getImageX() + AndroidUtilities.dp(4), photoImage.getImageY() + AndroidUtilities.dp(4), infoWidth + AndroidUtilities.dp(8) + infoOffset, AndroidUtilities.dpf(16.5f)); mediaBackgroundDrawable.draw(canvas); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java index 4b782b91..7008878d 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java @@ -41,7 +41,7 @@ public class ChatOrUserCell extends BaseCell { private CharSequence currentName; private ImageReceiver avatarImage; - private String subLabel; + private CharSequence subLabel; private ChatOrUserCellLayout cellLayout; private TLRPC.User user = null; @@ -112,7 +112,7 @@ public class ChatOrUserCell extends BaseCell { } } - public void setData(TLRPC.User u, TLRPC.Chat c, TLRPC.EncryptedChat ec, CharSequence n, String s) { + public void setData(TLRPC.User u, TLRPC.Chat c, TLRPC.EncryptedChat ec, CharSequence n, CharSequence s) { currentName = n; user = u; chat = c; @@ -236,6 +236,15 @@ public class ChatOrUserCell extends BaseCell { return; } + if (useSeparator) { + int h = getMeasuredHeight(); + if (!usePadding) { + canvas.drawLine(0, h - 1, getMeasuredWidth(), h - 1, linePaint); + } else { + canvas.drawLine(AndroidUtilities.dp(11), h - 1, getMeasuredWidth() - AndroidUtilities.dp(11), h - 1, linePaint); + } + } + if (drawAlpha != 1) { canvas.saveLayerAlpha(0, 0, canvas.getWidth(), canvas.getHeight(), (int)(255 * drawAlpha), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG); } @@ -263,16 +272,7 @@ public class ChatOrUserCell extends BaseCell { canvas.restore(); } - avatarImage.draw(canvas, cellLayout.avatarLeft, cellLayout.avatarTop, AndroidUtilities.dp(50), AndroidUtilities.dp(50)); - - if (useSeparator) { - int h = getMeasuredHeight(); - if (!usePadding) { - canvas.drawLine(0, h - 1, getMeasuredWidth(), h, linePaint); - } else { - canvas.drawLine(AndroidUtilities.dp(11), h - 1, getMeasuredWidth() - AndroidUtilities.dp(11), h, linePaint); - } - } + avatarImage.draw(canvas); } private class ChatOrUserCellLayout { @@ -381,7 +381,7 @@ public class ChatOrUserCell extends BaseCell { onlineLeft = usePadding ? AndroidUtilities.dp(11) : 0; } - String onlineString = ""; + CharSequence onlineString = ""; TextPaint currentOnlinePaint = offlinePaint; if (subLabel != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java index 99970c90..f13332df 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/DialogCell.java @@ -10,6 +10,7 @@ package org.telegram.ui.Cells; import android.content.Context; import android.graphics.Canvas; +import android.graphics.Paint; import android.graphics.drawable.Drawable; import android.text.Html; import android.text.Layout; @@ -48,6 +49,8 @@ public class DialogCell extends BaseCell { private static Drawable groupDrawable; private static Drawable broadcastDrawable; + private static Paint linePaint; + private TLRPC.TL_dialog currentDialog; private ImageReceiver avatarImage; @@ -57,6 +60,8 @@ public class DialogCell extends BaseCell { private TLRPC.EncryptedChat encryptedChat = null; private CharSequence lastPrintString = null; + public boolean useSeparator = false; + private void init() { if (namePaint == null) { namePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); @@ -85,6 +90,11 @@ public class DialogCell extends BaseCell { messagePaint.setColor(0xff808080); } + if (linePaint == null) { + linePaint = new Paint(); + linePaint.setColor(0xffdcdcdc); + } + if (messagePrintingPaint == null) { messagePrintingPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); messagePrintingPaint.setTextSize(AndroidUtilities.dp(16)); @@ -340,7 +350,16 @@ public class DialogCell extends BaseCell { canvas.restore(); } - avatarImage.draw(canvas, cellLayout.avatarLeft, cellLayout.avatarTop, AndroidUtilities.dp(54), AndroidUtilities.dp(54)); + avatarImage.draw(canvas); + + if (useSeparator) { + int h = getMeasuredHeight(); + if (AndroidUtilities.isTablet()) { + canvas.drawLine(0, h - 1, getMeasuredWidth(), h - 1, linePaint); + } else { + canvas.drawLine(AndroidUtilities.dp(11), h - 1, getMeasuredWidth() - AndroidUtilities.dp(11), h - 1, linePaint); + } + } } private class DialogCellLayout { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index d7832c45..a22bb862 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -367,6 +367,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not NotificationCenter.getInstance().addObserver(this, NotificationCenter.blockedUsersDidLoaded); NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileNewChunkAvailable); NotificationCenter.getInstance().addObserver(this, NotificationCenter.didCreatedNewDeleteTask); + NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioDidStarted); super.onFragmentCreate(); @@ -419,6 +420,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not NotificationCenter.getInstance().removeObserver(this, NotificationCenter.blockedUsersDidLoaded); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileNewChunkAvailable); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didCreatedNewDeleteTask); + NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioDidStarted); if (AndroidUtilities.isTablet()) { NotificationCenter.getInstance().postNotificationName(NotificationCenter.openedChatChanged, dialog_id, true); } @@ -838,7 +840,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } final ChatMediaCell cell = (ChatMediaCell)view; final MessageObject messageObject = cell.getMessageObject(); - if (messageObject == null || !messageObject.isSecretMedia() || !cell.getPhotoImage().isInsideImage(x, y - top)) { + if (messageObject == null || !messageObject.isSecretPhoto() || !cell.getPhotoImage().isInsideImage(x, y - top)) { break; } File file = FileLoader.getPathToMessage(messageObject.messageOwner); @@ -858,9 +860,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not chatListView.setOnItemClickListener(null); chatListView.setLongClickable(false); openSecretPhotoRunnable = null; - if (!messageObject.isOut() && messageObject.messageOwner.destroyTime == 0) { - MessagesController.getInstance().markMessageAsRead(dialog_id, messageObject.messageOwner.random_id); - messageObject.messageOwner.destroyTime = messageObject.messageOwner.ttl + ConnectionsManager.getInstance().getCurrentTime(); + if (sendSecretMessageRead(messageObject)) { cell.invalidate(); } SecretPhotoViewer.getInstance().setParentActivity(getParentActivity()); @@ -1026,6 +1026,15 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return fragmentView; } + private boolean sendSecretMessageRead(MessageObject messageObject) { + if (messageObject == null || messageObject.isOut() || !messageObject.isSecretMedia() || messageObject.messageOwner.destroyTime != 0) { + return false; + } + MessagesController.getInstance().markMessageAsRead(dialog_id, messageObject.messageOwner.random_id); + messageObject.messageOwner.destroyTime = messageObject.messageOwner.ttl + ConnectionsManager.getInstance().getCurrentTime(); + return true; + } + private void scrollToLastMessage() { if (unread_end_reached || first_unread_id == 0) { chatListView.setSelectionFromTop(messages.size() - 1, -100000 - chatListView.getPaddingTop()); @@ -1853,6 +1862,18 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not boolean hasFromMe = false; ArrayList arr = (ArrayList)args[1]; + if (currentEncryptedChat != null && arr.size() == 1) { + MessageObject messageObject = arr.get(0); + + if (messageObject.isOut() && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionTTLChange && getParentActivity() != null && AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) < 17 && currentEncryptedChat.ttl > 0 && currentEncryptedChat.ttl <= 60) { + AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); + builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); + builder.setPositiveButton(R.string.OK, null); + builder.setMessage(LocaleController.formatString("CompatibilityChat", R.string.CompatibilityChat, currentUser.first_name, currentUser.first_name)); + showAlertDialog(builder); + } + } + if (!unread_end_reached) { int currentMaxDate = Integer.MIN_VALUE; int currentMinMsgId = Integer.MIN_VALUE; @@ -2166,24 +2187,27 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } } else if (id == NotificationCenter.removeAllMessagesFromDialog) { - messages.clear(); - messagesByDays.clear(); - messagesDict.clear(); - progressView.setVisibility(View.GONE); - chatListView.setEmptyView(emptyViewContainer); - if (currentEncryptedChat == null) { - maxMessageId = Integer.MAX_VALUE; - minMessageId = Integer.MIN_VALUE; - } else { - maxMessageId = Integer.MIN_VALUE; - minMessageId = Integer.MAX_VALUE; + long did = (Long)args[0]; + if (dialog_id == did) { + messages.clear(); + messagesByDays.clear(); + messagesDict.clear(); + progressView.setVisibility(View.GONE); + chatListView.setEmptyView(emptyViewContainer); + if (currentEncryptedChat == null) { + maxMessageId = Integer.MAX_VALUE; + minMessageId = Integer.MIN_VALUE; + } else { + maxMessageId = Integer.MIN_VALUE; + minMessageId = Integer.MAX_VALUE; + } + maxDate = Integer.MIN_VALUE; + minDate = 0; + selectedMessagesIds.clear(); + selectedMessagesCanCopyIds.clear(); + actionBarLayer.hideActionMode(); + chatAdapter.notifyDataSetChanged(); } - maxDate = Integer.MIN_VALUE; - minDate = 0; - selectedMessagesIds.clear(); - selectedMessagesCanCopyIds.clear(); - actionBarLayer.hideActionMode(); - chatAdapter.notifyDataSetChanged(); } else if (id == NotificationCenter.screenshotTook) { updateInformationForScreenshotDetector(); } else if (id == NotificationCenter.blockedUsersDidLoaded) { @@ -2221,6 +2245,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (changed) { updateVisibleRows(); } + } else if (id == NotificationCenter.audioDidStarted) { + MessageObject messageObject = (MessageObject)args[0]; + sendSecretMessageRead(messageObject); } } @@ -2431,6 +2458,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } private void updateInformationForScreenshotDetector() { + if (currentEncryptedChat == null) { + return; + } ArrayList visibleMessages = new ArrayList(); if (chatListView != null) { int count = chatListView.getChildCount(); @@ -2893,9 +2923,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("AppName", R.string.AppName)); - builder.setPositiveButton(R.string.OK, null); + builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); if (message.type == 3) { - builder.setMessage(R.string.NoPlayerInstalled); + builder.setMessage(LocaleController.getString("NoPlayerInstalled", R.string.NoPlayerInstalled)); } else { builder.setMessage(LocaleController.formatString("NoHandleAppInstalled", R.string.NoHandleAppInstalled, message.messageOwner.media.document.mime_type)); } @@ -3104,6 +3134,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not PhotoViewer.getInstance().setParentActivity(getParentActivity()); PhotoViewer.getInstance().openPhoto(message, ChatActivity.this); } else if (message.type == 3) { + sendSecretMessageRead(message); try { File f = null; if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { @@ -3201,7 +3232,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); - builder.setItems(new CharSequence[] {LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("Call", R.string.Call)}, new DialogInterface.OnClickListener() { + builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("Call", R.string.Call)}, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 1) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java index d3253ada..8c56eca9 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileActivity.java @@ -42,6 +42,7 @@ import org.telegram.ui.Views.ActionBar.ActionBarMenu; import org.telegram.ui.Views.AvatarUpdater; import org.telegram.ui.Views.BackupImageView; import org.telegram.ui.Views.ActionBar.BaseFragment; +import org.telegram.ui.Views.SettingsSectionLayout; import java.util.ArrayList; import java.util.Collections; @@ -646,21 +647,19 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen return view; } else if (type == 1) { if (view == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = li.inflate(R.layout.settings_section_layout, viewGroup, false); + view = new SettingsSectionLayout(mContext); } - TextView textView = (TextView)view.findViewById(R.id.settings_section_text); if (i == settingsSectionRow) { - textView.setText(LocaleController.getString("SETTINGS", R.string.SETTINGS)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("SETTINGS", R.string.SETTINGS)); } else if (i == sharedMediaSectionRow) { - textView.setText(LocaleController.getString("SHAREDMEDIA", R.string.SHAREDMEDIA)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("SHAREDMEDIA", R.string.SHAREDMEDIA)); } else if (i == membersSectionRow) { TLRPC.Chat chat = MessagesController.getInstance().getChat(chat_id); int count = chat.participants_count; if (info != null) { count = info.participants.size(); } - textView.setText(LocaleController.formatPluralString("Members", count).toUpperCase()); + ((SettingsSectionLayout) view).setText(LocaleController.formatPluralString("Members", count).toUpperCase()); } } else if (type == 2) { if (view == null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileChangeNameActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileChangeNameActivity.java index 6bafe568..a77ea02e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileChangeNameActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatProfileChangeNameActivity.java @@ -11,6 +11,9 @@ package org.telegram.ui; import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; +import android.text.InputType; +import android.util.TypedValue; +import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -18,6 +21,7 @@ import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.TextView; import org.telegram.android.AndroidUtilities; @@ -26,6 +30,7 @@ import org.telegram.messenger.TLRPC; import org.telegram.android.MessagesController; import org.telegram.messenger.R; import org.telegram.ui.Views.ActionBar.BaseFragment; +import org.telegram.ui.Views.SettingsSectionLayout; public class ChatProfileChangeNameActivity extends BaseFragment { private EditText firstNameField; @@ -71,16 +76,27 @@ public class ChatProfileChangeNameActivity extends BaseFragment { TextView textView = (TextView)doneButton.findViewById(R.id.done_button_text); textView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase()); - fragmentView = inflater.inflate(R.layout.chat_profile_change_name_layout, container, false); - TLRPC.Chat currentChat = MessagesController.getInstance().getChat(chat_id); - firstNameField = (EditText)fragmentView.findViewById(R.id.first_name_field); - if (chat_id > 0) { - firstNameField.setHint(LocaleController.getString("GroupName", R.string.GroupName)); - } else { - firstNameField.setHint(LocaleController.getString("EnterListName", R.string.EnterListName)); - } + fragmentView = new LinearLayout(inflater.getContext()); + fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + fragmentView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(8), AndroidUtilities.dp(16), 0); + ((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL); + + SettingsSectionLayout settingsSectionLayout = new SettingsSectionLayout(inflater.getContext()); + ((LinearLayout) fragmentView).addView(settingsSectionLayout); + + firstNameField = new EditText(inflater.getContext()); + firstNameField.setText(currentChat.title); + firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19); + firstNameField.setHintTextColor(0xffa3a3a3); + firstNameField.setTextColor(0xff000000); + firstNameField.setPadding(AndroidUtilities.dp(15), 0, AndroidUtilities.dp(15), AndroidUtilities.dp(15)); + firstNameField.setMaxLines(3); + firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); + firstNameField.setImeOptions(EditorInfo.IME_ACTION_DONE); + AndroidUtilities.clearCursorDrawable(firstNameField); firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { @@ -91,15 +107,25 @@ public class ChatProfileChangeNameActivity extends BaseFragment { return false; } }); - firstNameField.setText(currentChat.title); - firstNameField.setSelection(firstNameField.length()); - - TextView headerLabel = (TextView)fragmentView.findViewById(R.id.settings_section_text); - if (chat_id > 0) { - headerLabel.setText(LocaleController.getString("EnterGroupNameTitle", R.string.EnterGroupNameTitle)); - } else { - headerLabel.setText(LocaleController.getString("EnterListName", R.string.EnterListName).toUpperCase()); + if (LocaleController.isRTL) { + firstNameField.setGravity(Gravity.RIGHT); } + + ((LinearLayout) fragmentView).addView(firstNameField); + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams(); + layoutParams.topMargin = AndroidUtilities.dp(15); + layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT; + layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT; + firstNameField.setLayoutParams(layoutParams); + + if (chat_id > 0) { + settingsSectionLayout.setText(LocaleController.getString("EnterGroupNameTitle", R.string.EnterGroupNameTitle)); + firstNameField.setHint(LocaleController.getString("GroupName", R.string.GroupName)); + } else { + settingsSectionLayout.setText(LocaleController.getString("EnterListName", R.string.EnterListName).toUpperCase()); + firstNameField.setHint(LocaleController.getString("EnterListName", R.string.EnterListName)); + } + firstNameField.setSelection(firstNameField.length()); } else { ViewGroup parent = (ViewGroup)fragmentView.getParent(); if (parent != null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java index 332381d6..9a733f9f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/CountrySelectActivity.java @@ -31,6 +31,7 @@ import org.telegram.ui.Views.ActionBar.ActionBarMenuItem; import org.telegram.ui.Views.ActionBar.BaseFragment; import org.telegram.ui.Views.PinnedHeaderListView; import org.telegram.ui.Views.SectionedBaseAdapter; +import org.telegram.ui.Views.SettingsSectionLayout; import java.io.BufferedReader; import java.io.InputStream; @@ -484,12 +485,10 @@ public class CountrySelectActivity extends BaseFragment { @Override public View getSectionHeaderView(int section, View convertView, ViewGroup parent) { if (convertView == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - convertView = li.inflate(R.layout.settings_section_layout, parent, false); + convertView = new SettingsSectionLayout(mContext); convertView.setBackgroundColor(0xfffafafa); } - TextView textView = (TextView)convertView.findViewById(R.id.settings_section_text); - textView.setText(sortedCountries.get(section).toUpperCase()); + ((SettingsSectionLayout) convertView).setText(sortedCountries.get(section).toUpperCase()); return convertView; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java index 52395ca1..a8eccbdb 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateActivity.java @@ -51,6 +51,7 @@ import org.telegram.ui.Views.BackupImageView; import org.telegram.ui.Views.ActionBar.BaseFragment; import org.telegram.ui.Views.PinnedHeaderListView; import org.telegram.ui.Views.SectionedBaseAdapter; +import org.telegram.ui.Views.SettingsSectionLayout; import java.util.ArrayList; import java.util.HashMap; @@ -597,15 +598,13 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen @Override public View getSectionHeaderView(int section, View convertView, ViewGroup parent) { if (convertView == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - convertView = li.inflate(R.layout.settings_section_layout, parent, false); + convertView = new SettingsSectionLayout(mContext); convertView.setBackgroundColor(0xffffffff); } - TextView textView = (TextView)convertView.findViewById(R.id.settings_section_text); if (searching && searchWas) { - textView.setText(LocaleController.getString("AllContacts", R.string.AllContacts)); + ((SettingsSectionLayout) convertView).setText(LocaleController.getString("AllContacts", R.string.AllContacts)); } else { - textView.setText(ContactsController.getInstance().sortedUsersSectionsArray.get(section)); + ((SettingsSectionLayout) convertView).setText(ContactsController.getInstance().sortedUsersSectionsArray.get(section)); } return convertView; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java index ac3dfe5f..972f87c4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/GroupCreateFinalActivity.java @@ -38,6 +38,7 @@ import org.telegram.ui.Views.BackupImageView; import org.telegram.ui.Views.ActionBar.BaseFragment; import org.telegram.ui.Views.PinnedHeaderListView; import org.telegram.ui.Views.SectionedBaseAdapter; +import org.telegram.ui.Views.SettingsSectionLayout; import java.util.ArrayList; import java.util.concurrent.Semaphore; @@ -420,12 +421,10 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati @Override public View getSectionHeaderView(int section, View convertView, ViewGroup parent) { if (convertView == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - convertView = li.inflate(R.layout.settings_section_layout, parent, false); + convertView = new SettingsSectionLayout(mContext); convertView.setBackgroundColor(0xffffffff); } - TextView textView = (TextView)convertView.findViewById(R.id.settings_section_text); - textView.setText(LocaleController.formatPluralString("Members", selectedContacts.size()).toUpperCase()); + ((SettingsSectionLayout) convertView).setText(LocaleController.formatPluralString("Members", selectedContacts.size()).toUpperCase()); return convertView; } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java index 9471d2fb..c65d8152 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/MessagesActivity.java @@ -12,6 +12,7 @@ import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; +import android.text.Html; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; @@ -35,13 +36,14 @@ import org.telegram.android.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.UserConfig; import org.telegram.messenger.Utilities; -import org.telegram.ui.Adapters.BaseFragmentAdapter; +import org.telegram.ui.Adapters.BaseContactsSearchAdapter; import org.telegram.ui.Cells.ChatOrUserCell; import org.telegram.ui.Cells.DialogCell; import org.telegram.ui.Views.ActionBar.ActionBarLayer; import org.telegram.ui.Views.ActionBar.ActionBarMenu; import org.telegram.ui.Views.ActionBar.ActionBarMenuItem; import org.telegram.ui.Views.ActionBar.BaseFragment; +import org.telegram.ui.Views.SettingsSectionLayout; import java.util.ArrayList; import java.util.Timer; @@ -64,10 +66,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter private int activityToken = (int)(Utilities.random.nextDouble() * Integer.MAX_VALUE); private long selectedDialog; - private Timer searchTimer; - public ArrayList searchResult; - public ArrayList searchResultNames; - private MessagesActivityDelegate delegate; private long openedDialogId = 0; @@ -144,7 +142,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter @Override public void onSearchCollapse() { - searchDialogs(null); searching = false; searchWas = false; if (messagesListView != null) { @@ -152,14 +149,16 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter searchEmptyView.setVisibility(View.GONE); } if (messagesListViewAdapter != null) { - messagesListViewAdapter.notifyDataSetChanged(); + messagesListViewAdapter.searchDialogs(null); } } @Override public void onTextChanged(EditText editText) { String text = editText.getText().toString(); - searchDialogs(text); + if (messagesListViewAdapter != null) { + messagesListViewAdapter.searchDialogs(text); + } if (text.length() != 0) { searchWas = true; if (messagesListViewAdapter != null) { @@ -231,10 +230,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter messagesListView = (ListView)fragmentView.findViewById(R.id.messages_list_view); messagesListView.setAdapter(messagesListViewAdapter); - if (delegate == null && AndroidUtilities.isTablet()) { - messagesListView.setDivider(inflater.getContext().getResources().getDrawable(R.drawable.messages_list_divider2)); - messagesListView.setDividerHeight(1); - } progressView = fragmentView.findViewById(R.id.progressLayout); messagesListViewAdapter.notifyDataSetChanged(); @@ -277,38 +272,34 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter messagesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView adapterView, View view, int i, long l) { - long dialog_id = 0; - if (searching && searchWas) { - if (i >= searchResult.size()) { - return; - } - TLObject obj = searchResult.get(i); - if (obj instanceof TLRPC.User) { - dialog_id = ((TLRPC.User) obj).id; - } else if (obj instanceof TLRPC.Chat) { - if (((TLRPC.Chat) obj).id > 0) { - dialog_id = -((TLRPC.Chat) obj).id; - } else { - dialog_id = AndroidUtilities.makeBroadcastId(((TLRPC.Chat) obj).id); - } - } else if (obj instanceof TLRPC.EncryptedChat) { - dialog_id = ((long)((TLRPC.EncryptedChat) obj).id) << 32; - } - } else { - if (serverOnly) { - if (i >= MessagesController.getInstance().dialogsServerOnly.size()) { - return; - } - TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogsServerOnly.get(i); - dialog_id = dialog.id; - } else { - if (i >= MessagesController.getInstance().dialogs.size()) { - return; - } - TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs.get(i); - dialog_id = dialog.id; - } + if (messagesListViewAdapter == null) { + return; } + TLObject obj = messagesListViewAdapter.getItem(i); + if (obj == null) { + return; + } + long dialog_id = 0; + if (obj instanceof TLRPC.User) { + dialog_id = ((TLRPC.User) obj).id; + if (messagesListViewAdapter.isGlobalSearch(i)) { + ArrayList users = new ArrayList(); + users.add((TLRPC.User)obj); + MessagesController.getInstance().putUsers(users, false); + MessagesStorage.getInstance().putUsersAndChats(users, null, false, true); + } + } else if (obj instanceof TLRPC.Chat) { + if (((TLRPC.Chat) obj).id > 0) { + dialog_id = -((TLRPC.Chat) obj).id; + } else { + dialog_id = AndroidUtilities.makeBroadcastId(((TLRPC.Chat) obj).id); + } + } else if (obj instanceof TLRPC.EncryptedChat) { + dialog_id = ((long)((TLRPC.EncryptedChat) obj).id) << 32; + } else if (obj instanceof TLRPC.TL_dialog) { + dialog_id = ((TLRPC.TL_dialog) obj).id; + } + if (onlySelect) { didSelectResult(dialog_id, true, false); } else { @@ -497,7 +488,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter } else if (id == NotificationCenter.reloadSearchResults) { int token = (Integer)args[0]; if (token == activityToken) { - updateSearchResults((ArrayList)args[1], (ArrayList)args[2], (ArrayList)args[3]); + messagesListViewAdapter.updateSearchResults((ArrayList) args[1], (ArrayList) args[2], (ArrayList) args[3]); } } else if (id == NotificationCenter.appDidLogout) { dialogsLoaded = false; @@ -624,86 +615,113 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter } } - public void updateSearchResults(final ArrayList result, final ArrayList names, final ArrayList encUsers) { - AndroidUtilities.RunOnUIThread(new Runnable() { - @Override - public void run() { - for (TLObject obj : result) { - if (obj instanceof TLRPC.User) { - TLRPC.User user = (TLRPC.User) obj; - MessagesController.getInstance().putUser(user, true); - } else if (obj instanceof TLRPC.Chat) { - TLRPC.Chat chat = (TLRPC.Chat) obj; - MessagesController.getInstance().putChat(chat, true); - } else if (obj instanceof TLRPC.EncryptedChat) { - TLRPC.EncryptedChat chat = (TLRPC.EncryptedChat) obj; - MessagesController.getInstance().putEncryptedChat(chat, true); - } - } - for (TLRPC.User user : encUsers) { - MessagesController.getInstance().putUser(user, true); - } - searchResult = result; - searchResultNames = names; - if (searching) { - messagesListViewAdapter.notifyDataSetChanged(); - } - } - }); - } + private class MessagesAdapter extends BaseContactsSearchAdapter { - public void searchDialogs(final String query) { - if (query == null) { - searchResult = null; - searchResultNames = null; - } else { - try { - if (searchTimer != null) { - searchTimer.cancel(); - } - } catch (Exception e) { - FileLog.e("tmessages", e); - } - searchTimer = new Timer(); - searchTimer.schedule(new TimerTask() { - @Override - public void run() { - try { - searchTimer.cancel(); - searchTimer = null; - } catch (Exception e) { - FileLog.e("tmessages", e); - } - MessagesStorage.getInstance().searchDialogs(activityToken, query, !serverOnly); - } - }, 100, 300); - } - } - - private class MessagesAdapter extends BaseFragmentAdapter { private Context mContext; + private Timer searchTimer; + private ArrayList searchResult; + private ArrayList searchResultNames; public MessagesAdapter(Context context) { mContext = context; } + public void updateSearchResults(final ArrayList result, final ArrayList names, final ArrayList encUsers) { + AndroidUtilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + for (TLObject obj : result) { + if (obj instanceof TLRPC.User) { + TLRPC.User user = (TLRPC.User) obj; + MessagesController.getInstance().putUser(user, true); + } else if (obj instanceof TLRPC.Chat) { + TLRPC.Chat chat = (TLRPC.Chat) obj; + MessagesController.getInstance().putChat(chat, true); + } else if (obj instanceof TLRPC.EncryptedChat) { + TLRPC.EncryptedChat chat = (TLRPC.EncryptedChat) obj; + MessagesController.getInstance().putEncryptedChat(chat, true); + } + } + for (TLRPC.User user : encUsers) { + MessagesController.getInstance().putUser(user, true); + } + searchResult = result; + searchResultNames = names; + if (searching) { + messagesListViewAdapter.notifyDataSetChanged(); + } + } + }); + } + + public boolean isGlobalSearch(int i) { + if (searching && searchWas) { + int localCount = searchResult == null ? 0 : searchResult.size(); + int globalCount = globalSearch == null ? 0 : globalSearch.size(); + if (i >= 0 && i < localCount) { + return false; + } else if (i > localCount && i <= globalCount + localCount) { + return true; + } + } + return false; + } + + public void searchDialogs(final String query) { + if (query == null) { + searchResult = null; + searchResultNames = null; + queryServerSearch(null); + notifyDataSetChanged(); + } else { + try { + if (searchTimer != null) { + searchTimer.cancel(); + } + } catch (Exception e) { + FileLog.e("tmessages", e); + } + searchTimer = new Timer(); + searchTimer.schedule(new TimerTask() { + @Override + public void run() { + try { + searchTimer.cancel(); + searchTimer = null; + } catch (Exception e) { + FileLog.e("tmessages", e); + } + MessagesStorage.getInstance().searchDialogs(activityToken, query, !serverOnly); + AndroidUtilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + queryServerSearch(query); + } + }); + } + }, 200, 300); + } + } + @Override public boolean areAllItemsEnabled() { - return true; + return false; } @Override public boolean isEnabled(int i) { - return true; + return !(searching && searchWas) || i != (searchResult == null ? 0 : searchResult.size()); } @Override public int getCount() { if (searching && searchWas) { - if (searchResult == null) { - return 0; + int count = searchResult == null ? 0 : searchResult.size(); + int globalCount = globalSearch == null ? 0 : globalSearch.size(); + if (globalCount != 0) { + count += globalCount + 1; } - return searchResult.size(); + return count; } int count; if (serverOnly) { @@ -721,8 +739,28 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter } @Override - public Object getItem(int i) { - return null; + public TLObject getItem(int i) { + if (searching && searchWas) { + int localCount = searchResult == null ? 0 : searchResult.size(); + int globalCount = globalSearch == null ? 0 : globalSearch.size(); + if (i >= 0 && i < localCount) { + return searchResult.get(i); + } else if (i > localCount && i <= globalCount + localCount) { + return globalSearch.get(i - localCount - 1); + } + return null; + } + if (serverOnly) { + if (i < 0 || i >= MessagesController.getInstance().dialogsServerOnly.size()) { + return null; + } + return MessagesController.getInstance().dialogsServerOnly.get(i); + } else { + if (i < 0 || i >= MessagesController.getInstance().dialogs.size()) { + return null; + } + return MessagesController.getInstance().dialogs.get(i); + } } @Override @@ -732,30 +770,47 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter @Override public boolean hasStableIds() { - return false; + return true; } @Override public View getView(int i, View view, ViewGroup viewGroup) { if (searching && searchWas) { - if (view == null) { - view = new ChatOrUserCell(mContext); - } - TLRPC.User user = null; - TLRPC.Chat chat = null; - TLRPC.EncryptedChat encryptedChat = null; + if (i == (searchResult == null ? 0 : searchResult.size())) { + if (view == null) { + view = new SettingsSectionLayout(mContext); + ((SettingsSectionLayout) view).setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch)); + view.setPadding(AndroidUtilities.dp(11), 0, AndroidUtilities.dp(11), 0); + } + } else { + if (view == null) { + view = new ChatOrUserCell(mContext); + } + TLRPC.User user = null; + TLRPC.Chat chat = null; + TLRPC.EncryptedChat encryptedChat = null; - TLObject obj = searchResult.get(i); - if (obj instanceof TLRPC.User) { - user = MessagesController.getInstance().getUser(((TLRPC.User)obj).id); - } else if (obj instanceof TLRPC.Chat) { - chat = MessagesController.getInstance().getChat(((TLRPC.Chat) obj).id); - } else if (obj instanceof TLRPC.EncryptedChat) { - encryptedChat = MessagesController.getInstance().getEncryptedChat(((TLRPC.EncryptedChat) obj).id); - user = MessagesController.getInstance().getUser(encryptedChat.user_id); - } + ((ChatOrUserCell) view).useSeparator = (i != getCount() - 1 && i != searchResult.size() - 1); + TLObject obj = getItem(i); + if (obj instanceof TLRPC.User) { + user = MessagesController.getInstance().getUser(((TLRPC.User) obj).id); + if (user == null) { + user = (TLRPC.User)obj; + } + } else if (obj instanceof TLRPC.Chat) { + chat = MessagesController.getInstance().getChat(((TLRPC.Chat) obj).id); + } else if (obj instanceof TLRPC.EncryptedChat) { + encryptedChat = MessagesController.getInstance().getEncryptedChat(((TLRPC.EncryptedChat) obj).id); + user = MessagesController.getInstance().getUser(encryptedChat.user_id); + } - ((ChatOrUserCell)view).setData(user, chat, encryptedChat, searchResultNames.get(i), null); + CharSequence username = null; + if (i > searchResult.size() && user.username != null) { + username = Html.fromHtml(String.format("@%s%s", user.username.substring(0, lastFoundUsername.length()), user.username.substring(lastFoundUsername.length()))); + } + + ((ChatOrUserCell) view).setData(user, chat, encryptedChat, i < searchResult.size() ? searchResultNames.get(i) : null, username); + } return view; } @@ -771,6 +826,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter if (view == null) { view = new DialogCell(mContext); } + ((DialogCell) view).useSeparator = (i != getCount() - 1); if (serverOnly) { ((DialogCell)view).setDialog(MessagesController.getInstance().dialogsServerOnly.get(i)); } else { @@ -791,12 +847,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter @Override public int getItemViewType(int i) { if (searching && searchWas) { - TLObject obj = searchResult.get(i); - if (obj instanceof TLRPC.User || obj instanceof TLRPC.EncryptedChat) { - return 2; - } else { + if (i == (searchResult == null ? 0 : searchResult.size())) { return 3; } + return 2; } if (serverOnly && i == MessagesController.getInstance().dialogsServerOnly.size() || !serverOnly && i == MessagesController.getInstance().dialogs.size()) { return 1; @@ -812,7 +866,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter @Override public boolean isEmpty() { if (searching && searchWas) { - return searchResult == null || searchResult.size() == 0; + return (searchResult == null || searchResult.size() == 0) && (globalSearch == null || globalSearch.isEmpty()); } if (MessagesController.getInstance().loadingDialogs && MessagesController.getInstance().dialogs.isEmpty()) { return false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index 635ed904..a1178e16 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -2140,7 +2140,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat float ai = -1; if (System.currentTimeMillis() - animationStartTime < animationDuration) { ai = interpolator.getInterpolation((float)(System.currentTimeMillis() - animationStartTime) / animationDuration); - if (ai >= 0.999f) { + if (ai >= 0.95f) { ai = -1; } } @@ -2221,7 +2221,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat int height = (int) (bitmapHeight * scale); centerImage.setImageCoords(-width / 2, -height / 2, width, height); - centerImage.draw(canvas, -width / 2, -height / 2, width, height); + centerImage.draw(canvas); } if (scale >= 1.0f) { @@ -2252,7 +2252,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat int height = (int) (bitmapHeight * scale); sideImage.setImageCoords(-width / 2, -height / 2, width, height); - sideImage.draw(canvas, -width / 2, -height / 2, width, height); + sideImage.draw(canvas); } } else { changingPage = false; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SecretPhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/SecretPhotoViewer.java index 3dd8e29d..a0164a47 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SecretPhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SecretPhotoViewer.java @@ -365,7 +365,7 @@ public class SecretPhotoViewer implements NotificationCenter.NotificationCenterD int height = (int) (bitmapHeight * scale); centerImage.setImageCoords(-width / 2, -height / 2, width, height); - centerImage.draw(canvas, -width / 2, -height / 2, width, height); + centerImage.draw(canvas); } canvas.restore(); } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java index daa9f6de..fdcc3dd5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsActivity.java @@ -60,6 +60,7 @@ import org.telegram.ui.Views.AvatarUpdater; import org.telegram.ui.Views.BackupImageView; import org.telegram.ui.Views.ActionBar.BaseFragment; import org.telegram.ui.Views.NumberPicker; +import org.telegram.ui.Views.SettingsSectionLayout; import java.io.File; import java.util.ArrayList; @@ -831,22 +832,20 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter return view; } else if (type == 1) { if (view == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = li.inflate(R.layout.settings_section_layout, viewGroup, false); + view = new SettingsSectionLayout(mContext); } - TextView textView = (TextView)view.findViewById(R.id.settings_section_text); if (i == numberSectionRow) { - textView.setText(LocaleController.getString("Info", R.string.Info)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("Info", R.string.Info)); } else if (i == settingsSectionRow) { - textView.setText(LocaleController.getString("SETTINGS", R.string.SETTINGS)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("SETTINGS", R.string.SETTINGS)); } else if (i == supportSectionRow) { - textView.setText(LocaleController.getString("Support", R.string.Support)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("Support", R.string.Support)); } else if (i == messagesSectionRow) { - textView.setText(LocaleController.getString("MessagesSettings", R.string.MessagesSettings)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("MessagesSettings", R.string.MessagesSettings)); } else if (i == mediaDownloadSection) { - textView.setText(LocaleController.getString("AutomaticMediaDownload", R.string.AutomaticMediaDownload)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("AutomaticMediaDownload", R.string.AutomaticMediaDownload)); } else if (i == contactsSectionRow) { - textView.setText(LocaleController.getString("Contacts", R.string.Contacts).toUpperCase()); + ((SettingsSectionLayout) view).setText(LocaleController.getString("Contacts", R.string.Contacts).toUpperCase()); } } else if (type == 2) { if (view == null) { @@ -971,7 +970,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter if (user != null && user.phone != null && user.phone.length() != 0) { detailTextView.setText(PhoneFormat.getInstance().format("+" + user.phone)); } else { - detailTextView.setText(LocaleController.getString("Unknown", R.string.Unknown)); + detailTextView.setText(LocaleController.getString("NumberUnknown", R.string.NumberUnknown)); } divider.setVisibility(View.VISIBLE); } else if (i == textSizeRow) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsersActivity.java index b2e169a6..49f3f879 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsBlockedUsersActivity.java @@ -249,7 +249,7 @@ public class SettingsBlockedUsersActivity extends BaseFragment implements Notifi ((ChatOrUserCell)view).useSeparator = true; } TLRPC.User user = MessagesController.getInstance().getUser(MessagesController.getInstance().blockedUsers.get(i)); - ((ChatOrUserCell)view).setData(user, null, null, null, user.phone != null && user.phone.length() != 0 ? PhoneFormat.getInstance().format("+" + user.phone) : LocaleController.getString("Unknown", R.string.Unknown)); + ((ChatOrUserCell)view).setData(user, null, null, null, user.phone != null && user.phone.length() != 0 ? PhoneFormat.getInstance().format("+" + user.phone) : LocaleController.getString("NumberUnknown", R.string.NumberUnknown)); } else if (type == 1) { if (view == null) { LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeNameActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeNameActivity.java index 86557b08..2d616aff 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeNameActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeNameActivity.java @@ -10,6 +10,9 @@ package org.telegram.ui; import android.app.Activity; import android.content.SharedPreferences; +import android.text.InputType; +import android.util.TypedValue; +import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -17,6 +20,7 @@ import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.TextView; import org.telegram.android.AndroidUtilities; @@ -30,6 +34,7 @@ import org.telegram.messenger.R; import org.telegram.messenger.RPCRequest; import org.telegram.messenger.UserConfig; import org.telegram.ui.Views.ActionBar.BaseFragment; +import org.telegram.ui.Views.SettingsSectionLayout; public class SettingsChangeNameActivity extends BaseFragment { private EditText firstNameField; @@ -63,14 +68,31 @@ public class SettingsChangeNameActivity extends BaseFragment { TextView textView = (TextView)doneButton.findViewById(R.id.done_button_text); textView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase()); - fragmentView = inflater.inflate(R.layout.settings_change_name_layout, container, false); - TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user == null) { user = UserConfig.getCurrentUser(); } - firstNameField = (EditText)fragmentView.findViewById(R.id.first_name_field); + fragmentView = new LinearLayout(inflater.getContext()); + fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + fragmentView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(8), AndroidUtilities.dp(16), 0); + ((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL); + + SettingsSectionLayout settingsSectionLayout = new SettingsSectionLayout(inflater.getContext()); + ((LinearLayout) fragmentView).addView(settingsSectionLayout); + settingsSectionLayout.setText(LocaleController.getString("YourFirstNameAndLastName", R.string.YourFirstNameAndLastName).toUpperCase()); + + firstNameField = new EditText(inflater.getContext()); + firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19); + firstNameField.setHintTextColor(0xffa3a3a3); + firstNameField.setTextColor(0xff000000); + firstNameField.setPadding(AndroidUtilities.dp(15), 0, AndroidUtilities.dp(15), AndroidUtilities.dp(15)); + firstNameField.setMaxLines(1); + firstNameField.setLines(1); + firstNameField.setSingleLine(true); + firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); + firstNameField.setImeOptions(EditorInfo.IME_ACTION_NEXT); firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName)); firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override @@ -83,7 +105,25 @@ public class SettingsChangeNameActivity extends BaseFragment { return false; } }); - lastNameField = (EditText)fragmentView.findViewById(R.id.last_name_field); + AndroidUtilities.clearCursorDrawable(firstNameField); + ((LinearLayout) fragmentView).addView(firstNameField); + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams(); + layoutParams.topMargin = AndroidUtilities.dp(15); + layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT; + layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT; + firstNameField.setLayoutParams(layoutParams); + + lastNameField = new EditText(inflater.getContext()); + lastNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19); + lastNameField.setHintTextColor(0xffa3a3a3); + lastNameField.setTextColor(0xff000000); + lastNameField.setPadding(AndroidUtilities.dp(15), 0, AndroidUtilities.dp(15), AndroidUtilities.dp(15)); + lastNameField.setMaxLines(1); + lastNameField.setLines(1); + lastNameField.setSingleLine(true); + lastNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + lastNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); + lastNameField.setImeOptions(EditorInfo.IME_ACTION_DONE); lastNameField.setHint(LocaleController.getString("LastName", R.string.LastName)); lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override @@ -95,15 +135,19 @@ public class SettingsChangeNameActivity extends BaseFragment { return false; } }); + AndroidUtilities.clearCursorDrawable(lastNameField); + ((LinearLayout) fragmentView).addView(lastNameField); + layoutParams = (LinearLayout.LayoutParams)lastNameField.getLayoutParams(); + layoutParams.topMargin = AndroidUtilities.dp(10); + layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT; + layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT; + lastNameField.setLayoutParams(layoutParams); if (user != null) { firstNameField.setText(user.first_name); firstNameField.setSelection(firstNameField.length()); lastNameField.setText(user.last_name); } - - TextView headerLabel = (TextView)fragmentView.findViewById(R.id.settings_section_text); - headerLabel.setText(LocaleController.getString("YourFirstNameAndLastName", R.string.YourFirstNameAndLastName)); } else { ViewGroup parent = (ViewGroup)fragmentView.getParent(); if (parent != null) { @@ -129,9 +173,14 @@ public class SettingsChangeNameActivity extends BaseFragment { if (currentUser == null || lastNameField.getText() == null || firstNameField.getText() == null) { return; } + String newFirst = firstNameField.getText().toString(); + String newLast = lastNameField.getText().toString(); + if (currentUser.first_name != null && currentUser.first_name.equals(newFirst) && currentUser.last_name != null && currentUser.last_name.equals(newLast)) { + return; + } TLRPC.TL_account_updateProfile req = new TLRPC.TL_account_updateProfile(); - currentUser.first_name = req.first_name = firstNameField.getText().toString(); - currentUser.last_name = req.last_name = lastNameField.getText().toString(); + currentUser.first_name = req.first_name = newFirst; + currentUser.last_name = req.last_name = newLast; TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user != null) { user.first_name = req.first_name; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeUsernameActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeUsernameActivity.java index ca1e855b..bf01f63f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeUsernameActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsChangeUsernameActivity.java @@ -13,6 +13,12 @@ import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.SharedPreferences; +import android.text.Editable; +import android.text.Html; +import android.text.InputType; +import android.text.TextWatcher; +import android.util.TypedValue; +import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; @@ -20,6 +26,7 @@ import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.TextView; import org.telegram.android.AndroidUtilities; @@ -35,13 +42,19 @@ import org.telegram.messenger.TLObject; import org.telegram.messenger.TLRPC; import org.telegram.messenger.UserConfig; import org.telegram.ui.Views.ActionBar.BaseFragment; +import org.telegram.ui.Views.SettingsSectionLayout; import java.util.ArrayList; public class SettingsChangeUsernameActivity extends BaseFragment { + private EditText firstNameField; - private View headerLabelView; private View doneButton; + private TextView checkTextView; + private long checkReqId = 0; + private String lastCheckName = null; + private Runnable checkRunnable = null; + private boolean lastNameAvailable = false; @Override public View createView(LayoutInflater inflater, ViewGroup container) { @@ -68,18 +81,37 @@ public class SettingsChangeUsernameActivity extends BaseFragment { TextView textView = (TextView)doneButton.findViewById(R.id.done_button_text); textView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase()); - fragmentView = inflater.inflate(R.layout.chat_profile_change_name_layout, container, false); - TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId()); if (user == null) { user = UserConfig.getCurrentUser(); } - firstNameField = (EditText)fragmentView.findViewById(R.id.first_name_field); + fragmentView = new LinearLayout(inflater.getContext()); + fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + fragmentView.setPadding(AndroidUtilities.dp(16), AndroidUtilities.dp(8), AndroidUtilities.dp(16), 0); + ((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL); + + SettingsSectionLayout settingsSectionLayout = new SettingsSectionLayout(inflater.getContext()); + ((LinearLayout) fragmentView).addView(settingsSectionLayout); + settingsSectionLayout.setText(LocaleController.getString("Username", R.string.Username).toUpperCase()); + + firstNameField = new EditText(inflater.getContext()); + firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19); + firstNameField.setHintTextColor(0xffa3a3a3); + firstNameField.setTextColor(0xff000000); + firstNameField.setPadding(AndroidUtilities.dp(15), 0, AndroidUtilities.dp(15), AndroidUtilities.dp(15)); + firstNameField.setMaxLines(1); + firstNameField.setLines(1); + firstNameField.setSingleLine(true); + firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT); + firstNameField.setImeOptions(EditorInfo.IME_ACTION_DONE); + firstNameField.setHint(LocaleController.getString("UsernamePlaceholder", R.string.UsernamePlaceholder)); + AndroidUtilities.clearCursorDrawable(firstNameField); firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { - if (i == EditorInfo.IME_ACTION_DONE) { + if (i == EditorInfo.IME_ACTION_DONE && doneButton != null) { doneButton.performClick(); return true; } @@ -87,13 +119,62 @@ public class SettingsChangeUsernameActivity extends BaseFragment { } }); + ((LinearLayout) fragmentView).addView(firstNameField); + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)firstNameField.getLayoutParams(); + layoutParams.topMargin = AndroidUtilities.dp(15); + layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT; + layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT; + firstNameField.setLayoutParams(layoutParams); + if (user != null && user.username != null && user.username.length() > 0) { firstNameField.setText(user.username); firstNameField.setSelection(firstNameField.length()); } - TextView headerLabel = (TextView)fragmentView.findViewById(R.id.settings_section_text); - headerLabel.setText(LocaleController.getString("Username", R.string.Username).toUpperCase()); + checkTextView = new TextView(inflater.getContext()); + checkTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); + checkTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), 0); + checkTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + ((LinearLayout) fragmentView).addView(checkTextView); + layoutParams = (LinearLayout.LayoutParams)checkTextView.getLayoutParams(); + layoutParams.topMargin = AndroidUtilities.dp(12); + layoutParams.width = LinearLayout.LayoutParams.WRAP_CONTENT; + layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT; + layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT; + checkTextView.setLayoutParams(layoutParams); + + TextView helpTextView = new TextView(inflater.getContext()); + helpTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); + helpTextView.setTextColor(0xff6d6d72); + helpTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), 0); + helpTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); + helpTextView.setText(Html.fromHtml(LocaleController.getString("UsernameHelp", R.string.UsernameHelp))); + ((LinearLayout) fragmentView).addView(helpTextView); + layoutParams = (LinearLayout.LayoutParams)helpTextView.getLayoutParams(); + layoutParams.topMargin = AndroidUtilities.dp(10); + layoutParams.width = LinearLayout.LayoutParams.WRAP_CONTENT; + layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT; + layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT; + helpTextView.setLayoutParams(layoutParams); + + firstNameField.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { + checkUserName(firstNameField.getText().toString(), false); + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + checkTextView.setVisibility(View.GONE); } else { ViewGroup parent = (ViewGroup)fragmentView.getParent(); if (parent != null) { @@ -128,7 +209,118 @@ public class SettingsChangeUsernameActivity extends BaseFragment { showAlertDialog(builder); } + private boolean checkUserName(final String name, boolean alert) { + if (name != null && name.length() > 0) { + checkTextView.setVisibility(View.VISIBLE); + } else { + checkTextView.setVisibility(View.GONE); + } + if (alert && name.length() == 0) { + return true; + } + if (checkRunnable != null) { + AndroidUtilities.CancelRunOnUIThread(checkRunnable); + checkRunnable = null; + lastCheckName = null; + if (checkReqId != 0) { + ConnectionsManager.getInstance().cancelRpc(checkReqId, true); + } + } + lastNameAvailable = false; + if (name != null) { + for (int a = 0; a < name.length(); a++) { + char ch = name.charAt(a); + if (a == 0 && ch >= '0' && ch <= '9') { + if (alert) { + showErrorAlert(LocaleController.getString("UsernameInvalidStartNumber", R.string.UsernameInvalidStartNumber)); + } else { + checkTextView.setText(LocaleController.getString("UsernameInvalidStartNumber", R.string.UsernameInvalidStartNumber)); + checkTextView.setTextColor(0xffcf3030); + } + return false; + } + if (!(ch >= '0' && ch <= '9' || ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || a == '_')) { + if (alert) { + showErrorAlert(LocaleController.getString("UsernameInvalid", R.string.UsernameInvalid)); + } else { + checkTextView.setText(LocaleController.getString("UsernameInvalid", R.string.UsernameInvalid)); + checkTextView.setTextColor(0xffcf3030); + } + return false; + } + } + } + if (name == null || name.length() < 5) { + if (alert) { + showErrorAlert(LocaleController.getString("UsernameInvalidShort", R.string.UsernameInvalidShort)); + } else { + checkTextView.setText(LocaleController.getString("UsernameInvalidShort", R.string.UsernameInvalidShort)); + checkTextView.setTextColor(0xffcf3030); + } + return false; + } + if (name.length() > 32) { + if (alert) { + showErrorAlert(LocaleController.getString("UsernameInvalidLong", R.string.UsernameInvalidLong)); + } else { + checkTextView.setText(LocaleController.getString("UsernameInvalidLong", R.string.UsernameInvalidLong)); + checkTextView.setTextColor(0xffcf3030); + } + return false; + } + + if (!alert) { + String currentName = UserConfig.getCurrentUser().username; + if (currentName == null) { + currentName = ""; + } + if (name.equals(currentName)) { + checkTextView.setText(LocaleController.formatString("UsernameAvailable", R.string.UsernameAvailable, name)); + checkTextView.setTextColor(0xff26972c); + return true; + } + + checkTextView.setText(LocaleController.getString("UsernameChecking", R.string.UsernameChecking)); + checkTextView.setTextColor(0xff6d6d72); + lastCheckName = name; + checkRunnable = new Runnable() { + @Override + public void run() { + TLRPC.TL_account_checkUsername req = new TLRPC.TL_account_checkUsername(); + req.username = name; + checkReqId = ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { + @Override + public void run(final TLObject response, final TLRPC.TL_error error) { + AndroidUtilities.RunOnUIThread(new Runnable() { + @Override + public void run() { + checkReqId = 0; + if (lastCheckName != null && lastCheckName.equals(name)) { + if (error == null && response instanceof TLRPC.TL_boolTrue) { + checkTextView.setText(LocaleController.formatString("UsernameAvailable", R.string.UsernameAvailable, name)); + checkTextView.setTextColor(0xff26972c); + lastNameAvailable = true; + } else { + checkTextView.setText(LocaleController.getString("UsernameInUse", R.string.UsernameInUse)); + checkTextView.setTextColor(0xffcf3030); + lastNameAvailable = false; + } + } + } + }); + } + }, true, RPCRequest.RPCRequestClassGeneric | RPCRequest.RPCRequestClassFailOnServerErrors); + } + }; + AndroidUtilities.RunOnUIThread(checkRunnable, 300); + } + return true; + } + private void saveName() { + if (!checkUserName(firstNameField.getText().toString(), true)) { + return; + } TLRPC.User user = UserConfig.getCurrentUser(); if (getParentActivity() == null || user == null) { return; @@ -142,10 +334,6 @@ public class SettingsChangeUsernameActivity extends BaseFragment { finishFragment(); return; } - if (newName.length() > 32 || newName.length() > 0 && newName.length() < 5) { - showErrorAlert("USERNAME_INVALID"); - return; - } final ProgressDialog progressDialog = new ProgressDialog(getParentActivity()); progressDialog.setMessage(LocaleController.getString("Loading", R.string.Loading)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsNotificationsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsNotificationsActivity.java index 7d7c41ae..0e2f2c0b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsNotificationsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsNotificationsActivity.java @@ -42,6 +42,7 @@ import org.telegram.ui.Adapters.BaseFragmentAdapter; import org.telegram.ui.Views.ActionBar.ActionBarLayer; import org.telegram.ui.Views.ActionBar.BaseFragment; import org.telegram.ui.Views.ColorPickerView; +import org.telegram.ui.Views.SettingsSectionLayout; public class SettingsNotificationsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate { private ListView listView; @@ -541,22 +542,20 @@ public class SettingsNotificationsActivity extends BaseFragment implements Notif int type = getItemViewType(i); if (type == 0) { if (view == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = li.inflate(R.layout.settings_section_layout, viewGroup, false); + view = new SettingsSectionLayout(mContext); } - TextView textView = (TextView)view.findViewById(R.id.settings_section_text); if (i == messageSectionRow) { - textView.setText(LocaleController.getString("MessageNotifications", R.string.MessageNotifications)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("MessageNotifications", R.string.MessageNotifications)); } else if (i == groupSectionRow) { - textView.setText(LocaleController.getString("GroupNotifications", R.string.GroupNotifications)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("GroupNotifications", R.string.GroupNotifications)); } else if (i == inappSectionRow) { - textView.setText(LocaleController.getString("InAppNotifications", R.string.InAppNotifications)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("InAppNotifications", R.string.InAppNotifications)); } else if (i == eventsSectionRow) { - textView.setText(LocaleController.getString("Events", R.string.Events)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("Events", R.string.Events)); } else if (i == otherSectionRow) { - textView.setText(LocaleController.getString("PhoneOther", R.string.PhoneOther)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("PhoneOther", R.string.PhoneOther)); } else if (i == resetSectionRow) { - textView.setText(LocaleController.getString("Reset", R.string.Reset)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("Reset", R.string.Reset)); } } if (type == 1) { if (view == null) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java index 84c53c1a..236ce54b 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/UserProfileActivity.java @@ -41,6 +41,7 @@ import org.telegram.ui.Views.ActionBar.ActionBarMenuItem; import org.telegram.ui.Views.BackupImageView; import org.telegram.ui.Views.ActionBar.BaseFragment; import org.telegram.ui.Views.IdenticonView; +import org.telegram.ui.Views.SettingsSectionLayout; import java.util.ArrayList; @@ -539,16 +540,14 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen return view; } else if (type == 1) { if (view == null) { - LayoutInflater li = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = li.inflate(R.layout.settings_section_layout, viewGroup, false); + view = new SettingsSectionLayout(mContext); } - TextView textView = (TextView)view.findViewById(R.id.settings_section_text); if (i == phoneSectionRow) { - textView.setText(LocaleController.getString("Info", R.string.Info)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("Info", R.string.Info)); } else if (i == settingsSectionRow) { - textView.setText(LocaleController.getString("SETTINGS", R.string.SETTINGS)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("SETTINGS", R.string.SETTINGS)); } else if (i == sharedMediaSectionRow) { - textView.setText(LocaleController.getString("SHAREDMEDIA", R.string.SHAREDMEDIA)); + ((SettingsSectionLayout) view).setText(LocaleController.getString("SHAREDMEDIA", R.string.SHAREDMEDIA)); } } else if (type == 2) { final TLRPC.User user = MessagesController.getInstance().getUser(user_id); @@ -621,7 +620,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen if (user.phone != null && user.phone.length() != 0) { textView.setText(PhoneFormat.getInstance().format("+" + user.phone)); } else { - textView.setText(LocaleController.getString("Unknown", R.string.Unknown)); + textView.setText(LocaleController.getString("NumberUnknown", R.string.NumberUnknown)); } divider.setVisibility(usernameRow != -1 ? View.VISIBLE : View.INVISIBLE); detailTextView.setText(LocaleController.getString("PhoneMobile", R.string.PhoneMobile)); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/BackupImageView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/BackupImageView.java index 529f715c..b584dcda 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/BackupImageView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/BackupImageView.java @@ -91,6 +91,6 @@ public class BackupImageView extends View { @Override protected void onDraw(Canvas canvas) { imageReceiver.setImageCoords(0, 0, getWidth(), getHeight()); - imageReceiver.draw(canvas, 0, 0, getWidth(), getHeight()); + imageReceiver.draw(canvas); } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/SettingsSectionLayout.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/SettingsSectionLayout.java new file mode 100644 index 00000000..f7bab4ec --- /dev/null +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/SettingsSectionLayout.java @@ -0,0 +1,82 @@ +/* + * This is the source code of Telegram for Android v. 1.7.x. + * It is licensed under GNU GPL v. 2 or later. + * You should have received a copy of the license in this archive (see LICENSE). + * + * Copyright Nikolai Kudashov, 2013-2014. + */ + +package org.telegram.ui.Views; + +import android.content.Context; +import android.graphics.Typeface; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.telegram.android.AndroidUtilities; +import org.telegram.android.LocaleController; + +public class SettingsSectionLayout extends LinearLayout { + + private TextView textView; + + private void init() { + setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + setOrientation(LinearLayout.VERTICAL); + + textView = new TextView(getContext()); + textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); + textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD)); + textView.setTextColor(0xff3b84c0); + addView(textView); + LayoutParams layoutParams = (LayoutParams)textView.getLayoutParams(); + layoutParams.width = LayoutParams.WRAP_CONTENT; + layoutParams.height = LayoutParams.WRAP_CONTENT; + layoutParams.leftMargin = AndroidUtilities.dp(8); + layoutParams.rightMargin = AndroidUtilities.dp(8); + layoutParams.topMargin = AndroidUtilities.dp(6); + layoutParams.bottomMargin = AndroidUtilities.dp(4); + if (LocaleController.isRTL) { + textView.setGravity(Gravity.RIGHT); + layoutParams.gravity = Gravity.RIGHT; + } + textView.setLayoutParams(layoutParams); + + View view = new View(getContext()); + view.setBackgroundColor(0xff6caae4); + addView(view); + layoutParams = (LayoutParams)view.getLayoutParams(); + layoutParams.weight = LayoutParams.MATCH_PARENT; + layoutParams.height = AndroidUtilities.dp(1); + view.setLayoutParams(layoutParams); + } + + public SettingsSectionLayout(Context context) { + super(context); + init(); + } + + public SettingsSectionLayout(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + public SettingsSectionLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + public SettingsSectionLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + init(); + } + + public void setText(String text) { + textView.setText(text); + } +} diff --git a/TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_activated_holo_light.9.png b/TMessagesProj/src/main/res/drawable-hdpi/textfield_activated.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_activated_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-hdpi/textfield_activated.9.png diff --git a/TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_default_holo_light.9.png b/TMessagesProj/src/main/res/drawable-hdpi/textfield_default.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_default_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-hdpi/textfield_default.9.png diff --git a/TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_disabled_focused_holo_light.9.png b/TMessagesProj/src/main/res/drawable-hdpi/textfield_disabled.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_disabled_focused_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-hdpi/textfield_disabled.9.png diff --git a/TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_disabled_holo_light.9.png b/TMessagesProj/src/main/res/drawable-hdpi/textfield_disabled2.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_disabled_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-hdpi/textfield_disabled2.9.png diff --git a/TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_focused_holo_light.9.png b/TMessagesProj/src/main/res/drawable-hdpi/textfield_focused.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-hdpi/holo_textfield_focused_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-hdpi/textfield_focused.9.png diff --git a/TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_activated_holo_light.9.png b/TMessagesProj/src/main/res/drawable-mdpi/textfield_activated.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_activated_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-mdpi/textfield_activated.9.png diff --git a/TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_default_holo_light.9.png b/TMessagesProj/src/main/res/drawable-mdpi/textfield_default.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_default_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-mdpi/textfield_default.9.png diff --git a/TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_disabled_focused_holo_light.9.png b/TMessagesProj/src/main/res/drawable-mdpi/textfield_disabled.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_disabled_focused_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-mdpi/textfield_disabled.9.png diff --git a/TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_disabled_holo_light.9.png b/TMessagesProj/src/main/res/drawable-mdpi/textfield_disabled2.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_disabled_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-mdpi/textfield_disabled2.9.png diff --git a/TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_focused_holo_light.9.png b/TMessagesProj/src/main/res/drawable-mdpi/textfield_focused.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-mdpi/holo_textfield_focused_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-mdpi/textfield_focused.9.png diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_activated_holo_light.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/textfield_activated.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_activated_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-xhdpi/textfield_activated.9.png diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_default_holo_light.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/textfield_default.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_default_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-xhdpi/textfield_default.9.png diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_disabled_focused_holo_light.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/textfield_disabled.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_disabled_focused_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-xhdpi/textfield_disabled.9.png diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_disabled_holo_light.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/textfield_disabled2.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_disabled_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-xhdpi/textfield_disabled2.9.png diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_focused_holo_light.9.png b/TMessagesProj/src/main/res/drawable-xhdpi/textfield_focused.9.png similarity index 100% rename from TMessagesProj/src/main/res/drawable-xhdpi/holo_textfield_focused_holo_light.9.png rename to TMessagesProj/src/main/res/drawable-xhdpi/textfield_focused.9.png diff --git a/TMessagesProj/src/main/res/drawable/holo_edit_text_light.xml b/TMessagesProj/src/main/res/drawable/edit_text.xml similarity index 51% rename from TMessagesProj/src/main/res/drawable/holo_edit_text_light.xml rename to TMessagesProj/src/main/res/drawable/edit_text.xml index 65ab33c7..492bc906 100644 --- a/TMessagesProj/src/main/res/drawable/holo_edit_text_light.xml +++ b/TMessagesProj/src/main/res/drawable/edit_text.xml @@ -1,11 +1,11 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout-ar/chat_profile_change_name_layout.xml b/TMessagesProj/src/main/res/layout-ar/chat_profile_change_name_layout.xml deleted file mode 100644 index 0ace49c8..00000000 --- a/TMessagesProj/src/main/res/layout-ar/chat_profile_change_name_layout.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout-ar/messages_list.xml b/TMessagesProj/src/main/res/layout-ar/messages_list.xml index 535c825b..15d7d46a 100644 --- a/TMessagesProj/src/main/res/layout-ar/messages_list.xml +++ b/TMessagesProj/src/main/res/layout-ar/messages_list.xml @@ -11,8 +11,8 @@ android:layout_alignParentBottom="true" android:clipToPadding="false" android:fadingEdge="none" - android:divider="@drawable/messages_list_divider" - android:dividerHeight="1px" + android:divider="@null" + android:dividerHeight="0px" android:fadingEdgeLength="0dp" android:verticalScrollbarPosition="left"/> diff --git a/TMessagesProj/src/main/res/layout-ar/notification_layout.xml b/TMessagesProj/src/main/res/layout-ar/notification_layout.xml deleted file mode 100644 index 5b1d7ca6..00000000 --- a/TMessagesProj/src/main/res/layout-ar/notification_layout.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/TMessagesProj/src/main/res/layout-ar/settings_change_name_layout.xml b/TMessagesProj/src/main/res/layout-ar/settings_change_name_layout.xml deleted file mode 100644 index 8f51da6d..00000000 --- a/TMessagesProj/src/main/res/layout-ar/settings_change_name_layout.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout-ar/settings_section_layout.xml b/TMessagesProj/src/main/res/layout-ar/settings_section_layout.xml deleted file mode 100644 index 79793ba3..00000000 --- a/TMessagesProj/src/main/res/layout-ar/settings_section_layout.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_profile_change_name_layout.xml b/TMessagesProj/src/main/res/layout/chat_profile_change_name_layout.xml deleted file mode 100644 index 27a53366..00000000 --- a/TMessagesProj/src/main/res/layout/chat_profile_change_name_layout.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/messages_list.xml b/TMessagesProj/src/main/res/layout/messages_list.xml index bd3eb600..1615aa8e 100644 --- a/TMessagesProj/src/main/res/layout/messages_list.xml +++ b/TMessagesProj/src/main/res/layout/messages_list.xml @@ -9,11 +9,10 @@ android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentBottom="true" - android:clipToPadding="false" android:fadingEdge="none" android:fadingEdgeLength="0dp" - android:divider="@drawable/messages_list_divider" - android:dividerHeight="1px" + android:divider="@null" + android:dividerHeight="0px" android:animationCache="false"/> - - - - - - - - - - - - - - - - - - diff --git a/TMessagesProj/src/main/res/layout/settings_change_name_layout.xml b/TMessagesProj/src/main/res/layout/settings_change_name_layout.xml deleted file mode 100644 index 6bdd8e59..00000000 --- a/TMessagesProj/src/main/res/layout/settings_change_name_layout.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/settings_section_layout.xml b/TMessagesProj/src/main/res/layout/settings_section_layout.xml deleted file mode 100644 index a9b6d851..00000000 --- a/TMessagesProj/src/main/res/layout/settings_section_layout.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-ar/strings.xml b/TMessagesProj/src/main/res/values-ar/strings.xml index 846b80dd..8bbcb33a 100644 --- a/TMessagesProj/src/main/res/values-ar/strings.xml +++ b/TMessagesProj/src/main/res/values-ar/strings.xml @@ -51,9 +51,10 @@ حذف وخروج الاسم مخفي اختر محادثة + %1$s يستخدم إصدار قديم من تيليجرام، لذلك، الصور السرية ستظهر في وضع الموافقة.\n\nعندما يقوم %2$s بتحديث تيليجرام، الصور التي بها عداد دقيقة أو أقل ستعمل بطريقة \"الاستمرار بالضغط للإستعراض\"، وسيتم إخبارك عندما يلتقط المستقبل صورة من شاشته. قائمة الرسالة الجماعية - قائمة رسالة جماعية جديدة + رسالة جماعية جديدة أدخل اسم القائمة أنت قمت بإنشاء قائمة رسالة جماعية إضافة مستلم @@ -146,8 +147,8 @@ %1$s,\nتم تسجيل الدخول لحسابك من جهاز جديد يوم %2$s\n\nالجهاز: %3$s\nالموقع: %4$s\n\nإذا لم يكن أنت من سجل الدخول، يمكنك الذهاب للإعدادات ثم تسجيل الخروج من كافة الأجهزة الأخرى.\n\nشكرًا,\nفريق عمل تيليجرام %1$s قام بتغيير صورته الشخصية الرد - Reply to %1$s - Reply to %1$s + الرد على %1$s + الرد على %1$s %1$s %2$s اختر جهة اتصال @@ -160,7 +161,7 @@ آخر ظهور آخر ظهور قم بدعوة صديق - GLOBAL SEARCH + بحث شامل إرسال الرسالة إلى... أدخل اسم للمجموعة @@ -198,16 +199,19 @@ عداد التدمير الذاتي إيقاف هذه الصورة هي تصور لمفتاح التشفير لهذه المحادثة السرية مع ]]>%1$s]]>.
]]>إذا كانت مطابقة للصورة التي في جهاز ]]>%2$s]]>, فمحادثتكم آمنة ٢٠٠٪.
]]>للمزيد نرجو الذهاب إلى telegram.org
- Unknown - INFO - الهاتف - Username - Your Username - Sorry, this username is already taken. - Sorry, this username is invalid. - A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + غير معروف + معلومات + هاتف + اسم مستخدم + معرّفك + المعذرة، اسم المستخدم تم اختياره مسبقًا. + المعذرة، اسم المستخدم غير مقبول. + سم المستخدم يجب أن يتكوّن من ٥ حروف على الأقل. + اسم المستخدم يجب ألا يتخطى ٣٢ حرف كحد أقصى. + المعذرة، اسم المستخدم لا يمكن أن يبدأ برقم. + يمكنك اختيار اسم مستخدم في ]]>تيليجرام]]>. إذا قمت بذلك، سيستطيع الناس إيجادك باستخدام الاسم المستخدم والتواصل معك من دون معرفة رقمك.
]]>يمكنك استخدام ]]>حروف اللغة الإنجليزية]]>, ]]>وأرقامها]]> و كذلك الخط. لا بد من استخدام ]]>٥]]> حروف على الأقل.
+ جاري مراجعة اسم المستخدم... + %1$s متاح. تم تعيين كافة الإشعارات افتراضيا حجم نص الرسائل @@ -387,7 +391,7 @@ قوي مرتبط بالسحاب خصوصي - أسرع تطبيق مراسلة في العالم.]]>كما أنه مجاني و آمن. + أسرع تطبيق مراسلة في العالم. ]]>كما أنه مجاني و آمن. تيليجرام]]> يوصل الرسائل أسرع من أي تطبيق آخر. تيليجرام]]> مجاني للأبد. بدون أية إعلانات. وبدون رسوم إشتراك. تيليجرام]]> يحمي الرسائل الخاصة بك من هجمات المخترقين. @@ -395,7 +399,7 @@ تيليجرام]]> يمكنك الوصول إلى الرسائل الخاصة بك من أجهزة متعددة. تيليجرام]]> الرسائل مشفرة بشكل قوي وتستطيع تدمير ذاتها إبدأ المراسلة - + %1$d متصل %1$d متصل %1$d متصل @@ -432,42 +436,42 @@ من %1$d جهات اتصال من %1$d جهة اتصال من %1$d جهة اتصال - %1$d seconds - %1$d second - %1$d seconds - %1$d seconds - %1$d seconds - %1$d seconds - %1$d minutes - %1$d minute - %1$d minutes - %1$d minutes - %1$d minutes - %1$d minutes - %1$d hours - %1$d hour - %1$d hours - %1$d hours - %1$d hours - %1$d hours - %1$d days - %1$d day - %1$d days - %1$d days - %1$d days - %1$d days - %1$d weeks - %1$d week - %1$d weeks - %1$d weeks - %1$d weeks - %1$d weeks + %1$d ثانية + %1$d ثانية + %1$d ثانيتان + %1$d ثوانٍ + %1$d ثانية + %1$d ثانية + %1$d دقيقة + %1$d دقيقة + %1$d دقيقتان + %1$d دقائق + %1$d دقيقة + %1$d دقيقة + %1$d ساعة + %1$d ساعة + %1$d ساعتان + %1$d ساعات + %1$d ساعة + %1$d ساعة + %1$d يوم + %1$d يوم + %1$d يومان + %1$d أيام + %1$d يوم + %1$d يوم + %1$d أسبوع + %1$d أسبوع + %1$d أسبوعان + %1$d أسابيع + %1$d أسبوع + %1$d أسبوع - dd MMM + MMM dd dd.MM.yy dd.MM.yyyy - d MMMM - d MMMM yyyy + MMMM d + MMMM d, yyyy EEE HH:mm h:mm a diff --git a/TMessagesProj/src/main/res/values-de/strings.xml b/TMessagesProj/src/main/res/values-de/strings.xml index 2880d6f5..796e9938 100644 --- a/TMessagesProj/src/main/res/values-de/strings.xml +++ b/TMessagesProj/src/main/res/values-de/strings.xml @@ -51,6 +51,7 @@ Löschen und beenden Versteckter Name Chat auswählen + %1$s benutzt eine ältere Version von Telegram, sodass Fotos in Geheimen Chats im Kompatibilitätsmodus angezeigt werden.\n\nSobald %2$s Telegram aktualisiert, werden Fotos mit Timern von 1 Minute und kürzer per \"Tippen und Halten\" angezeigt. Du wirst benachrichtigt, sobald dein Chatpartner ein Bildschirmfoto macht. Broadcast Liste Neue Broadcast Liste @@ -160,7 +161,7 @@ zul. online zul. online Freunde einladen - GLOBAL SEARCH + GLOBALE SUCHE Sende Nachricht an… Gruppenname @@ -198,16 +199,19 @@ Selbstzerstörungs-Timer Aus Das ist eine Darstellung des Schlüssels für den Geheimen Chat mit ]]>%1$s]]>.
]]>Wenn dieses Bild auf ]]>%2$s\s]]>s Telefon genau so aussieht, ist euer Chat zu 200%% sicher.
]]>Erfahre mehr auf telegram.org
- Unknown + Unbekannt INFO Telefon - Username - Your Username - Sorry, this username is already taken. - Sorry, this username is invalid. - A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + Benutzername + Dein Benutzername + Leider ist dieser Benutzername vergeben. + Benutzername leider nicht erlaubt. + Ein Benutzername benötigt mindestens 5 Zeichen. + Ein Benutzername darf maximal 32 Zeichen haben. + Benutzernamen dürfen leider nicht mit einer Zahl anfangen. + Wähle einen Benutzernamen, wenn du von anderen bei]]>Telegram]]>gefunden werden willst – ohne, dass sie deine Nummer kennen müssen.
]]>Erlaubt sind ]]>a–z]]>, ]]>0–9]]> und Unterstriche. Die Mindestlänge beträgt ]]>5]]> Zeichen.
+ Prüfe Benutzername... + %1$s ist verfügbar. Alle Einstellungen für Mitteilungen zurücksetzen Textgröße für Nachrichten @@ -247,8 +251,8 @@ Sprache Bedenke bitte, dass der Telegram Support von einem ehrenamtlichen Team betreut wird. Wir versuchen so schnell wie möglich zu antworten, dies kann jedoch manchmal ein bisschen dauern.
]]>Bitte schau auch in den Fragen und Antworten ]]> nach. Dort findest du Antworten auf die meisten Fragen und wichtige Tipps zur Problembehandlung]]>.
Frage einen Freiwilligen - Fragen und Antworten zu Telegram - https://telegram.org/faq + Fragen und Antworten + https://telegram.org/faq/ko Lokalisierung löschen? Falsche Sprachdatei Aktiviert @@ -432,36 +436,36 @@ von %1$d Kontakten von %1$d Kontakten von %1$d Kontakten - %1$d seconds - %1$d second - %1$d seconds - %1$d seconds - %1$d seconds - %1$d seconds - %1$d minutes - %1$d minute - %1$d minutes - %1$d minutes - %1$d minutes - %1$d minutes - %1$d hours - %1$d hour - %1$d hours - %1$d hours - %1$d hours - %1$d hours - %1$d days - %1$d day - %1$d days - %1$d days - %1$d days - %1$d days - %1$d weeks - %1$d week - %1$d weeks - %1$d weeks - %1$d weeks - %1$d weeks + %1$d Sekunden + %1$d Sekunde + %1$d Sekunden + %1$d Sekunden + %1$d Sekunden + %1$d Sekunden + %1$d Minuten + %1$d Minute + %1$d Minuten + %1$d Minuten + %1$d Minuten + %1$d Minuten + %1$d Stunden + %1$d Stunde + %1$d Stunden + %1$d Stunden + %1$d Stunden + %1$d Stunden + %1$d Tage + %1$d Tag + %1$d Tage + %1$d Tage + %1$d Tage + %1$d Tage + %1$d Wochen + %1$d Woche + %1$d Wochen + %1$d Wochen + %1$d Wochen + %1$d Wochen dd MMM dd.MM.yy diff --git a/TMessagesProj/src/main/res/values-es/strings.xml b/TMessagesProj/src/main/res/values-es/strings.xml index b1fc0208..87f41149 100644 --- a/TMessagesProj/src/main/res/values-es/strings.xml +++ b/TMessagesProj/src/main/res/values-es/strings.xml @@ -51,6 +51,7 @@ Eliminar y salir Nombre oculto Elige el chat + %1$s usa una versión antigua de Telegram, así que las fotos secretas serán mostradas en un modo de compatibilidad.\n\nCuando %2$s actualice Telegram, las fotos con autodestrucción de 1 minuto o menos funcionarán con el modo \'Mantén pulsado para ver\', y te notificaremos siempre que la otra parte haga una captura de pantalla. Lista de difusión Nueva difusión @@ -73,10 +74,10 @@ Tarjeta SD invisible - escribe... + escribiendo... Adjuntar - escribe... - escriben... + está escribiendo... + están escribiendo... ¿Tienes preguntas\nsobre Telegram? Hacer foto Galería @@ -160,7 +161,7 @@ últ. vez últ. vez el Invitar a amigos - GLOBAL SEARCH + BÚSQUEDA GLOBAL Enviar mensaje a... Nombre del grupo @@ -170,7 +171,7 @@ PON EL NOMBRE DEL GRUPO Fotos y vídeos - Información + Información FOTOS Y VÍDEOS AJUSTES Añadir miembro @@ -198,16 +199,19 @@ Autodestrucción Apagada Esta imagen es una visualización de la clave de cifrado para el chat secreto con ]]>%1$s]]>.
]]>Si esta imagen se ve igual en el teléfono de ]]>%2$s]]>, tu chat es seguro en un 200%%.
]]>Aprende más en telegram.org
- Unknown - INFO + Desconocido + INFORMACIÓN Teléfono - Username - Your Username - Sorry, this username is already taken. - Sorry, this username is invalid. - A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + Apodo + Tu apodo + Lo siento, este apodo ya está ocupado. + Lo siento, este apodo es inválido. + Un apodo debe tener al menos 5 caracteres. + El apodo no debe exceder los 32 caracteres. + Lo siento, un apodo no puede comenzar con un número. + Puedes elegir un apodo en ]]>Telegram]]>. Si lo haces, otras personas te podrán encontrar por ese apodo y contactarte sin saber tu número de teléfono.
]]>Puedes usar ]]>a–z]]>, ]]>0–9]]> y guiones bajos. La longitud mínima es de ]]>5]]> caracteres.
+ Verificando apodo... + %1$s está disponible. Restablecer las notificaciones Tamaño del texto @@ -265,7 +269,7 @@ Desactivadas Con pantalla encendida Con pantalla apagada - Mostrar siempre + Mostrar siempre Globo en el ícono Corto Largo @@ -290,7 +294,7 @@ Enviar ubicación Compartir ubicación - Mostrar todas las fotos y vídeos + Ir a Fotos y vídeos Guardar en galería %1$d de %2$d Galería @@ -408,12 +412,12 @@ %1$d miembros %1$d miembros %1$d miembros - y %1$d personas más escriben - y %1$d personas más escriben - y %1$d personas más escriben - y %1$d personas más escriben - y %1$d personas más escriben - y %1$d personas más escriben + y %1$d personas más están escribiendo + y %1$d persona más están escribiendo + y %1$d personas más están escribiendo + y %1$d personas más están escribiendo + y %1$d personas más están escribiendo + y %1$d personas más están escribiendo Sin mensajes nuevos %1$d nuevo mensaje %1$d nuevos mensajes @@ -432,36 +436,36 @@ de %1$d contactos de %1$d contactos de %1$d contactos - %1$d seconds - %1$d second - %1$d seconds - %1$d seconds - %1$d seconds - %1$d seconds - %1$d minutes - %1$d minute - %1$d minutes - %1$d minutes - %1$d minutes - %1$d minutes - %1$d hours - %1$d hour - %1$d hours - %1$d hours - %1$d hours - %1$d hours - %1$d days - %1$d day - %1$d days - %1$d days - %1$d days - %1$d days - %1$d weeks - %1$d week - %1$d weeks - %1$d weeks - %1$d weeks - %1$d weeks + %1$d segundos + %1$d segundo + %1$d segundos + %1$d segundos + %1$d segundos + %1$d segundos + %1$d minutos + %1$d minuto + %1$d minutos + %1$d minutos + %1$d minutos + %1$d minutos + %1$d horas + %1$d hora + %1$d horas + %1$d horas + %1$d horas + %1$d horas + %1$d días + %1$d día + %1$d días + %1$d días + %1$d días + %1$d días + %1$d semanas + %1$d semana + %1$d semanas + %1$d semanas + %1$d semanas + %1$d semanas dd \'de\' MMM dd.MM.yy diff --git a/TMessagesProj/src/main/res/values-it/strings.xml b/TMessagesProj/src/main/res/values-it/strings.xml index 46c1f712..90f500a9 100644 --- a/TMessagesProj/src/main/res/values-it/strings.xml +++ b/TMessagesProj/src/main/res/values-it/strings.xml @@ -51,6 +51,7 @@ Elimina ed esci Nome nascosto Seleziona chat + %1$s sta usando una versione vecchia di Telegram, quindi le foto segrete verranno visualizzate in modalità di compatibilità.\n\nUna volta che %2$s avrà aggiornato Telegram, le foto con il timer minore di 1 minuto funzioneranno in modalità \'Tieni premuto per vedere\' , e verrai notificato ogni volta che l\'altro esegue uno screenshot. Lista broadcast Nuova lista broadcast @@ -152,7 +153,7 @@ Seleziona contatto Ancora nessun contatto - Ciao, passa a Telegram: http://telegram.org/dl2 + Ehi, è il momento di passare a Telegram: http://telegram.org/dl2 oggi alle ieri alle in linea @@ -160,7 +161,7 @@ ultimo accesso ultimo accesso Invita amici - GLOBAL SEARCH + RICERCA GLOBALE Invia messaggio a... Immetti il nome del gruppo @@ -198,16 +199,19 @@ Timer di autodistruzione Spento Questa immagine è una visualizzazione della chiave di cifratura per questa chat segreta con ]]>%1$s]]>.
]]>Se questa immagine è uguale sul telefono di ]]>%2$s]]>, la chat è sicura al 200%%.
]]>Per saperne di più, visita Telegram.org
- Unknown + Sconosciuto INFO Telefono - Username - Your Username - Sorry, this username is already taken. - Sorry, this username is invalid. - A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + Nome utente + Il tuo Nome Utente + Nome utente già preso. + Nome utente non valido. + Il minimo per un nome utente è 5 caratteri. + Il massimo per un nome utente è 32 caratteri. + Un nome utente non può iniziare con numeri. + Puoi scegliere un nome utente su ]]>Telegram]]>. Se lo fai, le altre persone potranno trovarti tramite questo nome utente e contattarti senza conoscere il tuo numero di telefono.
]]>Puoi usare ]]>a–z]]>, ]]>0–9]]> e underscore. La lunghezza minima è di ]]>5]]> caratteri.
+ Controllando il nome utente... + %1$s è disponibile. Ripristina tutte le impostazioni di notifica predefinite Dimensione testo messaggi @@ -387,7 +391,7 @@ Potente Basato sul cloud Privato - L\'app di messaggi più veloce]]>al mondo.]]>È gratuita]]> e sicura]]>. + L\'app di messaggi più veloce]]> al mondo.]]>È gratuita]]> e sicura]]>. Telegram]]> consegna i messaggi più]]>velocemente di qualsiasi altra app. Telegram]]> sarà sempre gratuito.]]>Nessuna pubblicità. Nessun abbonamento. Telegram]]> protegge i tuoi messaggi]]>dagli attacchi degli hacker. @@ -432,36 +436,36 @@ da %1$d contatti da %1$d contatti da %1$d contatti - %1$d seconds - %1$d second - %1$d seconds - %1$d seconds - %1$d seconds - %1$d seconds - %1$d minutes - %1$d minute - %1$d minutes - %1$d minutes - %1$d minutes - %1$d minutes - %1$d hours - %1$d hour - %1$d hours - %1$d hours - %1$d hours - %1$d hours - %1$d days - %1$d day - %1$d days - %1$d days - %1$d days - %1$d days - %1$d weeks - %1$d week - %1$d weeks - %1$d weeks - %1$d weeks - %1$d weeks + %1$d secondi + %1$d secondo + %1$d secondi + %1$d secondi + %1$d secondi + %1$d secondi + %1$d minuti + %1$d minuto + %1$d minuti + %1$d minuti + %1$d minuti + %1$d minuti + %1$d ore + %1$d ora + %1$d ore + %1$d ore + %1$d ore + %1$d ore + %1$d giorni + %1$d giorno + %1$d giorni + %1$d giorni + %1$d giorni + %1$d giorni + %1$d settimane + %1$d settimana + %1$d settimane + %1$d settimane + %1$d settimane + %1$d settimane dd MMM dd.MM.yy diff --git a/TMessagesProj/src/main/res/values-ko/strings.xml b/TMessagesProj/src/main/res/values-ko/strings.xml index 9b62083e..955bc663 100644 --- a/TMessagesProj/src/main/res/values-ko/strings.xml +++ b/TMessagesProj/src/main/res/values-ko/strings.xml @@ -198,7 +198,7 @@ 자동삭제 타이머 해제 이 이미지는 ]]>%1$s]]>님과의 비밀대화에 사용 중인 암호화 키의 모습입니다.
]]>이 이미지가 ]]>%2$s]]>님의 암호화 키와 똑같다면 대화는 200%% 안전합니다.
]]>더 자세한 사항은 telegram.org 를 참고해 주세요.
- Unknown + Unknown INFO 전화번호 Username @@ -206,8 +206,11 @@ Sorry, this username is already taken. Sorry, this username is invalid. A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + A username must have maximum 32 characters. + Sorry, a username can\'t start with a number. + You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.
]]>You can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters.
+ Checking username... + %1$s is available. 모든 알림 설정이 초기화되었습니다 채팅 글자 크기 diff --git a/TMessagesProj/src/main/res/values-nl/strings.xml b/TMessagesProj/src/main/res/values-nl/strings.xml index dcb5fd21..489f024a 100644 --- a/TMessagesProj/src/main/res/values-nl/strings.xml +++ b/TMessagesProj/src/main/res/values-nl/strings.xml @@ -51,6 +51,7 @@ Verwijderen en verlaten Verborgen naam Kies een gesprek + %1$s gebruikt een oudere versie van Telegram, dus worden geheime foto\'s weergegeven in de compatibiliteitsmodus.\n\nZodra %2$s Telegram update werken foto\'s met timers voor 1 minuut of minder in de \'Houd ingedrukt om te bekijken\'-modus en krijg je een bericht wanneer de andere partij een schermafbeelding maakt. Verzendlijst Nieuwe verzendlijst @@ -160,7 +161,7 @@ gezien gezien Vrienden uitnodigen - GLOBAL SEARCH + WERELDWIJD ZOEKEN Bericht verzenden naar… Groepsnaam... @@ -198,16 +199,19 @@ Zelfvernietigingstimer Uit Dit is een weergave van de encryptiesleutel voor deze geheime chat met ]]>%1$s]]>.
]]>Als deze afbeelding er bij ]]>%2$s]]> hetzelfde uitziet, is jullie gesprek 200%% beveiligd.
]]>Lees meer op telegram.org.
- Unknown - INFO + Onbekend + INFORMATIE Telefoon - Username - Your Username - Sorry, this username is already taken. - Sorry, this username is invalid. - A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + Gebruikersnaam + Kies een naam + Sorry, deze gebruikersnaam is al bezet. + Sorry, deze gebruikersnaam is ongeldig. + Je naam moet minimaal 5 tekens hebben. + Je naam mag niet langer zijn dan 32 tekens. + Sorry, begincijfers zijn niet toegestaan. + Je kan een gebruikersnaam kiezen voor ]]>Telegram]]>. Hiermee kunnen anderen je vinden en contact met je opnemen zonder je telefoonnummer te weten.
]]>Je mag ]]>a–z]]>, ]]>0–9]]> en liggend streepje gebruiken. De minimale lengte is ]]>5]]> tekens.
+ Gebruikersnaam controleren. + %1$s is beschikbaar. Alle meldingsinstellingen herstellen Tekstgrootte berichten @@ -432,36 +436,36 @@ van %1$d contactpersonen van %1$d contactpersonen van %1$d contactpersonen - %1$d seconds - %1$d second - %1$d seconds - %1$d seconds - %1$d seconds - %1$d seconds - %1$d minutes - %1$d minute - %1$d minutes - %1$d minutes - %1$d minutes - %1$d minutes - %1$d hours - %1$d hour - %1$d hours - %1$d hours - %1$d hours - %1$d hours - %1$d days - %1$d day - %1$d days - %1$d days - %1$d days - %1$d days - %1$d weeks + %1$d seconden + %1$d seconde + %1$d seconden + %1$d seconden + %1$d seconden + %1$d seconden + %1$d minuten + %1$d minuut + %1$d minuten + %1$d minuten + %1$d minuten + %1$d minuten + %1$d uren + %1$d uur + %1$d uren + %1$d uren + %1$d uren + %1$d uren + %1$d dagen + %1$d dag + %1$d dagen + %1$d dagen + %1$d dagen + %1$d dagen + %1$d weken %1$d week - %1$d weeks - %1$d weeks - %1$d weeks - %1$d weeks + %1$d weken + %1$d weken + %1$d weken + %1$d weken dd MMM dd-MM-yy diff --git a/TMessagesProj/src/main/res/values-pt-rBR/strings.xml b/TMessagesProj/src/main/res/values-pt-rBR/strings.xml index 37f19d0c..98ca4144 100644 --- a/TMessagesProj/src/main/res/values-pt-rBR/strings.xml +++ b/TMessagesProj/src/main/res/values-pt-rBR/strings.xml @@ -51,6 +51,7 @@ Apagar e sair Nome oculto Selecione uma Conversa + %1$s está usando uma versão mais antiga do Telegram, por isso fotos secretas serão mostradas em modo de compatibilidade.\n\nAssim que %2$s atualize o Telegram, fotos com timers de 1 minuto ou menos passarão a funcionar no modo ‘Toque e segure para ver’, e você será notificado caso a outra pessoa salve a tela. Lista de Broadcast Nova Lista de Broadcast @@ -114,7 +115,7 @@ Conversa secreta solicitada Conversa secreta iniciada - %1$s estabeleceu o tempo de autodestruição para %2$s + %1$s estabeleceu o tempo de autodestruição para %2$s Você estabeleceu o tempo de autodestruição para %1$s %1$s desativou o temporizador de autodestruição Você desativou o temporizador de autodestruição @@ -146,8 +147,8 @@ %1$s,\nNós detectamos um login na sua conta de um novo dispositivo %2$s\n\nDispositivo: %3$s\nLocalização: %4$s\nSe não foi você, você pode ir em Configurações - Terminar todas as sessões.\n\nAtenciosamente,\nTime do Telegram %1$s atualizou a foto do perfil Responder - Reply to %1$s - Reply to %1$s + Responder para %1$s + Responder para %1$s %1$s %2$s Selecionar Contato @@ -160,7 +161,7 @@ visto visto Convidar Amigos - GLOBAL SEARCH + BUSCA GLOBAL Enviar mensagem para... Digite o nome do grupo @@ -198,16 +199,19 @@ Tempo de autodestruição Desativado Esta imagem é uma visualização da chave criptográfica para esta conversa secreta com ]]>%1$s]]>.
]]>Se esta imagem aparecer da mesma forma no telefone de ]]>%2$s\'s]]>, sua conversa é 200%% segura.
]]>Saiba mais em telegram.org
- Unknown + Desconhecido INFO Telefone - Username - Your Username - Sorry, this username is already taken. - Sorry, this username is invalid. - A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + Nome de Usuário + Seu nome de usuário + Desculpe, este usuário já existe. + Desculpe, este usuário é inválido. + O nome de usuário deve ter pelo menos 5 caracteres. + O nome de usuário não pode exceder 32 caracteres. + Desculpe, o nome de usuário não pode começar com um número. + Você pode escolher um nome de usuário no ]]>Telegram]]>. Assim, outras pessoas poderão te encontrar pelo nome de usuário e entrar em contato sem precisar saber seu telefone.
]]>Você pode usar ]]>a–z]]>, ]]>0–9]]> e underline. O tamanho mínimo é ]]>5]]> caracteres.
+ Verificando nome de usuário... + %1$s está disponível. Restaurar todas as configurações de notificação Tamanho do texto nas mensagens @@ -395,7 +399,7 @@ Telegram]]> permite você acessar suas]]> mensagens de múltiplos dispositivos. Telegram]]> possui mensagens fortemente]]>encriptadas e podem se auto-destruir. Comece a conversar - + %1$d online %1$d online %1$d online @@ -432,42 +436,42 @@ de %1$d contatos de %1$d contatos de %1$d contatos - %1$d seconds - %1$d second - %1$d seconds - %1$d seconds - %1$d seconds - %1$d seconds - %1$d minutes - %1$d minute - %1$d minutes - %1$d minutes - %1$d minutes - %1$d minutes - %1$d hours - %1$d hour - %1$d hours - %1$d hours - %1$d hours - %1$d hours - %1$d days - %1$d day - %1$d days - %1$d days - %1$d days - %1$d days - %1$d weeks - %1$d week - %1$d weeks - %1$d weeks - %1$d weeks - %1$d weeks + %1$d segundos + %1$d segundo + %1$d segundos + %1$d segundos + %1$d segundos + %1$d segundos + %1$d minutos + %1$d minuto + %1$d minutos + %1$d minutos + %1$d minutos + %1$d minutos + %1$d horas + %1$d hora + %1$d horas + %1$d horas + %1$d horas + %1$d horas + %1$d dias + %1$d dia + %1$d dias + %1$d dias + %1$d dias + %1$d dias + %1$d semanas + %1$d semana + %1$d semanas + %1$d semanas + %1$d semanas + %1$d semanas dd MMM dd.MM.yy dd.MM.yyyy d MMMM - d MMMM yyyy + MMMM d, yyyy EEE HH:mm h:mm a diff --git a/TMessagesProj/src/main/res/values-pt-rPT/strings.xml b/TMessagesProj/src/main/res/values-pt-rPT/strings.xml index af0f8721..86c2b427 100644 --- a/TMessagesProj/src/main/res/values-pt-rPT/strings.xml +++ b/TMessagesProj/src/main/res/values-pt-rPT/strings.xml @@ -51,6 +51,7 @@ Apagar e sair Nome oculto Selecione uma Conversa + %1$s está usando uma versão mais antiga do Telegram, por isso fotos secretas serão mostradas em modo de compatibilidade.\n\nAssim que %2$s atualize o Telegram, fotos com timers de 1 minuto ou menos passarão a funcionar no modo ‘Toque e segure para ver’, e você será notificado caso a outra pessoa salve a tela. Lista de Broadcast Nova Lista de Broadcast @@ -114,7 +115,7 @@ Conversa secreta solicitada Conversa secreta iniciada - %1$s estabeleceu o tempo de autodestruição para %2$s + %1$s estabeleceu o tempo de autodestruição para %2$s Você estabeleceu o tempo de autodestruição para %1$s %1$s desativou o temporizador de autodestruição Você desativou o temporizador de autodestruição @@ -146,8 +147,8 @@ %1$s,\nNós detectamos um login na sua conta de um novo dispositivo %2$s\n\nDispositivo: %3$s\nLocalização: %4$s\nSe não foi você, você pode ir em Configurações - Terminar todas as sessões.\n\nAtenciosamente,\nTime do Telegram %1$s atualizou a foto do perfil Responder - Reply to %1$s - Reply to %1$s + Responder para %1$s + Responder para %1$s %1$s %2$s Selecionar Contato @@ -160,7 +161,7 @@ visto visto Convidar Amigos - GLOBAL SEARCH + BUSCA GLOBAL Enviar mensagem para... Digite o nome do grupo @@ -198,16 +199,19 @@ Tempo de autodestruição Desativado Esta imagem é uma visualização da chave criptográfica para esta conversa secreta com ]]>%1$s]]>.
]]>Se esta imagem aparecer da mesma forma no telefone de ]]>%2$s\'s]]>, sua conversa é 200%% segura.
]]>Saiba mais em telegram.org
- Unknown + Desconhecido INFO Telefone - Username - Your Username - Sorry, this username is already taken. - Sorry, this username is invalid. - A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + Nome de Usuário + Seu nome de usuário + Desculpe, este usuário já existe. + Desculpe, este usuário é inválido. + O nome de usuário deve ter pelo menos 5 caracteres. + O nome de usuário não pode exceder 32 caracteres. + Desculpe, o nome de usuário não pode começar com um número. + Você pode escolher um nome de usuário no ]]>Telegram]]>. Assim, outras pessoas poderão te encontrar pelo nome de usuário e entrar em contato sem precisar saber seu telefone.
]]>Você pode usar ]]>a–z]]>, ]]>0–9]]> e underline. O tamanho mínimo é ]]>5]]> caracteres.
+ Verificando nome de usuário... + %1$s está disponível. Restaurar todas as configurações de notificação Tamanho do texto nas mensagens @@ -395,7 +399,7 @@ Telegram]]> permite você acessar suas]]> mensagens de múltiplos dispositivos. Telegram]]> possui mensagens fortemente]]>encriptadas e podem se auto-destruir. Comece a conversar - + %1$d online %1$d online %1$d online @@ -432,42 +436,42 @@ de %1$d contatos de %1$d contatos de %1$d contatos - %1$d seconds - %1$d second - %1$d seconds - %1$d seconds - %1$d seconds - %1$d seconds - %1$d minutes - %1$d minute - %1$d minutes - %1$d minutes - %1$d minutes - %1$d minutes - %1$d hours - %1$d hour - %1$d hours - %1$d hours - %1$d hours - %1$d hours - %1$d days - %1$d day - %1$d days - %1$d days - %1$d days - %1$d days - %1$d weeks - %1$d week - %1$d weeks - %1$d weeks - %1$d weeks - %1$d weeks + %1$d segundos + %1$d segundo + %1$d segundos + %1$d segundos + %1$d segundos + %1$d segundos + %1$d minutos + %1$d minuto + %1$d minutos + %1$d minutos + %1$d minutos + %1$d minutos + %1$d horas + %1$d hora + %1$d horas + %1$d horas + %1$d horas + %1$d horas + %1$d dias + %1$d dia + %1$d dias + %1$d dias + %1$d dias + %1$d dias + %1$d semanas + %1$d semana + %1$d semanas + %1$d semanas + %1$d semanas + %1$d semanas dd MMM dd.MM.yy dd.MM.yyyy d MMMM - d MMMM yyyy + MMMM d, yyyy EEE HH:mm h:mm a diff --git a/TMessagesProj/src/main/res/values-v21/styles.xml b/TMessagesProj/src/main/res/values-v21/styles.xml index e9ca2a04..bf6a1918 100644 --- a/TMessagesProj/src/main/res/values-v21/styles.xml +++ b/TMessagesProj/src/main/res/values-v21/styles.xml @@ -67,7 +67,7 @@ diff --git a/TMessagesProj/src/main/res/values/strings.xml b/TMessagesProj/src/main/res/values/strings.xml index c8188486..5b0071ea 100644 --- a/TMessagesProj/src/main/res/values/strings.xml +++ b/TMessagesProj/src/main/res/values/strings.xml @@ -51,6 +51,7 @@ Delete and exit Hidden Name Select Chat + %1$s is using an older version of Telegram, so secret photos will be shown in compatibility mode.\n\nOnce %2$s updates Telegram, photos with timers for 1 minute or less will start working in \'Tap and hold to view\' mode, and you will be notified whenever the other party takes a screenshot. Broadcast List New Broadcast List @@ -198,7 +199,7 @@ Self-Destruct Timer Off This image is a visualization of the encryption key for this secret chat with ]]>%1$s]]>.
]]>If this image looks the same on ]]>%2$s\'s]]> phone, your chat is 200%% secure.
]]>Learn more at telegram.org
- Unknown + Unknown INFO Phone Username @@ -206,8 +207,11 @@ Sorry, this username is already taken. Sorry, this username is invalid. A username must have at least 5 characters. - Sorry, a username can't start with a number. - You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.\n\nYou can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters. + The username must not exceed 32 characters. + Sorry, a username can\'t start with a number. + You can choose a username on ]]>Telegram]]>. If you do, other people will be able to find you by this username and contact you without knowing your phone number.
]]>You can use ]]>a–z]]>, ]]>0–9]]> and underscores. Minimum length is ]]>5]]> characters.
+ Checking username... + %1$s is available. Reset all notification settings to default Messages Text Size diff --git a/TMessagesProj/src/main/res/values/styles.xml b/TMessagesProj/src/main/res/values/styles.xml index a6dcf0b9..d3f110e3 100644 --- a/TMessagesProj/src/main/res/values/styles.xml +++ b/TMessagesProj/src/main/res/values/styles.xml @@ -59,7 +59,7 @@