New documents design, bug fixes

This commit is contained in:
DrKLO 2014-08-30 00:06:04 +03:00
parent 8bad655966
commit 16150fe751
58 changed files with 439 additions and 1306 deletions

View File

@ -80,7 +80,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 312
versionCode 315
versionName "1.8.0"
}
}

View File

@ -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;

View File

@ -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() {

View File

@ -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;
}

View File

@ -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);

View File

@ -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<TLRPC.Message> messages = onlyCount ? null : new ArrayList<TLRPC.Message>();
final ArrayList<TLRPC.User> users = onlyCount ? null : new ArrayList<TLRPC.User>();
final ArrayList<TLRPC.Chat> chats = onlyCount ? null : new ArrayList<TLRPC.Chat>();
final ArrayList<TLRPC.EncryptedChat> encryptedChats = onlyCount ? null : new ArrayList<TLRPC.EncryptedChat>();
if (messages != null && ids.length() > 0) {
final ArrayList<TLRPC.Message> messages = new ArrayList<TLRPC.Message>();
final ArrayList<TLRPC.User> users = new ArrayList<TLRPC.User>();
final ArrayList<TLRPC.Chat> chats = new ArrayList<TLRPC.Chat>();
final ArrayList<TLRPC.EncryptedChat> encryptedChats = new ArrayList<TLRPC.EncryptedChat>();
if (ids.length() > 0) {
ArrayList<Integer> userIds = new ArrayList<Integer>();
ArrayList<Integer> chatIds = new ArrayList<Integer>();
ArrayList<Integer> encryptedChatIds = new ArrayList<Integer>();
@ -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);
}

View File

@ -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<Long, Integer> 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<Long, Integer> 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);
}

View File

@ -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)];

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -29,7 +29,7 @@ public class ChatMessageCell extends ChatBaseCell {
private int totalVisibleBlocksCount = 0;
public ChatMessageCell(Context context) {
super(context, false);
super(context);
drawForwardedName = true;
}

View File

@ -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) {

View File

@ -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<String, ProgressBar> progressBarMap = new HashMap<String, ProgressBar>();
private HashMap<String, ArrayList<ProgressBar>> loadingFile = new HashMap<String, ArrayList<ProgressBar>>();
private HashMap<Integer, String> progressByTag = new HashMap<Integer, String>();
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<ProgressBar> arr = loadingFile.get(path);
if (arr == null) {
arr = new ArrayList<ProgressBar>();
loadingFile.put(path, arr);
}
arr.add(bar);
}
private void removeFromloadingFile(String path, ProgressBar bar) {
ArrayList<ProgressBar> 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<ProgressBar> 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);
}
}
}
}
}
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}
}
}

View File

