diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java index c32b5a14d..02b092ee0 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MessageObject.java @@ -60,14 +60,12 @@ public class MessageObject { public ArrayList photoThumbs; public VideoEditedInfo videoEditedInfo; public boolean viewsReloaded; - //public int wantedBotKeyboardWidth; public boolean attachPathExists; public boolean mediaExists; public boolean forceUpdate; private static TextPaint textPaint; - //private static TextPaint botButtonPaint; public int lastLineWidth; public int textWidth; public int textHeight; @@ -397,78 +395,6 @@ public class MessageObject { return textPaint; } - /* - public void generatePinMessageText(TLRPC.User fromUser, TLRPC.Chat chat) { - if (fromUser == null && chat == null) { - if (messageOwner.from_id > 0) { - fromUser = MessagesController.getInstance().getUser(messageOwner.from_id); - } - if (fromUser == null) { - chat = MessagesController.getInstance().getChat(messageOwner.to_id.channel_id); - } - } - if (replyMessageObject == null) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedNoText", R.string.ActionPinnedNoText), "un1", fromUser != null ? fromUser : chat); - } else { - if (replyMessageObject.isMusic()) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedMusic", R.string.ActionPinnedMusic), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.isVideo()) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedVideo", R.string.ActionPinnedVideo), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.isGif()) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedGif", R.string.ActionPinnedGif), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.isVoice()) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedVoice", R.string.ActionPinnedVoice), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.isSticker()) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedSticker", R.string.ActionPinnedSticker), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaDocument) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedFile", R.string.ActionPinnedFile), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaGeo) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedGeo", R.string.ActionPinnedGeo), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaContact) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedContact", R.string.ActionPinnedContact), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.messageOwner.media instanceof TLRPC.TL_messageMediaPhoto) { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedPhoto", R.string.ActionPinnedPhoto), "un1", fromUser != null ? fromUser : chat); - } else if (replyMessageObject.messageText != null && replyMessageObject.messageText.length() > 0) { - CharSequence mess = replyMessageObject.messageText; - if (mess.length() > 20) { - mess = mess.subSequence(0, 20) + "..."; - } - mess = Emoji.replaceEmoji(mess, textPaint.getFontMetricsInt(), AndroidUtilities.dp(20), false); - messageText = replaceWithLink(LocaleController.formatString("ActionPinnedText", R.string.ActionPinnedText, mess), "un1", fromUser != null ? fromUser : chat); - } else { - messageText = replaceWithLink(LocaleController.getString("ActionPinnedNoText", R.string.ActionPinnedNoText), "un1", fromUser != null ? fromUser : chat); - } - } - } - */ - - /* - private void measureInlineBotButtons() { - wantedBotKeyboardWidth = 0; - if (!(messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup)) { - return; - } - if (botButtonPaint == null) { - botButtonPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - botButtonPaint.setTextSize(AndroidUtilities.dp(15)); - botButtonPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); - } - for (int a = 0; a < messageOwner.reply_markup.rows.size(); a++) { - TLRPC.TL_keyboardButtonRow row = messageOwner.reply_markup.rows.get(a); - int maxButtonSize = 0; - int size = row.buttons.size(); - for (int b = 0; b < size; b++) { - CharSequence text = Emoji.replaceEmoji(row.buttons.get(b).text, botButtonPaint.getFontMetricsInt(), AndroidUtilities.dp(15), false); - StaticLayout staticLayout = new StaticLayout(text, botButtonPaint, AndroidUtilities.dp(2000), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); - if (staticLayout.getLineCount() > 0) { - maxButtonSize = Math.max(maxButtonSize, (int) Math.ceil(staticLayout.getLineWidth(0) - staticLayout.getLineLeft(0)) + AndroidUtilities.dp(4)); - } - } - wantedBotKeyboardWidth = Math.max(wantedBotKeyboardWidth, (maxButtonSize + AndroidUtilities.dp(12)) * size + AndroidUtilities.dp(5) * (size - 1)); - } - } - */ - public void setType() { int oldType = type; if (messageOwner instanceof TLRPC.TL_message /*|| messageOwner instanceof TLRPC.TL_messageForwarded_old2*/) { @@ -1215,7 +1141,7 @@ public class MessageObject { } public static boolean isMegagroup(TLRPC.Message message) { - return (message.flags & TLRPC.MESSAGE_FLAG_MEGAGROUP) != 0; + return false; } public static boolean isOut(TLRPC.Message message) { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/MrMailbox.java b/TMessagesProj/src/main/java/org/telegram/messenger/MrMailbox.java index 01b0540cc..c144e7294 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/MrMailbox.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/MrMailbox.java @@ -32,6 +32,7 @@ package org.telegram.messenger; import android.util.Log; +import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; public class MrMailbox { @@ -80,7 +81,7 @@ public class MrMailbox { ret.dialog_id = MrMsgGetChatId(hMsg); ret.unread = state!=MR_OUT_READ; // the state of outgoing messages ret.media_unread = ret.unread; - ret.flags = 0; // posible flags: TLRPC.MESSAGE_FLAG_HAS_FROM_ID, however, this seems to be read only + ret.flags = 0; // posible flags: MESSAGE_FLAG_HAS_FROM_ID, however, this seems to be read only ret.post = false; // ? true=avatar wird in gruppen nicht angezeigt ret.out = ret.from_id==1; // true=outgoing message, read eg. in MessageObject.isOutOwner() @@ -89,24 +90,31 @@ public class MrMailbox { } else if( type == MrMailbox.MR_MSG_IMAGE ) { String path = MrMailbox.MrMsgGetParam(hMsg, 'f', ""); - TLRPC.TL_photo photo = null; if( !path.isEmpty() ) { try { - // TODO: It is very inefficient to load all photos on dialog loading! FIX ME! - photo = SendMessagesHelper.getInstance().generatePhotoSizes(path, null); // TODO: does this degrade image quality? + //TLRPC.TL_photo photo; + //photo = SendMessagesHelper.getInstance().generatePhotoSizes(path, null); // TODO: does this degrade image quality? + + //ret.message = "-1"; + //ret.attachPath = new TLRPC.TL_messageMediaPhoto(); + //ret.media.photo = photo;// search for TL_messageMediaPhoto + + /* + photo = new TLRPC.TL_photo(); + TLRPC.TL_photoSize photoSize = new TLRPC.TL_photoSize(); + photoSize.w = MrMailbox.MrMsgGetParamInt(hMsg, 'w', 800); + photoSize.h = MrMailbox.MrMsgGetParamInt(hMsg, 'w', 800); + photoSize.size = 0; + photoSize.location.mr_path = path; + photoSize.type = "x"; + photo.sizes.add(photoSize); + */ + } catch (Exception e) { // the most common reason is a simple "file not found error" } } - if(photo!=null) { - ret.message = "-1"; - ret.media = new TLRPC.TL_messageMediaPhoto(); - ret.media.photo = photo; - } - else { - ret.message = "<" + LocaleController.getString("CannotLoadFile", R.string.CannotLoadFile) + ">"; - } } else { ret.message = "Messages of this type are not yet supported."; diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java b/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java index abb67205f..a8a9ce6a3 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/UserObject.java @@ -13,11 +13,7 @@ import org.telegram.tgnet.TLRPC; public class UserObject { public static boolean isDeleted(TLRPC.User user) { - return user == null || user instanceof TLRPC.TL_userDeleted_old2 || user instanceof TLRPC.TL_userEmpty || user.deleted; - } - - public static boolean isContact(TLRPC.User user) { - return user instanceof TLRPC.TL_userContact_old2 || user.contact || user.mutual_contact; + return user == null /*|| user instanceof TLRPC.TL_userDeleted_old2*/ || user instanceof TLRPC.TL_userEmpty || user.deleted; } public static boolean isUserSelf(TLRPC.User user) { diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java index f5208b85e..c737c0695 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java @@ -21,10 +21,8 @@ public class TLRPC { public static final int MESSAGE_FLAG_HAS_ENTITIES = 0x00000080; public static final int MESSAGE_FLAG_HAS_FROM_ID = 0x00000100; public static final int MESSAGE_FLAG_HAS_MEDIA = 0x00000200; - public static final int MESSAGE_FLAG_HAS_VIEWS = 0x00000400; public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800; public static final int MESSAGE_FLAG_EDITED = 0x00008000; - public static final int MESSAGE_FLAG_MEGAGROUP = 0x80000000; public static final int LAYER = 53; @@ -998,7 +996,6 @@ public class TLRPC { public int duration; public Photo photo; public Document document; - public long query_id; public static BotInlineResult TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { BotInlineResult result = null; @@ -2017,26 +2014,6 @@ public class TLRPC { } } - public static class TL_userDeleted_old2 extends User { - public static int constructor = 0xd6016d7a; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt32(exception); - first_name = stream.readString(exception); - last_name = stream.readString(exception); - username = stream.readString(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(id); - stream.writeString(first_name); - stream.writeString(last_name); - stream.writeString(username); - } - } - public static class TL_userEmpty extends User { public static int constructor = 0x200250ba; @@ -2515,38 +2492,6 @@ public class TLRPC { } } - public static class TL_video_layer45 extends Video { - public static int constructor = 0xf72887d3; - - - public void readParams(AbstractSerializedData stream, boolean exception) { - id = stream.readInt64(exception); - access_hash = stream.readInt64(exception); - date = stream.readInt32(exception); - duration = stream.readInt32(exception); - mime_type = stream.readString(exception); - size = stream.readInt32(exception); - thumb = PhotoSize.TLdeserialize(stream, stream.readInt32(exception), exception); - dc_id = stream.readInt32(exception); - w = stream.readInt32(exception); - h = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt64(id); - stream.writeInt64(access_hash); - stream.writeInt32(date); - stream.writeInt32(duration); - stream.writeString(mime_type); - stream.writeInt32(size); - thumb.serializeToStream(stream); - stream.writeInt32(dc_id); - stream.writeInt32(w); - stream.writeInt32(h); - } - } - public static class TopPeerCategory extends TLObject { public static TopPeerCategory TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { @@ -4251,37 +4196,6 @@ public class TLRPC { } } - public static class TL_messageRange extends TLObject { - public static int constructor = 0xae30253; - - public int min_id; - public int max_id; - - public static TL_messageRange TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { - if (TL_messageRange.constructor != constructor) { - if (exception) { - throw new RuntimeException(String.format("can't parse magic %x in TL_messageRange", constructor)); - } else { - return null; - } - } - TL_messageRange result = new TL_messageRange(); - result.readParams(stream, exception); - return result; - } - - public void readParams(AbstractSerializedData stream, boolean exception) { - min_id = stream.readInt32(exception); - max_id = stream.readInt32(exception); - } - - public void serializeToStream(AbstractSerializedData stream) { - stream.writeInt32(constructor); - stream.writeInt32(min_id); - stream.writeInt32(max_id); - } - } - public static class TL_contacts_resolvedPeer extends TLObject { public static int constructor = 0x7f077ad9; @@ -4643,9 +4557,6 @@ public class TLRPC { public boolean min; public InputChannel migrated_to; public String address; - public String venue; - public GeoPoint geo; - public boolean checked_in; public static Chat TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) { Chat result = null; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java index 844d17d2e..619e727b1 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ActionBar/Theme.java @@ -209,11 +209,8 @@ public class Theme { public static Drawable broadcastMediaDrawable; public static Drawable errorDrawable; public static Drawable systemDrawable; - //public static Drawable backgroundBluePressed; public static Drawable timeBackgroundDrawable; public static Drawable timeStickerBackgroundDrawable; - //public static Drawable botLink; - //public static Drawable botInline; public static Drawable[] clockChannelDrawable = new Drawable[2]; public static Drawable[] cornerOuter = new Drawable[4]; @@ -222,10 +219,6 @@ public class Theme { public static Drawable shareDrawable; public static Drawable shareIconDrawable; - public static Drawable[] viewsCountDrawable = new Drawable[2]; - public static Drawable viewsOutCountDrawable; - public static Drawable viewsMediaCountDrawable; - public static Drawable geoInDrawable; public static Drawable geoOutDrawable; @@ -270,13 +263,6 @@ public class Theme { broadcastDrawable = context.getResources().getDrawable(R.drawable.broadcast3); broadcastMediaDrawable = context.getResources().getDrawable(R.drawable.broadcast4); systemDrawable = context.getResources().getDrawable(R.drawable.system); - //botLink = context.getResources().getDrawable(R.drawable.bot_link); - //botInline = context.getResources().getDrawable(R.drawable.bot_lines); - - viewsCountDrawable[0] = context.getResources().getDrawable(R.drawable.post_views); - viewsCountDrawable[1] = context.getResources().getDrawable(R.drawable.post_views_s); - viewsOutCountDrawable = context.getResources().getDrawable(R.drawable.post_viewsg); - viewsMediaCountDrawable = context.getResources().getDrawable(R.drawable.post_views_w); fileStatesDrawable[0][0] = context.getResources().getDrawable(R.drawable.play_g); fileStatesDrawable[0][1] = context.getResources().getDrawable(R.drawable.play_g_s); diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java index 7a890d209..d0ff931c5 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Cells/ChatMessageCell.java @@ -46,7 +46,6 @@ import org.telegram.messenger.MrMailbox; import org.telegram.messenger.R; import org.telegram.messenger.SendMessagesHelper; import org.telegram.messenger.UserObject; -import org.telegram.messenger.Utilities; import org.telegram.messenger.browser.Browser; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; @@ -2742,14 +2741,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } } - /* EDIT BY MR - if ((currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) { - viewsLayout = new StaticLayout(currentViewsString, timePaint, viewsTextWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); - } else { - viewsLayout = null; - } - */ - if (isAvatarVisible) { avatarImage.setImageCoords(dp(6), layoutHeight - dp(44), dp(42), dp(42)); } @@ -3303,70 +3294,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate if (drawImageButton && photoImage.getVisible()) { radialProgress.draw(canvas); } - - /* - if (!botButtons.isEmpty()) { - int addX; - if (currentMessageObject.isOutOwner()) { - addX = getMeasuredWidth() - widthForButtons - dp(10); - } else { - addX = currentBackgroundDrawable.getBounds().left + dp(mediaBackground ? 1 : 7); - } - for (int a = 0; a < botButtons.size(); a++) { - BotButton button = botButtons.get(a); - int y = button.y + layoutHeight - dp(2); - Theme.systemDrawable.setColorFilter(a == pressedBotButton ? Theme.colorPressedFilter : Theme.colorFilter); - Theme.systemDrawable.setBounds(button.x + addX, y, button.x + addX + button.width, y + button.height); - Theme.systemDrawable.draw(canvas); - canvas.save(); - canvas.translate(button.x + addX + dp(5), y + (dp(44) - button.title.getLineBottom(button.title.getLineCount() - 1)) / 2); - button.title.draw(canvas); - canvas.restore(); - if (button.button instanceof TLRPC.TL_keyboardButtonUrl) { - int x = button.x + button.width - dp(3) - Theme.botLink.getIntrinsicWidth() + addX; - setDrawableBounds(Theme.botLink, x, y + dp(3)); - Theme.botLink.draw(canvas); - } else if (button.button instanceof TLRPC.TL_keyboardButtonSwitchInline) { - int x = button.x + button.width - dp(3) - Theme.botInline.getIntrinsicWidth() + addX; - setDrawableBounds(Theme.botInline, x, y + dp(3)); - Theme.botInline.draw(canvas); - } else if (button.button instanceof TLRPC.TL_keyboardButtonCallback || button.button instanceof TLRPC.TL_keyboardButtonRequestGeoLocation) { - boolean drawProgress = button.button instanceof TLRPC.TL_keyboardButtonCallback && SendMessagesHelper.getInstance().isSendingCallback(currentMessageObject, button.button) || - button.button instanceof TLRPC.TL_keyboardButtonRequestGeoLocation && SendMessagesHelper.getInstance().isSendingCurrentLocation(currentMessageObject, button.button); - if (drawProgress || !drawProgress && button.progressAlpha != 0) { - botProgressPaint.setAlpha(Math.min(255, (int) (button.progressAlpha * 255))); - int x = button.x + button.width - dp(9 + 3) + addX; - rect.set(x, y + dp(4), x + dp(8), y + dp(8 + 4)); - canvas.drawArc(rect, button.angle, 220, false, botProgressPaint); - invalidate((int) rect.left - dp(2), (int) rect.top - dp(2), (int) rect.right + dp(2), (int) rect.bottom + dp(2)); - long newTime = System.currentTimeMillis(); - if (Math.abs(button.lastUpdateTime - System.currentTimeMillis()) < 1000) { - long delta = (newTime - button.lastUpdateTime); - float dt = 360 * delta / 2000.0f; - button.angle += dt; - button.angle -= 360 * (button.angle / 360); - if (drawProgress) { - if (button.progressAlpha < 1.0f) { - button.progressAlpha += delta / 200.0f; - if (button.progressAlpha > 1.0f) { - button.progressAlpha = 1.0f; - } - } - } else { - if (button.progressAlpha > 0.0f) { - button.progressAlpha -= delta / 200.0f; - if (button.progressAlpha < 0.0f) { - button.progressAlpha = 0.0f; - } - } - } - } - button.lastUpdateTime = newTime; - } - } - } - } - */ } private Drawable getDrawableForCurrentState() { @@ -3806,14 +3733,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } timeTextWidth = timeWidth = (int) Math.ceil(timePaint.measureText(currentTimeString)); - /* EDIT BY MR - if ((messageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) { - currentViewsString = String.format("%s", LocaleController.formatShortNumber(Math.max(1, messageObject.messageOwner.views), null)); - viewsTextWidth = (int) Math.ceil(timePaint.measureText(currentViewsString)); - timeWidth += viewsTextWidth + Theme.viewsCountDrawable[0].getIntrinsicWidth() + dp(10); - } - */ - if (hasSign) { if (availableTimeWidth == 0) { availableTimeWidth = dp(1000); @@ -3868,15 +3787,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate } private void setMessageObjectInternal(MessageObject messageObject) { - if ((messageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) { - if (currentMessageObject.isContentUnread() && !currentMessageObject.isOut()) { - MessagesController.getInstance().addToViewsQueue(currentMessageObject.messageOwner, false); - currentMessageObject.setContentIsRead(); - } else if (!currentMessageObject.viewsReloaded) { - MessagesController.getInstance().addToViewsQueue(currentMessageObject.messageOwner, true); - currentMessageObject.viewsReloaded = true; - } - } if (currentMessageObject.isFromUser()) { currentUser = MessagesController.getInstance().getUser(currentMessageObject.messageOwner.from_id); @@ -4363,34 +4273,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate drawable.draw(canvas); int additionalX = 0; - if ((currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) { - additionalX = (int) (timeWidth - timeLayout.getLineWidth(0)); - - if (currentMessageObject.isSending()) { - if (!currentMessageObject.isOutOwner()) { - setDrawableBounds(Theme.clockMediaDrawable, timeX + dp(11), layoutHeight - dp(13.0f) - Theme.clockMediaDrawable.getIntrinsicHeight()); - Theme.clockMediaDrawable.draw(canvas); - } - } else if (currentMessageObject.isSendError()) { - if (!currentMessageObject.isOutOwner()) { - setDrawableBounds(Theme.errorDrawable, timeX + dp(11), layoutHeight - dp(12.5f) - Theme.errorDrawable.getIntrinsicHeight()); - Theme.errorDrawable.draw(canvas); - } - } else { - Drawable countDrawable = Theme.viewsMediaCountDrawable; - setDrawableBounds(countDrawable, timeX, layoutHeight - dp(9.5f) - timeLayout.getHeight()); - countDrawable.draw(canvas); - - /* EDIT BY MR - if (viewsLayout != null) { - canvas.save(); - canvas.translate(timeX + countDrawable.getIntrinsicWidth() + dp(3), layoutHeight - dp(11.3f) - timeLayout.getHeight()); - viewsLayout.draw(canvas); - canvas.restore(); - } - */ - } - } canvas.save(); canvas.translate(timeX + additionalX, layoutHeight - dp(11.3f) - timeLayout.getHeight()); @@ -4398,39 +4280,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate canvas.restore(); } else { int additionalX = 0; - if ((currentMessageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_HAS_VIEWS) != 0) { - additionalX = (int) (timeWidth - timeLayout.getLineWidth(0)); - - if (currentMessageObject.isSending()) { - if (!currentMessageObject.isOutOwner()) { - Drawable clockDrawable = Theme.clockChannelDrawable[isDrawSelectedBackground() ? 1 : 0]; - setDrawableBounds(clockDrawable, timeX + dp(11), layoutHeight - dp(8.5f) - clockDrawable.getIntrinsicHeight()); - clockDrawable.draw(canvas); - } - } else if (currentMessageObject.isSendError()) { - if (!currentMessageObject.isOutOwner()) { - setDrawableBounds(Theme.errorDrawable, timeX + dp(11), layoutHeight - dp(6.5f) - Theme.errorDrawable.getIntrinsicHeight()); - Theme.errorDrawable.draw(canvas); - } - } else { - if (!currentMessageObject.isOutOwner()) { - setDrawableBounds(Theme.viewsCountDrawable[isDrawSelectedBackground() ? 1 : 0], timeX, layoutHeight - dp(4.5f) - timeLayout.getHeight()); - Theme.viewsCountDrawable[isDrawSelectedBackground() ? 1 : 0].draw(canvas); - } else { - setDrawableBounds(Theme.viewsOutCountDrawable, timeX, layoutHeight - dp(4.5f) - timeLayout.getHeight()); - Theme.viewsOutCountDrawable.draw(canvas); - } - - /* EDIT BY MR - if (viewsLayout != null) { - canvas.save(); - canvas.translate(timeX + Theme.viewsOutCountDrawable.getIntrinsicWidth() + dp(3), layoutHeight - dp(6.5f) - timeLayout.getHeight()); - viewsLayout.draw(canvas); - canvas.restore(); - } - */ - } - } canvas.save(); canvas.translate(timeX + additionalX, layoutHeight - dp(6.5f) - timeLayout.getHeight()); @@ -4444,7 +4293,6 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate boolean drawCheck2 = false; boolean drawClock = false; boolean drawError = false; - boolean isBroadcast = (int)(currentMessageObject.getDialogId() >> 32) == 1; if (currentMessageObject.isSending()) { drawCheck1 = false; @@ -4477,7 +4325,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate Theme.clockMediaDrawable.draw(canvas); } } - if (isBroadcast) { + /*if (isBroadcast) { if (drawCheck1 || drawCheck2) { if (!mediaBackground) { setDrawableBounds(Theme.broadcastDrawable, layoutWidth - dp(20.5f) - Theme.broadcastDrawable.getIntrinsicWidth(), layoutHeight - dp(8.0f) - Theme.broadcastDrawable.getIntrinsicHeight()); @@ -4487,7 +4335,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate Theme.broadcastMediaDrawable.draw(canvas); } } - } else { + } else */ + { if (drawCheck2) { if (!mediaBackground) { if (drawCheck1) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java index d8c198921..a1f540ea8 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ChatAvatarContainer.java @@ -39,7 +39,6 @@ public class ChatAvatarContainer extends FrameLayout { private SimpleTextView titleTextView; private SimpleTextView subtitleTextView; private ImageView timeItem; - private TimerDrawable timerDrawable; private ChatActivity parentFragment; private TypingDotsDrawable typingDotsDrawable; private RecordStatusDrawable recordStatusDrawable; @@ -161,10 +160,12 @@ public class ChatAvatarContainer extends FrameLayout { } public void setTime(int value) { + /* if (timerDrawable == null) { return; } timerDrawable.setTime(value); + */ } public void setTitleIcons(int leftIcon, int rightIcon) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/TimerDrawable.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/TimerDrawable.java deleted file mode 100644 index 4cf6853b1..000000000 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/TimerDrawable.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * This is the source code of Telegram for Android v. 1.3.x. - * It is licensed under GNU GPL v. 2 or later. - * You should have received a copy of the license in this archive (see LICENSE). - * - * Copyright Nikolai Kudashov, 2013-2016. - */ - -package org.telegram.ui.Components; - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.ColorFilter; -import android.graphics.Paint; -import android.graphics.drawable.Drawable; -import android.text.Layout; -import android.text.StaticLayout; -import android.text.TextPaint; - -import org.telegram.messenger.AndroidUtilities; -import org.telegram.messenger.FileLog; -import org.telegram.messenger.R; - -public class TimerDrawable extends Drawable { - - private static Drawable emptyTimerDrawable; - private static Drawable timerDrawable; - private static TextPaint timePaint; - private StaticLayout timeLayout; - private float timeWidth = 0; - private int timeHeight = 0; - private int time = 0; - - public TimerDrawable(Context context) { - if (emptyTimerDrawable == null) { - emptyTimerDrawable = context.getResources().getDrawable(R.drawable.header_timer); - timerDrawable = context.getResources().getDrawable(R.drawable.header_timer2); - timePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); - timePaint.setTextSize(AndroidUtilities.dp(11)); - timePaint.setColor(0xffffffff); - timePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); - } - } - - public void setTime(int value) { - time = value; - - String timeString; - if (time >= 1 && time < 60) { - timeString = "" + value; - if (timeString.length() < 2) { - timeString += "s"; - } - } else if (time >= 60 && time < 60 * 60) { - timeString = "" + value / 60; - if (timeString.length() < 2) { - timeString += "m"; - } - } else if (time >= 60 * 60 && time < 60 * 60 * 24) { - timeString = "" + value / 60 / 60; - if (timeString.length() < 2) { - timeString += "h"; - } - } else if (time >= 60 * 60 * 24 && time < 60 * 60 * 24 * 7) { - timeString = "" + value / 60 / 60 / 24; - if (timeString.length() < 2) { - timeString += "d"; - } - } else { - timeString = "" + value / 60 / 60 / 24 / 7; - if (timeString.length() < 2) { - timeString += "w"; - } else if (timeString.length() > 2) { - timeString = "c"; - } - } - - timeWidth = timePaint.measureText(timeString); - try { - timeLayout = new StaticLayout(timeString, timePaint, (int)Math.ceil(timeWidth), Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, false); - timeHeight = timeLayout.getHeight(); - } catch (Exception e) { - timeLayout = null; - FileLog.e("tmessages", e); - } - - invalidateSelf(); - } - - @Override - public void draw(Canvas canvas) { - int width = timerDrawable.getIntrinsicWidth(); - int height = timerDrawable.getIntrinsicHeight(); - Drawable drawable; - if (time == 0) { - drawable = timerDrawable; - } else { - drawable = emptyTimerDrawable; - } - - int x = (width - drawable.getIntrinsicWidth()) / 2; - int y = (height - drawable.getIntrinsicHeight()) / 2; - drawable.setBounds(x, y, x + drawable.getIntrinsicWidth(), y + drawable.getIntrinsicHeight()); - drawable.draw(canvas); - - if (time != 0 && timeLayout != null) { - int xOffxet = 0; - if (AndroidUtilities.density == 3) { - xOffxet = -1; - } - canvas.translate((int)(width / 2 - Math.ceil(timeWidth / 2)) + xOffxet, (height - timeHeight) / 2); - timeLayout.draw(canvas); - } - } - - @Override - public void setAlpha(int alpha) { - - } - - @Override - public void setColorFilter(ColorFilter cf) { - - } - - @Override - public int getOpacity() { - return 0; - } - - @Override - public int getIntrinsicWidth() { - return timerDrawable.getIntrinsicWidth(); - } - - @Override - public int getIntrinsicHeight() { - return timerDrawable.getIntrinsicHeight(); - } -} diff --git a/TMessagesProj/src/main/res/drawable-hdpi/header_timer.png b/TMessagesProj/src/main/res/drawable-hdpi/header_timer.png deleted file mode 100755 index 0c17b9bba..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/header_timer.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/header_timer2.png b/TMessagesProj/src/main/res/drawable-hdpi/header_timer2.png deleted file mode 100755 index 019ad9c9a..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/header_timer2.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/post_views.png b/TMessagesProj/src/main/res/drawable-hdpi/post_views.png deleted file mode 100755 index ec2add861..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/post_views.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/post_views_s.png b/TMessagesProj/src/main/res/drawable-hdpi/post_views_s.png deleted file mode 100755 index ab68d75a0..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/post_views_s.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/post_views_w.png b/TMessagesProj/src/main/res/drawable-hdpi/post_views_w.png deleted file mode 100755 index a224f5961..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/post_views_w.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-hdpi/post_viewsg.png b/TMessagesProj/src/main/res/drawable-hdpi/post_viewsg.png deleted file mode 100755 index ff153d198..000000000 Binary files a/TMessagesProj/src/main/res/drawable-hdpi/post_viewsg.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/header_timer.png b/TMessagesProj/src/main/res/drawable-mdpi/header_timer.png deleted file mode 100755 index 66aee6c2e..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/header_timer.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/header_timer2.png b/TMessagesProj/src/main/res/drawable-mdpi/header_timer2.png deleted file mode 100755 index 5b63eb2ad..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/header_timer2.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/post_views.png b/TMessagesProj/src/main/res/drawable-mdpi/post_views.png deleted file mode 100755 index 7004aa51f..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/post_views.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/post_views_s.png b/TMessagesProj/src/main/res/drawable-mdpi/post_views_s.png deleted file mode 100755 index 2ecc48092..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/post_views_s.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/post_views_w.png b/TMessagesProj/src/main/res/drawable-mdpi/post_views_w.png deleted file mode 100755 index 894d8cbb6..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/post_views_w.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-mdpi/post_viewsg.png b/TMessagesProj/src/main/res/drawable-mdpi/post_viewsg.png deleted file mode 100755 index f59e64f88..000000000 Binary files a/TMessagesProj/src/main/res/drawable-mdpi/post_viewsg.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/header_timer.png b/TMessagesProj/src/main/res/drawable-xhdpi/header_timer.png deleted file mode 100755 index 7bdc8d569..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/header_timer.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/header_timer2.png b/TMessagesProj/src/main/res/drawable-xhdpi/header_timer2.png deleted file mode 100755 index 37c985e65..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/header_timer2.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/post_views.png b/TMessagesProj/src/main/res/drawable-xhdpi/post_views.png deleted file mode 100755 index 9cf0d5bdf..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/post_views.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/post_views_s.png b/TMessagesProj/src/main/res/drawable-xhdpi/post_views_s.png deleted file mode 100755 index 87af72332..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/post_views_s.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/post_views_w.png b/TMessagesProj/src/main/res/drawable-xhdpi/post_views_w.png deleted file mode 100755 index 2de06dd70..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/post_views_w.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xhdpi/post_viewsg.png b/TMessagesProj/src/main/res/drawable-xhdpi/post_viewsg.png deleted file mode 100755 index fc3764cc9..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xhdpi/post_viewsg.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer.png b/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer.png deleted file mode 100755 index 9d27a863f..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer2.png b/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer2.png deleted file mode 100755 index aeaa2455b..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/header_timer2.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/post_views.png b/TMessagesProj/src/main/res/drawable-xxhdpi/post_views.png deleted file mode 100755 index c86017216..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/post_views.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/post_views_s.png b/TMessagesProj/src/main/res/drawable-xxhdpi/post_views_s.png deleted file mode 100755 index 7839b3d39..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/post_views_s.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/post_views_w.png b/TMessagesProj/src/main/res/drawable-xxhdpi/post_views_w.png deleted file mode 100755 index 7ddf4de63..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/post_views_w.png and /dev/null differ diff --git a/TMessagesProj/src/main/res/drawable-xxhdpi/post_viewsg.png b/TMessagesProj/src/main/res/drawable-xxhdpi/post_viewsg.png deleted file mode 100755 index b8889aa3f..000000000 Binary files a/TMessagesProj/src/main/res/drawable-xxhdpi/post_viewsg.png and /dev/null differ