Search in sources :

Example 1 with PathAnimator

use of org.telegram.ui.Components.PathAnimator 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));
    }
}
Also used : Path(android.graphics.Path) LinkPath(org.telegram.ui.Components.LinkPath) MsgClockDrawable(org.telegram.ui.Components.MsgClockDrawable) Canvas(android.graphics.Canvas) RLottieDrawable(org.telegram.ui.Components.RLottieDrawable) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) BitmapDrawable(android.graphics.drawable.BitmapDrawable) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) PorterDuffXfermode(android.graphics.PorterDuffXfermode) PathAnimator(org.telegram.ui.Components.PathAnimator) Resources(android.content.res.Resources)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Resources (android.content.res.Resources)1 Bitmap (android.graphics.Bitmap)1 Canvas (android.graphics.Canvas)1 Paint (android.graphics.Paint)1 Path (android.graphics.Path)1 PorterDuffXfermode (android.graphics.PorterDuffXfermode)1 RectF (android.graphics.RectF)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 TextPaint (android.text.TextPaint)1 LinkPath (org.telegram.ui.Components.LinkPath)1 MsgClockDrawable (org.telegram.ui.Components.MsgClockDrawable)1 PathAnimator (org.telegram.ui.Components.PathAnimator)1 RLottieDrawable (org.telegram.ui.Components.RLottieDrawable)1