diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index d60fb1b6..e57703a9 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -80,7 +80,7 @@ android { defaultConfig { minSdkVersion 8 targetSdkVersion 19 - versionCode 312 + versionCode 315 versionName "1.8.0" } } diff --git a/TMessagesProj/src/main/java/org/telegram/android/ImageLoader.java b/TMessagesProj/src/main/java/org/telegram/android/ImageLoader.java index cf08591c..714479e3 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/ImageLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/android/ImageLoader.java @@ -278,10 +278,7 @@ public class ImageLoader { } } } catch (Exception e) { - if (canDeleteFile && cacheFileFinal != null && cacheFileFinal.length() == 0) { - cacheFileFinal.delete(); - } - FileLog.e("tmessages", e); + //don't promt } return image != null ? new BitmapDrawable(image) : null; } @@ -641,7 +638,8 @@ public class ImageLoader { if (filter != null) { key += "@" + filter; } - if (imageReceiver != null) { + BitmapDrawable bitmapDrawable = memCache.get(key); + if (bitmapDrawable != null && imageReceiver != null) { Integer TAG = imageReceiver.getTag(); if (TAG != null) { CacheImage alreadyLoadingImage = imageLoadingByTag.get(TAG); @@ -650,7 +648,7 @@ public class ImageLoader { } } } - return memCache.get(key); + return bitmapDrawable; } public void replaceImageInCache(final String oldKey, final String newKey) { @@ -744,7 +742,8 @@ public class ImageLoader { } img.addImageView(imageView); imageLoadingByKeys.put(key, img); - cacheOutTasks.add(new CacheOutTask(img)); + img.cacheTask = new CacheOutTask(img); + cacheOutTasks.add(img.cacheTask); runCacheTasks(false); } else { img.url = url; diff --git a/TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java b/TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java index 5ac40331..02aca637 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java +++ b/TMessagesProj/src/main/java/org/telegram/android/ImageReceiver.java @@ -33,7 +33,6 @@ public class ImageReceiver { private int imageX = 0, imageY = 0, imageW = 0, imageH = 0; private Rect drawRegion = new Rect(); private boolean isVisible = true; - private boolean selfSetting = false; private boolean isAspectFit = false; public ImageReceiver() { @@ -106,12 +105,7 @@ public class ImageReceiver { isPlaceholder = true; ImageLoader.getInstance().loadImage(fileLocation, httpUrl, this, size); } else { - selfSetting = true; setImageBitmap(img, currentPath); - selfSetting = false; - } - if (parentView != null) { - parentView.invalidate(); } } @@ -122,7 +116,7 @@ public class ImageReceiver { isPlaceholder = false; ImageLoader.getInstance().incrementUseCount(currentPath); currentImage = bitmap; - if (!selfSetting && parentView != null) { + if (parentView != null) { parentView.invalidate(); } } @@ -193,7 +187,7 @@ public class ImageReceiver { } } - public void draw(Canvas canvas, int x, int y, int w, int h) { + public boolean draw(Canvas canvas, int x, int y, int w, int h) { try { Drawable bitmapDrawable = currentImage; if (bitmapDrawable == null && last_placeholder != null && last_placeholder instanceof BitmapDrawable) { @@ -240,12 +234,14 @@ public class ImageReceiver { } } } + return true; } else if (last_placeholder != null) { drawRegion.set(x, y, x + w, y + h); last_placeholder.setBounds(drawRegion); if (isVisible) { last_placeholder.draw(canvas); } + return true; } } catch (Exception e) { if (currentPath != null) { @@ -255,6 +251,7 @@ public class ImageReceiver { setImage(last_path, last_httpUrl, last_filter, last_placeholder, last_size); FileLog.e("tmessages", e); } + return false; } public Bitmap getBitmap() { diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/android/MessageObject.java index dfb10f03..5ec21af4 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessageObject.java @@ -279,24 +279,20 @@ public class MessageObject { type = 3; } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaContact) { if (isFromMe()) { - contentType = 4; + contentType = 3; type = 12; } else { - contentType = 5; + contentType = 4; type = 13; } } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaUnsupported) { contentType = type = 0; } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaDocument) { + contentType = 1; if (message.media.document.thumb != null && !(message.media.document.thumb instanceof TLRPC.TL_photoSizeEmpty) && message.media.document.mime_type != null && message.media.document.mime_type.equals("image/gif")) { - contentType = 1; type = 8; } else { - if (isFromMe()) { - contentType = type = 8; - } else { - contentType = type = 9; - } + type = 9; } } else if (message.media != null && message.media instanceof TLRPC.TL_messageMediaAudio) { contentType = type = 2; @@ -305,9 +301,11 @@ public class MessageObject { if (message.action instanceof TLRPC.TL_messageActionLoginUnknownLocation) { contentType = type = 0; } else if (message.action instanceof TLRPC.TL_messageActionChatEditPhoto || message.action instanceof TLRPC.TL_messageActionUserUpdatedPhoto) { - contentType = type = 11; + contentType = 8; + type = 11; } else { - contentType = type = 10; + contentType = 7; + type = 10; } } else if (message instanceof TLRPC.TL_messageForwarded) { contentType = type = 0; @@ -417,7 +415,7 @@ public class MessageObject { } private void generateLayout() { - if (type != 0 && type != 1 && type != 8 && type != 9 || messageOwner.to_id == null || messageText == null || messageText.length() == 0) { + if (type != 0 || messageOwner.to_id == null || messageText == null || messageText.length() == 0) { return; } diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java index aa43c96a..a5efd842 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesController.java @@ -170,6 +170,15 @@ public class MessagesController implements NotificationCenter.NotificationCenter user.status = null; user.photo = new TLRPC.TL_userProfilePhotoEmpty(); putUser(user, true); + + user = new TLRPC.TL_userForeign(); + user.phone = "42777"; + user.id = 777000; + user.first_name = "Telegram"; + user.last_name = "Notifications"; + user.status = null; + user.photo = new TLRPC.TL_userProfilePhotoEmpty(); + putUser(user, true); } public static TLRPC.InputUser getInputUser(TLRPC.User user) { @@ -2991,11 +3000,11 @@ public class MessagesController implements NotificationCenter.NotificationCenter UserConfig.saveConfig(false); newMessage.unread = true; newMessage.date = update.date; - newMessage.from_id = 333000; + newMessage.from_id = 777000; newMessage.to_id = new TLRPC.TL_peerUser(); newMessage.to_id.user_id = UserConfig.getClientUserId(); newMessage.out = false; - newMessage.dialog_id = 333000; + newMessage.dialog_id = 777000; messagesArr.add(newMessage); MessageObject obj = new MessageObject(newMessage, usersDict); diff --git a/TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java b/TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java index 7ed8172e..13d194c4 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java +++ b/TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java @@ -31,6 +31,7 @@ import org.telegram.ui.ApplicationLoader; import java.io.File; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -170,7 +171,7 @@ public class MessagesStorage { } catch (Exception e) { FileLog.e("tmessages", e); } - loadUnreadMessages(false); + loadUnreadMessages(); } public void updateDbToVersion3() { @@ -352,7 +353,7 @@ public class MessagesStorage { }); } - public void loadUnreadMessages(final boolean onlyCount) { + public void loadUnreadMessages() { storageQueue.postRunnable(new Runnable() { @Override public void run() { @@ -364,20 +365,18 @@ public class MessagesStorage { long did = cursor.longValue(0); int count = cursor.intValue(1); pushDialogs.put(did, count); - if (!onlyCount) { - if (ids.length() != 0) { - ids += ","; - } - ids += did; + if (ids.length() != 0) { + ids += ","; } + ids += did; } cursor.dispose(); - final ArrayList messages = onlyCount ? null : new ArrayList(); - final ArrayList users = onlyCount ? null : new ArrayList(); - final ArrayList chats = onlyCount ? null : new ArrayList(); - final ArrayList encryptedChats = onlyCount ? null : new ArrayList(); - if (messages != null && ids.length() > 0) { + final ArrayList messages = new ArrayList(); + final ArrayList users = new ArrayList(); + final ArrayList chats = new ArrayList(); + final ArrayList encryptedChats = new ArrayList(); + if (ids.length() > 0) { ArrayList userIds = new ArrayList(); ArrayList chatIds = new ArrayList(); ArrayList encryptedChatIds = new ArrayList(); @@ -510,7 +509,7 @@ public class MessagesStorage { cursor.dispose(); } } - + Collections.reverse(messages); AndroidUtilities.RunOnUIThread(new Runnable() { @Override public void run() { @@ -3595,7 +3594,7 @@ public class MessagesStorage { database.commitTransaction(); - loadUnreadMessages(true); + loadUnreadMessages(); } catch (Exception e) { FileLog.e("tmessages", e); } diff --git a/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java b/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java index 6286c385..0d189ce9 100644 --- a/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java +++ b/TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java @@ -373,6 +373,7 @@ public class NotificationsController { .setContentTitle(name) .setSmallIcon(R.drawable.notification) .setAutoCancel(true) + .setNumber(total_unread_count) .setContentIntent(contentIntent); String lastMessage = null; @@ -577,6 +578,7 @@ public class NotificationsController { } pushMessagesDict.put(messageObject.messageOwner.id, messageObject); pushMessages.add(0, messageObject); + FileLog.e("tmessages", "processNewMessages add dialog = " + dialog_id); } } @@ -607,6 +609,7 @@ public class NotificationsController { Integer currentCount = pushDialogs.get(dialog_id); Integer newCount = entry.getValue(); + FileLog.e("tmessages", "processDialogsUpdateRead dialog = " + dialog_id + " newCount = " + newCount + " oldCount = " + currentCount); if (newCount < 0) { if (currentCount == null) { continue; @@ -646,6 +649,17 @@ public class NotificationsController { MessagesController.getInstance().putChats(chats, true); MessagesController.getInstance().putEncryptedChats(encryptedChats, true); + pushDialogs.clear(); + pushMessages.clear(); + pushMessagesDict.clear(); + total_unread_count = 0; + SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Context.MODE_PRIVATE); + for (HashMap.Entry entry : dialogs.entrySet()) { + pushDialogs.put(entry.getKey(), entry.getValue()); + total_unread_count += entry.getValue(); + FileLog.e("tmessages", "processLoadedUnreadMessages dialog = " + entry.getKey() + " count = " + entry.getValue()); + } + FileLog.e("tmessages", "processLoadedUnreadMessages total = " + total_unread_count + " messages = " + messages.size()); if (messages != null) { for (TLRPC.Message message : messages) { if (pushMessagesDict.containsKey(message.id)) { @@ -660,21 +674,12 @@ public class NotificationsController { pushMessages.add(0, messageObject); } } - - pushDialogs.clear(); - total_unread_count = 0; - SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Context.MODE_PRIVATE); - for (HashMap.Entry entry : dialogs.entrySet()) { - pushDialogs.put(entry.getKey(), entry.getValue()); - total_unread_count += entry.getValue(); - } if (total_unread_count == 0) { - pushMessages.clear(); - pushMessagesDict.clear(); popupMessages.clear(); showOrUpdateNotification(false); NotificationCenter.getInstance().postNotificationName(NotificationCenter.pushMessagesUpdated); } + if (preferences.getBoolean("badgeNumber", true)) { setBadge(ApplicationLoader.applicationContext, total_unread_count); } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java index 7903e768..163b54a6 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/Utilities.java @@ -547,7 +547,7 @@ public class Utilities { } public static int getUserAvatarForId(int id) { - if (id / 1000 == 333) { + if (id / 1000 == 333 || id / 1000 == 777) { return R.drawable.telegram_avatar; } return arrUsersAvatars[getColorIndex(id)]; 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 2798d818..bedb1568 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatAudioCell.java @@ -60,7 +60,7 @@ public class ChatAudioCell extends ChatBaseCell implements SeekBar.SeekBarDelega private String currentNameString; public ChatAudioCell(Context context) { - super(context, false); + super(context); TAG = MediaController.getInstance().generateObserverTag(); avatarImage = new ImageReceiver(this); 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 f9c357ab..41365d4e 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatBaseCell.java @@ -146,10 +146,9 @@ public class ChatBaseCell extends BaseCell { } } - public ChatBaseCell(Context context, boolean isMedia) { + public ChatBaseCell(Context context) { super(context); init(); - media = isMedia; avatarImage = new ImageReceiver(this); } 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 8d37efe9..dfb635bf 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMediaCell.java @@ -16,11 +16,13 @@ import android.graphics.drawable.Drawable; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; +import android.text.TextUtils; import android.view.MotionEvent; import android.view.SoundEffectConstants; import org.telegram.android.AndroidUtilities; import org.telegram.android.ImageLoader; +import org.telegram.android.LocaleController; import org.telegram.messenger.FileLoader; import org.telegram.android.MediaController; import org.telegram.messenger.R; @@ -43,10 +45,15 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD private static Drawable placeholderInDrawable; private static Drawable placeholderOutDrawable; + private static Drawable placeholderDocInDrawable; + private static Drawable placeholderDocOutDrawable; private static Drawable videoIconDrawable; private static Drawable[] buttonStatesDrawables = new Drawable[4]; + private static Drawable[][] buttonStatesDrawablesDoc = new Drawable[2][2]; private static TextPaint infoPaint; private static MessageObject lastDownloadedGifMessage = null; + private static TextPaint namePaint; + private static Paint docBackPaint; private GifDrawable gifDrawable = null; @@ -74,23 +81,38 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD private int infoOffset = 0; private String currentInfoString; + private StaticLayout nameLayout; + private int nameWidth = 0; + private String currentNameString; + public ChatMediaCellDelegate mediaDelegate = null; public ChatMediaCell(Context context) { - super(context, true); + super(context); if (placeholderInDrawable == null) { placeholderInDrawable = getResources().getDrawable(R.drawable.photo_placeholder_in); placeholderOutDrawable = getResources().getDrawable(R.drawable.photo_placeholder_out); + placeholderDocInDrawable = getResources().getDrawable(R.drawable.doc_blue); + placeholderDocOutDrawable = getResources().getDrawable(R.drawable.doc_green); buttonStatesDrawables[0] = getResources().getDrawable(R.drawable.photoload); buttonStatesDrawables[1] = getResources().getDrawable(R.drawable.photocancel); buttonStatesDrawables[2] = getResources().getDrawable(R.drawable.photogif); buttonStatesDrawables[3] = getResources().getDrawable(R.drawable.playvideo); + buttonStatesDrawablesDoc[0][0] = getResources().getDrawable(R.drawable.docload_b); + buttonStatesDrawablesDoc[1][0] = getResources().getDrawable(R.drawable.doccancel_b); + buttonStatesDrawablesDoc[0][1] = getResources().getDrawable(R.drawable.docload_g); + buttonStatesDrawablesDoc[1][1] = getResources().getDrawable(R.drawable.doccancel_g); videoIconDrawable = getResources().getDrawable(R.drawable.ic_video); infoPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - infoPaint.setColor(0xffffffff); infoPaint.setTextSize(AndroidUtilities.dp(12)); + + namePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + namePaint.setColor(0xff000000); + namePaint.setTextSize(AndroidUtilities.dp(16)); + + docBackPaint = new Paint(); } TAG = MediaController.getInstance().generateObserverTag(); @@ -135,7 +157,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD buttonPressed = 1; invalidate(); result = true; - } else if (photoImage.isInsideImage(x, y)) { + } else if (x >= photoImage.getImageX() && x <= photoImage.getImageX() + backgroundWidth && y >= photoImage.getImageY() && y <= photoImage.getImageY() + photoImage.getImageHeight()) { imagePressed = true; result = true; } @@ -213,6 +235,12 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD if (mediaDelegate != null) { mediaDelegate.didPressedImage(this); } + } else if (currentMessageObject.type == 9) { + if (buttonState == -1) { + if (mediaDelegate != null) { + mediaDelegate.didPressedImage(this); + } + } } } @@ -225,7 +253,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD } else { photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, currentMessageObject.isOut() ? placeholderOutDrawable : placeholderInDrawable, currentPhotoObject.photoOwner.size); } - } else if (currentMessageObject.type == 8) { + } else if (currentMessageObject.type == 8 || currentMessageObject.type == 9) { FileLoader.getInstance().loadFile(currentMessageObject.messageOwner.media.document); lastDownloadedGifMessage = currentMessageObject; } else if (currentMessageObject.type == 3) { @@ -243,7 +271,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD cancelLoading = true; if (currentMessageObject.type == 1) { ImageLoader.getInstance().cancelLoadingForImageView(photoImage); - } else if (currentMessageObject.type == 8) { + } else if (currentMessageObject.type == 8 || currentMessageObject.type == 9) { FileLoader.getInstance().cancelLoadFile(currentMessageObject.messageOwner.media.document); if (lastDownloadedGifMessage != null && lastDownloadedGifMessage.messageOwner.id == currentMessageObject.messageOwner.id) { lastDownloadedGifMessage = null; @@ -297,6 +325,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD @Override public void setMessageObject(MessageObject messageObject) { + media = messageObject.type != 9; if (currentMessageObject != messageObject || isPhotoDataChanged(messageObject) || isUserDataChanged()) { super.setMessageObject(messageObject); cancelLoading = false; @@ -308,7 +337,41 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD currentUrl = null; photoNotSet = false; - if (messageObject.type == 8) { + if (messageObject.type == 9) { + String name = messageObject.messageOwner.media.document.file_name; + if (name == null || name.length() == 0) { + name = LocaleController.getString("AttachDocument", R.string.AttachDocument); + } + int maxWidth = Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) - AndroidUtilities.dp(122 + 86 + 24); + if (currentNameString == null || !currentNameString.equals(name)) { + currentNameString = name; + nameWidth = (int) Math.ceil(namePaint.measureText(currentNameString)); + nameWidth = Math.min(maxWidth, (int) Math.ceil(namePaint.measureText(currentNameString))); + CharSequence str = TextUtils.ellipsize(currentNameString, namePaint, nameWidth, TextUtils.TruncateAt.END); + nameLayout = new StaticLayout(str, namePaint, nameWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + } + + String fileName = messageObject.getFileName(); + int idx = fileName.lastIndexOf("."); + String ext = null; + if (idx != -1) { + ext = fileName.substring(idx + 1); + } + if (ext == null || ext.length() == 0) { + ext = messageObject.messageOwner.media.document.mime_type; + } + ext = ext.toUpperCase(); + + String str = Utilities.formatFileSize(messageObject.messageOwner.media.document.size) + " " + ext; + + if (currentInfoString == null || !currentInfoString.equals(str)) { + currentInfoString = str; + infoOffset = 0; + infoWidth = Math.min(maxWidth, (int) Math.ceil(infoPaint.measureText(currentInfoString))); + CharSequence str2 = TextUtils.ellipsize(currentInfoString, infoPaint, infoWidth, TextUtils.TruncateAt.END); + infoLayout = new StaticLayout(str2, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); + } + } else if (messageObject.type == 8) { gifDrawable = MediaController.getInstance().getGifDrawable(this, false); String str = Utilities.formatFileSize(messageObject.messageOwner.media.document.size); @@ -318,6 +381,8 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD infoWidth = (int) Math.ceil(infoPaint.measureText(currentInfoString)); infoLayout = new StaticLayout(currentInfoString, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } + nameLayout = null; + currentNameString = null; } else if (messageObject.type == 3) { int duration = messageObject.messageOwner.media.video.duration; int minutes = duration / 60; @@ -329,12 +394,31 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD infoWidth = (int) Math.ceil(infoPaint.measureText(currentInfoString)); infoLayout = new StaticLayout(currentInfoString, infoPaint, infoWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); } + nameLayout = null; + currentNameString = null; } else { currentInfoString = null; + currentNameString = null; infoLayout = null; + nameLayout = null; } - if (messageObject.type == 4) { + if (messageObject.type == 9) { + photoWidth = AndroidUtilities.dp(86); + photoHeight = AndroidUtilities.dp(86); + backgroundWidth = photoWidth + Math.max(nameWidth, infoWidth) + AndroidUtilities.dp(40); + currentPhotoObject = PhotoObject.getClosestImageWithSize(messageObject.photoThumbs, 800, 800); + if (currentPhotoObject != null) { + if (currentPhotoObject.image != null) { + photoImage.setImageBitmap(currentPhotoObject.image); + } else { + currentPhotoFilter = String.format(Locale.US, "%d_%d_b", photoWidth, photoHeight); + photoImage.setImage(currentPhotoObject.photoOwner.location, currentPhotoFilter, null, currentPhotoObject.photoOwner.size); + } + } else { + photoImage.setImageBitmap((BitmapDrawable)null); + } + } else if (messageObject.type == 4) { photoWidth = AndroidUtilities.dp(100); photoHeight = AndroidUtilities.dp(100); backgroundWidth = photoWidth + AndroidUtilities.dp(12); @@ -446,7 +530,7 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD } fileName = FileLoader.getAttachFileName(currentPhotoObject.photoOwner); cacheFile = new File(AndroidUtilities.getCacheDir(), fileName); - } else if (currentMessageObject.type == 8 || currentMessageObject.type == 3) { + } else if (currentMessageObject.type == 8 || currentMessageObject.type == 3 || currentMessageObject.type == 9) { if (currentMessageObject.messageOwner.attachPath != null && currentMessageObject.messageOwner.attachPath.length() != 0) { File f = new File(currentMessageObject.messageOwner.attachPath); if (f.exists()) { @@ -530,7 +614,11 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD int x; if (currentMessageObject.isOut()) { - x = layoutWidth - backgroundWidth - AndroidUtilities.dp(3); + if (media) { + x = layoutWidth - backgroundWidth - AndroidUtilities.dp(3); + } else { + x = layoutWidth - backgroundWidth + AndroidUtilities.dp(6); + } } else { if (isChat) { x = AndroidUtilities.dp(67); @@ -542,11 +630,12 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD int size = AndroidUtilities.dp(44); buttonX = (int)(x + (photoWidth - size) / 2.0f); buttonY = (int)(AndroidUtilities.dp(7) + (photoHeight - size) / 2.0f); - progressView.rect.set(buttonX + AndroidUtilities.dp(2), buttonY + AndroidUtilities.dp(2), buttonX + AndroidUtilities.dp(42), buttonY + AndroidUtilities.dp(42)); + progressView.rect.set(buttonX + AndroidUtilities.dp(1), buttonY + AndroidUtilities.dp(1), buttonX + AndroidUtilities.dp(43), buttonY + AndroidUtilities.dp(43)); } @Override protected void onAfterBackgroundDraw(Canvas canvas) { + boolean imageDrawn = false; if (gifDrawable != null) { canvas.save(); gifDrawable.setBounds(photoImage.getImageX(), photoImage.getImageY(), photoImage.getImageX() + photoWidth, photoImage.getImageY() + photoHeight); @@ -554,12 +643,46 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD canvas.restore(); } else { photoImage.setVisible(!PhotoViewer.getInstance().isShowingImage(currentMessageObject), false); - photoImage.draw(canvas, photoImage.getImageX(), photoImage.getImageY(), photoWidth, photoHeight); + imageDrawn = photoImage.draw(canvas, photoImage.getImageX(), photoImage.getImageY(), photoWidth, photoHeight); drawTime = photoImage.getVisible(); } + if (currentMessageObject.type == 9) { + if (currentMessageObject.isOut()) { + infoPaint.setColor(0xff75b166); + docBackPaint.setColor(0xffd0f3b3); + } else { + infoPaint.setColor(0xffa1adbb); + docBackPaint.setColor(0xffebf0f5); + } + + if (!imageDrawn) { + canvas.drawRect(photoImage.getImageX(), photoImage.getImageY(), photoImage.getImageX() + photoImage.getImageWidth(), photoImage.getImageY() + photoImage.getImageHeight(), docBackPaint); + + if (buttonState == -1) { + Drawable drawable = currentMessageObject.isOut() ? placeholderDocOutDrawable : placeholderDocInDrawable; + setDrawableBounds(drawable, photoImage.getImageX() + AndroidUtilities.dp(27), photoImage.getImageY() + AndroidUtilities.dp(27)); + drawable.draw(canvas); + } + if (currentMessageObject.isOut()) { + progressView.setColor(0xff81bd72); + } else { + progressView.setColor(0xffadbdcc); + } + } else { + progressView.setColor(0xffffffff); + } + } else { + progressView.setColor(0xffffffff); + } + if (buttonState >= 0 && buttonState < 4) { - Drawable currentButtonDrawable = buttonStatesDrawables[buttonState]; + Drawable currentButtonDrawable = null; + if (currentMessageObject.type == 9 && !imageDrawn) { + currentButtonDrawable = buttonStatesDrawablesDoc[buttonState][currentMessageObject.isOut() ? 1 : 0]; + } else { + currentButtonDrawable = buttonStatesDrawables[buttonState]; + } setDrawableBounds(currentButtonDrawable, buttonX, buttonY); currentButtonDrawable.draw(canvas); } @@ -568,7 +691,20 @@ public class ChatMediaCell extends ChatBaseCell implements MediaController.FileD progressView.draw(canvas); } - if (infoLayout != null && (buttonState == 1 || buttonState == 0 || buttonState == 3)) { + if (nameLayout != null) { + canvas.save(); + canvas.translate(photoImage.getImageX() + photoImage.getImageWidth() + AndroidUtilities.dp(10), photoImage.getImageY() + AndroidUtilities.dp(8)); + nameLayout.draw(canvas); + canvas.restore(); + + if (infoLayout != null) { + canvas.save(); + canvas.translate(photoImage.getImageX() + photoImage.getImageWidth() + AndroidUtilities.dp(10), photoImage.getImageY() + AndroidUtilities.dp(30)); + infoLayout.draw(canvas); + canvas.restore(); + } + } else if (infoLayout != null && (buttonState == 1 || buttonState == 0 || buttonState == 3)) { + 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/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index 85693349..8d03bfb0 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -29,7 +29,7 @@ public class ChatMessageCell extends ChatBaseCell { private int totalVisibleBlocksCount = 0; public ChatMessageCell(Context context) { - super(context, false); + super(context); drawForwardedName = true; } 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 823a5ae1..20213837 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatOrUserCell.java @@ -405,6 +405,7 @@ public class ChatOrUserCell extends BaseCell { } avatarImage.setImageCoords(avatarLeft, avatarTop, AndroidUtilities.dp(50), AndroidUtilities.dp(50)); + double widthpx = 0; float left = 0; if (LocaleController.isRTL) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 5f0d48e1..3963b7cd 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -43,7 +43,6 @@ import android.widget.AdapterView; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; -import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; @@ -62,7 +61,6 @@ import org.telegram.messenger.FileLog; import org.telegram.android.MessageObject; import org.telegram.android.PhotoObject; import org.telegram.messenger.ConnectionsManager; -import org.telegram.messenger.FileLoader; import org.telegram.android.MessagesController; import org.telegram.android.NotificationCenter; import org.telegram.messenger.R; @@ -149,7 +147,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private boolean firstLoading = true; private int minDate = 0; - private int progressTag = 0; private boolean first = true; private int unread_to_load = 0; private int first_unread_id = 0; @@ -163,10 +160,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not private TLRPC.ChatParticipants info = null; private int onlineCount = -1; - private HashMap progressBarMap = new HashMap(); - private HashMap> loadingFile = new HashMap>(); - private HashMap progressByTag = new HashMap(); - private CharSequence lastPrintString; private long chatEnterTime = 0; @@ -341,10 +334,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not NotificationCenter.getInstance().addObserver(this, NotificationCenter.encryptedChatUpdated); NotificationCenter.getInstance().addObserver(this, NotificationCenter.messagesReadedEncrypted); NotificationCenter.getInstance().addObserver(this, NotificationCenter.removeAllMessagesFromDialog); - NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileUploadProgressChanged); - NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileDidFailedLoad); - NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileDidLoaded); - NotificationCenter.getInstance().addObserver(this, NotificationCenter.FileLoadProgressChanged); NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioProgressDidChanged); NotificationCenter.getInstance().addObserver(this, NotificationCenter.audioDidReset); NotificationCenter.getInstance().addObserver(this, NotificationCenter.screenshotTook); @@ -381,10 +370,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not NotificationCenter.getInstance().removeObserver(this, NotificationCenter.encryptedChatUpdated); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.messagesReadedEncrypted); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.removeAllMessagesFromDialog); - NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileUploadProgressChanged); - NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileDidFailedLoad); - NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileDidLoaded); - NotificationCenter.getInstance().removeObserver(this, NotificationCenter.FileLoadProgressChanged); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.contactsDidLoaded); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioProgressDidChanged); NotificationCenter.getInstance().removeObserver(this, NotificationCenter.audioDidReset); @@ -715,7 +700,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } emptyView.setPadding(AndroidUtilities.dp(7), AndroidUtilities.dp(1), AndroidUtilities.dp(7), AndroidUtilities.dp(1)); - if (currentUser != null && currentUser.id / 1000 == 333) { + if (currentUser != null && (currentUser.id / 1000 == 333 || currentUser.id % 1000 == 0)) { emptyView.setText(LocaleController.getString("GotAQuestion", R.string.GotAQuestion)); } @@ -1048,22 +1033,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } - private void addToLoadingFile(String path, ProgressBar bar) { - ArrayList arr = loadingFile.get(path); - if (arr == null) { - arr = new ArrayList(); - loadingFile.put(path, arr); - } - arr.add(bar); - } - - private void removeFromloadingFile(String path, ProgressBar bar) { - ArrayList arr = loadingFile.get(path); - if (arr != null) { - arr.remove(bar); - } - } - private void updateOnlineCount() { if (info == null) { return; @@ -1094,7 +1063,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not return -1; } } else { - if (messageObject.type == 7) { + if (messageObject.type == 6) { return -1; } else if (messageObject.type == 10 || messageObject.type == 11) { if (messageObject.messageOwner.id == 0) { @@ -1136,7 +1105,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } } } else { - if (messageObject.type == 7) { + if (messageObject.type == 6) { return -1; } else if (messageObject.messageOwner.send_state == MessageObject.MESSAGE_SEND_STATE_SEND_ERROR) { if (!(messageObject.messageOwner.media instanceof TLRPC.TL_messageMediaEmpty)) { @@ -1775,7 +1744,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not dateMsg.message = LocaleController.formatDateChat(obj.messageOwner.date); dateMsg.id = 0; MessageObject dateObj = new MessageObject(dateMsg, null); - dateObj.contentType = dateObj.type = 10; + dateObj.type = 10; + dateObj.contentType = 7; if (forwardLoad) { messages.add(0, dateObj); } else { @@ -1798,7 +1768,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not dateMsg.message = ""; dateMsg.id = 0; MessageObject dateObj = new MessageObject(dateMsg, null); - dateObj.contentType = dateObj.type = 7; + dateObj.contentType = dateObj.type = 6; boolean dateAdded = true; if (a != messArr.size() - 1) { MessageObject next = messArr.get(a + 1); @@ -2012,9 +1982,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (minDate == 0 || obj.messageOwner.date < minDate) { minDate = obj.messageOwner.date; } - if (obj.messageOwner.attachPath != null && obj.messageOwner.attachPath.length() != 0) { - progressBarMap.put(obj.messageOwner.attachPath, null); - } if (obj.isOut()) { removeUnreadPlane(false); @@ -2042,7 +2009,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not dateMsg.message = LocaleController.formatDateChat(obj.messageOwner.date); dateMsg.id = 0; MessageObject dateObj = new MessageObject(dateMsg, null); - dateObj.contentType = dateObj.type = 10; + dateObj.type = 10; + dateObj.contentType = 7; messages.add(0, dateObj); } if (!obj.isOut() && obj.messageOwner.unread) { @@ -2177,17 +2145,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not obj.messageOwner.id = newMsgId; obj.messageOwner.send_state = MessageObject.MESSAGE_SEND_STATE_SENT; updateVisibleRows(); - if (obj.messageOwner.attachPath != null && obj.messageOwner.attachPath.length() != 0) { - progressBarMap.remove(obj.messageOwner.attachPath); - } } } else if (id == NotificationCenter.messageReceivedByAck) { Integer msgId = (Integer)args[0]; MessageObject obj = messagesDict.get(msgId); if (obj != null) { - if (obj.messageOwner.attachPath != null && obj.messageOwner.attachPath.length() != 0) { - progressBarMap.remove(obj.messageOwner.attachPath); - } obj.messageOwner.send_state = MessageObject.MESSAGE_SEND_STATE_SENT; updateVisibleRows(); } @@ -2197,9 +2159,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (obj != null) { obj.messageOwner.send_state = MessageObject.MESSAGE_SEND_STATE_SEND_ERROR; updateVisibleRows(); - if (obj.messageOwner.attachPath != null && obj.messageOwner.attachPath.length() != 0) { - progressBarMap.remove(obj.messageOwner.attachPath); - } } } else if (id == NotificationCenter.chatInfoDidLoaded) { int chatId = (Integer)args[0]; @@ -2210,40 +2169,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not SendMessagesHelper.getInstance().setCurrentChatInfo(info); } } - } else if (id == NotificationCenter.FileUploadProgressChanged) { - String location = (String)args[0]; - boolean enc = (Boolean)args[2]; - if (enc && currentEncryptedChat == null) { - return; - } else if (!enc && currentEncryptedChat != null) { - return; - } - ProgressBar bar; - if ((bar = progressBarMap.get(location)) != null) { - Float progress = (Float)args[1]; - bar.setProgress((int) (progress * 100)); - } - } else if (id == NotificationCenter.FileDidFailedLoad) { - String location = (String)args[0]; - if (loadingFile.containsKey(location)) { - loadingFile.remove(location); - updateVisibleRows(); - } - } else if (id == NotificationCenter.FileDidLoaded) { - String location = (String)args[0]; - if (loadingFile.containsKey(location)) { - loadingFile.remove(location); - updateVisibleRows(); - } - } else if (id == NotificationCenter.FileLoadProgressChanged) { - String location = (String)args[0]; - ArrayList arr = loadingFile.get(location); - if (arr != null) { - Float progress = (Float)args[1]; - for (ProgressBar bar : arr) { - bar.setProgress((int)(progress * 100)); - } - } } else if (id == NotificationCenter.contactsDidLoaded) { updateContactStatus(); updateSubtitle(); @@ -2368,12 +2293,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not currentUser = user; } if (currentEncryptedChat != null && !(currentEncryptedChat instanceof TLRPC.TL_encryptedChat) - || currentUser.id / 1000 == 333 - || currentUser.id / 1000 == 777 + || currentUser.id / 1000 == 333 || currentUser.id / 1000 == 777 || currentUser instanceof TLRPC.TL_userEmpty || currentUser instanceof TLRPC.TL_userDeleted - || (currentUser.phone != null && currentUser.phone.length() != 0 && - ContactsController.getInstance().contactsDict.get(currentUser.id) != null && - (ContactsController.getInstance().contactsDict.size() != 0 || !ContactsController.getInstance().isLoadingContacts()))) { + || ContactsController.getInstance().isLoadingContacts() + || (currentUser.phone != null && currentUser.phone.length() != 0 && ContactsController.getInstance().contactsDict.get(currentUser.id) != null && (ContactsController.getInstance().contactsDict.size() != 0 || !ContactsController.getInstance().isLoadingContacts()))) { topPanel.setVisibility(View.GONE); } else { topPanel.setVisibility(View.VISIBLE); @@ -2868,7 +2791,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, getParentActivity(), 1, null); } else if (selectedObject.type == 1) { MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, getParentActivity(), 0, null); - } else if (selectedObject.type == 8 || selectedObject.type == 9) { + } else if (selectedObject.type == 8) { MediaController.saveFile(fileName, selectedObject.messageOwner.attachPath, getParentActivity(), 2, selectedObject.messageOwner.media.document.file_name); } } else if (option == 5) { @@ -3080,12 +3003,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } else if (messageType == 13) { holder.chatBubbleView.setBackgroundResource(R.drawable.chat_incoming_text_states); holder.chatBubbleView.setPadding(AndroidUtilities.dp(15), AndroidUtilities.dp(6), AndroidUtilities.dp(9), 0); - } else if (messageType == 8) { - holder.chatBubbleView.setBackgroundResource(R.drawable.chat_outgoing_text_states); - holder.chatBubbleView.setPadding(AndroidUtilities.dp(9), AndroidUtilities.dp(9), AndroidUtilities.dp(18), 0); - } else if (messageType == 9) { - holder.chatBubbleView.setBackgroundResource(R.drawable.chat_incoming_text_states); - holder.chatBubbleView.setPadding(AndroidUtilities.dp(18), AndroidUtilities.dp(9), AndroidUtilities.dp(9), 0); } } else { if (messageType == 12) { @@ -3102,20 +3019,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in); } holder.chatBubbleView.setPadding(AndroidUtilities.dp(15), AndroidUtilities.dp(6), AndroidUtilities.dp(9), 0); - } else if (messageType == 8) { - if (selected) { - holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out_selected); - } else { - holder.chatBubbleView.setBackgroundResource(R.drawable.msg_out); - } - holder.chatBubbleView.setPadding(AndroidUtilities.dp(9), AndroidUtilities.dp(9), AndroidUtilities.dp(18), 0); - } else if (messageType == 9) { - if (selected) { - holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in_selected); - } else { - holder.chatBubbleView.setBackgroundResource(R.drawable.msg_in); - } - holder.chatBubbleView.setPadding(AndroidUtilities.dp(18), AndroidUtilities.dp(9), AndroidUtilities.dp(9), 0); } } } @@ -3277,28 +3180,20 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not view = new ChatMessageCell(mContext); } if (type == 1) { view = new ChatMediaCell(mContext); - } else if (type == 10) { + } else if (type == 7) { view = li.inflate(R.layout.chat_action_message_layout, viewGroup, false); - } else if (type == 11) { + } else if (type == 8) { view = li.inflate(R.layout.chat_action_change_photo_layout, viewGroup, false); - } else if (type == 4) { + } else if (type == 3) { view = li.inflate(R.layout.chat_outgoing_contact_layout, viewGroup, false); - } else if (type == 5) { + } else if (type == 4) { if (currentChat != null) { view = li.inflate(R.layout.chat_group_incoming_contact_layout, viewGroup, false); } else { view = li.inflate(R.layout.chat_incoming_contact_layout, viewGroup, false); } - } else if (type == 7) { + } else if (type == 6) { view = li.inflate(R.layout.chat_unread_layout, viewGroup, false); - } else if (type == 8) { - view = li.inflate(R.layout.chat_outgoing_document_layout, viewGroup, false); - } else if (type == 9) { - if (currentChat != null) { - view = li.inflate(R.layout.chat_group_incoming_document_layout, viewGroup, false); - } else { - view = li.inflate(R.layout.chat_incoming_document_layout, viewGroup, false); - } } else if (type == 2) { view = new ChatAudioCell(mContext); } @@ -3383,6 +3278,48 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not LocationActivity fragment = new LocationActivity(); fragment.setMessageObject(message); presentFragment(fragment); + } else if (message.type == 9) { + File f = null; + String fileName = message.getFileName(); + if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { + f = new File(message.messageOwner.attachPath); + } + if (f == null || f != null && !f.exists()) { + f = new File(AndroidUtilities.getCacheDir(), fileName); + } + if (f != null && f.exists()) { + String realMimeType = null; + try { + Intent intent = new Intent(Intent.ACTION_VIEW); + if (message.type == 8 || message.type == 9) { + MimeTypeMap myMime = MimeTypeMap.getSingleton(); + int idx = fileName.lastIndexOf("."); + if (idx != -1) { + String ext = fileName.substring(idx + 1); + realMimeType = myMime.getMimeTypeFromExtension(ext.toLowerCase()); + if (realMimeType != null) { + intent.setDataAndType(Uri.fromFile(f), realMimeType); + } else { + intent.setDataAndType(Uri.fromFile(f), "text/plain"); + } + } else { + intent.setDataAndType(Uri.fromFile(f), "text/plain"); + } + } + if (realMimeType != null) { + try { + getParentActivity().startActivity(intent); + } catch (Exception e) { + intent.setDataAndType(Uri.fromFile(f), "text/plain"); + getParentActivity().startActivity(intent); + } + } else { + getParentActivity().startActivity(intent); + } + } catch (Exception e) { + alertUserOpenError(message); + } + } } } }; @@ -3414,11 +3351,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (!endReached && messages.size() != 0) { offset = 0; if (i == 0) { - return 6; + return 5; } } if (!unread_end_reached && i == (messages.size() + 1 - offset)) { - return 6; + return 5; } MessageObject message = messages.get(messages.size() - i - offset); return message.contentType; @@ -3426,7 +3363,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not @Override public int getViewTypeCount() { - return 12; + return 9; } @Override @@ -3453,8 +3390,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not public BackupImageView photoImage; public ImageView halfCheckImage; public ImageView checkImage; - public TextView actionAttachButton; - public TextView videoTimeText; public MessageObject message; public TextView phoneTextView; public BackupImageView contactAvatar; @@ -3463,14 +3398,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not public View addContactView; public View chatBubbleView; - public ProgressBar actionProgress; - public View actionView; - public ImageView actionCancelButton; - - private PhotoObject photoObjectToSet = null; - private File photoFile = null; - private String photoFilter = null; - public void update() { TLRPC.User fromUser = MessagesController.getInstance().getUser(message.messageOwner.from_id); @@ -3556,51 +3483,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not contactAvatar.setImageResource(Utilities.getUserAvatarForId(message.messageOwner.media.user_id)); addContactView.setVisibility(View.GONE); } - } else if (type == 7) { + } else if (type == 6) { messageTextView.setTextSize(16); messageTextView.setText(LocaleController.formatPluralString("NewMessages", unread_to_load)); - } else if (type == 8 || type == 9) { - TLRPC.Document document = message.messageOwner.media.document; - if (document instanceof TLRPC.TL_document || document instanceof TLRPC.TL_documentEncrypted) { - nameTextView.setText(message.messageOwner.media.document.file_name); - - String fileName = message.getFileName(); - int idx = fileName.lastIndexOf("."); - String ext = null; - if (idx != -1) { - ext = fileName.substring(idx + 1); - } - if (ext == null || ext.length() == 0) { - ext = message.messageOwner.media.document.mime_type; - } - ext = ext.toUpperCase(); - if (document.size < 1024) { - phoneTextView.setText(String.format("%d B %s", document.size, ext)); - } else if (document.size < 1024 * 1024) { - phoneTextView.setText(String.format("%.1f KB %s", document.size / 1024.0f, ext)); - } else { - phoneTextView.setText(String.format("%.1f MB %s", document.size / 1024.0f / 1024.0f, ext)); - } - if (document.thumb instanceof TLRPC.TL_photoSize) { - contactAvatar.setImage(document.thumb.location, "50_50", type == 8 ? R.drawable.doc_green : R.drawable.doc_blue); - } else if (document.thumb instanceof TLRPC.TL_photoCachedSize) { - contactAvatar.setImage(document.thumb.location, "50_50", type == 8 ? R.drawable.doc_green : R.drawable.doc_blue); - } else { - if (type == 8) { - contactAvatar.setImageResource(R.drawable.doc_green); - } else { - contactAvatar.setImageResource(R.drawable.doc_blue); - } - } - } else { - nameTextView.setText("Error"); - phoneTextView.setText("Error"); - if (type == 8) { - contactAvatar.setImageResource(R.drawable.doc_green); - } else { - contactAvatar.setImageResource(R.drawable.doc_blue); - } - } } if (message.isFromMe()) { @@ -3609,37 +3494,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not checkImage.setVisibility(View.INVISIBLE); halfCheckImage.setImageResource(R.drawable.msg_clock); halfCheckImage.setVisibility(View.VISIBLE); - if (actionView != null) { - if (actionView != null) { - actionView.setVisibility(View.VISIBLE); - } - Float progress = null; - if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { - progress = FileLoader.getInstance().getFileProgress(message.messageOwner.attachPath); - progressByTag.put((Integer)actionProgress.getTag(), message.messageOwner.attachPath); - progressBarMap.put(message.messageOwner.attachPath, actionProgress); - } - if (progress != null) { - actionProgress.setProgress((int)(progress * 100)); - } else { - actionProgress.setProgress(0); - } - } - if (actionAttachButton != null) { - actionAttachButton.setVisibility(View.GONE); - } } else if (message.messageOwner.send_state == MessageObject.MESSAGE_SEND_STATE_SEND_ERROR) { halfCheckImage.setVisibility(View.VISIBLE); halfCheckImage.setImageResource(R.drawable.msg_warning); if (checkImage != null) { checkImage.setVisibility(View.INVISIBLE); } - if (actionView != null) { - actionView.setVisibility(View.GONE); - } - if (actionAttachButton != null) { - actionAttachButton.setVisibility(View.GONE); - } } else if (message.messageOwner.send_state == MessageObject.MESSAGE_SEND_STATE_SENT) { if (!message.messageOwner.unread) { halfCheckImage.setVisibility(View.VISIBLE); @@ -3650,108 +3510,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not checkImage.setVisibility(View.INVISIBLE); halfCheckImage.setImageResource(R.drawable.msg_check); } - if (actionView != null) { - actionView.setVisibility(View.GONE); - } - if (actionAttachButton != null) { - actionAttachButton.setVisibility(View.VISIBLE); - } } } } - if (message.type == 8 || message.type == 9) { - Integer tag = (Integer)actionProgress.getTag(); - String file = progressByTag.get(tag); - if (file != null) { - removeFromloadingFile(file, actionProgress); - } - if (message.messageOwner.send_state != MessageObject.MESSAGE_SEND_STATE_SENDING && message.messageOwner.send_state != MessageObject.MESSAGE_SEND_STATE_SEND_ERROR) { - if (file != null) { - progressBarMap.remove(file); - } - String fileName = message.getFileName(); - boolean load = false; - if (message.type != 2 && message.type != 3 && message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { - File f = new File(message.messageOwner.attachPath); - if (f.exists()) { - if (actionAttachButton != null) { - actionAttachButton.setVisibility(View.VISIBLE); - if (message.type == 8 || message.type == 9) { - actionAttachButton.setText(LocaleController.getString("Open", R.string.Open)); - } - } - if (actionView != null) { - actionView.setVisibility(View.GONE); - } - } else { - load = true; - } - } - if (load && message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0 || !load && (message.messageOwner.attachPath == null || message.messageOwner.attachPath.length() == 0)) { - File cacheFile = null; - if ((cacheFile = new File(AndroidUtilities.getCacheDir(), fileName)).exists()) { - if (actionAttachButton != null) { - actionAttachButton.setVisibility(View.VISIBLE); - if (message.type == 8 || message.type == 9) { - actionAttachButton.setText(LocaleController.getString("Open", R.string.Open)); - } - } - if (actionView != null) { - actionView.setVisibility(View.GONE); - } - load = false; - } else { - load = true; - } - } - if (load) { - Float progress = FileLoader.getInstance().getFileProgress(fileName); - if (loadingFile.containsKey(fileName) || progress != null) { - if (progress != null) { - actionProgress.setProgress((int)(progress * 100)); - } else { - actionProgress.setProgress(0); - } - progressByTag.put((Integer)actionProgress.getTag(), fileName); - addToLoadingFile(fileName, actionProgress); - if (actionView != null) { - actionView.setVisibility(View.VISIBLE); - } - if (actionAttachButton != null) { - actionAttachButton.setVisibility(View.GONE); - } - } else { - if (actionView != null) { - actionView.setVisibility(View.GONE); - } - if (actionAttachButton != null) { - actionAttachButton.setVisibility(View.VISIBLE); - if (message.type == 8 || message.type == 9) { - actionAttachButton.setText(LocaleController.getString("DOWNLOAD", R.string.DOWNLOAD)); - } - } - } - } - } - if (message.type == 8 || message.type == 9) { - int width; - if (currentChat != null && type != 8) { - if (actionView.getVisibility() == View.VISIBLE) { - width = AndroidUtilities.displaySize.x - AndroidUtilities.dp(290); - } else { - width = AndroidUtilities.displaySize.x - AndroidUtilities.dp(270); - } - } else { - if (actionView.getVisibility() == View.VISIBLE) { - width = AndroidUtilities.displaySize.x - AndroidUtilities.dp(240); - } else { - width = AndroidUtilities.displaySize.x - AndroidUtilities.dp(220); - } - } - nameTextView.setMaxWidth(width); - phoneTextView.setMaxWidth(width); - } - } } public ChatListRowHolderEx(View view, int type) { @@ -3762,12 +3523,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not photoImage = (BackupImageView)view.findViewById(R.id.chat_photo_image); halfCheckImage = (ImageView)view.findViewById(R.id.chat_row_halfcheck); checkImage = (ImageView)view.findViewById(R.id.chat_row_check); - actionAttachButton = (TextView)view.findViewById(R.id.chat_view_action_button); messageTextView = (TextView)view.findViewById(R.id.chat_message_text); - videoTimeText = (TextView)view.findViewById(R.id.chat_video_time); - actionView = view.findViewById(R.id.chat_view_action_layout); - actionProgress = (ProgressBar)view.findViewById(R.id.chat_view_action_progress); - actionCancelButton = (ImageView)view.findViewById(R.id.chat_view_action_cancel_button); phoneTextView = (TextView)view.findViewById(R.id.phone_text_view); contactAvatar = (BackupImageView)view.findViewById(R.id.contact_avatar); contactView = view.findViewById(R.id.shared_layout); @@ -3778,21 +3534,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, MessagesController.getInstance().fontSize); } - if (actionProgress != null) { - actionProgress.setTag(progressTag); - progressTag++; - } - - if (type != 2 && type != 3) { - if (actionView != null) { - if (isCustomTheme) { - actionView.setBackgroundResource(R.drawable.system_black); - } else { - actionView.setBackgroundResource(R.drawable.system_blue); - } - } - } - if (messageLayoutAction != null) { if (isCustomTheme) { messageLayoutAction.setBackgroundResource(R.drawable.system_black); @@ -3829,9 +3570,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not contactView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - if (message.type == 8 || message.type == 9) { - processOnClick(view); - } else if (message.type == 12 || message.type == 13) { + if (message.type == 12 || message.type == 13) { if (actionBarLayer.isActionModeShowed()) { processRowSelect(view); return; @@ -3903,15 +3642,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not }); } - if (actionAttachButton != null) { - actionAttachButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - processOnClick(view); - } - }); - } - if (avatarImageView != null) { avatarImageView.setOnClickListener(new View.OnClickListener() { @Override @@ -3929,33 +3659,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not }); } - if (actionCancelButton != null) { - actionCancelButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - if (message != null) { - Integer tag = (Integer)actionProgress.getTag(); - if (message.messageOwner.send_state != 0) { - SendMessagesHelper.getInstance().cancelSendingMessage(message); - String file = progressByTag.get(tag); - if (file != null) { - progressBarMap.remove(file); - } - } else if (message.type == 8 || message.type == 9) { - String file = progressByTag.get(tag); - if (file != null) { - loadingFile.remove(file); - if (message.type == 8 || message.type == 9) { - FileLoader.getInstance().cancelLoadFile(message.messageOwner.media.document); - } - updateVisibleRows(); - } - } - } - } - }); - } - if (photoImage != null) { photoImage.setOnClickListener(new View.OnClickListener() { @Override @@ -3983,63 +3686,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not if (message.type == 11) { PhotoViewer.getInstance().setParentActivity(getParentActivity()); PhotoViewer.getInstance().openPhoto(message, ChatActivity.this); - } else if (message.type == 8 || message.type == 9) { - File f = null; - String fileName = message.getFileName(); - if (message.messageOwner.attachPath != null && message.messageOwner.attachPath.length() != 0) { - f = new File(message.messageOwner.attachPath); - } - if (f == null || f != null && !f.exists()) { - f = new File(AndroidUtilities.getCacheDir(), fileName); - } - if (f != null && f.exists()) { - String realMimeType = null; - try { - Intent intent = new Intent(Intent.ACTION_VIEW); - if (message.type == 8 || message.type == 9) { - MimeTypeMap myMime = MimeTypeMap.getSingleton(); - int idx = fileName.lastIndexOf("."); - if (idx != -1) { - String ext = fileName.substring(idx + 1); - realMimeType = myMime.getMimeTypeFromExtension(ext.toLowerCase()); - if (realMimeType != null) { - intent.setDataAndType(Uri.fromFile(f), realMimeType); - } else { - intent.setDataAndType(Uri.fromFile(f), "text/plain"); - } - } else { - intent.setDataAndType(Uri.fromFile(f), "text/plain"); - } - } - if (realMimeType != null) { - try { - getParentActivity().startActivity(intent); - } catch (Exception e) { - intent.setDataAndType(Uri.fromFile(f), "text/plain"); - getParentActivity().startActivity(intent); - } - } else { - getParentActivity().startActivity(intent); - } - } catch (Exception e) { - alertUserOpenError(message); - } - } else { - if (message.messageOwner.send_state != MessageObject.MESSAGE_SEND_STATE_SEND_ERROR && message.messageOwner.send_state != MessageObject.MESSAGE_SEND_STATE_SENDING || !message.isOut()) { - if (!loadingFile.containsKey(fileName)) { - progressByTag.put((Integer)actionProgress.getTag(), fileName); - addToLoadingFile(fileName, actionProgress); - if (message.type == 8 || message.type == 9) { - FileLoader.getInstance().loadFile(message.messageOwner.media.document); - } - updateVisibleRows(); - } - } else { - if (message.messageOwner.send_state == MessageObject.MESSAGE_SEND_STATE_SEND_ERROR) { - createMenu(view, false); - } - } - } } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java index aa793fd7..7778eef8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/LaunchActivity.java @@ -26,7 +26,6 @@ import org.telegram.android.SendMessagesHelper; import org.telegram.messenger.ConnectionsManager; import org.telegram.messenger.FileLog; import org.telegram.android.LocaleController; -import org.telegram.android.MessagesController; import org.telegram.android.NotificationCenter; import org.telegram.messenger.R; import org.telegram.messenger.TLRPC; @@ -362,23 +361,14 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen int userId = intent.getIntExtra("userId", 0); int encId = intent.getIntExtra("encId", 0); if (chatId != 0) { - TLRPC.Chat chat = MessagesController.getInstance().getChat(chatId); - if (chat != null) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats); - push_chat_id = chatId; - } + NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats); + push_chat_id = chatId; } else if (userId != 0) { - TLRPC.User user = MessagesController.getInstance().getUser(userId); - if (user != null) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats); - push_user_id = userId; - } + NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats); + push_user_id = userId; } else if (encId != 0) { - TLRPC.EncryptedChat chat = MessagesController.getInstance().getEncryptedChat(encId); - if (chat != null) { - NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats); - push_enc_id = encId; - } + NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats); + push_enc_id = encId; } else { showDialogsList = true; } @@ -425,6 +415,9 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen fragment.setDelegate(this); presentFragment(fragment, false, true); pushOpened = true; + if (PhotoViewer.getInstance().isVisible()) { + PhotoViewer.getInstance().closePhoto(true); + } } if (open_settings != 0) { presentFragment(new SettingsActivity(), false, true); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java index ada07e37..c09aa674 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/PhotoViewer.java @@ -489,7 +489,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat windowLayoutParams.format = PixelFormat.TRANSLUCENT; windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; windowLayoutParams.gravity = Gravity.TOP; - windowLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION; + windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; actionBar = new ActionBar(activity); @@ -1212,6 +1212,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat int prevIndex = currentIndex; currentIndex = index; currentFileName = getFileName(index, null); + boolean sameImage = false; if (!imagesArr.isEmpty()) { deleteButton.setVisibility(View.VISIBLE); @@ -1240,7 +1241,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } else { deleteButton.setVisibility(View.GONE); } + TLRPC.FileLocation old = currentFileLocation; currentFileLocation = imagesArrLocations.get(index); + if (old != null && currentFileLocation != null && old.local_id == currentFileLocation.local_id && old.volume_id == currentFileLocation.volume_id) { + sameImage = true; + } actionBarLayer.setTitle(LocaleController.formatString("Of", R.string.Of, currentIndex + 1, imagesArrLocations.size())); } else if (!imagesArrLocals.isEmpty()) { currentPathObject = imagesArrLocals.get(index).path; @@ -1270,33 +1275,35 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat } } - draggingDown = false; - translationX = 0; - translationY = 0; - scale = 1; - animateToX = 0; - animateToY = 0; - animateToScale = 1; - animationDuration = 0; - animationStartTime = 0; + if (!sameImage) { + draggingDown = false; + translationX = 0; + translationY = 0; + scale = 1; + animateToX = 0; + animateToY = 0; + animateToScale = 1; + animationDuration = 0; + animationStartTime = 0; - pinchStartDistance = 0; - pinchStartScale = 1; - pinchCenterX = 0; - pinchCenterY = 0; - pinchStartX = 0; - pinchStartY = 0; - moveStartX = 0; - moveStartY = 0; - zooming = false; - moving = false; - doubleTap = false; - invalidCoords = false; - canDragDown = true; - changingPage = false; - switchImageAfterAnimation = 0; - canZoom = currentFileName == null || !currentFileName.endsWith("mp4"); - updateMinMax(scale); + pinchStartDistance = 0; + pinchStartScale = 1; + pinchCenterX = 0; + pinchCenterY = 0; + pinchStartX = 0; + pinchStartY = 0; + moveStartX = 0; + moveStartY = 0; + zooming = false; + moving = false; + doubleTap = false; + invalidCoords = false; + canDragDown = true; + changingPage = false; + switchImageAfterAnimation = 0; + canZoom = currentFileName == null || !currentFileName.endsWith("mp4"); + updateMinMax(scale); + } if (prevIndex == -1) { setIndexToImage(centerImage, currentIndex); @@ -1915,7 +1922,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat draggingDown = true; moving = false; dragY = ev.getY(); - if (isActionBarVisible) { + if (isActionBarVisible && canShowBottom) { toggleActionBar(false, true); } return true; @@ -2334,7 +2341,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat @Override public boolean onSingleTapConfirmed(MotionEvent e) { - toggleActionBar(!isActionBarVisible, true); + if (canShowBottom) { + toggleActionBar(!isActionBarVisible, true); + } else { + checkImageView.callOnClick(); + } return true; } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java index fc454b83..7347e7b4 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/SettingsWallpapersActivity.java @@ -177,18 +177,22 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - if (i == 0) { - Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); - File image = Utilities.generatePicturePath(); - if (image != null) { - takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image)); - currentPicturePath = image.getAbsolutePath(); + try { + if (i == 0) { + Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + File image = Utilities.generatePicturePath(); + if (image != null) { + takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image)); + currentPicturePath = image.getAbsolutePath(); + } + getParentActivity().startActivityForResult(takePictureIntent, 10); + } else if (i == 1) { + Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); + photoPickerIntent.setType("image/*"); + getParentActivity().startActivityForResult(photoPickerIntent, 11); } - getParentActivity().startActivityForResult(takePictureIntent, 10); - } else if (i == 1) { - Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); - photoPickerIntent.setType("image/*"); - getParentActivity().startActivityForResult(photoPickerIntent, 11); + } catch (Exception e) { + FileLog.e("tmessages", e); } } }); @@ -521,7 +525,6 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica selection.setVisibility(View.INVISIBLE); } } - } 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/Views/ActionBar/ActionBarActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarActivity.java index 40b72321..8aaee775 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/ActionBar/ActionBarActivity.java @@ -744,19 +744,11 @@ public class ActionBarActivity extends Activity { } containerView.invalidate(); if (intent != null) { - try { - ActionBarActivity.super.startActivityForResult(intent, requestCode); - } catch (Exception e) { - FileLog.e("tmessages", e); - } + super.startActivityForResult(intent, requestCode); } } else { if (intent != null) { - try { - super.startActivityForResult(intent, requestCode); - } catch (Exception e) { - FileLog.e("tmessages", e); - } + super.startActivityForResult(intent, requestCode); } } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/HorizontalListView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/HorizontalListView.java index d9cad047..277ea468 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/HorizontalListView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/HorizontalListView.java @@ -43,7 +43,6 @@ public class HorizontalListView extends AdapterView { private OnItemLongClickListener mOnItemLongClicked; private boolean mDataChanged = false; - public HorizontalListView(Context context, AttributeSet attrs) { super(context, attrs); initView(); @@ -66,7 +65,7 @@ public class HorizontalListView extends AdapterView { } @Override - public void setOnItemClickListener(AdapterView.OnItemClickListener listener){ + public void setOnItemClickListener(AdapterView.OnItemClickListener listener) { mOnItemClicked = listener; } @@ -76,10 +75,9 @@ public class HorizontalListView extends AdapterView { } private DataSetObserver mDataObserver = new DataSetObserver() { - @Override public void onChanged() { - synchronized(HorizontalListView.this){ + synchronized (HorizontalListView.this) { mDataChanged = true; } invalidate(); @@ -92,7 +90,6 @@ public class HorizontalListView extends AdapterView { invalidate(); requestLayout(); } - }; @Override @@ -113,7 +110,7 @@ public class HorizontalListView extends AdapterView { @Override public void setAdapter(ListAdapter adapter) { - if(mAdapter != null && mDataObserver != null) { + if (mAdapter != null && mDataObserver != null) { mAdapter.unregisterDataSetObserver(mDataObserver); } mAdapter = adapter; @@ -121,35 +118,33 @@ public class HorizontalListView extends AdapterView { reset(); } - private synchronized void reset(){ + private synchronized void reset() { initView(); + mRemovedViewQueue.clear(); removeAllViewsInLayout(); requestLayout(); } private void addAndMeasureChild(final View child, int viewPos) { LayoutParams params = child.getLayoutParams(); - if(params == null) { + if (params == null) { params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); } - addViewInLayout(child, viewPos, params, true); - child.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), - MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST)); + child.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST)); } - @SuppressLint("DrawAllocation") @Override protected synchronized void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - if(mAdapter == null){ + if (mAdapter == null) { return; } - if(mDataChanged){ + if (mDataChanged) { int oldCurrentX = mCurrentX; initView(); removeAllViewsInLayout(); @@ -157,15 +152,15 @@ public class HorizontalListView extends AdapterView { mDataChanged = false; } - if(mScroller.computeScrollOffset()){ + if (mScroller.computeScrollOffset()) { mNextX = mScroller.getCurrX(); } - if(mNextX <= 0){ + if (mNextX <= 0) { mNextX = 0; mScroller.forceFinished(true); } - if(mNextX >= mMaxX) { + if (mNextX >= mMaxX) { mNextX = mMaxX; mScroller.forceFinished(true); } @@ -178,35 +173,34 @@ public class HorizontalListView extends AdapterView { mCurrentX = mNextX; - if(!mScroller.isFinished()){ - post(new Runnable(){ + if (!mScroller.isFinished()) { + post(new Runnable() { @Override public void run() { requestLayout(); } }); - } } private void fillList(final int dx) { int edge = 0; - View child = getChildAt(getChildCount()-1); - if(child != null) { + View child = getChildAt(getChildCount() - 1); + if (child != null) { edge = child.getRight(); } fillListRight(edge, dx); edge = 0; child = getChildAt(0); - if(child != null) { + if (child != null) { edge = child.getLeft(); } fillListLeft(edge, dx); } private void fillListRight(int rightEdge, final int dx) { - while(rightEdge + dx < getWidth() && mRightViewIndex < mAdapter.getCount()) { + while (rightEdge + dx < getWidth() && mRightViewIndex < mAdapter.getCount()) { View v = null; int type = mAdapter.getItemViewType(mRightViewIndex); @@ -219,8 +213,9 @@ public class HorizontalListView extends AdapterView { addAndMeasureChild(child, -1); rightEdge += child.getMeasuredWidth(); + child.invalidate(); - if(mRightViewIndex == mAdapter.getCount() - 1) { + if (mRightViewIndex == mAdapter.getCount() - 1) { mMaxX = mCurrentX + rightEdge - getWidth() + getPaddingLeft(); } @@ -233,7 +228,7 @@ public class HorizontalListView extends AdapterView { } private void fillListLeft(int leftEdge, final int dx) { - while(leftEdge + dx > 0 && mLeftViewIndex >= 0) { + while (leftEdge + dx > 0 && mLeftViewIndex >= 0) { View v = null; int type = mAdapter.getItemViewType(mLeftViewIndex); LinkedList list = mRemovedViewQueue.get(type); @@ -252,44 +247,43 @@ public class HorizontalListView extends AdapterView { private void removeNonVisibleItems(final int dx) { View child = getChildAt(0); - while(child != null && child.getRight() + dx <= 0) { + while (child != null && child.getRight() + dx <= 0) { mDisplayOffset += child.getMeasuredWidth(); - int type = (Integer)child.getTag(R.string.CacheTag); + int type = (Integer) child.getTag(R.string.CacheTag); LinkedList list = mRemovedViewQueue.get(type); if (list == null) { list = new LinkedList(); mRemovedViewQueue.put(type, list); } - list.offer(child); + list.add(child); removeViewInLayout(child); mLeftViewIndex++; child = getChildAt(0); - } child = getChildAt(getChildCount() - 1); - while(child != null && child.getLeft() + dx >= getWidth()) { - int type = (Integer)child.getTag(R.string.CacheTag); + while (child != null && child.getLeft() + dx >= getWidth()) { + int type = (Integer) child.getTag(R.string.CacheTag); LinkedList list = mRemovedViewQueue.get(type); if (list == null) { list = new LinkedList(); mRemovedViewQueue.put(type, list); } - list.offer(child); + list.add(child); removeViewInLayout(child); mRightViewIndex--; - child = getChildAt(getChildCount()-1); + child = getChildAt(getChildCount() - 1); } } private void positionItems(final int dx) { - if(getChildCount() > 0){ + if (getChildCount() > 0) { mDisplayOffset += dx; int left = mDisplayOffset; - for(int i=0;i { return super.onInterceptTouchEvent(ev); } - protected boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, - float velocityY) { - synchronized(HorizontalListView.this){ - mScroller.fling(mNextX, 0, (int)-velocityX, 0, 0, mMaxX, 0, 0); + protected boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { + synchronized (HorizontalListView.this) { + mScroller.fling(mNextX, 0, (int) -velocityX, 0, 0, mMaxX, 0, 0); } requestLayout(); @@ -339,37 +332,32 @@ public class HorizontalListView extends AdapterView { } @Override - public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, - float velocityY) { + public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return HorizontalListView.this.onFling(e1, e2, velocityX, velocityY); } @Override - public boolean onScroll(MotionEvent e1, MotionEvent e2, - float distanceX, float distanceY) { - - synchronized(HorizontalListView.this){ - mNextX += (int)distanceX; + public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { + synchronized (HorizontalListView.this) { + mNextX += (int) distanceX; } requestLayout(); - return true; } @Override public boolean onSingleTapUp(MotionEvent e) { - for(int i=0;i { } break; } - } } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Views/RoundProgressView.java b/TMessagesProj/src/main/java/org/telegram/ui/Views/RoundProgressView.java index df1ddaa9..551b4944 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Views/RoundProgressView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Views/RoundProgressView.java @@ -24,10 +24,14 @@ public class RoundProgressView { paint = new Paint(); paint.setColor(0xffffffff); paint.setStyle(Paint.Style.STROKE); - paint.setStrokeWidth(AndroidUtilities.dp(1)); + paint.setStrokeWidth(AndroidUtilities.dp(2)); paint.setAntiAlias(true); } + public void setColor(int color) { + paint.setColor(color); + } + public void setProgress(float progress) { currentProgress = progress; if (currentProgress < 0) { diff --git a/TMessagesProj/src/main/res/drawable-hdpi/doc_blue.png b/TMessagesProj/src/main/res/drawable-hdpi/doc_blue.png old mode 100755 new mode 100644 index c9cd6911..1c1b3cdf Binary files a/TMessagesProj/src/main/res/drawable-hdpi/doc_blue.png and b/TMessagesProj/src/main/res/drawable-hdpi/doc_blue.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/doc_green.png b/TMessagesProj/src/main/res/drawable-hdpi/doc_green.png old mode 100755 new mode 100644 index 890cc33f..68b72142 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/doc_green.png and b/TMessagesProj/src/main/res/drawable-hdpi/doc_green.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/doccancel_b.png.png b/TMessagesProj/src/main/res/drawable-hdpi/doccancel_b.png.png new file mode 100644 index 00000000..5fe1295c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/doccancel_b.png.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/doccancel_g.png b/TMessagesProj/src/main/res/drawable-hdpi/doccancel_g.png new file mode 100644 index 00000000..00716eef Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/doccancel_g.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/docload_b.png.png b/TMessagesProj/src/main/res/drawable-hdpi/docload_b.png.png new file mode 100644 index 00000000..a39c692e Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/docload_b.png.png differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/docload_g.png.png b/TMessagesProj/src/main/res/drawable-hdpi/docload_g.png.png new file mode 100644 index 00000000..c8ac99de Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-hdpi/docload_g.png.png differ diff --git a/TMessagesProj/src/main/res/drawable-ldpi/doc_blue.png b/TMessagesProj/src/main/res/drawable-ldpi/doc_blue.png old mode 100755 new mode 100644 index d39e47fe..e757044d Binary files a/TMessagesProj/src/main/res/drawable-ldpi/doc_blue.png and b/TMessagesProj/src/main/res/drawable-ldpi/doc_blue.png differ diff --git a/TMessagesProj/src/main/res/drawable-ldpi/doc_green.png b/TMessagesProj/src/main/res/drawable-ldpi/doc_green.png old mode 100755 new mode 100644 index d279bca6..5eef56f3 Binary files a/TMessagesProj/src/main/res/drawable-ldpi/doc_green.png and b/TMessagesProj/src/main/res/drawable-ldpi/doc_green.png differ diff --git a/TMessagesProj/src/main/res/drawable-ldpi/doccancel_b.png b/TMessagesProj/src/main/res/drawable-ldpi/doccancel_b.png new file mode 100644 index 00000000..7e3eafac Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-ldpi/doccancel_b.png differ diff --git a/TMessagesProj/src/main/res/drawable-ldpi/doccancel_g.png b/TMessagesProj/src/main/res/drawable-ldpi/doccancel_g.png new file mode 100644 index 00000000..608f103c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-ldpi/doccancel_g.png differ diff --git a/TMessagesProj/src/main/res/drawable-ldpi/docload_b.png b/TMessagesProj/src/main/res/drawable-ldpi/docload_b.png new file mode 100644 index 00000000..84b9884a Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-ldpi/docload_b.png differ diff --git a/TMessagesProj/src/main/res/drawable-ldpi/docload_g.png b/TMessagesProj/src/main/res/drawable-ldpi/docload_g.png new file mode 100644 index 00000000..6c2a38b5 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-ldpi/docload_g.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/doc_blue.png b/TMessagesProj/src/main/res/drawable-mdpi/doc_blue.png old mode 100755 new mode 100644 index 69b5351e..3364e737 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/doc_blue.png and b/TMessagesProj/src/main/res/drawable-mdpi/doc_blue.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/doc_green.png b/TMessagesProj/src/main/res/drawable-mdpi/doc_green.png old mode 100755 new mode 100644 index ebb8cbf7..91549a4d Binary files a/TMessagesProj/src/main/res/drawable-mdpi/doc_green.png and b/TMessagesProj/src/main/res/drawable-mdpi/doc_green.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/doccancel_b.png b/TMessagesProj/src/main/res/drawable-mdpi/doccancel_b.png new file mode 100644 index 00000000..ee9762fd Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/doccancel_b.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/doccancel_g.png b/TMessagesProj/src/main/res/drawable-mdpi/doccancel_g.png new file mode 100644 index 00000000..371d6a4c Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/doccancel_g.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/docload_b.png b/TMessagesProj/src/main/res/drawable-mdpi/docload_b.png new file mode 100644 index 00000000..fed5ef3e Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/docload_b.png differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/docload_g.png b/TMessagesProj/src/main/res/drawable-mdpi/docload_g.png new file mode 100644 index 00000000..80620158 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-mdpi/docload_g.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/doc_blue.png b/TMessagesProj/src/main/res/drawable-xhdpi/doc_blue.png old mode 100755 new mode 100644 index f8cfa704..459d5c97 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/doc_blue.png and b/TMessagesProj/src/main/res/drawable-xhdpi/doc_blue.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/doc_green.png b/TMessagesProj/src/main/res/drawable-xhdpi/doc_green.png old mode 100755 new mode 100644 index ff5df25e..39b34fcd Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/doc_green.png and b/TMessagesProj/src/main/res/drawable-xhdpi/doc_green.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/doccancel_b.png b/TMessagesProj/src/main/res/drawable-xhdpi/doccancel_b.png new file mode 100644 index 00000000..932492f4 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/doccancel_b.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/doccancel_g.png b/TMessagesProj/src/main/res/drawable-xhdpi/doccancel_g.png new file mode 100644 index 00000000..4b1ad66d Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/doccancel_g.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/docload_b.png b/TMessagesProj/src/main/res/drawable-xhdpi/docload_b.png new file mode 100644 index 00000000..7b8c18cc Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/docload_b.png differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/docload_g.png b/TMessagesProj/src/main/res/drawable-xhdpi/docload_g.png new file mode 100644 index 00000000..52d94e79 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xhdpi/docload_g.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/doc_blue.png b/TMessagesProj/src/main/res/drawable-xxhdpi/doc_blue.png old mode 100755 new mode 100644 index f9e72f34..5c8fc8d7 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/doc_blue.png and b/TMessagesProj/src/main/res/drawable-xxhdpi/doc_blue.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/doc_green.png b/TMessagesProj/src/main/res/drawable-xxhdpi/doc_green.png old mode 100755 new mode 100644 index e7d32c22..8e08cbcc Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/doc_green.png and b/TMessagesProj/src/main/res/drawable-xxhdpi/doc_green.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/doccancel_b.png b/TMessagesProj/src/main/res/drawable-xxhdpi/doccancel_b.png new file mode 100644 index 00000000..782b8942 Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/doccancel_b.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/doccancel_g.png b/TMessagesProj/src/main/res/drawable-xxhdpi/doccancel_g.png new file mode 100644 index 00000000..cd2f08dc Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/doccancel_g.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/docload_b.png b/TMessagesProj/src/main/res/drawable-xxhdpi/docload_b.png new file mode 100644 index 00000000..05cae54b Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/docload_b.png differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/docload_g.png b/TMessagesProj/src/main/res/drawable-xxhdpi/docload_g.png new file mode 100644 index 00000000..4b44c5ef Binary files /dev/null and b/TMessagesProj/src/main/res/drawable-xxhdpi/docload_g.png differ diff --git a/TMessagesProj/src/main/res/layout/chat_group_incoming_document_layout.xml b/TMessagesProj/src/main/res/layout/chat_group_incoming_document_layout.xml deleted file mode 100644 index 85bf92b6..00000000 --- a/TMessagesProj/src/main/res/layout/chat_group_incoming_document_layout.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_group_incoming_location_layout.xml b/TMessagesProj/src/main/res/layout/chat_group_incoming_location_layout.xml deleted file mode 100644 index d10dbcf4..00000000 --- a/TMessagesProj/src/main/res/layout/chat_group_incoming_location_layout.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_incoming_document_layout.xml b/TMessagesProj/src/main/res/layout/chat_incoming_document_layout.xml deleted file mode 100644 index eb562cf1..00000000 --- a/TMessagesProj/src/main/res/layout/chat_incoming_document_layout.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_incoming_location_layout.xml b/TMessagesProj/src/main/res/layout/chat_incoming_location_layout.xml deleted file mode 100644 index 5e25a7a8..00000000 --- a/TMessagesProj/src/main/res/layout/chat_incoming_location_layout.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_outgoing_document_layout.xml b/TMessagesProj/src/main/res/layout/chat_outgoing_document_layout.xml deleted file mode 100644 index 66044546..00000000 --- a/TMessagesProj/src/main/res/layout/chat_outgoing_document_layout.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/layout/chat_outgoing_location_layout.xml b/TMessagesProj/src/main/res/layout/chat_outgoing_location_layout.xml deleted file mode 100644 index 459e185f..00000000 --- a/TMessagesProj/src/main/res/layout/chat_outgoing_location_layout.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/TMessagesProj/src/main/res/values-it/strings.xml b/TMessagesProj/src/main/res/values-it/strings.xml index 079157f9..cd56303e 100644 --- a/TMessagesProj/src/main/res/values-it/strings.xml +++ b/TMessagesProj/src/main/res/values-it/strings.xml @@ -11,14 +11,14 @@ Il tuo telefono - Conferma il prefisso della tua nazione \ne inserisci il tuo numero di telefono. + Conferma il prefisso della tua nazione\ne inserisci il tuo numero di telefono. Scegli una nazione Prefisso errato Il tuo codice Abbiamo inviato un SMS al tuo telefono con il codice di attivazione - Ti chiameremo tra + Ti telefoneremo tra Ti stiamo chiamando… Codice Numero errato? @@ -58,11 +58,11 @@ Seleziona chat - Lista Broadcast - Nuova Lista Broadcast + Lista broadcast + Nuova lista broadcast Immetti il nome della lista Hai creato una lista broadcast - Aggiungi Destinatario + Aggiungi destinatario Rimuovi dalla lista broadcast @@ -76,12 +76,12 @@ Trasferimento USB attivo Archiviazione interna Archiviazione esterna - Radice di sistema + Root di sistema Scheda SD invisibile - scrivendo… + sta scrivendo… Allega sta scrivendo… stanno scrivendo… @@ -104,10 +104,10 @@ Selezionati: %d CONDIVIDI LE MIE INFORMAZIONI DI CONTATTO AGGIUNGI AI CONTATTI - %s ti ha mandato un invito a una chat privata. + %s ti ha mandato un invito a una chat segreta. Hai invitato %s a entrare in una chat segreta. Chat segrete: - Utilizzano la cifratura punto-punto + Utilizzano la crittografia end-to-end Non lasciano traccia sui nostri server Hanno un contatore di autodistruzione Non permettono l’inoltro @@ -115,7 +115,7 @@ Hai lasciato il gruppo Elimina questo gruppo Elimina questa chat - TRASCINA PER ANNULLARE + CANCELLA Salva in download Applica file di localizzazione Allegato non supportato @@ -123,10 +123,10 @@ Chat segreta richiesta Chat segreta iniziata - %1$s imposta il contatore di autodistruzione a %2$s - Hai impostato il contatore di autodistruzione a %1$s - %1$s ha disabilitato il contatore di autodistruzione - Hai disabilitato il contatore di autodistruzione + %1$s ha impostato il timer di autodistruzione a %2$s + Hai impostato il timer di autodistruzione a %1$s + %1$s ha disabilitato il timer di autodistruzione + Hai disabilitato il timer di autodistruzione 2 secondi 5 secondi 1 minuto @@ -141,7 +141,7 @@ %1$s ha condiviso un contatto con te %1$s ti ha inviato una posizione %1$s ti ha inviato un documento - %1$s ti ha inviato dell\'audio + %1$s ti ha inviato un audio %1$s @ %2$s: %3$s %1$s ha inviato un messaggio al gruppo %2$s %1$s ha inviato una foto al gruppo %2$s @@ -149,7 +149,7 @@ %1$s ha condiviso un contatto con il gruppo %2$s %1$s ha inviato una posizione al gruppo %2$s %1$s ha inviato un documento al gruppo %2$s - %1$s ha inviato dell\'audio al gruppo %2$s + %1$s ha inviato un audio al gruppo %2$s %1$s ti ha invitato nel gruppo %2$s %1$s ha modificato il nome del gruppo %2$s %1$s ha modificato la foto del gruppo %2$s @@ -158,9 +158,9 @@ %1$s ti ha rimosso dal gruppo %2$s %1$s ha lasciato il gruppo %2$s %1$s ha iniziato a usare Telegram! - %1$s,\nAbbiamo rilevato un accesso al tuo account da un nuovo dispositivo %2$s\n\nDispositivo: %3$s\nPosizione: %4$s\n\nSe non sei stato tu, puoi andare su Impostazioni - Termina tutte le sessioni.\n\nGrazie,\nIl Team di Telegram + %1$s,\nAbbiamo rilevato un accesso al tuo account da un nuovo dispositivo %2$s\n\nDispositivo: %3$s\nPosizione: %4$s\n\nSe non sei stato tu, puoi andare su Impostazioni - Termina tutte le sessioni.\n\nGrazie,\nil team di Telegram %1$s ha aggiornato la foto del profilo - Reply + Rispondi Seleziona contatto @@ -211,7 +211,7 @@ Impossibile creare una chat segreta con %1$s.\n\n%2$s sta usando una vecchia versione di Telegram e deve prima aggiornarla. Chat segreta Chiave di cifratura - Contatore di autodistruzione + Timer di autodistruzione Spento 2s 5s @@ -259,37 +259,37 @@ Un contatto si è collegato a Telegram PEBBLE Lingua - Nota che il supporto di Telegram è fornito da volontari. Proviamo a rispondere non appena possibile, ma potrebbe richiedere del tempo.
]]>Dai un\'occhiata alle Domande frequenti]]>: troverai risposte alla maggior parte delle domande e suggerimenti importanti per l\'individuazione del problema]]>.
+ Nota che il supporto di Telegram è fornito da volontari. Proviamo a rispondere non appena possibile, ma potrebbe richiedere del tempo.
]]>Dai un\'occhiata alle Domande frequenti]]>: troverai risposte alla maggior parte delle domande e suggerimenti importanti per l\'individuazione del problema]]>.
Chiedi a un volontario Domande frequenti - https://telegram.org/faq + https://telegram.org/faq/it Eliminare la localizzazione? File della localizzazione non valido Abilitato Disabilitato Servizio notifiche - Se i servizi di Google Play sono sufficienti per ricevere le notifiche, è possibile disabilitare il Servizio Notifiche. Ti raccomandiamo comunque di lasciarlo abilitato per lasciare l\'app attiva in background e ricevere le notifiche istantanee. + Se i servizi di Google Play sono sufficienti per ricevere le notifiche, è possibile disabilitare il Servizio notifiche. Ti raccomandiamo comunque di lasciarlo abilitato per lasciare l\'app attiva in background e ricevere le notifiche istantanee. Ordina per Importa contatti Solo tramite WiFi Nome Cognome Colore LED - Notifiche Popup + Notifiche popup Nessun popup Solo con schermo acceso Solo con schermo spento Mostra sempre i popup Contatore Badge - Short - Long - System default - Settings default - AUTOMATIC MEDIA DOWNLOAD - When using mobile data - When connected on Wi-Fi - When roaming - No media + Breve + Lungo + Predefinito di sistema + Impostazioni predefinite + SCARICAMENTO AUTOMATICO MEDIA + Quando si utilizza la rete dati + Quando si utilizza il Wi-Fi + In roaming + Nessun media Nessun media condiviso @@ -314,9 +314,9 @@ Ancora nessuna foto - Modifica Video - Video Originale - Video Modificato + Modifica video + Video originale + Video modificato Avanti @@ -376,8 +376,8 @@ Cognome non valido Caricamento… Non hai un lettore video, per favore installane uno per continuare - Invia un’email a sms@telegram.org e parlaci del tuo problema. - Nessuna applicazione può gestire il tipo di file \'%1$s\', per favore installane una per proseguire + Invia un’email a sms@telegram.org spiegandoci il problema. + Non hai nessuna applicazione che può gestire il tipo di file \'%1$s\': installane una per proseguire Questo utente non ha ancora Telegram, vuoi invitarlo? Sei sicuro? Vuoi aggiungere il contatto? diff --git a/TMessagesProj/src/main/res/values-nl/strings.xml b/TMessagesProj/src/main/res/values-nl/strings.xml index 3616506e..8913dc25 100644 --- a/TMessagesProj/src/main/res/values-nl/strings.xml +++ b/TMessagesProj/src/main/res/values-nl/strings.xml @@ -160,7 +160,7 @@ %1$s heeft nu Telegram! %1$s,\nEr is op je account ingelogd vanaf een nieuw apparaat op %2$s\n\nApparaat: %3$s\nLocatie: %4$s\n\nAls jij dit niet was, kun je alle sessies beëindigen via Instellingen – Beëindig alle andere sessies.\n\nBedankt,\nHet Telegram-team %1$s heeft zijn/haar profielfoto gewijzigd - Reply + Antwoord Kies een contact @@ -259,7 +259,7 @@ Contact lid geworden van Telegram PEBBLE Taal - Houd er rekening mee dat de ondersteuning van Telegram door vrijwilligers wordt gedaan. We doen ons best om zo snel mogelijk te antwoorden, maar het kan even even duren.
]]>Bekijk ook de veelgestelde vragen]]>: hier staan de antwoorden op de meeste vragen en belangrijke tips voor het oplossen van problemen]]>.
+ Houd er rekening mee dat de ondersteuning van Telegram door vrijwilligers wordt gedaan. We doen ons best om zo snel mogelijk te antwoorden, maar het kan even even duren.
]]>Bekijk ook de veelgestelde vragen]]>: hier staan de antwoorden op de meeste vragen en belangrijke tips voor het oplossen van problemen]]>.
Vraag een vrijwilliger Veelgestelde vragen https://telegram.org/faq @@ -281,15 +281,15 @@ Alleen wanneer scherm \"uit\" staat Altijd popup tonen Badgenummer - Short - Long - System default - Settings default - AUTOMATIC MEDIA DOWNLOAD - When using mobile data - When connected on Wi-Fi - When roaming - No media + Kort + Lang + Standaardinstelling + Standaardinstelling + AUTOMATISCH MEDIA OPHALEN + Bij mobiel datagebruik + Bij Wi-Fi verbinding + Bij roamen + Geen media Nog geen media gedeeld