@ -43,7 +43,6 @@ public class HorizontalListView extends AdapterView<ListAdapter> {
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<ListAdapter> {
}
@Override
public void setOnItemClickListener(AdapterView.OnItemClickListener listener){
public void setOnItemClickListener(AdapterView.OnItemClickListener listener) {
mOnItemClicked = listener;
}
@ -76,10 +75,9 @@ public class HorizontalListView extends AdapterView<ListAdapter> {
}
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<ListAdapter> {
invalidate();
requestLayout();
}
};
@Override
@ -113,7 +110,7 @@ public class HorizontalListView extends AdapterView<ListAdapter> {
@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<ListAdapter> {
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<ListAdapter> {
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<ListAdapter> {
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<ListAdapter> {
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<ListAdapter> {
}
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<View> list = mRemovedViewQueue.get(type);
@ -252,44 +247,43 @@ public class HorizontalListView extends AdapterView<ListAdapter> {
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<View> list = mRemovedViewQueue.get(type);
if (list == null) {
list = new LinkedList<View>();
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<View> list = mRemovedViewQueue.get(type);
if (list == null) {
list = new LinkedList<View>();
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<getChildCount();i++){
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
int childWidth = child.getMeasuredWidth();
child.layout(left + getPaddingLeft(), 0, left + childWidth + getPaddingLeft(), child.getMeasuredHeight());
@ -316,10 +310,9 @@ public class HorizontalListView extends AdapterView<ListAdapter> {
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<ListAdapter> {
}
@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<getChildCount();i++){
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (isEventWithinView(e, child)) {
if(mOnItemClicked != null){
mOnItemClicked.onItemClick(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId( mLeftViewIndex + 1 + i ));
if (mOnItemClicked != null) {
mOnItemClicked.onItemClick(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId(mLeftViewIndex + 1 + i));
}
if(mOnItemSelected != null){
mOnItemSelected.onItemSelected(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId( mLeftViewIndex + 1 + i ));
if (mOnItemSelected != null) {
mOnItemSelected.onItemSelected(HorizontalListView.this, child, mLeftViewIndex + 1 + i, mAdapter.getItemId(mLeftViewIndex + 1 + i));
}
break;
}
}
return true;
}
@ -385,7 +373,6 @@ public class HorizontalListView extends AdapterView<ListAdapter> {
}
break;
}
}
}

View File

@ -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) {

BIN
TMessagesProj/src/main/res/drawable-hdpi/doc_blue.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
TMessagesProj/src/main/res/drawable-hdpi/doc_green.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
TMessagesProj/src/main/res/drawable-ldpi/doc_blue.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
TMessagesProj/src/main/res/drawable-ldpi/doc_green.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 490 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
TMessagesProj/src/main/res/drawable-mdpi/doc_blue.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
TMessagesProj/src/main/res/drawable-mdpi/doc_green.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
TMessagesProj/src/main/res/drawable-xhdpi/doc_blue.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
TMessagesProj/src/main/res/drawable-xhdpi/doc_green.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
TMessagesProj/src/main/res/drawable-xxhdpi/doc_blue.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
TMessagesProj/src/main/res/drawable-xxhdpi/doc_green.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -1,134 +0,0 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top"
android:gravity="left">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginLeft="6dp"
android:id="@+id/chat_group_avatar_image"
android:layout_marginBottom="2dp"
android:layout_marginRight="4dp"
android:layout_gravity="bottom"/>
<org.telegram.ui.Views.FrameLayoutFixed
android:orientation="horizontal"
android:layout_height="78dp"
android:layout_width="wrap_content"
android:paddingTop="9dp"
android:paddingLeft="18dp"
android:paddingRight="9dp"
android:layout_gravity="top|left"
android:id="@+id/chat_bubble_layout">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="69dp"
android:layout_width="wrap_content"
android:layout_gravity="top|right"
android:id="@+id/shared_layout">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:background="#40b7c9d7"
android:id="@+id/contact_avatar"/>
<org.telegram.ui.Views.TightTextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="3dp"
android:textSize="14dp"
android:lines="1"
android:singleLine="true"
android:layout_gravity="top"
android:ellipsize="end"
android:maxLines="1"
android:textColor="#000000"
android:layout_marginRight="2dp"
android:id="@+id/chat_user_group_name"
android:layout_marginLeft="50dp"/>
<org.telegram.ui.Views.TightTextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="50dp"
android:singleLine="true"
android:layout_marginTop="22dp"
android:layout_gravity="top"
android:layout_marginRight="2dp"
android:textSize="11dp"
android:maxLines="1"
android:textColor="#9daab8"
android:id="@+id/phone_text_view"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_text"
android:textColor="#a1aab3"
android:textSize="12dp"
android:layout_marginBottom="5dp"
android:layout_gravity="bottom|right"/>
</org.telegram.ui.Views.FrameLayoutFixed>
</org.telegram.ui.Views.FrameLayoutFixed>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="wrap_content"
android:layout_width="140dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:id="@+id/chat_view_action_layout"
android:visibility="gone">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="centerInside"
android:layout_marginRight="4dp"
android:layout_gravity="right|center"
android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/ic_msg_btn_cross_custom"
android:clickable="true"/>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="3dp"
android:layout_gravity="left|center_vertical"
android:progressDrawable="@drawable/progress_chat"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="12dp"
android:layout_marginRight="36dp"
android:id="@+id/chat_view_action_progress"
android:max="100"/>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:id="@+id/chat_view_action_button"
android:textSize="14dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:descendantFocusability="blocksDescendants"
android:clickable="true"
android:gravity="center|left"
android:visibility="gone"
android:textStyle="bold"
android:layout_gravity="center_vertical|left"/>
</LinearLayout>

View File

@ -1,75 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginLeft="6dp"
android:id="@+id/chat_group_avatar_image"
android:layout_marginBottom="2dp"
android:layout_gravity="bottom"/>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_gravity="top"
android:id="@+id/chat_bubble_layout"
android:addStatesFromChildren="true">
<org.telegram.ui.Views.BackupImageView
android:layout_height="100dp"
android:layout_width="100dp"
android:layout_margin="6dp"
android:layout_gravity="top"
android:id="@+id/chat_photo_image"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="16dp"
android:id="@+id/chat_time_layout"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_gravity="right|bottom"
android:background="@drawable/phototime">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#ffffff"
android:textSize="12dp"
android:layout_gravity="bottom"
android:layout_marginBottom="1dp"
android:id="@+id/chat_time_text"/>
</LinearLayout>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:textStyle="bold"
android:id="@+id/chat_view_action_button"
android:layout_gravity="center"
android:gravity="center"
android:textSize="14dp"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:descendantFocusability="blocksDescendants"
android:clickable="true"
android:layout_marginLeft="10dp"/>
</LinearLayout>

View File

@ -1,126 +0,0 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top"
android:gravity="left">
<org.telegram.ui.Views.FrameLayoutFixed
android:orientation="horizontal"
android:layout_height="78dp"
android:layout_width="wrap_content"
android:paddingTop="9dp"
android:paddingLeft="18dp"
android:paddingRight="9dp"
android:layout_gravity="top|left"
android:id="@+id/chat_bubble_layout">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="69dp"
android:layout_width="wrap_content"
android:layout_gravity="top|right"
android:id="@+id/shared_layout">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:background="#40b7c9d7"
android:src="@drawable/doc_blue"
android:id="@+id/contact_avatar"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scrollHorizontally="true"
android:layout_marginTop="3dp"
android:textSize="14dp"
android:lines="1"
android:singleLine="true"
android:layout_marginRight="2dp"
android:layout_gravity="top"
android:ellipsize="end"
android:textColor="#000000"
android:id="@+id/chat_user_group_name"
android:maxLines="1"
android:layout_marginLeft="50dp"/>
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="22dp"
android:layout_gravity="top"
android:layout_marginRight="2dp"
android:textSize="11dp"
android:maxLines="1"
android:singleLine="true"
android:textColor="#9daab8"
android:id="@+id/phone_text_view"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_text"
android:textColor="#a1aab3"
android:textSize="12dp"
android:layout_gravity="bottom|right"
android:layout_marginBottom="5dp"/>
</org.telegram.ui.Views.FrameLayoutFixed>
</org.telegram.ui.Views.FrameLayoutFixed>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="wrap_content"
android:layout_width="140dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:id="@+id/chat_view_action_layout"
android:visibility="gone">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="centerInside"
android:layout_marginRight="4dp"
android:layout_gravity="right|center"
android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/ic_msg_btn_cross_custom"
android:clickable="true"/>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="3dp"
android:layout_gravity="left|center_vertical"
android:progressDrawable="@drawable/progress_chat"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="12dp"
android:layout_marginRight="36dp"
android:id="@+id/chat_view_action_progress"
android:max="100"/>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:id="@+id/chat_view_action_button"
android:textSize="14dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:descendantFocusability="blocksDescendants"
android:clickable="true"
android:gravity="center"
android:visibility="gone"
android:textStyle="bold"
android:layout_gravity="center_vertical"/>
</LinearLayout>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="9dp"
android:id="@+id/chat_bubble_layout"
android:layout_gravity="top"
android:addStatesFromChildren="true">
<org.telegram.ui.Views.BackupImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_margin="6dp"
android:layout_gravity="top"
android:minHeight="100dp"
android:minWidth="100dp"
android:id="@+id/chat_photo_image"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="16dp"
android:id="@+id/chat_time_layout"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_gravity="right|bottom"
android:background="@drawable/phototime">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#ffffff"
android:textSize="12dp"
android:layout_gravity="bottom"
android:layout_marginBottom="1dp"
android:id="@+id/chat_time_text"/>
</LinearLayout>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:layout_gravity="center"
android:gravity="center"
android:textStyle="bold"
android:id="@+id/chat_view_action_button"
android:textSize="14dp"
android:layout_marginLeft="10dp"
android:descendantFocusability="blocksDescendants"
android:clickable="true"/>
</LinearLayout>

View File

@ -1,152 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top"
android:gravity="right">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="wrap_content"
android:layout_width="140dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:id="@+id/chat_view_action_layout"
android:layout_gravity="center"
android:visibility="gone">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="centerInside"
android:layout_marginLeft="4dp"
android:id="@+id/chat_view_action_cancel_button"
android:src="@drawable/ic_msg_btn_cross_custom"
android:layout_gravity="left|center"
android:clickable="true"/>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="3dp"
style="?android:attr/progressBarStyleHorizontal"
android:progress="50"
android:layout_marginLeft="36dp"
android:layout_marginRight="12dp"
android:layout_gravity="right|center_vertical"
android:progressDrawable="@drawable/progress_chat"
android:id="@+id/chat_view_action_progress"
android:max="100"/>
</org.telegram.ui.Views.FrameLayoutFixed>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:id="@+id/chat_view_action_button"
android:textSize="14dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:descendantFocusability="blocksDescendants"
android:clickable="true"
android:gravity="center"
android:visibility="gone"
android:textStyle="bold"
android:layout_gravity="center"/>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="78dp"
android:layout_width="wrap_content"
android:paddingTop="9dp"
android:paddingLeft="9dp"
android:paddingRight="18dp"
android:layout_gravity="top|right"
android:id="@+id/chat_bubble_layout">
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_height="69dp"
android:layout_width="wrap_content"
android:layout_gravity="top|right"
android:id="@+id/shared_layout">
<org.telegram.ui.Views.BackupImageView
android:layout_width="42dp"
android:layout_height="42dp"
android:background="#408ed057"
android:id="@+id/contact_avatar"/>
<org.telegram.ui.Views.TightTextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scrollHorizontally="true"
android:layout_marginTop="3dp"
android:textSize="14dp"
android:lines="1"
android:singleLine="true"
android:layout_marginRight="2dp"
android:layout_gravity="top"
android:ellipsize="end"
android:textColor="#000000"
android:id="@+id/chat_user_group_name"
android:layout_marginLeft="50dp"/>
<org.telegram.ui.Views.TightTextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="22dp"
android:layout_gravity="top"
android:layout_marginRight="2dp"
android:textSize="11dp"
android:maxLines="1"
android:textColor="#75b166"
android:id="@+id/phone_text_view"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_layout"
android:layout_gravity="bottom|right"
android:layout_marginBottom="5dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chat_time_text"
android:textColor="#70b15c"
android:textSize="12dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/msg_check"
android:layout_marginTop="2dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="-8dp"
android:id="@+id/chat_row_check"
android:visibility="visible"
android:layout_gravity="top"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/msg_halfcheck"
android:layout_marginTop="2dp"
android:id="@+id/chat_row_halfcheck"
android:visibility="visible"
android:layout_gravity="top"/>
</LinearLayout>
</org.telegram.ui.Views.FrameLayoutFixed>
</org.telegram.ui.Views.FrameLayoutFixed>
</LinearLayout>

View File

@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:paddingBottom="1dp"
android:paddingTop="1dp"
android:layout_gravity="top">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#54759e"
android:background="@drawable/chat_incoming_media_states"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:id="@+id/chat_view_action_button"
android:textSize="14dp"
android:layout_marginRight="10dp"
android:textStyle="bold"
android:descendantFocusability="blocksDescendants"
android:clickable="true"
android:gravity="center"
android:layout_gravity="center"/>
<org.telegram.ui.Views.FrameLayoutFixed
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="9dp"
android:id="@+id/chat_bubble_layout"
android:layout_gravity="top"
android:addStatesFromChildren="true">
<org.telegram.ui.Views.BackupImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_margin="6dp"
android:layout_gravity="top"
android:minHeight="100dp"
android:minWidth="100dp"
android:id="@+id/chat_photo_image"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="16dp"
android:id="@+id/chat_time_layout"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_gravity="right|bottom"
android:background="@drawable/phototime">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textColor="#ffffff"
android:textSize="12dp"
android:layout_gravity="bottom"
android:layout_marginBottom="1dp"
android:id="@+id/chat_time_text"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/msg_check_w"
android:layout_marginTop="1dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="-8dp"
android:id="@+id/chat_row_check"
android:visibility="visible"
android:layout_gravity="top"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:id="@+id/chat_row_halfcheck"
android:visibility="visible"
android:src="@drawable/msg_halfcheck_w"
android:layout_gravity="top"/>
</LinearLayout>
</org.telegram.ui.Views.FrameLayoutFixed>
</LinearLayout>

View File

@ -11,14 +11,14 @@
<!--signin view-->
<string name="YourPhone">Il tuo telefono</string>
<string name="StartText">Conferma il prefisso della tua nazione \ne inserisci il tuo numero di telefono.</string>
<string name="StartText">Conferma il prefisso della tua nazione\ne inserisci il tuo numero di telefono.</string>
<string name="ChooseCountry">Scegli una nazione</string>
<string name="WrongCountry">Prefisso errato</string>
<!--code enter view-->
<string name="YourCode">Il tuo codice</string>
<string name="SentSmsCode">Abbiamo inviato un SMS al tuo telefono con il codice di attivazione</string>
<string name="CallText">Ti chiameremo tra</string>
<string name="CallText">Ti telefoneremo tra</string>
<string name="Calling">Ti stiamo chiamando…</string>
<string name="Code">Codice</string>
<string name="WrongNumber">Numero errato?</string>
@ -58,11 +58,11 @@
<string name="SelectChat">Seleziona chat</string>
<!--broadcasts-->
<string name="BroadcastList">Lista Broadcast</string>
<string name="NewBroadcastList">Nuova Lista Broadcast</string>
<string name="BroadcastList">Lista broadcast</string>
<string name="NewBroadcastList">Nuova lista broadcast</string>
<string name="EnterListName">Immetti il nome della lista</string>
<string name="YouCreatedBroadcastList">Hai creato una lista broadcast</string>
<string name="AddRecipient">Aggiungi Destinatario</string>
<string name="AddRecipient">Aggiungi destinatario</string>
<string name="KickFromBroadcast">Rimuovi dalla lista broadcast</string>
<!--documents view-->
@ -76,12 +76,12 @@
<string name="UsbActive">Trasferimento USB attivo</string>
<string name="InternalStorage">Archiviazione interna</string>
<string name="ExternalStorage">Archiviazione esterna</string>
<string name="SystemRoot">Radice di sistema</string>
<string name="SystemRoot">Root di sistema</string>
<string name="SdCard">Scheda SD</string>
<!--chat view-->
<string name="Invisible">invisibile</string>
<string name="Typing">scrivendo…</string>
<string name="Typing">sta scrivendo…</string>
<string name="Attach">Allega</string>
<string name="IsTyping">sta scrivendo…</string>
<string name="AreTyping">stanno scrivendo…</string>
@ -104,10 +104,10 @@
<string name="Selected">Selezionati: %d</string>
<string name="ShareMyContactInfo">CONDIVIDI LE MIE INFORMAZIONI DI CONTATTO</string>
<string name="AddToContacts">AGGIUNGI AI CONTATTI</string>
<string name="EncryptedPlaceholderTitleIncoming">%s ti ha mandato un invito a una chat privata.</string>
<string name="EncryptedPlaceholderTitleIncoming">%s ti ha mandato un invito a una chat segreta.</string>
<string name="EncryptedPlaceholderTitleOutgoing">Hai invitato %s a entrare in una chat segreta.</string>
<string name="EncryptedDescriptionTitle">Chat segrete:</string>
<string name="EncryptedDescription1">Utilizzano la cifratura punto-punto</string>
<string name="EncryptedDescription1">Utilizzano la crittografia end-to-end</string>
<string name="EncryptedDescription2">Non lasciano traccia sui nostri server</string>
<string name="EncryptedDescription3">Hanno un contatore di autodistruzione</string>
<string name="EncryptedDescription4">Non permettono linoltro</string>
@ -115,7 +115,7 @@
<string name="YouLeft">Hai lasciato il gruppo</string>
<string name="DeleteThisGroup">Elimina questo gruppo</string>
<string name="DeleteThisChat">Elimina questa chat</string>
<string name="SlideToCancel">TRASCINA PER ANNULLARE</string>
<string name="SlideToCancel">CANCELLA</string>
<string name="SaveToDownloads">Salva in download</string>
<string name="ApplyLocalizationFile">Applica file di localizzazione</string>
<string name="UnsupportedAttachment">Allegato non supportato</string>
@ -123,10 +123,10 @@
<!--notification-->
<string name="EncryptedChatRequested">Chat segreta richiesta</string>
<string name="EncryptedChatAccepted">Chat segreta iniziata</string>
<string name="MessageLifetimeChanged">%1$s imposta il contatore di autodistruzione a %2$s</string>
<string name="MessageLifetimeChangedOutgoing">Hai impostato il contatore di autodistruzione a %1$s</string>
<string name="MessageLifetimeRemoved">%1$s ha disabilitato il contatore di autodistruzione</string>
<string name="MessageLifetimeYouRemoved">Hai disabilitato il contatore di autodistruzione</string>
<string name="MessageLifetimeChanged">%1$s ha impostato il timer di autodistruzione a %2$s</string>
<string name="MessageLifetimeChangedOutgoing">Hai impostato il timer di autodistruzione a %1$s</string>
<string name="MessageLifetimeRemoved">%1$s ha disabilitato il timer di autodistruzione</string>
<string name="MessageLifetimeYouRemoved">Hai disabilitato il timer di autodistruzione</string>
<string name="MessageLifetime2s">2 secondi</string>
<string name="MessageLifetime5s">5 secondi</string>
<string name="MessageLifetime1m">1 minuto</string>
@ -141,7 +141,7 @@
<string name="NotificationMessageContact">%1$s ha condiviso un contatto con te</string>
<string name="NotificationMessageMap">%1$s ti ha inviato una posizione</string>
<string name="NotificationMessageDocument">%1$s ti ha inviato un documento</string>
<string name="NotificationMessageAudio">%1$s ti ha inviato dell\'audio</string>
<string name="NotificationMessageAudio">%1$s ti ha inviato un audio</string>
<string name="NotificationMessageGroupText">%1$s @ %2$s: %3$s</string>
<string name="NotificationMessageGroupNoText">%1$s ha inviato un messaggio al gruppo %2$s</string>
<string name="NotificationMessageGroupPhoto">%1$s ha inviato una foto al gruppo %2$s</string>
@ -149,7 +149,7 @@
<string name="NotificationMessageGroupContact">%1$s ha condiviso un contatto con il gruppo %2$s</string>
<string name="NotificationMessageGroupMap">%1$s ha inviato una posizione al gruppo %2$s</string>
<string name="NotificationMessageGroupDocument">%1$s ha inviato un documento al gruppo %2$s</string>
<string name="NotificationMessageGroupAudio">%1$s ha inviato dell\'audio al gruppo %2$s</string>
<string name="NotificationMessageGroupAudio">%1$s ha inviato un audio al gruppo %2$s</string>
<string name="NotificationInvitedToGroup">%1$s ti ha invitato nel gruppo %2$s</string>
<string name="NotificationEditedGroupName">%1$s ha modificato il nome del gruppo %2$s</string>
<string name="NotificationEditedGroupPhoto">%1$s ha modificato la foto del gruppo %2$s</string>
@ -158,9 +158,9 @@
<string name="NotificationGroupKickYou">%1$s ti ha rimosso dal gruppo %2$s</string>
<string name="NotificationGroupLeftMember">%1$s ha lasciato il gruppo %2$s</string>
<string name="NotificationContactJoined">%1$s ha iniziato a usare Telegram!</string>
<string name="NotificationUnrecognizedDevice">%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</string>
<string name="NotificationUnrecognizedDevice">%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</string>
<string name="NotificationContactNewPhoto">%1$s ha aggiornato la foto del profilo</string>
<string name="Reply">Reply</string>
<string name="Reply">Rispondi</string>
<!--contacts view-->
<string name="SelectContact">Seleziona contatto</string>
@ -211,7 +211,7 @@
<string name="CreateEncryptedChatOutdatedError">Impossibile creare una chat segreta con %1$s.\n\n%2$s sta usando una vecchia versione di Telegram e deve prima aggiornarla.</string>
<string name="SecretTitle">Chat segreta</string>
<string name="EncryptionKey">Chiave di cifratura</string>
<string name="MessageLifetime">Contatore di autodistruzione</string>
<string name="MessageLifetime">Timer di autodistruzione</string>
<string name="ShortMessageLifetimeForever">Spento</string>
<string name="ShortMessageLifetime2s">2s</string>
<string name="ShortMessageLifetime5s">5s</string>
@ -259,37 +259,37 @@
<string name="ContactJoined">Un contatto si è collegato a Telegram</string>
<string name="Pebble">PEBBLE</string>
<string name="Language">Lingua</string>
<string name="AskAQuestionInfo">Nota che il supporto di Telegram è fornito da volontari. Proviamo a rispondere non appena possibile, ma potrebbe richiedere del tempo.<![CDATA[<br><br>]]>Dai un\'occhiata alle <![CDATA[<a href="http://telegram.org/faq#general">Domande frequenti</a>]]>: troverai risposte alla maggior parte delle domande e suggerimenti importanti per <![CDATA[<a href="http://telegram.org/faq#troubleshooting">l\'individuazione del problema</a>]]>.</string>
<string name="AskAQuestionInfo">Nota che il supporto di Telegram è fornito da volontari. Proviamo a rispondere non appena possibile, ma potrebbe richiedere del tempo.<![CDATA[<br><br>]]>Dai un\'occhiata alle <![CDATA[<a href=\"https://telegram.org/faq/it#domande-generali\">Domande frequenti</a>]]>: troverai risposte alla maggior parte delle domande e suggerimenti importanti per <![CDATA[<a href=\"https://telegram.org/faq/it#risoluzione-dei-problemi\">l\'individuazione del problema</a>]]>.</string>
<string name="AskButton">Chiedi a un volontario</string>
<string name="TelegramFaq">Domande frequenti</string>
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
<string name="TelegramFaqUrl">https://telegram.org/faq/it</string>
<string name="DeleteLocalization">Eliminare la localizzazione?</string>
<string name="IncorrectLocalization">File della localizzazione non valido</string>
<string name="Enabled">Abilitato</string>
<string name="Disabled">Disabilitato</string>
<string name="NotificationsService">Servizio notifiche</string>
<string name="NotificationsServiceDisableInfo">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.</string>
<string name="NotificationsServiceDisableInfo">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.</string>
<string name="SortBy">Ordina per</string>
<string name="ImportContacts">Importa contatti</string>
<string name="WiFiOnly">Solo tramite WiFi</string>
<string name="SortFirstName">Nome</string>
<string name="SortLastName">Cognome</string>
<string name="LedColor">Colore LED</string>
<string name="PopupNotification">Notifiche Popup</string>
<string name="PopupNotification">Notifiche popup</string>
<string name="NoPopup">Nessun popup</string>
<string name="OnlyWhenScreenOn">Solo con schermo acceso</string>
<string name="OnlyWhenScreenOff">Solo con schermo spento</string>
<string name="AlwaysShowPopup">Mostra sempre i popup</string>
<string name="BadgeNumber">Contatore Badge</string>
<string name="Short">Short</string>
<string name="Long">Long</string>
<string name="SystemDefault">System default</string>
<string name="SettingsDefault">Settings default</string>
<string name="AutomaticMediaDownload">AUTOMATIC MEDIA DOWNLOAD</string>
<string name="WhenUsingMobileData">When using mobile data</string>
<string name="WhenConnectedOnWiFi">When connected on Wi-Fi</string>
<string name="WhenRoaming">When roaming</string>
<string name="NoMediaAutoDownload">No media</string>
<string name="Short">Breve</string>
<string name="Long">Lungo</string>
<string name="SystemDefault">Predefinito di sistema</string>
<string name="SettingsDefault">Impostazioni predefinite</string>
<string name="AutomaticMediaDownload">SCARICAMENTO AUTOMATICO MEDIA</string>
<string name="WhenUsingMobileData">Quando si utilizza la rete dati</string>
<string name="WhenConnectedOnWiFi">Quando si utilizza il Wi-Fi</string>
<string name="WhenRoaming">In roaming</string>
<string name="NoMediaAutoDownload">Nessun media</string>
<!--media view-->
<string name="NoMedia">Nessun media condiviso</string>
@ -314,9 +314,9 @@
<string name="NoPhotos">Ancora nessuna foto</string>
<!--edit video view-->
<string name="EditVideo">Modifica Video</string>
<string name="OriginalVideo">Video Originale</string>
<string name="EditedVideo">Video Modificato</string>
<string name="EditVideo">Modifica video</string>
<string name="OriginalVideo">Video originale</string>
<string name="EditedVideo">Video modificato</string>
<!--button titles-->
<string name="Next">Avanti</string>
@ -376,8 +376,8 @@
<string name="InvalidLastName">Cognome non valido</string>
<string name="Loading">Caricamento…</string>
<string name="NoPlayerInstalled">Non hai un lettore video, per favore installane uno per continuare</string>
<string name="NoMailInstalled">Invia unemail a sms@telegram.org e parlaci del tuo problema.</string>
<string name="NoHandleAppInstalled">Nessuna applicazione può gestire il tipo di file \'%1$s\', per favore installane una per proseguire</string>
<string name="NoMailInstalled">Invia unemail a sms@telegram.org spiegandoci il problema.</string>
<string name="NoHandleAppInstalled">Non hai nessuna applicazione che può gestire il tipo di file \'%1$s\': installane una per proseguire</string>
<string name="InviteUser">Questo utente non ha ancora Telegram, vuoi invitarlo?</string>
<string name="AreYouSure">Sei sicuro?</string>
<string name="AddContactQ">Vuoi aggiungere il contatto?</string>

View File

@ -160,7 +160,7 @@
<string name="NotificationContactJoined">%1$s heeft nu Telegram!</string>
<string name="NotificationUnrecognizedDevice">%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</string>
<string name="NotificationContactNewPhoto">%1$s heeft zijn/haar profielfoto gewijzigd</string>
<string name="Reply">Reply</string>
<string name="Reply">Antwoord</string>
<!--contacts view-->
<string name="SelectContact">Kies een contact</string>
@ -259,7 +259,7 @@
<string name="ContactJoined">Contact lid geworden van Telegram</string>
<string name="Pebble">PEBBLE</string>
<string name="Language">Taal</string>
<string name="AskAQuestionInfo">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.<![CDATA[<br><br>]]>Bekijk ook de <![CDATA[<a href="http://telegram.org/faq#general">veelgestelde vragen</a>]]>: hier staan de antwoorden op de meeste vragen en belangrijke tips voor <![CDATA[<a href="http://telegram.org/faq#troubleshooting">het oplossen van problemen</a>]]>.</string>
<string name="AskAQuestionInfo">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.<![CDATA[<br><br>]]>Bekijk ook de <![CDATA[<a href=\"http://telegram.org/faq#general\">veelgestelde vragen</a>]]>: hier staan de antwoorden op de meeste vragen en belangrijke tips voor <![CDATA[<a href=\"http://telegram.org/faq#troubleshooting\">het oplossen van problemen</a>]]>.</string>
<string name="AskButton">Vraag een vrijwilliger</string>
<string name="TelegramFaq">Veelgestelde vragen</string>
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
@ -281,15 +281,15 @@
<string name="OnlyWhenScreenOff">Alleen wanneer scherm \"uit\" staat</string>
<string name="AlwaysShowPopup">Altijd popup tonen</string>
<string name="BadgeNumber">Badgenummer</string>
<string name="Short">Short</string>
<string name="Long">Long</string>
<string name="SystemDefault">System default</string>
<string name="SettingsDefault">Settings default</string>
<string name="AutomaticMediaDownload">AUTOMATIC MEDIA DOWNLOAD</string>
<string name="WhenUsingMobileData">When using mobile data</string>
<string name="WhenConnectedOnWiFi">When connected on Wi-Fi</string>
<string name="WhenRoaming">When roaming</string>
<string name="NoMediaAutoDownload">No media</string>
<string name="Short">Kort</string>
<string name="Long">Lang</string>
<string name="SystemDefault">Standaardinstelling</string>
<string name="SettingsDefault">Standaardinstelling</string>
<string name="AutomaticMediaDownload">AUTOMATISCH MEDIA OPHALEN</string>
<string name="WhenUsingMobileData">Bij mobiel datagebruik</string>
<string name="WhenConnectedOnWiFi">Bij Wi-Fi verbinding</string>
<string name="WhenRoaming">Bij roamen</string>
<string name="NoMediaAutoDownload">Geen media</string>
<!--media view-->
<string name="NoMedia">Nog geen media gedeeld</string>