use of org.telegram.ui.Components.MsgClockDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class Theme method createChatResources.
public static void createChatResources(Context context, boolean fontsOnly) {
createCommonChatResources();
if (!fontsOnly && chat_msgInDrawable == null) {
Resources resources = context.getResources();
chat_msgNoSoundDrawable = resources.getDrawable(R.drawable.video_muted);
chat_msgInDrawable = new MessageDrawable(MessageDrawable.TYPE_TEXT, false, false);
chat_msgInSelectedDrawable = new MessageDrawable(MessageDrawable.TYPE_TEXT, false, true);
chat_msgOutDrawable = new MessageDrawable(MessageDrawable.TYPE_TEXT, true, false);
chat_msgOutSelectedDrawable = new MessageDrawable(MessageDrawable.TYPE_TEXT, true, true);
chat_msgInMediaDrawable = new MessageDrawable(MessageDrawable.TYPE_MEDIA, false, false);
chat_msgInMediaSelectedDrawable = new MessageDrawable(MessageDrawable.TYPE_MEDIA, false, true);
chat_msgOutMediaDrawable = new MessageDrawable(MessageDrawable.TYPE_MEDIA, true, false);
chat_msgOutMediaSelectedDrawable = new MessageDrawable(MessageDrawable.TYPE_MEDIA, true, true);
playPauseAnimator = new PathAnimator(0.293f, -26, -28, 1.0f);
playPauseAnimator.addSvgKeyFrame("M 34.141 16.042 C 37.384 17.921 40.886 20.001 44.211 21.965 C 46.139 23.104 49.285 24.729 49.586 25.917 C 50.289 28.687 48.484 30 46.274 30 L 6 30.021 C 3.79 30.021 2.075 30.023 2 26.021 L 2.009 3.417 C 2.009 0.417 5.326 -0.58 7.068 0.417 C 10.545 2.406 25.024 10.761 34.141 16.042 Z", 166);
playPauseAnimator.addSvgKeyFrame("M 37.843 17.769 C 41.143 19.508 44.131 21.164 47.429 23.117 C 48.542 23.775 49.623 24.561 49.761 25.993 C 50.074 28.708 48.557 30 46.347 30 L 6 30.012 C 3.79 30.012 2 28.222 2 26.012 L 2.009 4.609 C 2.009 1.626 5.276 0.664 7.074 1.541 C 10.608 3.309 28.488 12.842 37.843 17.769 Z", 200);
playPauseAnimator.addSvgKeyFrame("M 40.644 18.756 C 43.986 20.389 49.867 23.108 49.884 25.534 C 49.897 27.154 49.88 24.441 49.894 26.059 C 49.911 28.733 48.6 30 46.39 30 L 6 30.013 C 3.79 30.013 2 28.223 2 26.013 L 2.008 5.52 C 2.008 2.55 5.237 1.614 7.079 2.401 C 10.656 4 31.106 14.097 40.644 18.756 Z", 217);
playPauseAnimator.addSvgKeyFrame("M 43.782 19.218 C 47.117 20.675 50.075 21.538 50.041 24.796 C 50.022 26.606 50.038 24.309 50.039 26.104 C 50.038 28.736 48.663 30 46.453 30 L 6 29.986 C 3.79 29.986 2 28.196 2 25.986 L 2.008 6.491 C 2.008 3.535 5.196 2.627 7.085 3.316 C 10.708 4.731 33.992 14.944 43.782 19.218 Z", 234);
playPauseAnimator.addSvgKeyFrame("M 47.421 16.941 C 50.544 18.191 50.783 19.91 50.769 22.706 C 50.761 24.484 50.76 23.953 50.79 26.073 C 50.814 27.835 49.334 30 47.124 30 L 5 30.01 C 2.79 30.01 1 28.22 1 26.01 L 1.001 10.823 C 1.001 8.218 3.532 6.895 5.572 7.26 C 7.493 8.01 47.421 16.941 47.421 16.941 Z", 267);
playPauseAnimator.addSvgKeyFrame("M 47.641 17.125 C 50.641 18.207 51.09 19.935 51.078 22.653 C 51.07 24.191 51.062 21.23 51.088 23.063 C 51.109 24.886 49.587 27 47.377 27 L 5 27.009 C 2.79 27.009 1 25.219 1 23.009 L 0.983 11.459 C 0.983 8.908 3.414 7.522 5.476 7.838 C 7.138 8.486 47.641 17.125 47.641 17.125 Z", 300);
playPauseAnimator.addSvgKeyFrame("M 48 7 C 50.21 7 52 8.79 52 11 C 52 19 52 19 52 19 C 52 21.21 50.21 23 48 23 L 4 23 C 1.79 23 0 21.21 0 19 L 0 11 C 0 8.79 1.79 7 4 7 C 48 7 48 7 48 7 Z", 383);
chat_msgOutCheckDrawable = resources.getDrawable(R.drawable.msg_check).mutate();
chat_msgOutCheckSelectedDrawable = resources.getDrawable(R.drawable.msg_check).mutate();
chat_msgOutCheckReadDrawable = resources.getDrawable(R.drawable.msg_check).mutate();
chat_msgOutCheckReadSelectedDrawable = resources.getDrawable(R.drawable.msg_check).mutate();
chat_msgMediaCheckDrawable = resources.getDrawable(R.drawable.msg_check_s).mutate();
chat_msgStickerCheckDrawable = resources.getDrawable(R.drawable.msg_check_s).mutate();
chat_msgOutHalfCheckDrawable = resources.getDrawable(R.drawable.msg_halfcheck).mutate();
chat_msgOutHalfCheckSelectedDrawable = resources.getDrawable(R.drawable.msg_halfcheck).mutate();
chat_msgMediaHalfCheckDrawable = resources.getDrawable(R.drawable.msg_halfcheck_s).mutate();
chat_msgStickerHalfCheckDrawable = resources.getDrawable(R.drawable.msg_halfcheck_s).mutate();
chat_msgClockDrawable = new MsgClockDrawable();
chat_msgInViewsDrawable = resources.getDrawable(R.drawable.msg_views).mutate();
chat_msgInViewsSelectedDrawable = resources.getDrawable(R.drawable.msg_views).mutate();
chat_msgOutViewsDrawable = resources.getDrawable(R.drawable.msg_views).mutate();
chat_msgOutViewsSelectedDrawable = resources.getDrawable(R.drawable.msg_views).mutate();
chat_msgInRepliesDrawable = resources.getDrawable(R.drawable.msg_reply_small).mutate();
chat_msgInRepliesSelectedDrawable = resources.getDrawable(R.drawable.msg_reply_small).mutate();
chat_msgOutRepliesDrawable = resources.getDrawable(R.drawable.msg_reply_small).mutate();
chat_msgOutRepliesSelectedDrawable = resources.getDrawable(R.drawable.msg_reply_small).mutate();
chat_msgInPinnedDrawable = resources.getDrawable(R.drawable.msg_pin_mini).mutate();
chat_msgInPinnedSelectedDrawable = resources.getDrawable(R.drawable.msg_pin_mini).mutate();
chat_msgOutPinnedDrawable = resources.getDrawable(R.drawable.msg_pin_mini).mutate();
chat_msgOutPinnedSelectedDrawable = resources.getDrawable(R.drawable.msg_pin_mini).mutate();
chat_msgMediaPinnedDrawable = resources.getDrawable(R.drawable.msg_pin_mini).mutate();
chat_msgStickerPinnedDrawable = resources.getDrawable(R.drawable.msg_pin_mini).mutate();
chat_msgMediaViewsDrawable = resources.getDrawable(R.drawable.msg_views).mutate();
chat_msgMediaRepliesDrawable = resources.getDrawable(R.drawable.msg_reply_small).mutate();
chat_msgStickerViewsDrawable = resources.getDrawable(R.drawable.msg_views).mutate();
chat_msgStickerRepliesDrawable = resources.getDrawable(R.drawable.msg_reply_small).mutate();
chat_msgInMenuDrawable = resources.getDrawable(R.drawable.msg_actions).mutate();
chat_msgInMenuSelectedDrawable = resources.getDrawable(R.drawable.msg_actions).mutate();
chat_msgOutMenuDrawable = resources.getDrawable(R.drawable.msg_actions).mutate();
chat_msgOutMenuSelectedDrawable = resources.getDrawable(R.drawable.msg_actions).mutate();
chat_msgMediaMenuDrawable = resources.getDrawable(R.drawable.video_actions);
chat_msgInInstantDrawable = resources.getDrawable(R.drawable.msg_instant).mutate();
chat_msgOutInstantDrawable = resources.getDrawable(R.drawable.msg_instant).mutate();
chat_msgErrorDrawable = resources.getDrawable(R.drawable.msg_warning);
chat_muteIconDrawable = resources.getDrawable(R.drawable.list_mute).mutate();
chat_lockIconDrawable = resources.getDrawable(R.drawable.ic_lock_header);
chat_msgBroadcastDrawable = resources.getDrawable(R.drawable.broadcast3).mutate();
chat_msgBroadcastMediaDrawable = resources.getDrawable(R.drawable.broadcast3).mutate();
chat_msgInCallDrawable[0] = resources.getDrawable(R.drawable.chat_calls_voice).mutate();
chat_msgInCallSelectedDrawable[0] = resources.getDrawable(R.drawable.chat_calls_voice).mutate();
chat_msgOutCallDrawable[0] = resources.getDrawable(R.drawable.chat_calls_voice).mutate();
chat_msgOutCallSelectedDrawable[0] = resources.getDrawable(R.drawable.chat_calls_voice).mutate();
chat_msgInCallDrawable[1] = resources.getDrawable(R.drawable.chat_calls_video).mutate();
chat_msgInCallSelectedDrawable[1] = resources.getDrawable(R.drawable.chat_calls_video).mutate();
chat_msgOutCallDrawable[1] = resources.getDrawable(R.drawable.chat_calls_video).mutate();
chat_msgOutCallSelectedDrawable[1] = resources.getDrawable(R.drawable.chat_calls_video).mutate();
chat_msgCallUpGreenDrawable = resources.getDrawable(R.drawable.chat_calls_outgoing).mutate();
chat_msgCallDownRedDrawable = resources.getDrawable(R.drawable.chat_calls_incoming).mutate();
chat_msgCallDownGreenDrawable = resources.getDrawable(R.drawable.chat_calls_incoming).mutate();
for (int a = 0; a < 2; a++) {
chat_pollCheckDrawable[a] = resources.getDrawable(R.drawable.poll_right).mutate();
chat_pollCrossDrawable[a] = resources.getDrawable(R.drawable.poll_wrong).mutate();
chat_pollHintDrawable[a] = resources.getDrawable(R.drawable.smiles_panel_objects).mutate();
chat_psaHelpDrawable[a] = resources.getDrawable(R.drawable.msg_psa).mutate();
}
calllog_msgCallUpRedDrawable = resources.getDrawable(R.drawable.ic_call_made_green_18dp).mutate();
calllog_msgCallUpGreenDrawable = resources.getDrawable(R.drawable.ic_call_made_green_18dp).mutate();
calllog_msgCallDownRedDrawable = resources.getDrawable(R.drawable.ic_call_received_green_18dp).mutate();
calllog_msgCallDownGreenDrawable = resources.getDrawable(R.drawable.ic_call_received_green_18dp).mutate();
chat_msgAvatarLiveLocationDrawable = resources.getDrawable(R.drawable.livepin).mutate();
chat_inlineResultFile = resources.getDrawable(R.drawable.bot_file);
chat_inlineResultAudio = resources.getDrawable(R.drawable.bot_music);
chat_inlineResultLocation = resources.getDrawable(R.drawable.bot_location);
chat_redLocationIcon = resources.getDrawable(R.drawable.map_pin).mutate();
chat_botLinkDrawalbe = resources.getDrawable(R.drawable.bot_link);
chat_botInlineDrawable = resources.getDrawable(R.drawable.bot_lines);
chat_botCardDrawalbe = resources.getDrawable(R.drawable.bot_card);
chat_commentDrawable = resources.getDrawable(R.drawable.msg_msgbubble);
chat_commentStickerDrawable = resources.getDrawable(R.drawable.msg_msgbubble2);
chat_commentArrowDrawable = resources.getDrawable(R.drawable.msg_arrowright);
chat_contextResult_shadowUnderSwitchDrawable = resources.getDrawable(R.drawable.header_shadow).mutate();
chat_attachButtonDrawables[0] = new RLottieDrawable(R.raw.attach_gallery, "attach_gallery", AndroidUtilities.dp(26), AndroidUtilities.dp(26));
chat_attachButtonDrawables[1] = new RLottieDrawable(R.raw.attach_music, "attach_music", AndroidUtilities.dp(26), AndroidUtilities.dp(26));
chat_attachButtonDrawables[2] = new RLottieDrawable(R.raw.attach_file, "attach_file", AndroidUtilities.dp(26), AndroidUtilities.dp(26));
chat_attachButtonDrawables[3] = new RLottieDrawable(R.raw.attach_contact, "attach_contact", AndroidUtilities.dp(26), AndroidUtilities.dp(26));
chat_attachButtonDrawables[4] = new RLottieDrawable(R.raw.attach_location, "attach_location", AndroidUtilities.dp(26), AndroidUtilities.dp(26));
chat_attachButtonDrawables[5] = new RLottieDrawable(R.raw.attach_poll, "attach_poll", AndroidUtilities.dp(26), AndroidUtilities.dp(26));
chat_attachEmptyDrawable = resources.getDrawable(R.drawable.nophotos3);
chat_shareIconDrawable = resources.getDrawable(R.drawable.share_arrow).mutate();
chat_replyIconDrawable = resources.getDrawable(R.drawable.fast_reply);
chat_goIconDrawable = resources.getDrawable(R.drawable.message_arrow);
chat_fileMiniStatesDrawable[0][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.audio_mini_arrow);
chat_fileMiniStatesDrawable[0][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.audio_mini_arrow);
chat_fileMiniStatesDrawable[1][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.audio_mini_cancel);
chat_fileMiniStatesDrawable[1][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.audio_mini_cancel);
chat_fileMiniStatesDrawable[2][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.audio_mini_arrow);
chat_fileMiniStatesDrawable[2][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.audio_mini_arrow);
chat_fileMiniStatesDrawable[3][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.audio_mini_cancel);
chat_fileMiniStatesDrawable[3][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.audio_mini_cancel);
chat_fileMiniStatesDrawable[4][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.video_mini_arrow);
chat_fileMiniStatesDrawable[4][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.video_mini_arrow);
chat_fileMiniStatesDrawable[5][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.video_mini_cancel);
chat_fileMiniStatesDrawable[5][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(22), R.drawable.video_mini_cancel);
int rad = AndroidUtilities.dp(2);
RectF rect = new RectF();
chat_filePath[0] = new Path();
chat_filePath[0].moveTo(AndroidUtilities.dp(7), AndroidUtilities.dp(3));
chat_filePath[0].lineTo(AndroidUtilities.dp(14), AndroidUtilities.dp(3));
chat_filePath[0].lineTo(AndroidUtilities.dp(21), AndroidUtilities.dp(10));
chat_filePath[0].lineTo(AndroidUtilities.dp(21), AndroidUtilities.dp(20));
rect.set(AndroidUtilities.dp(21) - rad * 2, AndroidUtilities.dp(19) - rad, AndroidUtilities.dp(21), AndroidUtilities.dp(19) + rad);
chat_filePath[0].arcTo(rect, 0, 90, false);
chat_filePath[0].lineTo(AndroidUtilities.dp(6), AndroidUtilities.dp(21));
rect.set(AndroidUtilities.dp(5), AndroidUtilities.dp(19) - rad, AndroidUtilities.dp(5) + rad * 2, AndroidUtilities.dp(19) + rad);
chat_filePath[0].arcTo(rect, 90, 90, false);
chat_filePath[0].lineTo(AndroidUtilities.dp(5), AndroidUtilities.dp(4));
rect.set(AndroidUtilities.dp(5), AndroidUtilities.dp(3), AndroidUtilities.dp(5) + rad * 2, AndroidUtilities.dp(3) + rad * 2);
chat_filePath[0].arcTo(rect, 180, 90, false);
chat_filePath[0].close();
chat_filePath[1] = new Path();
chat_filePath[1].moveTo(AndroidUtilities.dp(14), AndroidUtilities.dp(5));
chat_filePath[1].lineTo(AndroidUtilities.dp(19), AndroidUtilities.dp(10));
chat_filePath[1].lineTo(AndroidUtilities.dp(14), AndroidUtilities.dp(10));
chat_filePath[1].close();
chat_flameIcon = resources.getDrawable(R.drawable.burn).mutate();
chat_gifIcon = resources.getDrawable(R.drawable.msg_round_gif_m).mutate();
chat_fileStatesDrawable[0][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_play_m);
chat_fileStatesDrawable[0][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_play_m);
chat_fileStatesDrawable[1][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_pause_m);
chat_fileStatesDrawable[1][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_pause_m);
chat_fileStatesDrawable[2][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_load_m);
chat_fileStatesDrawable[2][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_load_m);
chat_fileStatesDrawable[3][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_file_s);
chat_fileStatesDrawable[3][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_file_s);
chat_fileStatesDrawable[4][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_cancel_m);
chat_fileStatesDrawable[4][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_cancel_m);
chat_fileStatesDrawable[5][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_play_m);
chat_fileStatesDrawable[5][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_play_m);
chat_fileStatesDrawable[6][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_pause_m);
chat_fileStatesDrawable[6][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_pause_m);
chat_fileStatesDrawable[7][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_load_m);
chat_fileStatesDrawable[7][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_load_m);
chat_fileStatesDrawable[8][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_file_s);
chat_fileStatesDrawable[8][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_file_s);
chat_fileStatesDrawable[9][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_cancel_m);
chat_fileStatesDrawable[9][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_round_cancel_m);
chat_photoStatesDrawables[0][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_load_m);
chat_photoStatesDrawables[0][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_load_m);
chat_photoStatesDrawables[1][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_cancel_m);
chat_photoStatesDrawables[1][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_cancel_m);
chat_photoStatesDrawables[2][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_gif_m);
chat_photoStatesDrawables[2][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_gif_m);
chat_photoStatesDrawables[3][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_play_m);
chat_photoStatesDrawables[3][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_play_m);
chat_photoStatesDrawables[4][0] = chat_photoStatesDrawables[4][1] = resources.getDrawable(R.drawable.burn);
chat_photoStatesDrawables[5][0] = chat_photoStatesDrawables[5][1] = resources.getDrawable(R.drawable.circle);
chat_photoStatesDrawables[6][0] = chat_photoStatesDrawables[6][1] = resources.getDrawable(R.drawable.photocheck);
chat_photoStatesDrawables[7][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_load_m);
chat_photoStatesDrawables[7][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_load_m);
chat_photoStatesDrawables[8][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_cancel_m);
chat_photoStatesDrawables[8][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_cancel_m);
chat_photoStatesDrawables[9][0] = resources.getDrawable(R.drawable.doc_big).mutate();
chat_photoStatesDrawables[9][1] = resources.getDrawable(R.drawable.doc_big).mutate();
chat_photoStatesDrawables[10][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_load_m);
chat_photoStatesDrawables[10][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_load_m);
chat_photoStatesDrawables[11][0] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_cancel_m);
chat_photoStatesDrawables[11][1] = createCircleDrawableWithIcon(AndroidUtilities.dp(48), R.drawable.msg_round_cancel_m);
chat_photoStatesDrawables[12][0] = resources.getDrawable(R.drawable.doc_big).mutate();
chat_photoStatesDrawables[12][1] = resources.getDrawable(R.drawable.doc_big).mutate();
chat_contactDrawable[0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_contact);
chat_contactDrawable[1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_contact);
chat_locationDrawable[0] = resources.getDrawable(R.drawable.msg_location).mutate();
chat_locationDrawable[1] = resources.getDrawable(R.drawable.msg_location).mutate();
chat_composeShadowDrawable = context.getResources().getDrawable(R.drawable.compose_panel_shadow).mutate();
chat_composeShadowRoundDrawable = context.getResources().getDrawable(R.drawable.sheet_shadow_round).mutate();
try {
int bitmapSize = AndroidUtilities.roundMessageSize + AndroidUtilities.dp(6);
Bitmap bitmap = Bitmap.createBitmap(bitmapSize, bitmapSize, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
Paint eraserPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
eraserPaint.setColor(0);
eraserPaint.setStyle(Paint.Style.FILL);
eraserPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setShadowLayer(AndroidUtilities.dp(4), 0, 0, 0x5f000000);
for (int a = 0; a < 2; a++) {
canvas.drawCircle(bitmapSize / 2, bitmapSize / 2, AndroidUtilities.roundMessageSize / 2 - AndroidUtilities.dp(1), a == 0 ? paint : eraserPaint);
}
try {
canvas.setBitmap(null);
} catch (Exception ignore) {
}
chat_roundVideoShadow = new BitmapDrawable(bitmap);
} catch (Throwable ignore) {
}
defaultChatDrawables.clear();
defaultChatDrawableColorKeys.clear();
addChatDrawable(key_drawable_botInline, chat_botInlineDrawable, key_chat_serviceIcon);
addChatDrawable(key_drawable_botLink, chat_botLinkDrawalbe, key_chat_serviceIcon);
addChatDrawable(key_drawable_goIcon, chat_goIconDrawable, key_chat_serviceIcon);
addChatDrawable(key_drawable_commentSticker, chat_commentStickerDrawable, key_chat_serviceIcon);
addChatDrawable(key_drawable_msgError, chat_msgErrorDrawable, key_chat_sentErrorIcon);
addChatDrawable(key_drawable_msgIn, chat_msgInDrawable, null);
addChatDrawable(key_drawable_msgInSelected, chat_msgInSelectedDrawable, null);
addChatDrawable(key_drawable_msgInMedia, chat_msgInMediaDrawable, null);
addChatDrawable(key_drawable_msgInMediaSelected, chat_msgInMediaSelectedDrawable, null);
addChatDrawable(key_drawable_msgOut, chat_msgOutDrawable, null);
addChatDrawable(key_drawable_msgOutSelected, chat_msgOutSelectedDrawable, null);
addChatDrawable(key_drawable_msgOutMedia, chat_msgOutMediaDrawable, null);
addChatDrawable(key_drawable_msgOutMediaSelected, chat_msgOutMediaSelectedDrawable, null);
addChatDrawable(key_drawable_msgOutCallAudio, chat_msgOutCallDrawable[0], key_chat_outInstant);
addChatDrawable(key_drawable_msgOutCallAudioSelected, chat_msgOutCallSelectedDrawable[0], key_chat_outInstantSelected);
addChatDrawable(key_drawable_msgOutCallVideo, chat_msgOutCallDrawable[1], key_chat_outInstant);
addChatDrawable(key_drawable_msgOutCallVideoSelected, chat_msgOutCallSelectedDrawable[1], key_chat_outInstantSelected);
addChatDrawable(key_drawable_msgOutCheck, chat_msgOutCheckDrawable, key_chat_outSentCheck);
addChatDrawable(key_drawable_msgOutCheckSelected, chat_msgOutCheckSelectedDrawable, key_chat_outSentCheckSelected);
addChatDrawable(key_drawable_msgOutCheckRead, chat_msgOutCheckReadDrawable, key_chat_outSentCheckRead);
addChatDrawable(key_drawable_msgOutCheckReadSelected, chat_msgOutCheckReadSelectedDrawable, key_chat_outSentCheckReadSelected);
addChatDrawable(key_drawable_msgOutHalfCheck, chat_msgOutHalfCheckDrawable, key_chat_outSentCheckRead);
addChatDrawable(key_drawable_msgOutHalfCheckSelected, chat_msgOutHalfCheckSelectedDrawable, key_chat_outSentCheckReadSelected);
addChatDrawable(key_drawable_msgOutInstant, chat_msgOutInstantDrawable, key_chat_outInstant);
addChatDrawable(key_drawable_msgOutMenu, chat_msgOutMenuDrawable, key_chat_outMenu);
addChatDrawable(key_drawable_msgOutMenuSelected, chat_msgOutMenuSelectedDrawable, key_chat_outMenuSelected);
addChatDrawable(key_drawable_msgOutPinned, chat_msgOutPinnedDrawable, key_chat_outViews);
addChatDrawable(key_drawable_msgOutPinnedSelected, chat_msgOutPinnedSelectedDrawable, key_chat_outViewsSelected);
addChatDrawable(key_drawable_msgOutReplies, chat_msgOutRepliesDrawable, key_chat_outViews);
addChatDrawable(key_drawable_msgOutRepliesSelected, chat_msgOutRepliesSelectedDrawable, key_chat_outViewsSelected);
addChatDrawable(key_drawable_msgOutViews, chat_msgOutViewsDrawable, key_chat_outViews);
addChatDrawable(key_drawable_msgOutViewsSelected, chat_msgOutViewsSelectedDrawable, key_chat_outViewsSelected);
addChatDrawable(key_drawable_msgStickerCheck, chat_msgStickerCheckDrawable, key_chat_serviceText);
addChatDrawable(key_drawable_msgStickerHalfCheck, chat_msgStickerHalfCheckDrawable, key_chat_serviceText);
addChatDrawable(key_drawable_msgStickerPinned, chat_msgStickerPinnedDrawable, key_chat_serviceText);
addChatDrawable(key_drawable_msgStickerReplies, chat_msgStickerRepliesDrawable, key_chat_serviceText);
addChatDrawable(key_drawable_msgStickerViews, chat_msgStickerViewsDrawable, key_chat_serviceText);
addChatDrawable(key_drawable_replyIcon, chat_replyIconDrawable, key_chat_serviceIcon);
addChatDrawable(key_drawable_shareIcon, chat_shareIconDrawable, key_chat_serviceIcon);
addChatDrawable(key_drawable_muteIconDrawable, chat_muteIconDrawable, key_chat_muteIcon);
addChatDrawable(key_drawable_lockIconDrawable, chat_lockIconDrawable, key_chat_lockIcon);
addChatDrawable(key_drawable_chat_pollHintDrawableOut, chat_pollHintDrawable[1], key_chat_outPreviewInstantText);
addChatDrawable(key_drawable_chat_pollHintDrawableIn, chat_pollHintDrawable[0], key_chat_inPreviewInstantText);
applyChatTheme(fontsOnly, false);
}
if (!fontsOnly && chat_botProgressPaint != null) {
chat_botProgressPaint.setStrokeWidth(AndroidUtilities.dp(2));
chat_infoPaint.setTextSize(AndroidUtilities.dp(12));
chat_stickerCommentCountPaint.setTextSize(AndroidUtilities.dp(11));
chat_docNamePaint.setTextSize(AndroidUtilities.dp(15));
chat_locationTitlePaint.setTextSize(AndroidUtilities.dp(15));
chat_locationAddressPaint.setTextSize(AndroidUtilities.dp(13));
chat_audioTimePaint.setTextSize(AndroidUtilities.dp(12));
chat_livePaint.setTextSize(AndroidUtilities.dp(12));
chat_audioTitlePaint.setTextSize(AndroidUtilities.dp(16));
chat_audioPerformerPaint.setTextSize(AndroidUtilities.dp(15));
chat_botButtonPaint.setTextSize(AndroidUtilities.dp(15));
chat_contactNamePaint.setTextSize(AndroidUtilities.dp(15));
chat_contactPhonePaint.setTextSize(AndroidUtilities.dp(13));
chat_durationPaint.setTextSize(AndroidUtilities.dp(12));
chat_timePaint.setTextSize(AndroidUtilities.dp(12));
chat_adminPaint.setTextSize(AndroidUtilities.dp(13));
chat_namePaint.setTextSize(AndroidUtilities.dp(14));
chat_forwardNamePaint.setTextSize(AndroidUtilities.dp(14));
chat_replyNamePaint.setTextSize(AndroidUtilities.dp(14));
chat_replyTextPaint.setTextSize(AndroidUtilities.dp(14));
chat_gamePaint.setTextSize(AndroidUtilities.dp(13));
chat_shipmentPaint.setTextSize(AndroidUtilities.dp(13));
chat_instantViewPaint.setTextSize(AndroidUtilities.dp(13));
chat_instantViewRectPaint.setStrokeWidth(AndroidUtilities.dp(1));
chat_pollTimerPaint.setStrokeWidth(AndroidUtilities.dp(1.1f));
chat_actionTextPaint.setTextSize(AndroidUtilities.dp(Math.max(16, SharedConfig.fontSize) - 2));
chat_contextResult_titleTextPaint.setTextSize(AndroidUtilities.dp(15));
chat_contextResult_descriptionTextPaint.setTextSize(AndroidUtilities.dp(13));
chat_radialProgressPaint.setStrokeWidth(AndroidUtilities.dp(3));
chat_radialProgress2Paint.setStrokeWidth(AndroidUtilities.dp(2));
}
}
use of org.telegram.ui.Components.MsgClockDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatMessageCell method drawClockOrErrorLayout.
private void drawClockOrErrorLayout(Canvas canvas, boolean drawTime, boolean drawError, float layoutHeight, float alpha, float timeYOffset, float timeX, float progress, boolean drawSelectionBackground) {
boolean useScale = progress != 1f;
float scale = 0.5f + 0.5f * progress;
alpha *= progress;
if (drawTime) {
if (!currentMessageObject.isOutOwner()) {
MsgClockDrawable clockDrawable = Theme.chat_msgClockDrawable;
int clockColor;
if (shouldDrawTimeOnMedia()) {
clockColor = getThemedColor(Theme.key_chat_mediaSentClock);
} else {
clockColor = getThemedColor(drawSelectionBackground ? Theme.key_chat_outSentClockSelected : Theme.key_chat_mediaSentClock);
}
clockDrawable.setColor(clockColor);
float timeY = shouldDrawTimeOnMedia() ? photoImage.getImageY2() + additionalTimeOffsetY - AndroidUtilities.dp(9.0f) : layoutHeight - AndroidUtilities.dp(pinnedBottom || pinnedTop ? 9.5f : 8.5f) + timeYOffset;
setDrawableBounds(clockDrawable, timeX + (currentMessageObject.scheduled ? 0 : AndroidUtilities.dp(11)), timeY - clockDrawable.getIntrinsicHeight());
clockDrawable.setAlpha((int) (255 * alpha));
if (useScale) {
canvas.save();
canvas.scale(scale, scale, clockDrawable.getBounds().centerX(), clockDrawable.getBounds().centerY());
}
clockDrawable.draw(canvas);
clockDrawable.setAlpha(255);
invalidate();
if (useScale) {
canvas.restore();
}
}
} else if (drawError) {
if (!currentMessageObject.isOutOwner()) {
float x = timeX + (currentMessageObject.scheduled ? 0 : AndroidUtilities.dp(11));
float y = shouldDrawTimeOnMedia() ? photoImage.getImageY2() + additionalTimeOffsetY - AndroidUtilities.dp(21.5f) : layoutHeight - AndroidUtilities.dp(pinnedBottom || pinnedTop ? 21.5f : 20.5f) + timeYOffset;
rect.set(x, y, x + AndroidUtilities.dp(14), y + AndroidUtilities.dp(14));
int oldAlpha = Theme.chat_msgErrorPaint.getAlpha();
Theme.chat_msgErrorPaint.setAlpha((int) (255 * alpha));
if (useScale) {
canvas.save();
canvas.scale(scale, scale, rect.centerX(), rect.centerY());
}
canvas.drawRoundRect(rect, AndroidUtilities.dp(1), AndroidUtilities.dp(1), Theme.chat_msgErrorPaint);
Theme.chat_msgErrorPaint.setAlpha(oldAlpha);
Drawable errorDrawable = getThemedDrawable(Theme.key_drawable_msgError);
setDrawableBounds(errorDrawable, x + AndroidUtilities.dp(6), y + AndroidUtilities.dp(2));
errorDrawable.setAlpha((int) (255 * alpha));
errorDrawable.draw(canvas);
errorDrawable.setAlpha(255);
if (useScale) {
canvas.restore();
}
}
}
}
use of org.telegram.ui.Components.MsgClockDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class Theme method createDialogsResources.
public static void createDialogsResources(Context context) {
createCommonResources(context);
createCommonDialogResources(context);
if (dialogs_namePaint == null) {
Resources resources = context.getResources();
dialogs_namePaint = new TextPaint[2];
dialogs_nameEncryptedPaint = new TextPaint[2];
dialogs_messagePaint = new TextPaint[2];
dialogs_messagePrintingPaint = new TextPaint[2];
for (int a = 0; a < 2; a++) {
dialogs_namePaint[a] = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_namePaint[a].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
dialogs_nameEncryptedPaint[a] = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_nameEncryptedPaint[a].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
dialogs_messagePaint[a] = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_messagePrintingPaint[a] = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
}
dialogs_searchNamePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_searchNamePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
dialogs_searchNameEncryptedPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_searchNameEncryptedPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
dialogs_messageNamePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_messageNamePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
dialogs_timePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_archiveTextPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_archiveTextPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
dialogs_archiveTextPaintSmall = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_archiveTextPaintSmall.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
dialogs_onlinePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_offlinePaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
dialogs_tabletSeletedPaint = new Paint();
dialogs_pinnedPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
dialogs_countGrayPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
dialogs_errorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
dialogs_actionMessagePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
dialogs_lockDrawable = resources.getDrawable(R.drawable.list_secret);
dialogs_checkDrawable = resources.getDrawable(R.drawable.list_check).mutate();
dialogs_playDrawable = resources.getDrawable(R.drawable.minithumb_play).mutate();
dialogs_checkReadDrawable = resources.getDrawable(R.drawable.list_check).mutate();
dialogs_halfCheckDrawable = resources.getDrawable(R.drawable.list_halfcheck);
dialogs_clockDrawable = new MsgClockDrawable();
dialogs_errorDrawable = resources.getDrawable(R.drawable.list_warning_sign);
dialogs_reorderDrawable = resources.getDrawable(R.drawable.list_reorder).mutate();
dialogs_groupDrawable = resources.getDrawable(R.drawable.list_group);
dialogs_broadcastDrawable = resources.getDrawable(R.drawable.list_broadcast);
dialogs_muteDrawable = resources.getDrawable(R.drawable.list_mute).mutate();
dialogs_verifiedDrawable = resources.getDrawable(R.drawable.verified_area).mutate();
dialogs_scamDrawable = new ScamDrawable(11, 0);
dialogs_fakeDrawable = new ScamDrawable(11, 1);
dialogs_verifiedCheckDrawable = resources.getDrawable(R.drawable.verified_check).mutate();
dialogs_mentionDrawable = resources.getDrawable(R.drawable.mentionchatslist);
dialogs_reactionsMentionDrawable = resources.getDrawable(R.drawable.reactionchatslist);
dialogs_botDrawable = resources.getDrawable(R.drawable.list_bot);
dialogs_pinnedDrawable = resources.getDrawable(R.drawable.list_pin);
moveUpDrawable = resources.getDrawable(R.drawable.preview_open);
RectF rect = new RectF();
chat_updatePath[0] = new Path();
chat_updatePath[2] = new Path();
float cx = AndroidUtilities.dp(12);
float cy = AndroidUtilities.dp(12);
rect.set(cx - AndroidUtilities.dp(5), cy - AndroidUtilities.dp(5), cx + AndroidUtilities.dp(5), cy + AndroidUtilities.dp(5));
chat_updatePath[2].arcTo(rect, -160, -110, true);
chat_updatePath[2].arcTo(rect, 20, -110, true);
chat_updatePath[0].moveTo(cx, cy + AndroidUtilities.dp(5 + 3));
chat_updatePath[0].lineTo(cx, cy + AndroidUtilities.dp(5 - 3));
chat_updatePath[0].lineTo(cx + AndroidUtilities.dp(3), cy + AndroidUtilities.dp(5));
chat_updatePath[0].close();
chat_updatePath[0].moveTo(cx, cy - AndroidUtilities.dp(5 + 3));
chat_updatePath[0].lineTo(cx, cy - AndroidUtilities.dp(5 - 3));
chat_updatePath[0].lineTo(cx - AndroidUtilities.dp(3), cy - AndroidUtilities.dp(5));
chat_updatePath[0].close();
applyDialogsTheme();
}
dialogs_messageNamePaint.setTextSize(AndroidUtilities.dp(14));
dialogs_timePaint.setTextSize(AndroidUtilities.dp(13));
dialogs_archiveTextPaint.setTextSize(AndroidUtilities.dp(13));
dialogs_archiveTextPaintSmall.setTextSize(AndroidUtilities.dp(11));
dialogs_onlinePaint.setTextSize(AndroidUtilities.dp(15));
dialogs_offlinePaint.setTextSize(AndroidUtilities.dp(15));
dialogs_searchNamePaint.setTextSize(AndroidUtilities.dp(16));
dialogs_searchNameEncryptedPaint.setTextSize(AndroidUtilities.dp(16));
}
use of org.telegram.ui.Components.MsgClockDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatMessageCell method drawStatusDrawable.
private void drawStatusDrawable(Canvas canvas, boolean drawCheck1, boolean drawCheck2, boolean drawClock, boolean drawError, boolean isBroadcast, float alpha, boolean bigRadius, float timeYOffset, float layoutHeight, float progress, boolean moveCheck, boolean drawSelectionBackground) {
final boolean useScale = progress != 1f && !moveCheck;
float scale = 0.5f + 0.5f * progress;
if (useScale) {
alpha = alpha * progress;
}
float timeY = photoImage.getImageY2() + additionalTimeOffsetY - AndroidUtilities.dp(8.5f);
if (drawClock) {
MsgClockDrawable drawable = Theme.chat_msgClockDrawable;
int color;
if (shouldDrawTimeOnMedia()) {
if (currentMessageObject.shouldDrawWithoutBackground()) {
color = getThemedColor(Theme.key_chat_serviceText);
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 24 : 22) - drawable.getIntrinsicWidth(), timeY - drawable.getIntrinsicHeight() + timeYOffset);
drawable.setAlpha((int) (255 * timeAlpha * alpha));
} else {
color = getThemedColor(Theme.key_chat_mediaSentClock);
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 24 : 22) - drawable.getIntrinsicWidth(), timeY - drawable.getIntrinsicHeight() + timeYOffset);
drawable.setAlpha((int) (255 * alpha));
}
} else {
color = getThemedColor(Theme.key_chat_outSentClock);
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(18.5f) - drawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dp(8.5f) - drawable.getIntrinsicHeight() + timeYOffset);
drawable.setAlpha((int) (255 * alpha));
}
drawable.setColor(color);
if (useScale) {
canvas.save();
canvas.scale(scale, scale, drawable.getBounds().centerX(), drawable.getBounds().centerY());
}
drawable.draw(canvas);
drawable.setAlpha(255);
if (useScale) {
canvas.restore();
}
invalidate();
}
if (isBroadcast) {
if (drawCheck1 || drawCheck2) {
Drawable drawable;
if (shouldDrawTimeOnMedia()) {
setDrawableBounds(Theme.chat_msgBroadcastMediaDrawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 26 : 24) - Theme.chat_msgBroadcastMediaDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dp(14.0f) - Theme.chat_msgBroadcastMediaDrawable.getIntrinsicHeight() + timeYOffset);
Theme.chat_msgBroadcastMediaDrawable.setAlpha((int) (255 * alpha));
drawable = Theme.chat_msgBroadcastMediaDrawable;
} else {
setDrawableBounds(Theme.chat_msgBroadcastDrawable, layoutWidth - AndroidUtilities.dp(20.5f) - Theme.chat_msgBroadcastDrawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dp(8.0f) - Theme.chat_msgBroadcastDrawable.getIntrinsicHeight() + timeYOffset);
Theme.chat_msgBroadcastDrawable.setAlpha((int) (255 * alpha));
drawable = Theme.chat_msgBroadcastDrawable;
}
if (useScale) {
canvas.save();
canvas.scale(scale, scale, drawable.getBounds().centerX(), drawable.getBounds().centerY());
}
drawable.draw(canvas);
if (useScale) {
canvas.restore();
}
drawable.setAlpha(255);
}
} else {
if (drawCheck2) {
if (shouldDrawTimeOnMedia()) {
Drawable drawable;
if (moveCheck) {
canvas.save();
}
if (currentMessageObject.shouldDrawWithoutBackground()) {
drawable = getThemedDrawable(Theme.key_drawable_msgStickerCheck);
if (drawCheck1) {
if (moveCheck) {
canvas.translate(AndroidUtilities.dp(4.8f) * (1f - progress), 0);
}
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 28.3f : 26.3f) - drawable.getIntrinsicWidth(), timeY - drawable.getIntrinsicHeight() + timeYOffset);
} else {
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 23.5f : 21.5f) - drawable.getIntrinsicWidth(), timeY - drawable.getIntrinsicHeight() + timeYOffset);
}
drawable.setAlpha((int) (255 * timeAlpha * alpha));
} else {
if (drawCheck1) {
if (moveCheck) {
canvas.translate(AndroidUtilities.dp(4.8f) * (1f - progress), 0);
}
setDrawableBounds(Theme.chat_msgMediaCheckDrawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 28.3f : 26.3f) - Theme.chat_msgMediaCheckDrawable.getIntrinsicWidth(), timeY - Theme.chat_msgMediaCheckDrawable.getIntrinsicHeight() + timeYOffset);
} else {
setDrawableBounds(Theme.chat_msgMediaCheckDrawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 23.5f : 21.5f) - Theme.chat_msgMediaCheckDrawable.getIntrinsicWidth(), timeY - Theme.chat_msgMediaCheckDrawable.getIntrinsicHeight() + timeYOffset);
}
Theme.chat_msgMediaCheckDrawable.setAlpha((int) (255 * timeAlpha * alpha));
drawable = Theme.chat_msgMediaCheckDrawable;
}
if (useScale) {
canvas.save();
canvas.scale(scale, scale, drawable.getBounds().centerX(), drawable.getBounds().centerY());
}
drawable.draw(canvas);
if (useScale) {
canvas.restore();
}
if (moveCheck) {
canvas.restore();
}
drawable.setAlpha(255);
} else {
Drawable drawable;
if (moveCheck) {
canvas.save();
}
if (drawCheck1) {
if (moveCheck) {
canvas.translate(AndroidUtilities.dp(4) * (1f - progress), 0);
}
drawable = getThemedDrawable(drawSelectionBackground ? Theme.key_drawable_msgOutCheckReadSelected : Theme.key_drawable_msgOutCheckRead);
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(22.5f) - drawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dp(pinnedBottom || pinnedTop ? 9 : 8) - drawable.getIntrinsicHeight() + timeYOffset);
} else {
drawable = getThemedDrawable(drawSelectionBackground ? Theme.key_drawable_msgOutCheckSelected : Theme.key_drawable_msgOutCheck);
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(18.5f) - drawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dp(pinnedBottom || pinnedTop ? 9 : 8) - drawable.getIntrinsicHeight() + timeYOffset);
}
drawable.setAlpha((int) (255 * alpha));
if (useScale) {
canvas.save();
canvas.scale(scale, scale, drawable.getBounds().centerX(), drawable.getBounds().centerY());
}
drawable.draw(canvas);
if (useScale) {
canvas.restore();
}
if (moveCheck) {
canvas.restore();
}
drawable.setAlpha(255);
}
}
if (drawCheck1) {
if (shouldDrawTimeOnMedia()) {
Drawable drawable;
if (currentMessageObject.shouldDrawWithoutBackground()) {
drawable = getThemedDrawable(Theme.key_drawable_msgStickerHalfCheck);
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 23.5f : 21.5f) - drawable.getIntrinsicWidth(), timeY - drawable.getIntrinsicHeight() + timeYOffset);
drawable.setAlpha((int) (255 * timeAlpha * alpha));
} else {
drawable = Theme.chat_msgMediaHalfCheckDrawable;
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(bigRadius ? 23.5f : 21.5f) - drawable.getIntrinsicWidth(), timeY - drawable.getIntrinsicHeight() + timeYOffset);
drawable.setAlpha((int) (255 * timeAlpha * alpha));
}
if (useScale || moveCheck) {
canvas.save();
canvas.scale(scale, scale, drawable.getBounds().centerX(), drawable.getBounds().centerY());
}
drawable.draw(canvas);
if (useScale || moveCheck) {
canvas.restore();
}
drawable.setAlpha(255);
} else {
Drawable drawable = getThemedDrawable(drawSelectionBackground ? Theme.key_drawable_msgOutHalfCheckSelected : Theme.key_drawable_msgOutHalfCheck);
setDrawableBounds(drawable, layoutWidth - AndroidUtilities.dp(18) - drawable.getIntrinsicWidth(), layoutHeight - AndroidUtilities.dp(pinnedBottom || pinnedTop ? 9 : 8) - drawable.getIntrinsicHeight() + timeYOffset);
drawable.setAlpha((int) (255 * alpha));
if (useScale || moveCheck) {
canvas.save();
canvas.scale(scale, scale, drawable.getBounds().centerX(), drawable.getBounds().centerY());
}
drawable.draw(canvas);
if (useScale || moveCheck) {
canvas.restore();
}
drawable.setAlpha(255);
}
}
}
if (drawError) {
int x;
float y;
if (shouldDrawTimeOnMedia()) {
x = layoutWidth - AndroidUtilities.dp(34.5f);
y = layoutHeight - AndroidUtilities.dp(26.5f) + timeYOffset;
} else {
x = layoutWidth - AndroidUtilities.dp(32);
y = layoutHeight - AndroidUtilities.dp(pinnedBottom || pinnedTop ? 22 : 21) + timeYOffset;
}
rect.set(x, y, x + AndroidUtilities.dp(14), y + AndroidUtilities.dp(14));
int oldAlpha = Theme.chat_msgErrorPaint.getAlpha();
Theme.chat_msgErrorPaint.setAlpha((int) (oldAlpha * alpha));
canvas.drawRoundRect(rect, AndroidUtilities.dp(1), AndroidUtilities.dp(1), Theme.chat_msgErrorPaint);
Theme.chat_msgErrorPaint.setAlpha(oldAlpha);
setDrawableBounds(Theme.chat_msgErrorDrawable, x + AndroidUtilities.dp(6), y + AndroidUtilities.dp(2));
Theme.chat_msgErrorDrawable.setAlpha((int) (255 * alpha));
if (useScale) {
canvas.save();
canvas.scale(scale, scale, Theme.chat_msgErrorDrawable.getBounds().centerX(), Theme.chat_msgErrorDrawable.getBounds().centerY());
}
Theme.chat_msgErrorDrawable.draw(canvas);
Theme.chat_msgErrorDrawable.setAlpha(255);
if (useScale) {
canvas.restore();
}
}
}
Aggregations