use of org.telegram.ui.Components.RLottieDrawable 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.RLottieDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class Theme method createCommonResources.
public static void createCommonResources(Context context) {
if (dividerPaint == null) {
dividerPaint = new Paint();
dividerPaint.setStrokeWidth(1);
dividerExtraPaint = new Paint();
dividerExtraPaint.setStrokeWidth(1);
avatar_backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
checkboxSquare_checkPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
checkboxSquare_checkPaint.setStyle(Paint.Style.STROKE);
checkboxSquare_checkPaint.setStrokeWidth(AndroidUtilities.dp(2));
checkboxSquare_checkPaint.setStrokeCap(Paint.Cap.ROUND);
checkboxSquare_eraserPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
checkboxSquare_eraserPaint.setColor(0);
checkboxSquare_eraserPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
checkboxSquare_backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
linkSelectionPaint = new Paint();
linkSelectionPaint.setPathEffect(LinkPath.roundedEffect);
Resources resources = context.getResources();
avatarDrawables[0] = resources.getDrawable(R.drawable.chats_saved);
avatarDrawables[1] = resources.getDrawable(R.drawable.ghost);
avatarDrawables[2] = resources.getDrawable(R.drawable.folders_private);
avatarDrawables[3] = resources.getDrawable(R.drawable.folders_requests);
avatarDrawables[4] = resources.getDrawable(R.drawable.folders_group);
avatarDrawables[5] = resources.getDrawable(R.drawable.folders_channel);
avatarDrawables[6] = resources.getDrawable(R.drawable.folders_bot);
avatarDrawables[7] = resources.getDrawable(R.drawable.folders_mute);
avatarDrawables[8] = resources.getDrawable(R.drawable.folders_read);
avatarDrawables[9] = resources.getDrawable(R.drawable.folders_archive);
avatarDrawables[10] = resources.getDrawable(R.drawable.folders_private);
avatarDrawables[11] = resources.getDrawable(R.drawable.chats_replies);
if (dialogs_archiveAvatarDrawable != null) {
dialogs_archiveAvatarDrawable.setCallback(null);
dialogs_archiveAvatarDrawable.recycle();
}
if (dialogs_archiveDrawable != null) {
dialogs_archiveDrawable.recycle();
}
if (dialogs_unarchiveDrawable != null) {
dialogs_unarchiveDrawable.recycle();
}
if (dialogs_pinArchiveDrawable != null) {
dialogs_pinArchiveDrawable.recycle();
}
if (dialogs_unpinArchiveDrawable != null) {
dialogs_unpinArchiveDrawable.recycle();
}
if (dialogs_hidePsaDrawable != null) {
dialogs_hidePsaDrawable.recycle();
}
dialogs_archiveAvatarDrawable = new RLottieDrawable(R.raw.chats_archiveavatar, "chats_archiveavatar", AndroidUtilities.dp(36), AndroidUtilities.dp(36), false, null);
dialogs_archiveDrawable = new RLottieDrawable(R.raw.chats_archive, "chats_archive", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_unarchiveDrawable = new RLottieDrawable(R.raw.chats_unarchive, "chats_unarchive", AndroidUtilities.dp(AndroidUtilities.dp(36)), AndroidUtilities.dp(36));
dialogs_pinArchiveDrawable = new RLottieDrawable(R.raw.chats_hide, "chats_hide", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_unpinArchiveDrawable = new RLottieDrawable(R.raw.chats_unhide, "chats_unhide", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_hidePsaDrawable = new RLottieDrawable(R.raw.chat_audio_record_delete, "chats_psahide", AndroidUtilities.dp(30), AndroidUtilities.dp(30));
dialogs_swipeMuteDrawable = new RLottieDrawable(R.raw.swipe_mute, "swipe_mute", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_swipeUnmuteDrawable = new RLottieDrawable(R.raw.swipe_unmute, "swipe_unmute", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_swipeReadDrawable = new RLottieDrawable(R.raw.swipe_read, "swipe_read", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_swipeUnreadDrawable = new RLottieDrawable(R.raw.swipe_unread, "swipe_unread", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_swipeDeleteDrawable = new RLottieDrawable(R.raw.swipe_delete, "swipe_delete", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_swipeUnpinDrawable = new RLottieDrawable(R.raw.swipe_unpin, "swipe_unpin", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
dialogs_swipePinDrawable = new RLottieDrawable(R.raw.swipe_pin, "swipe_pin", AndroidUtilities.dp(36), AndroidUtilities.dp(36));
applyCommonTheme();
}
}
use of org.telegram.ui.Components.RLottieDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class TwoStepVerificationSetupActivity method setRandomMonkeyIdleAnimation.
private void setRandomMonkeyIdleAnimation(boolean first) {
if (currentType != TYPE_ENTER_FIRST) {
return;
}
if (setAnimationRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(setAnimationRunnable);
}
RLottieDrawable currentAnimation = imageView.getAnimatedDrawable();
if (first || (currentAnimation == animationDrawables[0] || currentAnimation == animationDrawables[1]) || passwordEditText.length() == 0 && (currentAnimation == null || !currentAnimation.isRunning())) {
if (Utilities.random.nextInt() % 2 == 0) {
imageView.setAnimation(animationDrawables[0]);
animationDrawables[0].setProgress(0.0f);
} else {
imageView.setAnimation(animationDrawables[1]);
animationDrawables[1].setProgress(0.0f);
}
if (!first) {
imageView.playAnimation();
}
}
AndroidUtilities.runOnUIThread(setAnimationRunnable = () -> {
if (setAnimationRunnable == null) {
return;
}
setRandomMonkeyIdleAnimation(false);
}, Utilities.random.nextInt(2000) + 5000);
}
use of org.telegram.ui.Components.RLottieDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class DialogsActivity method getThemeDescriptions.
@Override
public ArrayList<ThemeDescription> getThemeDescriptions() {
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
for (int b = 0; b < 3; b++) {
RecyclerListView list;
if (b == 2) {
if (searchViewPager == null) {
continue;
}
list = searchViewPager.searchListView;
} else if (viewPages != null) {
list = b < viewPages.length ? viewPages[b].listView : null;
} else {
continue;
}
if (list == null) {
continue;
}
int count = list.getChildCount();
for (int a = 0; a < count; a++) {
View child = list.getChildAt(a);
if (child instanceof ProfileSearchCell) {
((ProfileSearchCell) child).update(0);
} else if (child instanceof DialogCell) {
((DialogCell) child).update(0);
} else if (child instanceof UserCell) {
((UserCell) child).update(0);
}
}
}
if (searchViewPager != null && searchViewPager.dialogsSearchAdapter != null) {
RecyclerListView recyclerListView = searchViewPager.dialogsSearchAdapter.getInnerListView();
if (recyclerListView != null) {
int count = recyclerListView.getChildCount();
for (int a = 0; a < count; a++) {
View child = recyclerListView.getChildAt(a);
if (child instanceof HintDialogCell) {
((HintDialogCell) child).update();
}
}
}
}
if (sideMenu != null) {
View child = sideMenu.getChildAt(0);
if (child instanceof DrawerProfileCell) {
DrawerProfileCell profileCell = (DrawerProfileCell) child;
profileCell.applyBackground(true);
profileCell.updateColors();
}
}
if (viewPages != null) {
for (int a = 0; a < viewPages.length; a++) {
if (viewPages[a].pullForegroundDrawable == null) {
continue;
}
viewPages[a].pullForegroundDrawable.updateColors();
}
}
if (actionBar != null) {
actionBar.setPopupBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), true);
actionBar.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), false, true);
actionBar.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon), true, true);
actionBar.setPopupItemsSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector), true);
}
if (scrimPopupWindowItems != null) {
for (int a = 0; a < scrimPopupWindowItems.length; a++) {
scrimPopupWindowItems[a].setColors(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon));
scrimPopupWindowItems[a].setSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector));
}
}
if (scrimPopupWindow != null) {
final View contentView = scrimPopupWindow.getContentView();
contentView.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
contentView.invalidate();
}
if (doneItem != null) {
doneItem.setIconColor(Theme.getColor(Theme.key_actionBarDefaultIcon));
}
if (commentView != null) {
commentView.updateColors();
}
if (filtersView != null) {
filtersView.updateColors();
}
if (searchViewPager != null) {
searchViewPager.updateColors();
}
if (searchTabsView != null) {
searchTabsView.updateColors();
}
if (searchItem != null) {
EditTextBoldCursor editText = searchItem.getSearchField();
if (whiteActionBar) {
editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
editText.setHintTextColor(Theme.getColor(Theme.key_player_time));
editText.setCursorColor(Theme.getColor(Theme.key_chat_messagePanelCursor));
} else {
editText.setCursorColor(Theme.getColor(Theme.key_actionBarDefaultSearch));
editText.setHintTextColor(Theme.getColor(Theme.key_actionBarDefaultSearchPlaceholder));
editText.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSearch));
}
searchItem.updateColor();
}
setSearchAnimationProgress(searchAnimationProgress);
};
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
if (movingView != null) {
arrayList.add(new ThemeDescription(movingView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
}
if (doneItem != null) {
arrayList.add(new ThemeDescription(doneItem, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_actionBarDefaultSelector));
}
if (folderId == 0) {
if (onlySelect) {
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
}
arrayList.add(new ThemeDescription(fragmentView, 0, null, actionBarDefaultPaint, null, null, Theme.key_actionBarDefault));
if (searchViewPager != null) {
arrayList.add(new ThemeDescription(searchViewPager.searchListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
}
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, cellDelegate, Theme.key_actionBarDefaultIcon));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, new Drawable[] { Theme.dialogs_holidayDrawable }, null, Theme.key_actionBarDefaultTitle));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder));
} else {
arrayList.add(new ThemeDescription(fragmentView, 0, null, actionBarDefaultPaint, null, null, Theme.key_actionBarDefaultArchived));
if (searchViewPager != null) {
arrayList.add(new ThemeDescription(searchViewPager.searchListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
}
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchivedIcon));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, new Drawable[] { Theme.dialogs_holidayDrawable }, null, Theme.key_actionBarDefaultArchivedTitle));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchivedSelector));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultArchivedSearch));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultArchivedSearchPlaceholder));
}
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultIcon));
// arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_BACKGROUND, null, null, null, null, Theme.key_actionBarActionModeDefault));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_TOPBACKGROUND, null, null, null, null, Theme.key_actionBarActionModeDefaultTop));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultSelector));
arrayList.add(new ThemeDescription(selectedDialogsCountTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuItem));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuItemIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_dialogButtonSelector));
if (filterTabsView != null) {
if (actionBar.isActionModeShowed()) {
arrayList.add(new ThemeDescription(filterTabsView, 0, new Class[] { FilterTabsView.class }, new String[] { "selectorDrawable" }, null, null, null, Theme.key_profile_tabSelectedLine));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_profile_tabSelectedText));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_profile_tabText));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_profile_tabSelector));
} else {
arrayList.add(new ThemeDescription(filterTabsView, 0, new Class[] { FilterTabsView.class }, new String[] { "selectorDrawable" }, null, null, null, Theme.key_actionBarTabLine));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_actionBarTabActiveText));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_actionBarTabUnactiveText));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_actionBarTabSelector));
}
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), 0, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_chats_tabUnreadActiveBackground));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), 0, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_chats_tabUnreadUnactiveBackground));
}
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionIcon));
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chats_actionBackground));
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chats_actionPressedBackground));
for (int a = 0; a < 3; a++) {
RecyclerListView list;
if (a == 2) {
if (searchViewPager == null) {
continue;
}
list = searchViewPager.searchListView;
} else if (viewPages != null) {
list = a < viewPages.length ? viewPages[a].listView : null;
} else {
continue;
}
if (list == null) {
continue;
}
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
arrayList.add(new ThemeDescription(list, 0, new Class[] { View.class }, Theme.dividerPaint, null, null, Theme.key_divider));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_countGrayPaint, null, null, Theme.key_chats_unreadCounterMuted));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_countTextPaint, null, null, Theme.key_chats_unreadCounterText));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_lockDrawable }, null, Theme.key_chats_secretIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_groupDrawable, Theme.dialogs_broadcastDrawable, Theme.dialogs_botDrawable }, null, Theme.key_chats_nameIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_scamDrawable, Theme.dialogs_fakeDrawable }, null, Theme.key_chats_draft));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_pinnedDrawable, Theme.dialogs_reorderDrawable }, null, Theme.key_chats_pinnedIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Paint[] { Theme.dialogs_namePaint[0], Theme.dialogs_namePaint[1], Theme.dialogs_searchNamePaint }, null, null, Theme.key_chats_name));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Paint[] { Theme.dialogs_nameEncryptedPaint[0], Theme.dialogs_nameEncryptedPaint[1], Theme.dialogs_searchNameEncryptedPaint }, null, null, Theme.key_chats_secretName));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_messagePaint[1], null, null, Theme.key_chats_message_threeLines));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_messagePaint[0], null, null, Theme.key_chats_message));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_messageNamePaint, null, null, Theme.key_chats_nameMessage_threeLines));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_chats_draft));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, Theme.dialogs_messagePrintingPaint, null, null, Theme.key_chats_actionMessage));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_timePaint, null, null, Theme.key_chats_date));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_pinnedPaint, null, null, Theme.key_chats_pinnedOverlay));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_tabletSeletedPaint, null, null, Theme.key_chats_tabletSelectedOverlay));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_checkDrawable }, null, Theme.key_chats_sentCheck));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_checkReadDrawable, Theme.dialogs_halfCheckDrawable }, null, Theme.key_chats_sentReadCheck));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_clockDrawable }, null, Theme.key_chats_sentClock));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_errorPaint, null, null, Theme.key_chats_sentError));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_errorDrawable }, null, Theme.key_chats_sentErrorIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_verifiedCheckDrawable }, null, Theme.key_chats_verifiedCheck));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_verifiedDrawable }, null, Theme.key_chats_verifiedBackground));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_muteDrawable }, null, Theme.key_chats_muteIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_mentionDrawable }, null, Theme.key_chats_mentionIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_chats_archivePinBackground));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_chats_onlineCircle));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_CHECKBOX, new Class[] { DialogCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[] { DialogCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_checkboxCheck));
arrayList.add(new ThemeDescription(list, 0, new Class[] { LoadingCell.class }, new String[] { "progressBar" }, null, null, null, Theme.key_progressCircle));
arrayList.add(new ThemeDescription(list, 0, new Class[] { ProfileSearchCell.class }, Theme.dialogs_offlinePaint, null, null, Theme.key_windowBackgroundWhiteGrayText3));
arrayList.add(new ThemeDescription(list, 0, new Class[] { ProfileSearchCell.class }, Theme.dialogs_onlinePaint, null, null, Theme.key_windowBackgroundWhiteBlueText3));
GraySectionCell.createThemeDescriptions(arrayList, list);
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { HashtagSearchCell.class }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[] { ShadowSectionCell.class }, null, null, null, Theme.key_windowBackgroundGrayShadow));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[] { ShadowSectionCell.class }, null, null, null, Theme.key_windowBackgroundGray));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[] { TextInfoPrivacyCell.class }, null, null, null, Theme.key_windowBackgroundGrayShadow));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[] { TextInfoPrivacyCell.class }, null, null, null, Theme.key_windowBackgroundGray));
arrayList.add(new ThemeDescription(list, 0, new Class[] { TextInfoPrivacyCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayText4));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText2));
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundSaved));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchived));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchivedHidden));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessage));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_draft));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_attachMessage));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameArchived));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessageArchived));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessageArchived_threeLines));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_messageArchived));
if (viewPages != null) {
for (int a = 0; a < viewPages.length; a++) {
if (folderId == 0) {
arrayList.add(new ThemeDescription(viewPages[a].listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
} else {
arrayList.add(new ThemeDescription(viewPages[a].listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
}
arrayList.add(new ThemeDescription(viewPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DialogsEmptyCell.class }, new String[] { "emptyTextView1" }, null, null, null, Theme.key_chats_nameMessage_threeLines));
arrayList.add(new ThemeDescription(viewPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DialogsEmptyCell.class }, new String[] { "emptyTextView2" }, null, null, null, Theme.key_chats_message));
if (SharedConfig.archiveHidden) {
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Arrow1", Theme.key_avatar_backgroundArchivedHidden));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Arrow2", Theme.key_avatar_backgroundArchivedHidden));
} else {
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Arrow1", Theme.key_avatar_backgroundArchived));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Arrow2", Theme.key_avatar_backgroundArchived));
}
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Box2", Theme.key_avatar_text));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Box1", Theme.key_avatar_text));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_pinArchiveDrawable }, "Arrow", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_pinArchiveDrawable }, "Line", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unpinArchiveDrawable }, "Arrow", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unpinArchiveDrawable }, "Line", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveDrawable }, "Arrow", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveDrawable }, "Box2", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveDrawable }, "Box1", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Line 1", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Line 2", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Line 3", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Cup Red", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Box", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unarchiveDrawable }, "Arrow1", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unarchiveDrawable }, "Arrow2", Theme.key_chats_archivePinBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unarchiveDrawable }, "Box2", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unarchiveDrawable }, "Box1", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "statusColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "statusOnlineColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { TextCell.class }, new String[] { "imageView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(viewPages[a].progressView, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle));
ViewPager pager = viewPages[a].dialogsAdapter.getArchiveHintCellPager();
arrayList.add(new ThemeDescription(pager, 0, new Class[] { ArchiveHintInnerCell.class }, new String[] { "imageView" }, null, null, null, Theme.key_chats_nameMessage_threeLines));
arrayList.add(new ThemeDescription(pager, 0, new Class[] { ArchiveHintInnerCell.class }, new String[] { "imageView2" }, null, null, null, Theme.key_chats_unreadCounter));
arrayList.add(new ThemeDescription(pager, 0, new Class[] { ArchiveHintInnerCell.class }, new String[] { "headerTextView" }, null, null, null, Theme.key_chats_nameMessage_threeLines));
arrayList.add(new ThemeDescription(pager, 0, new Class[] { ArchiveHintInnerCell.class }, new String[] { "messageTextView" }, null, null, null, Theme.key_chats_message));
arrayList.add(new ThemeDescription(pager, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
}
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_archivePullDownBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_archivePullDownBackgroundActive));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_chats_menuBackground));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuName));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuPhone));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuPhoneCats));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuCloudBackgroundCats));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chat_serviceBackground));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuTopShadow));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuTopShadowCats));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { DrawerProfileCell.class }, new String[] { "darkThemeView" }, null, null, null, Theme.key_chats_menuName));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { DrawerProfileCell.class }, null, null, cellDelegate, Theme.key_chats_menuTopBackgroundCats));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { DrawerProfileCell.class }, null, null, cellDelegate, Theme.key_chats_menuTopBackground));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { DrawerActionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemIcon));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerActionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemText));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerUserCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemText));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DrawerUserCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_chats_unreadCounterText));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DrawerUserCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_chats_unreadCounter));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DrawerUserCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_chats_menuBackground));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { DrawerAddCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemIcon));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerAddCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemText));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DividerCell.class }, Theme.dividerPaint, null, null, Theme.key_divider));
if (searchViewPager != null) {
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, Theme.dialogs_countGrayPaint, null, null, Theme.key_chats_unreadCounterMuted));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, Theme.dialogs_countTextPaint, null, null, Theme.key_chats_unreadCounterText));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, Theme.dialogs_archiveTextPaint, null, null, Theme.key_chats_archiveText));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, null, null, null, Theme.key_chats_onlineCircle));
}
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "frameLayout" }, null, null, null, Theme.key_inappPlayerBackground));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { FragmentContextView.class }, new String[] { "playButton" }, null, null, null, Theme.key_inappPlayerPlayPause));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_inappPlayerTitle));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_FASTSCROLL, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_inappPlayerPerformer));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { FragmentContextView.class }, new String[] { "closeButton" }, null, null, null, Theme.key_inappPlayerClose));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "frameLayout" }, null, null, null, Theme.key_returnToCallBackground));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_returnToCallText));
for (int a = 0; a < undoView.length; a++) {
arrayList.add(new ThemeDescription(undoView[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_undo_background));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "undoImageView" }, null, null, null, Theme.key_undo_cancelColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "undoTextView" }, null, null, null, Theme.key_undo_cancelColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "infoTextView" }, null, null, null, Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "subinfoTextView" }, null, null, null, Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "textPaint" }, null, null, null, Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "progressPaint" }, null, null, null, Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "info1", Theme.key_undo_background));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "info2", Theme.key_undo_background));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc12", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc11", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc10", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc9", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc8", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc7", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc6", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc5", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc4", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc3", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc2", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc1", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "Oval", Theme.key_undo_infoColor));
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBackgroundGray));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlack));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextLink));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLinkSelection));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue3));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue4));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextRed));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextRed2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray3));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray4));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRedIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextHint));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogInputField));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogInputFieldActivated));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareCheck));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareUnchecked));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareDisabled));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRadioBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRadioBackgroundChecked));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogProgressCircle));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogButton));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogButtonSelector));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogScrollGlow));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRoundCheckBox));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRoundCheckBoxCheck));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBadgeBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBadgeText));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLineProgress));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLineProgressBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogGrayLine));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialog_inlineProgressBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialog_inlineProgress));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchHint));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchText));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogFloatingButton));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogFloatingIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogShadowLine));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_sheet_scrollUp));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_sheet_other));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBar));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarSelector));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarTitle));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarTop));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarSubtitle));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarItems));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_background));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_time));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progressBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progressCachedBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progress));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_button));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_buttonActive));
if (commentView != null) {
arrayList.add(new ThemeDescription(commentView, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground));
arrayList.add(new ThemeDescription(commentView, 0, null, null, new Drawable[] { Theme.chat_composeShadowDrawable }, null, Theme.key_chat_messagePanelShadow));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { ChatActivityEnterView.class }, new String[] { "messageEditText" }, null, null, null, Theme.key_chat_messagePanelText));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_CURSORCOLOR, new Class[] { ChatActivityEnterView.class }, new String[] { "messageEditText" }, null, null, null, Theme.key_chat_messagePanelCursor));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_HINTTEXTCOLOR, new Class[] { ChatActivityEnterView.class }, new String[] { "messageEditText" }, null, null, null, Theme.key_chat_messagePanelHint));
// arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, null, null, null, Theme.key_chat_messagePanelSend));
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarTipBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_player_time));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chat_messagePanelCursor));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_actionBarIconBlue));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_groupcreate_spanBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayGreen1));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayGreen2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayBlue1));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayBlue2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelGreen1));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelGreen2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelBlue1));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelBlue2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelGray));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertGradientMuted));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertGradientMuted2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertGradientUnmuted));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertGradientUnmuted2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_mutedByAdminGradient));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_mutedByAdminGradient2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_mutedByAdminGradient3));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertMutedByAdmin));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertMutedByAdmin2));
if (filtersView != null) {
arrayList.addAll(filtersView.getThemeDescriptions());
filtersView.updateColors();
}
if (searchViewPager != null) {
searchViewPager.getThemeDescriptors(arrayList);
}
return arrayList;
}
use of org.telegram.ui.Components.RLottieDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class ProfileActivity method createView.
@Override
public View createView(Context context) {
Theme.createProfileResources(context);
Theme.createChatResources(context, false);
searchTransitionOffset = 0;
searchTransitionProgress = 1f;
searchMode = false;
hasOwnBackground = true;
extraHeight = AndroidUtilities.dp(88f);
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(final int id) {
if (getParentActivity() == null) {
return;
}
if (id == -1) {
finishFragment();
} else if (id == block_contact) {
TLRPC.User user = getMessagesController().getUser(userId);
if (user == null) {
return;
}
if (!isBot || MessagesController.isSupportUser(user)) {
if (userBlocked) {
getMessagesController().unblockPeer(userId);
if (BulletinFactory.canShowBulletin(ProfileActivity.this)) {
BulletinFactory.createBanBulletin(ProfileActivity.this, false).show();
}
} else {
if (reportSpam) {
AlertsCreator.showBlockReportSpamAlert(ProfileActivity.this, userId, user, null, currentEncryptedChat, false, null, param -> {
if (param == 1) {
getNotificationCenter().removeObserver(ProfileActivity.this, NotificationCenter.closeChats);
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
playProfileAnimation = 0;
finishFragment();
} else {
getNotificationCenter().postNotificationName(NotificationCenter.peerSettingsDidLoad, userId);
}
}, null);
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("BlockUser", R.string.BlockUser));
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("AreYouSureBlockContact2", R.string.AreYouSureBlockContact2, ContactsController.formatName(user.first_name, user.last_name))));
builder.setPositiveButton(LocaleController.getString("BlockContact", R.string.BlockContact), (dialogInterface, i) -> {
getMessagesController().blockPeer(userId);
if (BulletinFactory.canShowBulletin(ProfileActivity.this)) {
BulletinFactory.createBanBulletin(ProfileActivity.this, true).show();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog dialog = builder.create();
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
}
}
} else {
if (!userBlocked) {
getMessagesController().blockPeer(userId);
} else {
getMessagesController().unblockPeer(userId);
getSendMessagesHelper().sendMessage("/start", userId, null, null, null, false, null, null, null, true, 0, null);
finishFragment();
}
}
} else if (id == add_contact) {
TLRPC.User user = getMessagesController().getUser(userId);
Bundle args = new Bundle();
args.putLong("user_id", user.id);
args.putBoolean("addContact", true);
presentFragment(new ContactAddActivity(args));
} else if (id == share_contact) {
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 3);
args.putString("selectAlertString", LocaleController.getString("SendContactToText", R.string.SendContactToText));
args.putString("selectAlertStringGroup", LocaleController.getString("SendContactToGroupText", R.string.SendContactToGroupText));
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(ProfileActivity.this);
presentFragment(fragment);
} else if (id == edit_contact) {
Bundle args = new Bundle();
args.putLong("user_id", userId);
presentFragment(new ContactAddActivity(args));
} else if (id == delete_contact) {
final TLRPC.User user = getMessagesController().getUser(userId);
if (user == null || getParentActivity() == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("DeleteContact", R.string.DeleteContact));
builder.setMessage(LocaleController.getString("AreYouSureDeleteContact", R.string.AreYouSureDeleteContact));
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> {
ArrayList<TLRPC.User> arrayList = new ArrayList<>();
arrayList.add(user);
getContactsController().deleteContact(arrayList, true);
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog dialog = builder.create();
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
} else if (id == leave_group) {
leaveChatPressed();
} else if (id == edit_channel) {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
ChatEditActivity fragment = new ChatEditActivity(args);
fragment.setInfo(chatInfo);
presentFragment(fragment);
} else if (id == invite_to_group) {
final TLRPC.User user = getMessagesController().getUser(userId);
if (user == null) {
return;
}
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putInt("dialogsType", 2);
args.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupAlertText", R.string.AddToTheGroupAlertText, UserObject.getUserName(user), "%1$s"));
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate((fragment1, dids, message, param) -> {
long did = dids.get(0);
Bundle args1 = new Bundle();
args1.putBoolean("scrollToTopOnResume", true);
args1.putLong("chat_id", -did);
if (!getMessagesController().checkCanOpenChat(args1, fragment1)) {
return;
}
getNotificationCenter().removeObserver(ProfileActivity.this, NotificationCenter.closeChats);
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
getMessagesController().addUserToChat(-did, user, 0, null, ProfileActivity.this, null);
presentFragment(new ChatActivity(args1), true);
removeSelfFromStack();
});
presentFragment(fragment);
} else if (id == share) {
try {
String text = null;
if (userId != 0) {
TLRPC.User user = getMessagesController().getUser(userId);
if (user == null) {
return;
}
if (botInfo != null && userInfo != null && !TextUtils.isEmpty(userInfo.about)) {
text = String.format("%s https://" + getMessagesController().linkPrefix + "/%s", userInfo.about, user.username);
} else {
text = String.format("https://" + getMessagesController().linkPrefix + "/%s", user.username);
}
} else if (chatId != 0) {
TLRPC.Chat chat = getMessagesController().getChat(chatId);
if (chat == null) {
return;
}
if (chatInfo != null && !TextUtils.isEmpty(chatInfo.about)) {
text = String.format("%s\nhttps://" + getMessagesController().linkPrefix + "/%s", chatInfo.about, chat.username);
} else {
text = String.format("https://" + getMessagesController().linkPrefix + "/%s", chat.username);
}
}
if (TextUtils.isEmpty(text)) {
return;
}
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, text);
startActivityForResult(Intent.createChooser(intent, LocaleController.getString("BotShare", R.string.BotShare)), 500);
} catch (Exception e) {
FileLog.e(e);
}
} else if (id == add_shortcut) {
try {
long did;
if (currentEncryptedChat != null) {
did = DialogObject.makeEncryptedDialogId(currentEncryptedChat.id);
} else if (userId != 0) {
did = userId;
} else if (chatId != 0) {
did = -chatId;
} else {
return;
}
getMediaDataController().installShortcut(did);
} catch (Exception e) {
FileLog.e(e);
}
} else if (id == call_item || id == video_call_item) {
if (userId != 0) {
TLRPC.User user = getMessagesController().getUser(userId);
if (user != null) {
VoIPHelper.startCall(user, id == video_call_item, userInfo != null && userInfo.video_calls_available, getParentActivity(), userInfo, getAccountInstance());
}
} else if (chatId != 0) {
ChatObject.Call call = getMessagesController().getGroupCall(chatId, false);
if (call == null) {
VoIPHelper.showGroupCallAlert(ProfileActivity.this, currentChat, null, false, getAccountInstance());
} else {
VoIPHelper.startCall(currentChat, null, null, false, getParentActivity(), ProfileActivity.this, getAccountInstance());
}
}
} else if (id == search_members) {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putInt("type", ChatUsersActivity.TYPE_USERS);
args.putBoolean("open_search", true);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(chatInfo);
presentFragment(fragment);
} else if (id == add_member) {
openAddMember();
} else if (id == statistics) {
TLRPC.Chat chat = getMessagesController().getChat(chatId);
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putBoolean("is_megagroup", chat.megagroup);
StatisticActivity fragment = new StatisticActivity(args);
presentFragment(fragment);
} else if (id == view_discussion) {
openDiscussion();
} else if (id == start_secret_chat) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AreYouSureSecretChatTitle", R.string.AreYouSureSecretChatTitle));
builder.setMessage(LocaleController.getString("AreYouSureSecretChat", R.string.AreYouSureSecretChat));
builder.setPositiveButton(LocaleController.getString("Start", R.string.Start), (dialogInterface, i) -> {
creatingChat = true;
getSecretChatHelper().startSecretChat(getParentActivity(), getMessagesController().getUser(userId));
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
} else if (id == gallery_menu_save) {
if (getParentActivity() == null) {
return;
}
if (Build.VERSION.SDK_INT >= 23 && (Build.VERSION.SDK_INT <= 28 || BuildVars.NO_SCOPED_STORAGE) && getParentActivity().checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
getParentActivity().requestPermissions(new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE }, 4);
return;
}
ImageLocation location = avatarsViewPager.getImageLocation(avatarsViewPager.getRealPosition());
if (location == null) {
return;
}
final boolean isVideo = location.imageType == FileLoader.IMAGE_TYPE_ANIMATION;
File f = FileLoader.getPathToAttach(location.location, isVideo ? "mp4" : null, true);
if (f.exists()) {
MediaController.saveFile(f.toString(), getParentActivity(), 0, null, null, () -> {
if (getParentActivity() == null) {
return;
}
BulletinFactory.createSaveToGalleryBulletin(ProfileActivity.this, isVideo, null).show();
});
}
} else if (id == edit_name) {
presentFragment(new ChangeNameActivity());
} else if (id == logout) {
presentFragment(new LogoutActivity());
} else if (id == set_as_main) {
int position = avatarsViewPager.getRealPosition();
TLRPC.Photo photo = avatarsViewPager.getPhoto(position);
if (photo == null) {
return;
}
avatarsViewPager.startMovePhotoToBegin(position);
TLRPC.TL_photos_updateProfilePhoto req = new TLRPC.TL_photos_updateProfilePhoto();
req.id = new TLRPC.TL_inputPhoto();
req.id.id = photo.id;
req.id.access_hash = photo.access_hash;
req.id.file_reference = photo.file_reference;
UserConfig userConfig = getUserConfig();
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
avatarsViewPager.finishSettingMainPhoto();
if (response instanceof TLRPC.TL_photos_photo) {
TLRPC.TL_photos_photo photos_photo = (TLRPC.TL_photos_photo) response;
getMessagesController().putUsers(photos_photo.users, false);
TLRPC.User user = getMessagesController().getUser(userConfig.clientUserId);
if (photos_photo.photo instanceof TLRPC.TL_photo) {
avatarsViewPager.replaceFirstPhoto(photo, photos_photo.photo);
if (user != null) {
user.photo.photo_id = photos_photo.photo.id;
userConfig.setCurrentUser(user);
userConfig.saveConfig(true);
}
}
}
}));
undoView.showWithAction(userId, UndoView.ACTION_PROFILE_PHOTO_CHANGED, photo.video_sizes.isEmpty() ? null : 1);
TLRPC.User user = getMessagesController().getUser(userConfig.clientUserId);
TLRPC.PhotoSize bigSize = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 800);
if (user != null) {
TLRPC.PhotoSize smallSize = FileLoader.getClosestPhotoSizeWithSize(photo.sizes, 90);
user.photo.photo_id = photo.id;
user.photo.photo_small = smallSize.location;
user.photo.photo_big = bigSize.location;
userConfig.setCurrentUser(user);
userConfig.saveConfig(true);
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged);
updateProfileData();
}
avatarsViewPager.commitMoveToBegin();
} else if (id == edit_avatar) {
int position = avatarsViewPager.getRealPosition();
ImageLocation location = avatarsViewPager.getImageLocation(position);
if (location == null) {
return;
}
File f = FileLoader.getPathToAttach(PhotoViewer.getFileLocation(location), PhotoViewer.getFileLocationExt(location), true);
boolean isVideo = location.imageType == FileLoader.IMAGE_TYPE_ANIMATION;
String thumb;
if (isVideo) {
ImageLocation imageLocation = avatarsViewPager.getRealImageLocation(position);
thumb = FileLoader.getPathToAttach(PhotoViewer.getFileLocation(imageLocation), PhotoViewer.getFileLocationExt(imageLocation), true).getAbsolutePath();
} else {
thumb = null;
}
imageUpdater.openPhotoForEdit(f.getAbsolutePath(), thumb, 0, isVideo);
} else if (id == delete_avatar) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
ImageLocation location = avatarsViewPager.getImageLocation(avatarsViewPager.getRealPosition());
if (location == null) {
return;
}
if (location.imageType == FileLoader.IMAGE_TYPE_ANIMATION) {
builder.setTitle(LocaleController.getString("AreYouSureDeleteVideoTitle", R.string.AreYouSureDeleteVideoTitle));
builder.setMessage(LocaleController.formatString("AreYouSureDeleteVideo", R.string.AreYouSureDeleteVideo));
} else {
builder.setTitle(LocaleController.getString("AreYouSureDeletePhotoTitle", R.string.AreYouSureDeletePhotoTitle));
builder.setMessage(LocaleController.formatString("AreYouSureDeletePhoto", R.string.AreYouSureDeletePhoto));
}
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialogInterface, i) -> {
int position = avatarsViewPager.getRealPosition();
TLRPC.Photo photo = avatarsViewPager.getPhoto(position);
if (avatarsViewPager.getRealCount() == 1) {
setForegroundImage(true);
}
if (photo == null || avatarsViewPager.getRealPosition() == 0) {
getMessagesController().deleteUserPhoto(null);
} else {
TLRPC.TL_inputPhoto inputPhoto = new TLRPC.TL_inputPhoto();
inputPhoto.id = photo.id;
inputPhoto.access_hash = photo.access_hash;
inputPhoto.file_reference = photo.file_reference;
if (inputPhoto.file_reference == null) {
inputPhoto.file_reference = new byte[0];
}
getMessagesController().deleteUserPhoto(inputPhoto);
getMessagesStorage().clearUserPhoto(userId, photo.id);
}
if (avatarsViewPager.removePhotoAtIndex(position)) {
avatarsViewPager.setVisibility(View.GONE);
avatarImage.setForegroundAlpha(1f);
avatarContainer.setVisibility(View.VISIBLE);
doNotSetForeground = true;
final View view = layoutManager.findViewByPosition(0);
if (view != null) {
listView.smoothScrollBy(0, view.getTop() - AndroidUtilities.dp(88), CubicBezierInterpolator.EASE_OUT_QUINT);
}
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
} else if (id == add_photo) {
onWriteButtonClick();
} else if (id == qr_button) {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putLong("user_id", userId);
presentFragment(new QrActivity(args));
}
}
});
if (sharedMediaLayout != null) {
sharedMediaLayout.onDestroy();
}
final long did;
if (dialogId != 0) {
did = dialogId;
} else if (userId != 0) {
did = userId;
} else {
did = -chatId;
}
ArrayList<Integer> users = chatInfo != null && chatInfo.participants != null && chatInfo.participants.participants.size() > 5 ? sortedUsers : null;
sharedMediaLayout = new SharedMediaLayout(context, did, sharedMediaPreloader, userInfo != null ? userInfo.common_chats_count : 0, sortedUsers, chatInfo, users != null, this, this, SharedMediaLayout.VIEW_TYPE_PROFILE_ACTIVITY) {
@Override
protected void onSelectedTabChanged() {
updateSelectedMediaTabText();
}
@Override
protected boolean canShowSearchItem() {
return mediaHeaderVisible;
}
@Override
protected void onSearchStateChanged(boolean expanded) {
if (SharedConfig.smoothKeyboard) {
AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
}
listView.stopScroll();
avatarContainer2.setPivotY(avatarContainer.getPivotY() + avatarContainer.getMeasuredHeight() / 2f);
avatarContainer2.setPivotX(avatarContainer2.getMeasuredWidth() / 2f);
AndroidUtilities.updateViewVisibilityAnimated(avatarContainer2, !expanded, 0.95f, true);
callItem.setVisibility(expanded || !callItemVisible ? GONE : INVISIBLE);
videoCallItem.setVisibility(expanded || !videoCallItemVisible ? GONE : INVISIBLE);
editItem.setVisibility(expanded || !editItemVisible ? GONE : INVISIBLE);
otherItem.setVisibility(expanded ? GONE : INVISIBLE);
if (qrItem != null) {
qrItem.setVisibility(expanded ? GONE : INVISIBLE);
}
}
@Override
protected boolean onMemberClick(TLRPC.ChatParticipant participant, boolean isLong) {
return ProfileActivity.this.onMemberClick(participant, isLong);
}
};
sharedMediaLayout.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.MATCH_PARENT));
ActionBarMenu menu = actionBar.createMenu();
if (userId == getUserConfig().clientUserId) {
qrItem = menu.addItem(qr_button, R.drawable.msg_qr_mini, getResourceProvider());
qrItem.setVisibility(isQrNeedVisible() ? View.VISIBLE : View.GONE);
qrItem.setContentDescription(LocaleController.getString("AuthAnotherClientScan", R.string.AuthAnotherClientScan));
}
if (imageUpdater != null) {
searchItem = menu.addItem(search_button, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
@Override
public Animator getCustomToggleTransition() {
searchMode = !searchMode;
if (!searchMode) {
searchItem.clearFocusOnSearchView();
}
if (searchMode) {
searchItem.getSearchField().setText("");
}
return searchExpandTransition(searchMode);
}
@Override
public void onTextChanged(EditText editText) {
searchAdapter.search(editText.getText().toString().toLowerCase());
}
});
searchItem.setContentDescription(LocaleController.getString("SearchInSettings", R.string.SearchInSettings));
searchItem.setSearchFieldHint(LocaleController.getString("SearchInSettings", R.string.SearchInSettings));
sharedMediaLayout.getSearchItem().setVisibility(View.GONE);
if (expandPhoto) {
searchItem.setVisibility(View.GONE);
}
}
videoCallItem = menu.addItem(video_call_item, R.drawable.profile_video);
videoCallItem.setContentDescription(LocaleController.getString("VideoCall", R.string.VideoCall));
if (chatId != 0) {
callItem = menu.addItem(call_item, R.drawable.msg_voicechat2);
if (ChatObject.isChannelOrGiga(currentChat)) {
callItem.setContentDescription(LocaleController.getString("VoipChannelVoiceChat", R.string.VoipChannelVoiceChat));
} else {
callItem.setContentDescription(LocaleController.getString("VoipGroupVoiceChat", R.string.VoipGroupVoiceChat));
}
} else {
callItem = menu.addItem(call_item, R.drawable.ic_call);
callItem.setContentDescription(LocaleController.getString("Call", R.string.Call));
}
editItem = menu.addItem(edit_channel, R.drawable.group_edit_profile);
editItem.setContentDescription(LocaleController.getString("Edit", R.string.Edit));
otherItem = menu.addItem(10, R.drawable.ic_ab_other);
otherItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
int scrollTo;
int scrollToPosition = 0;
Object writeButtonTag = null;
if (listView != null && imageUpdater != null) {
scrollTo = layoutManager.findFirstVisibleItemPosition();
View topView = layoutManager.findViewByPosition(scrollTo);
if (topView != null) {
scrollToPosition = topView.getTop() - listView.getPaddingTop();
} else {
scrollTo = -1;
}
writeButtonTag = writeButton.getTag();
} else {
scrollTo = -1;
}
createActionBarMenu(false);
listAdapter = new ListAdapter(context);
searchAdapter = new SearchAdapter(context);
avatarDrawable = new AvatarDrawable();
avatarDrawable.setProfile(true);
fragmentView = new NestedFrameLayout(context) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (pinchToZoomHelper.isInOverlayMode()) {
return pinchToZoomHelper.onTouchEvent(ev);
}
if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll() && sharedMediaLayout.isPinnedToTop()) {
return sharedMediaLayout.dispatchFastScrollEvent(ev);
}
if (sharedMediaLayout != null && sharedMediaLayout.checkPinchToZoom(ev)) {
return true;
}
return super.dispatchTouchEvent(ev);
}
private boolean ignoreLayout;
private Paint grayPaint = new Paint();
@Override
public boolean hasOverlappingRendering() {
return false;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int actionBarHeight = ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0);
if (listView != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
if (layoutParams.topMargin != actionBarHeight) {
layoutParams.topMargin = actionBarHeight;
}
}
if (searchListView != null) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) searchListView.getLayoutParams();
if (layoutParams.topMargin != actionBarHeight) {
layoutParams.topMargin = actionBarHeight;
}
}
int height = MeasureSpec.getSize(heightMeasureSpec);
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
boolean changed = false;
if (lastMeasuredContentWidth != getMeasuredWidth() || lastMeasuredContentHeight != getMeasuredHeight()) {
changed = lastMeasuredContentWidth != 0 && lastMeasuredContentWidth != getMeasuredWidth();
listContentHeight = 0;
int count = listAdapter.getItemCount();
lastMeasuredContentWidth = getMeasuredWidth();
lastMeasuredContentHeight = getMeasuredHeight();
int ws = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY);
int hs = MeasureSpec.makeMeasureSpec(listView.getMeasuredHeight(), MeasureSpec.UNSPECIFIED);
positionToOffset.clear();
for (int i = 0; i < count; i++) {
int type = listAdapter.getItemViewType(i);
positionToOffset.put(i, listContentHeight);
if (type == 13) {
listContentHeight += listView.getMeasuredHeight();
} else {
RecyclerView.ViewHolder holder = listAdapter.createViewHolder(null, type);
listAdapter.onBindViewHolder(holder, i);
holder.itemView.measure(ws, hs);
listContentHeight += holder.itemView.getMeasuredHeight();
}
}
if (emptyView != null) {
((LayoutParams) emptyView.getLayoutParams()).topMargin = AndroidUtilities.dp(88) + AndroidUtilities.statusBarHeight;
}
}
if (!fragmentOpened && (expandPhoto || openAnimationInProgress && playProfileAnimation == 2)) {
ignoreLayout = true;
if (expandPhoto) {
if (searchItem != null) {
searchItem.setAlpha(0.0f);
searchItem.setEnabled(false);
searchItem.setVisibility(GONE);
}
nameTextView[1].setTextColor(Color.WHITE);
onlineTextView[1].setTextColor(Color.argb(179, 255, 255, 255));
actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR, false);
actionBar.setItemsColor(Color.WHITE, false);
overlaysView.setOverlaysVisible();
overlaysView.setAlphaValue(1.0f, false);
avatarImage.setForegroundAlpha(1.0f);
avatarContainer.setVisibility(View.GONE);
avatarsViewPager.resetCurrentItem();
avatarsViewPager.setVisibility(View.VISIBLE);
expandPhoto = false;
}
allowPullingDown = true;
isPulledDown = true;
if (otherItem != null) {
if (!getMessagesController().isChatNoForwards(currentChat)) {
otherItem.showSubItem(gallery_menu_save);
} else {
otherItem.hideSubItem(gallery_menu_save);
}
if (imageUpdater != null) {
otherItem.showSubItem(edit_avatar);
otherItem.showSubItem(delete_avatar);
otherItem.hideSubItem(logout);
}
}
currentExpanAnimatorFracture = 1.0f;
int paddingTop;
int paddingBottom;
if (isInLandscapeMode) {
paddingTop = AndroidUtilities.dp(88f);
paddingBottom = 0;
} else {
paddingTop = listView.getMeasuredWidth();
paddingBottom = Math.max(0, getMeasuredHeight() - (listContentHeight + AndroidUtilities.dp(88) + actionBarHeight));
}
if (banFromGroup != 0) {
paddingBottom += AndroidUtilities.dp(48);
listView.setBottomGlowOffset(AndroidUtilities.dp(48));
} else {
listView.setBottomGlowOffset(0);
}
initialAnimationExtraHeight = paddingTop - actionBarHeight;
layoutManager.scrollToPositionWithOffset(0, -actionBarHeight);
listView.setPadding(0, paddingTop, 0, paddingBottom);
measureChildWithMargins(listView, widthMeasureSpec, 0, heightMeasureSpec, 0);
listView.layout(0, actionBarHeight, listView.getMeasuredWidth(), actionBarHeight + listView.getMeasuredHeight());
ignoreLayout = false;
} else if (fragmentOpened && !openAnimationInProgress && !firstLayout) {
ignoreLayout = true;
int paddingTop;
int paddingBottom;
if (isInLandscapeMode || AndroidUtilities.isTablet()) {
paddingTop = AndroidUtilities.dp(88f);
paddingBottom = 0;
} else {
paddingTop = listView.getMeasuredWidth();
paddingBottom = Math.max(0, getMeasuredHeight() - (listContentHeight + AndroidUtilities.dp(88) + actionBarHeight));
}
if (banFromGroup != 0) {
paddingBottom += AndroidUtilities.dp(48);
listView.setBottomGlowOffset(AndroidUtilities.dp(48));
} else {
listView.setBottomGlowOffset(0);
}
int currentPaddingTop = listView.getPaddingTop();
View view = null;
int pos = RecyclerView.NO_POSITION;
for (int i = 0; i < listView.getChildCount(); i++) {
int p = listView.getChildAdapterPosition(listView.getChildAt(i));
if (p != RecyclerView.NO_POSITION) {
view = listView.getChildAt(i);
pos = p;
break;
}
}
if (view == null) {
view = listView.getChildAt(0);
if (view != null) {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(view);
pos = holder.getAdapterPosition();
if (pos == RecyclerView.NO_POSITION) {
pos = holder.getPosition();
}
}
}
int top = paddingTop;
if (view != null) {
top = view.getTop();
}
boolean layout = false;
if (actionBar.isSearchFieldVisible() && sharedMediaRow >= 0) {
layoutManager.scrollToPositionWithOffset(sharedMediaRow, -paddingTop);
layout = true;
} else if (invalidateScroll || currentPaddingTop != paddingTop) {
if (savedScrollPosition >= 0) {
layoutManager.scrollToPositionWithOffset(savedScrollPosition, savedScrollOffset - paddingTop);
} else if ((!changed || !allowPullingDown) && view != null) {
if (pos == 0 && !allowPullingDown && top > AndroidUtilities.dp(88)) {
top = AndroidUtilities.dp(88);
}
layoutManager.scrollToPositionWithOffset(pos, top - paddingTop);
layout = true;
} else {
layoutManager.scrollToPositionWithOffset(0, AndroidUtilities.dp(88) - paddingTop);
}
}
if (currentPaddingTop != paddingTop || listView.getPaddingBottom() != paddingBottom) {
listView.setPadding(0, paddingTop, 0, paddingBottom);
layout = true;
}
if (layout) {
measureChildWithMargins(listView, widthMeasureSpec, 0, heightMeasureSpec, 0);
try {
listView.layout(0, actionBarHeight, listView.getMeasuredWidth(), actionBarHeight + listView.getMeasuredHeight());
} catch (Exception e) {
FileLog.e(e);
}
}
ignoreLayout = false;
}
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
savedScrollPosition = -1;
firstLayout = false;
invalidateScroll = false;
checkListViewScroll();
}
@Override
public void requestLayout() {
if (ignoreLayout) {
return;
}
super.requestLayout();
}
private final ArrayList<View> sortedChildren = new ArrayList<>();
private final Comparator<View> viewComparator = (view, view2) -> (int) (view.getY() - view2.getY());
@Override
protected void dispatchDraw(Canvas canvas) {
whitePaint.setColor(Theme.getColor(Theme.key_windowBackgroundWhite));
if (listView.getVisibility() == VISIBLE) {
grayPaint.setColor(Theme.getColor(Theme.key_windowBackgroundGray));
if (transitionAnimationInProress) {
whitePaint.setAlpha((int) (255 * listView.getAlpha()));
}
if (transitionAnimationInProress) {
grayPaint.setAlpha((int) (255 * listView.getAlpha()));
}
int count = listView.getChildCount();
sortedChildren.clear();
boolean hasRemovingItems = false;
for (int i = 0; i < count; i++) {
View child = listView.getChildAt(i);
if (listView.getChildAdapterPosition(child) != RecyclerView.NO_POSITION) {
sortedChildren.add(listView.getChildAt(i));
} else {
hasRemovingItems = true;
}
}
Collections.sort(sortedChildren, viewComparator);
boolean hasBackground = false;
float lastY = listView.getY();
count = sortedChildren.size();
if (!openAnimationInProgress && count > 0 && !hasRemovingItems) {
lastY += sortedChildren.get(0).getY();
}
float alpha = 1f;
for (int i = 0; i < count; i++) {
View child = sortedChildren.get(i);
boolean currentHasBackground = child.getBackground() != null;
int currentY = (int) (listView.getY() + child.getY());
if (hasBackground == currentHasBackground) {
if (child.getAlpha() == 1f) {
alpha = 1f;
}
continue;
}
if (hasBackground) {
canvas.drawRect(listView.getX(), lastY, listView.getX() + listView.getMeasuredWidth(), currentY, grayPaint);
} else {
if (alpha != 1f) {
canvas.drawRect(listView.getX(), lastY, listView.getX() + listView.getMeasuredWidth(), currentY, grayPaint);
whitePaint.setAlpha((int) (255 * alpha));
canvas.drawRect(listView.getX(), lastY, listView.getX() + listView.getMeasuredWidth(), currentY, whitePaint);
whitePaint.setAlpha(255);
} else {
canvas.drawRect(listView.getX(), lastY, listView.getX() + listView.getMeasuredWidth(), currentY, whitePaint);
}
}
hasBackground = currentHasBackground;
lastY = currentY;
alpha = child.getAlpha();
}
if (hasBackground) {
canvas.drawRect(listView.getX(), lastY, listView.getX() + listView.getMeasuredWidth(), listView.getBottom(), grayPaint);
} else {
if (alpha != 1f) {
canvas.drawRect(listView.getX(), lastY, listView.getX() + listView.getMeasuredWidth(), listView.getBottom(), grayPaint);
whitePaint.setAlpha((int) (255 * alpha));
canvas.drawRect(listView.getX(), lastY, listView.getX() + listView.getMeasuredWidth(), listView.getBottom(), whitePaint);
whitePaint.setAlpha(255);
} else {
canvas.drawRect(listView.getX(), lastY, listView.getX() + listView.getMeasuredWidth(), listView.getBottom(), whitePaint);
}
}
} else {
int top = searchListView.getTop();
canvas.drawRect(0, top + extraHeight + searchTransitionOffset, getMeasuredWidth(), top + getMeasuredHeight(), whitePaint);
}
super.dispatchDraw(canvas);
if (profileTransitionInProgress && parentLayout.fragmentsStack.size() > 1) {
BaseFragment fragment = parentLayout.fragmentsStack.get(parentLayout.fragmentsStack.size() - 2);
if (fragment instanceof ChatActivity) {
ChatActivity chatActivity = (ChatActivity) fragment;
FragmentContextView fragmentContextView = chatActivity.getFragmentContextView();
if (fragmentContextView != null && fragmentContextView.isCallStyle()) {
float progress = extraHeight / AndroidUtilities.dpf2(fragmentContextView.getStyleHeight());
if (progress > 1f) {
progress = 1f;
}
canvas.save();
canvas.translate(fragmentContextView.getX(), fragmentContextView.getY());
fragmentContextView.setDrawOverlay(true);
fragmentContextView.setCollapseTransition(true, extraHeight, progress);
fragmentContextView.draw(canvas);
fragmentContextView.setCollapseTransition(false, extraHeight, progress);
fragmentContextView.setDrawOverlay(false);
canvas.restore();
}
}
}
if (scrimPaint.getAlpha() > 0) {
canvas.drawRect(0, 0, getWidth(), getHeight(), scrimPaint);
}
if (scrimView != null) {
int c = canvas.save();
canvas.translate(scrimView.getLeft(), scrimView.getTop());
if (scrimView == actionBar.getBackButton()) {
int r = Math.max(scrimView.getMeasuredWidth(), scrimView.getMeasuredHeight()) / 2;
int wasAlpha = actionBarBackgroundPaint.getAlpha();
actionBarBackgroundPaint.setAlpha((int) (wasAlpha * (scrimPaint.getAlpha() / 255f) / 0.3f));
canvas.drawCircle(r, r, r * 0.8f, actionBarBackgroundPaint);
actionBarBackgroundPaint.setAlpha(wasAlpha);
}
scrimView.draw(canvas);
canvas.restoreToCount(c);
}
}
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
if (pinchToZoomHelper.isInOverlayMode() && (child == avatarContainer2 || child == actionBar || child == writeButton)) {
return true;
}
return super.drawChild(canvas, child, drawingTime);
}
};
fragmentView.setWillNotDraw(false);
FrameLayout frameLayout = (FrameLayout) fragmentView;
listView = new RecyclerListView(context) {
private VelocityTracker velocityTracker;
@Override
protected boolean canHighlightChildAt(View child, float x, float y) {
return !(child instanceof AboutLinkCell);
}
@Override
protected boolean allowSelectChildAtPosition(View child) {
return child != sharedMediaLayout;
}
@Override
public boolean hasOverlappingRendering() {
return false;
}
@Override
protected void requestChildOnScreen(View child, View focused) {
}
@Override
public void invalidate() {
super.invalidate();
if (fragmentView != null) {
fragmentView.invalidate();
}
}
@Override
public boolean onTouchEvent(MotionEvent e) {
final int action = e.getAction();
if (action == MotionEvent.ACTION_DOWN) {
if (velocityTracker == null) {
velocityTracker = VelocityTracker.obtain();
} else {
velocityTracker.clear();
}
velocityTracker.addMovement(e);
} else if (action == MotionEvent.ACTION_MOVE) {
if (velocityTracker != null) {
velocityTracker.addMovement(e);
velocityTracker.computeCurrentVelocity(1000);
listViewVelocityY = velocityTracker.getYVelocity(e.getPointerId(e.getActionIndex()));
}
} else if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
if (velocityTracker != null) {
velocityTracker.recycle();
velocityTracker = null;
}
}
final boolean result = super.onTouchEvent(e);
if (action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL) {
if (allowPullingDown) {
final View view = layoutManager.findViewByPosition(0);
if (view != null) {
if (isPulledDown) {
final int actionBarHeight = ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0);
listView.smoothScrollBy(0, view.getTop() - listView.getMeasuredWidth() + actionBarHeight, CubicBezierInterpolator.EASE_OUT_QUINT);
} else {
listView.smoothScrollBy(0, view.getTop() - AndroidUtilities.dp(88), CubicBezierInterpolator.EASE_OUT_QUINT);
}
}
}
}
return result;
}
@Override
public boolean drawChild(Canvas canvas, View child, long drawingTime) {
if (getItemAnimator().isRunning() && child.getBackground() == null && child.getTranslationY() != 0) {
boolean useAlpha = listView.getChildAdapterPosition(child) == sharedMediaRow && child.getAlpha() != 1f;
if (useAlpha) {
whitePaint.setAlpha((int) (255 * listView.getAlpha() * child.getAlpha()));
}
canvas.drawRect(listView.getX(), child.getY(), listView.getX() + listView.getMeasuredWidth(), child.getY() + child.getHeight(), whitePaint);
if (useAlpha) {
whitePaint.setAlpha((int) (255 * listView.getAlpha()));
}
}
return super.drawChild(canvas, child, drawingTime);
}
};
listView.setVerticalScrollBarEnabled(false);
DefaultItemAnimator defaultItemAnimator = new DefaultItemAnimator() {
int animationIndex = -1;
@Override
protected void onAllAnimationsDone() {
super.onAllAnimationsDone();
getNotificationCenter().onAnimationFinish(animationIndex);
}
@Override
public void runPendingAnimations() {
boolean removalsPending = !mPendingRemovals.isEmpty();
boolean movesPending = !mPendingMoves.isEmpty();
boolean changesPending = !mPendingChanges.isEmpty();
boolean additionsPending = !mPendingAdditions.isEmpty();
if (removalsPending || movesPending || additionsPending || changesPending) {
ValueAnimator valueAnimator = ValueAnimator.ofFloat(0, 1f);
valueAnimator.addUpdateListener(valueAnimator1 -> listView.invalidate());
valueAnimator.setDuration(getMoveDuration());
valueAnimator.start();
animationIndex = getNotificationCenter().setAnimationInProgress(animationIndex, null);
}
super.runPendingAnimations();
}
@Override
protected long getAddAnimationDelay(long removeDuration, long moveDuration, long changeDuration) {
return 0;
}
@Override
protected long getMoveAnimationDelay() {
return 0;
}
@Override
public long getMoveDuration() {
return 220;
}
@Override
public long getRemoveDuration() {
return 220;
}
@Override
public long getAddDuration() {
return 220;
}
};
listView.setItemAnimator(defaultItemAnimator);
defaultItemAnimator.setSupportsChangeAnimations(false);
defaultItemAnimator.setDelayAnimations(false);
listView.setClipToPadding(false);
listView.setHideIfEmpty(false);
layoutManager = new LinearLayoutManager(context) {
@Override
public boolean supportsPredictiveItemAnimations() {
return imageUpdater != null;
}
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
final View view = layoutManager.findViewByPosition(0);
if (view != null && !openingAvatar) {
final int canScroll = view.getTop() - AndroidUtilities.dp(88);
if (!allowPullingDown && canScroll > dy) {
dy = canScroll;
if (avatarsViewPager.hasImages() && avatarImage.getImageReceiver().hasNotThumb() && !isInLandscapeMode && !AndroidUtilities.isTablet()) {
allowPullingDown = avatarBig == null;
}
} else if (allowPullingDown) {
if (dy >= canScroll) {
dy = canScroll;
allowPullingDown = false;
} else if (listView.getScrollState() == RecyclerListView.SCROLL_STATE_DRAGGING) {
if (!isPulledDown) {
dy /= 2;
}
}
}
}
return super.scrollVerticallyBy(dy, recycler, state);
}
};
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
layoutManager.mIgnoreTopPadding = false;
listView.setLayoutManager(layoutManager);
listView.setGlowColor(0);
listView.setAdapter(listAdapter);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
listView.setOnItemClickListener((view, position, x, y) -> {
if (getParentActivity() == null) {
return;
}
if (position == settingsKeyRow) {
Bundle args = new Bundle();
args.putInt("chat_id", DialogObject.getEncryptedChatId(dialogId));
presentFragment(new IdenticonActivity(args));
} else if (position == settingsTimerRow) {
showDialog(AlertsCreator.createTTLAlert(getParentActivity(), currentEncryptedChat, null).create());
} else if (position == notificationsRow) {
if (LocaleController.isRTL && x <= AndroidUtilities.dp(76) || !LocaleController.isRTL && x >= view.getMeasuredWidth() - AndroidUtilities.dp(76)) {
NotificationsCheckCell checkCell = (NotificationsCheckCell) view;
boolean checked = !checkCell.isChecked();
boolean defaultEnabled = getNotificationsController().isGlobalNotificationsEnabled(did);
if (checked) {
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
SharedPreferences.Editor editor = preferences.edit();
if (defaultEnabled) {
editor.remove("notify2_" + did);
} else {
editor.putInt("notify2_" + did, 0);
}
getMessagesStorage().setDialogFlags(did, 0);
editor.commit();
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(did);
if (dialog != null) {
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
}
} else {
int untilTime = Integer.MAX_VALUE;
SharedPreferences preferences = MessagesController.getNotificationsSettings(currentAccount);
SharedPreferences.Editor editor = preferences.edit();
long flags;
if (!defaultEnabled) {
editor.remove("notify2_" + did);
flags = 0;
} else {
editor.putInt("notify2_" + did, 2);
flags = 1;
}
getNotificationsController().removeNotificationsForDialog(did);
getMessagesStorage().setDialogFlags(did, flags);
editor.commit();
TLRPC.Dialog dialog = getMessagesController().dialogs_dict.get(did);
if (dialog != null) {
dialog.notify_settings = new TLRPC.TL_peerNotifySettings();
if (defaultEnabled) {
dialog.notify_settings.mute_until = untilTime;
}
}
}
getNotificationsController().updateServerNotificationsSettings(did);
checkCell.setChecked(checked);
RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findViewHolderForPosition(notificationsRow);
if (holder != null) {
listAdapter.onBindViewHolder(holder, notificationsRow);
}
return;
}
AlertsCreator.showCustomNotificationsDialog(ProfileActivity.this, did, -1, null, currentAccount, param -> listAdapter.notifyItemChanged(notificationsRow));
} else if (position == unblockRow) {
getMessagesController().unblockPeer(userId);
if (BulletinFactory.canShowBulletin(ProfileActivity.this)) {
BulletinFactory.createBanBulletin(ProfileActivity.this, false).show();
}
} else if (position == sendMessageRow) {
onWriteButtonClick();
} else if (position == reportRow) {
AlertsCreator.createReportAlert(getParentActivity(), getDialogId(), 0, ProfileActivity.this, null);
} else if (position >= membersStartRow && position < membersEndRow) {
TLRPC.ChatParticipant participant;
if (!sortedUsers.isEmpty()) {
participant = chatInfo.participants.participants.get(sortedUsers.get(position - membersStartRow));
} else {
participant = chatInfo.participants.participants.get(position - membersStartRow);
}
onMemberClick(participant, false);
} else if (position == addMemberRow) {
openAddMember();
} else if (position == usernameRow) {
if (currentChat != null) {
try {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
if (!TextUtils.isEmpty(chatInfo.about)) {
intent.putExtra(Intent.EXTRA_TEXT, currentChat.title + "\n" + chatInfo.about + "\nhttps://" + getMessagesController().linkPrefix + "/" + currentChat.username);
} else {
intent.putExtra(Intent.EXTRA_TEXT, currentChat.title + "\nhttps://" + getMessagesController().linkPrefix + "/" + currentChat.username);
}
getParentActivity().startActivityForResult(Intent.createChooser(intent, LocaleController.getString("BotShare", R.string.BotShare)), 500);
} catch (Exception e) {
FileLog.e(e);
}
}
} else if (position == locationRow) {
if (chatInfo.location instanceof TLRPC.TL_channelLocation) {
LocationActivity fragment = new LocationActivity(LocationActivity.LOCATION_TYPE_GROUP_VIEW);
fragment.setChatLocation(chatId, (TLRPC.TL_channelLocation) chatInfo.location);
presentFragment(fragment);
}
} else if (position == joinRow) {
getMessagesController().addUserToChat(currentChat.id, getUserConfig().getCurrentUser(), 0, null, ProfileActivity.this, null);
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeSearchByActiveAction);
} else if (position == subscribersRow) {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putInt("type", ChatUsersActivity.TYPE_USERS);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(chatInfo);
presentFragment(fragment);
} else if (position == subscribersRequestsRow) {
MemberRequestsActivity activity = new MemberRequestsActivity(chatId);
presentFragment(activity);
} else if (position == administratorsRow) {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putInt("type", ChatUsersActivity.TYPE_ADMIN);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(chatInfo);
presentFragment(fragment);
} else if (position == blockedUsersRow) {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putInt("type", ChatUsersActivity.TYPE_BANNED);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(chatInfo);
presentFragment(fragment);
} else if (position == notificationRow) {
presentFragment(new NotificationsSettingsActivity());
} else if (position == privacyRow) {
presentFragment(new PrivacySettingsActivity());
} else if (position == dataRow) {
presentFragment(new DataSettingsActivity());
} else if (position == chatRow) {
presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC));
} else if (position == filtersRow) {
presentFragment(new FiltersSetupActivity());
} else if (position == devicesRow) {
presentFragment(new SessionsActivity(0));
} else if (position == questionRow) {
showDialog(AlertsCreator.createSupportAlert(ProfileActivity.this));
} else if (position == faqRow) {
Browser.openUrl(getParentActivity(), LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl));
} else if (position == policyRow) {
Browser.openUrl(getParentActivity(), LocaleController.getString("PrivacyPolicyUrl", R.string.PrivacyPolicyUrl));
} else if (position == sendLogsRow) {
sendLogs(false);
} else if (position == sendLastLogsRow) {
sendLogs(true);
} else if (position == clearLogsRow) {
FileLog.cleanupLogs();
} else if (position == switchBackendRow) {
if (getParentActivity() == null) {
return;
}
AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity());
builder1.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
builder1.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder1.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> {
SharedConfig.pushAuthKey = null;
SharedConfig.pushAuthKeyId = null;
SharedConfig.saveConfig();
getConnectionsManager().switchBackend(true);
});
builder1.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder1.create());
} else if (position == languageRow) {
presentFragment(new LanguageSelectActivity());
} else if (position == setUsernameRow) {
presentFragment(new ChangeUsernameActivity());
} else if (position == bioRow) {
if (userInfo != null) {
presentFragment(new ChangeBioActivity());
}
} else if (position == numberRow) {
presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER));
} else if (position == setAvatarRow) {
onWriteButtonClick();
} else {
processOnClickOrPress(position, view);
}
});
listView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
private int pressCount = 0;
@Override
public boolean onItemClick(View view, int position) {
if (position == versionRow) {
pressCount++;
if (pressCount >= 2 || BuildVars.DEBUG_PRIVATE_VERSION) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("DebugMenu", R.string.DebugMenu));
CharSequence[] items;
items = new CharSequence[] { LocaleController.getString("DebugMenuImportContacts", R.string.DebugMenuImportContacts), LocaleController.getString("DebugMenuReloadContacts", R.string.DebugMenuReloadContacts), LocaleController.getString("DebugMenuResetContacts", R.string.DebugMenuResetContacts), LocaleController.getString("DebugMenuResetDialogs", R.string.DebugMenuResetDialogs), BuildVars.DEBUG_VERSION ? null : (BuildVars.LOGS_ENABLED ? LocaleController.getString("DebugMenuDisableLogs", R.string.DebugMenuDisableLogs) : LocaleController.getString("DebugMenuEnableLogs", R.string.DebugMenuEnableLogs)), SharedConfig.inappCamera ? LocaleController.getString("DebugMenuDisableCamera", R.string.DebugMenuDisableCamera) : LocaleController.getString("DebugMenuEnableCamera", R.string.DebugMenuEnableCamera), LocaleController.getString("DebugMenuClearMediaCache", R.string.DebugMenuClearMediaCache), LocaleController.getString("DebugMenuCallSettings", R.string.DebugMenuCallSettings), null, BuildVars.DEBUG_PRIVATE_VERSION || BuildVars.isStandaloneApp() ? LocaleController.getString("DebugMenuCheckAppUpdate", R.string.DebugMenuCheckAppUpdate) : null, LocaleController.getString("DebugMenuReadAllDialogs", R.string.DebugMenuReadAllDialogs), SharedConfig.pauseMusicOnRecord ? LocaleController.getString("DebugMenuDisablePauseMusic", R.string.DebugMenuDisablePauseMusic) : LocaleController.getString("DebugMenuEnablePauseMusic", R.string.DebugMenuEnablePauseMusic), BuildVars.DEBUG_VERSION && !AndroidUtilities.isTablet() && Build.VERSION.SDK_INT >= 23 ? (SharedConfig.smoothKeyboard ? LocaleController.getString("DebugMenuDisableSmoothKeyboard", R.string.DebugMenuDisableSmoothKeyboard) : LocaleController.getString("DebugMenuEnableSmoothKeyboard", R.string.DebugMenuEnableSmoothKeyboard)) : null, BuildVars.DEBUG_PRIVATE_VERSION ? (SharedConfig.disableVoiceAudioEffects ? "Enable voip audio effects" : "Disable voip audio effects") : null, Build.VERSION.SDK_INT >= 21 ? (SharedConfig.noStatusBar ? "Show status bar background" : "Hide status bar background") : null, BuildVars.DEBUG_PRIVATE_VERSION ? "Clean app update" : null, BuildVars.DEBUG_PRIVATE_VERSION ? "Reset suggestions" : null };
builder.setItems(items, (dialog, which) -> {
if (which == 0) {
getUserConfig().syncContacts = true;
getUserConfig().saveConfig(false);
getContactsController().forceImportContacts();
} else if (which == 1) {
getContactsController().loadContacts(false, 0);
} else if (which == 2) {
getContactsController().resetImportedContacts();
} else if (which == 3) {
getMessagesController().forceResetDialogs();
} else if (which == 4) {
BuildVars.LOGS_ENABLED = !BuildVars.LOGS_ENABLED;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
sharedPreferences.edit().putBoolean("logsEnabled", BuildVars.LOGS_ENABLED).commit();
updateRowsIds();
listAdapter.notifyDataSetChanged();
} else if (which == 5) {
SharedConfig.toggleInappCamera();
} else if (which == 6) {
getMessagesStorage().clearSentMedia();
SharedConfig.setNoSoundHintShowed(false);
SharedPreferences.Editor editor = MessagesController.getGlobalMainSettings().edit();
editor.remove("archivehint").remove("proximityhint").remove("archivehint_l").remove("gifhint").remove("reminderhint").remove("soundHint").remove("themehint").remove("bganimationhint").remove("filterhint").commit();
MessagesController.getEmojiSettings(currentAccount).edit().remove("featured_hidden").commit();
SharedConfig.textSelectionHintShows = 0;
SharedConfig.lockRecordAudioVideoHint = 0;
SharedConfig.stickersReorderingHintUsed = false;
SharedConfig.forwardingOptionsHintShown = false;
SharedConfig.messageSeenHintCount = 3;
SharedConfig.emojiInteractionsHintCount = 3;
SharedConfig.dayNightThemeSwitchHintCount = 3;
SharedConfig.fastScrollHintCount = 3;
ChatThemeController.getInstance(currentAccount).clearCache();
} else if (which == 7) {
VoIPHelper.showCallDebugSettings(getParentActivity());
} else if (which == 8) {
SharedConfig.toggleRoundCamera16to9();
} else if (which == 9) {
((LaunchActivity) getParentActivity()).checkAppUpdate(true);
} else if (which == 10) {
getMessagesStorage().readAllDialogs(-1);
} else if (which == 11) {
SharedConfig.togglePauseMusicOnRecord();
} else if (which == 12) {
SharedConfig.toggleSmoothKeyboard();
if (SharedConfig.smoothKeyboard && getParentActivity() != null) {
getParentActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
} else if (which == 13) {
SharedConfig.toggleDisableVoiceAudioEffects();
} else if (which == 14) {
SharedConfig.toggleNoStatusBar();
if (getParentActivity() != null && Build.VERSION.SDK_INT >= 21) {
if (SharedConfig.noStatusBar) {
getParentActivity().getWindow().setStatusBarColor(0);
} else {
getParentActivity().getWindow().setStatusBarColor(0x33000000);
}
}
} else if (which == 15) {
SharedConfig.pendingAppUpdate = null;
SharedConfig.saveConfig();
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.appUpdateAvailable);
} else if (which == 16) {
Set<String> suggestions = getMessagesController().pendingSuggestions;
suggestions.add("VALIDATE_PHONE_NUMBER");
suggestions.add("VALIDATE_PASSWORD");
getNotificationCenter().postNotificationName(NotificationCenter.newSuggestionsAvailable);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
} else {
try {
Toast.makeText(getParentActivity(), "¯\\_(ツ)_/¯", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
FileLog.e(e);
}
}
return true;
} else if (position >= membersStartRow && position < membersEndRow) {
final TLRPC.ChatParticipant participant;
if (!sortedUsers.isEmpty()) {
participant = visibleChatParticipants.get(sortedUsers.get(position - membersStartRow));
} else {
participant = visibleChatParticipants.get(position - membersStartRow);
}
return onMemberClick(participant, true);
} else {
return processOnClickOrPress(position, view);
}
}
});
if (searchItem != null) {
searchListView = new RecyclerListView(context);
searchListView.setVerticalScrollBarEnabled(false);
searchListView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
searchListView.setGlowColor(Theme.getColor(Theme.key_avatar_backgroundActionBarBlue));
searchListView.setAdapter(searchAdapter);
searchListView.setItemAnimator(null);
searchListView.setVisibility(View.GONE);
searchListView.setLayoutAnimation(null);
searchListView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
frameLayout.addView(searchListView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
searchListView.setOnItemClickListener((view, position) -> {
if (position < 0) {
return;
}
Object object = numberRow;
boolean add = true;
if (searchAdapter.searchWas) {
if (position < searchAdapter.searchResults.size()) {
object = searchAdapter.searchResults.get(position);
} else {
position -= searchAdapter.searchResults.size() + 1;
if (position >= 0 && position < searchAdapter.faqSearchResults.size()) {
object = searchAdapter.faqSearchResults.get(position);
}
}
} else {
if (!searchAdapter.recentSearches.isEmpty()) {
position--;
}
if (position >= 0 && position < searchAdapter.recentSearches.size()) {
object = searchAdapter.recentSearches.get(position);
} else {
position -= searchAdapter.recentSearches.size() + 1;
if (position >= 0 && position < searchAdapter.faqSearchArray.size()) {
object = searchAdapter.faqSearchArray.get(position);
add = false;
}
}
}
if (object instanceof SearchAdapter.SearchResult) {
SearchAdapter.SearchResult result = (SearchAdapter.SearchResult) object;
result.open();
} else if (object instanceof MessagesController.FaqSearchResult) {
MessagesController.FaqSearchResult result = (MessagesController.FaqSearchResult) object;
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.openArticle, searchAdapter.faqWebPage, result.url);
}
if (add && object != null) {
searchAdapter.addRecent(object);
}
});
searchListView.setOnItemLongClickListener((view, position) -> {
if (searchAdapter.isSearchWas() || searchAdapter.recentSearches.isEmpty()) {
return false;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("ClearSearch", R.string.ClearSearch));
builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton).toUpperCase(), (dialogInterface, i) -> searchAdapter.clearRecent());
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
return true;
});
searchListView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
}
}
});
searchListView.setAnimateEmptyView(true, 1);
emptyView = new StickerEmptyView(context, null, 1);
emptyView.setAnimateLayoutChange(true);
emptyView.subtitle.setVisibility(View.GONE);
emptyView.setVisibility(View.GONE);
frameLayout.addView(emptyView);
searchAdapter.loadFaqWebPage();
}
if (banFromGroup != 0) {
TLRPC.Chat chat = getMessagesController().getChat(banFromGroup);
if (currentChannelParticipant == null) {
TLRPC.TL_channels_getParticipant req = new TLRPC.TL_channels_getParticipant();
req.channel = MessagesController.getInputChannel(chat);
req.participant = getMessagesController().getInputPeer(userId);
getConnectionsManager().sendRequest(req, (response, error) -> {
if (response != null) {
AndroidUtilities.runOnUIThread(() -> currentChannelParticipant = ((TLRPC.TL_channels_channelParticipant) response).participant);
}
});
}
FrameLayout frameLayout1 = new FrameLayout(context) {
@Override
protected void onDraw(Canvas canvas) {
int bottom = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), bottom);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0, bottom, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
frameLayout1.setWillNotDraw(false);
frameLayout.addView(frameLayout1, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 51, Gravity.LEFT | Gravity.BOTTOM));
frameLayout1.setOnClickListener(v -> {
ChatRightsEditActivity fragment = new ChatRightsEditActivity(userId, banFromGroup, null, chat.default_banned_rights, currentChannelParticipant != null ? currentChannelParticipant.banned_rights : null, "", ChatRightsEditActivity.TYPE_BANNED, true, false);
fragment.setDelegate(new ChatRightsEditActivity.ChatRightsEditActivityDelegate() {
@Override
public void didSetRights(int rights, TLRPC.TL_chatAdminRights rightsAdmin, TLRPC.TL_chatBannedRights rightsBanned, String rank) {
removeSelfFromStack();
}
@Override
public void didChangeOwner(TLRPC.User user) {
undoView.showWithAction(-chatId, currentChat.megagroup ? UndoView.ACTION_OWNER_TRANSFERED_GROUP : UndoView.ACTION_OWNER_TRANSFERED_CHANNEL, user);
}
});
presentFragment(fragment);
});
TextView textView = new TextView(context);
textView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
textView.setGravity(Gravity.CENTER);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
textView.setText(LocaleController.getString("BanFromTheGroup", R.string.BanFromTheGroup));
frameLayout1.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 1, 0, 0));
listView.setPadding(0, AndroidUtilities.dp(88), 0, AndroidUtilities.dp(48));
listView.setBottomGlowOffset(AndroidUtilities.dp(48));
} else {
listView.setPadding(0, AndroidUtilities.dp(88), 0, 0);
}
topView = new TopView(context);
topView.setBackgroundColor(Theme.getColor(Theme.key_avatar_backgroundActionBarBlue));
frameLayout.addView(topView);
avatarContainer = new FrameLayout(context);
avatarContainer2 = new FrameLayout(context) {
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (transitionOnlineText != null) {
canvas.save();
canvas.translate(onlineTextView[0].getX(), onlineTextView[0].getY());
canvas.saveLayerAlpha(0, 0, transitionOnlineText.getMeasuredWidth(), transitionOnlineText.getMeasuredHeight(), (int) (255 * (1f - animationProgress)), Canvas.ALL_SAVE_FLAG);
transitionOnlineText.draw(canvas);
canvas.restore();
canvas.restore();
invalidate();
}
}
};
AndroidUtilities.updateViewVisibilityAnimated(avatarContainer2, true, 1f, false);
frameLayout.addView(avatarContainer2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.START, 0, 0, 0, 0));
avatarContainer.setPivotX(0);
avatarContainer.setPivotY(0);
avatarContainer2.addView(avatarContainer, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.LEFT, 64, 0, 0, 0));
avatarImage = new AvatarImageView(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (getImageReceiver().hasNotThumb()) {
info.setText(LocaleController.getString("AccDescrProfilePicture", R.string.AccDescrProfilePicture));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, LocaleController.getString("Open", R.string.Open)));
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, LocaleController.getString("AccDescrOpenInPhotoViewer", R.string.AccDescrOpenInPhotoViewer)));
}
} else {
info.setVisibleToUser(false);
}
}
};
avatarImage.getImageReceiver().setAllowDecodeSingleFrame(true);
avatarImage.setRoundRadius(AndroidUtilities.dp(21));
avatarImage.setPivotX(0);
avatarImage.setPivotY(0);
avatarContainer.addView(avatarImage, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
avatarImage.setOnClickListener(v -> {
if (avatarBig != null) {
return;
}
if (!AndroidUtilities.isTablet() && !isInLandscapeMode && avatarImage.getImageReceiver().hasNotThumb()) {
openingAvatar = true;
allowPullingDown = true;
View child = null;
for (int i = 0; i < listView.getChildCount(); i++) {
if (listView.getChildAdapterPosition(listView.getChildAt(i)) == 0) {
child = listView.getChildAt(i);
break;
}
}
if (child != null) {
RecyclerView.ViewHolder holder = listView.findContainingViewHolder(child);
if (holder != null) {
Integer offset = positionToOffset.get(holder.getAdapterPosition());
if (offset != null) {
listView.smoothScrollBy(0, -(offset + (listView.getPaddingTop() - child.getTop() - actionBar.getMeasuredHeight())), CubicBezierInterpolator.EASE_OUT_QUINT);
return;
}
}
}
}
openAvatar();
});
avatarImage.setOnLongClickListener(v -> {
if (avatarBig != null) {
return false;
}
openAvatar();
return false;
});
avatarProgressView = new RadialProgressView(context) {
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
{
paint.setColor(0x55000000);
}
@Override
protected void onDraw(Canvas canvas) {
if (avatarImage != null && avatarImage.getImageReceiver().hasNotThumb()) {
paint.setAlpha((int) (0x55 * avatarImage.getImageReceiver().getCurrentAlpha()));
canvas.drawCircle(getMeasuredWidth() / 2.0f, getMeasuredHeight() / 2.0f, getMeasuredWidth() / 2.0f, paint);
}
super.onDraw(canvas);
}
};
avatarProgressView.setSize(AndroidUtilities.dp(26));
avatarProgressView.setProgressColor(0xffffffff);
avatarProgressView.setNoProgress(false);
avatarContainer.addView(avatarProgressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
timeItem = new ImageView(context);
timeItem.setPadding(AndroidUtilities.dp(10), AndroidUtilities.dp(10), AndroidUtilities.dp(5), AndroidUtilities.dp(5));
timeItem.setScaleType(ImageView.ScaleType.CENTER);
timeItem.setAlpha(0.0f);
timeItem.setImageDrawable(timerDrawable = new TimerDrawable(context));
frameLayout.addView(timeItem, LayoutHelper.createFrame(34, 34, Gravity.TOP | Gravity.LEFT));
updateTimeItem();
showAvatarProgress(false, false);
if (avatarsViewPager != null) {
avatarsViewPager.onDestroy();
}
overlaysView = new OverlaysView(context);
avatarsViewPager = new ProfileGalleryView(context, userId != 0 ? userId : -chatId, actionBar, listView, avatarImage, getClassGuid(), overlaysView);
avatarsViewPager.setChatInfo(chatInfo);
avatarContainer2.addView(avatarsViewPager);
avatarContainer2.addView(overlaysView);
avatarImage.setAvatarsViewPager(avatarsViewPager);
avatarsViewPagerIndicatorView = new PagerIndicatorView(context);
avatarContainer2.addView(avatarsViewPagerIndicatorView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
frameLayout.addView(actionBar);
for (int a = 0; a < nameTextView.length; a++) {
if (playProfileAnimation == 0 && a == 0) {
continue;
}
nameTextView[a] = new SimpleTextView(context);
if (a == 1) {
nameTextView[a].setTextColor(Theme.getColor(Theme.key_profile_title));
} else {
nameTextView[a].setTextColor(Theme.getColor(Theme.key_actionBarDefaultTitle));
}
nameTextView[a].setTextSize(18);
nameTextView[a].setGravity(Gravity.LEFT);
nameTextView[a].setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
nameTextView[a].setLeftDrawableTopPadding(-AndroidUtilities.dp(1.3f));
nameTextView[a].setPivotX(0);
nameTextView[a].setPivotY(0);
nameTextView[a].setAlpha(a == 0 ? 0.0f : 1.0f);
if (a == 1) {
nameTextView[a].setScrollNonFitText(true);
nameTextView[a].setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
}
int rightMargin = a == 0 ? (48 + ((callItemVisible && userId != 0) ? 48 : 0)) : 0;
avatarContainer2.addView(nameTextView[a], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, rightMargin, 0));
}
for (int a = 0; a < onlineTextView.length; a++) {
onlineTextView[a] = new SimpleTextView(context);
onlineTextView[a].setTextColor(Theme.getColor(Theme.key_avatar_subtitleInProfileBlue));
onlineTextView[a].setTextSize(14);
onlineTextView[a].setGravity(Gravity.LEFT);
onlineTextView[a].setAlpha(a == 0 || a == 2 ? 0.0f : 1.0f);
if (a > 0) {
onlineTextView[a].setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
}
avatarContainer2.addView(onlineTextView[a], LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, a == 0 ? 48 : 8, 0));
}
mediaCounterTextView = new AudioPlayerAlert.ClippingTextViewSwitcher(context) {
@Override
protected TextView createTextView() {
TextView textView = new TextView(context);
textView.setTextColor(Theme.getColor(Theme.key_player_actionBarSubtitle));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
textView.setSingleLine(true);
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setGravity(Gravity.LEFT);
return textView;
}
};
mediaCounterTextView.setAlpha(0.0f);
avatarContainer2.addView(mediaCounterTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 8, 0));
updateProfileData();
writeButton = new RLottieImageView(context);
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground)), 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
writeButton.setBackground(combinedDrawable);
if (userId != 0) {
if (imageUpdater != null) {
cameraDrawable = new RLottieDrawable(R.raw.camera_outline, "" + R.raw.camera_outline, AndroidUtilities.dp(56), AndroidUtilities.dp(56), false, null);
writeButton.setAnimation(cameraDrawable);
writeButton.setContentDescription(LocaleController.getString("AccDescrChangeProfilePicture", R.string.AccDescrChangeProfilePicture));
writeButton.setPadding(AndroidUtilities.dp(2), 0, 0, AndroidUtilities.dp(2));
} else {
writeButton.setImageResource(R.drawable.profile_newmsg);
writeButton.setContentDescription(LocaleController.getString("AccDescrOpenChat", R.string.AccDescrOpenChat));
}
} else {
writeButton.setImageResource(R.drawable.profile_discuss);
writeButton.setContentDescription(LocaleController.getString("ViewDiscussion", R.string.ViewDiscussion));
}
writeButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_actionIcon), PorterDuff.Mode.MULTIPLY));
writeButton.setScaleType(ImageView.ScaleType.CENTER);
frameLayout.addView(writeButton, LayoutHelper.createFrame(60, 60, Gravity.RIGHT | Gravity.TOP, 0, 0, 16, 0));
writeButton.setOnClickListener(v -> {
if (writeButton.getTag() != null) {
return;
}
onWriteButtonClick();
});
needLayout(false);
if (scrollTo != -1) {
if (writeButtonTag != null) {
writeButton.setTag(0);
writeButton.setScaleX(0.2f);
writeButton.setScaleY(0.2f);
writeButton.setAlpha(0.0f);
}
}
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
}
if (openingAvatar && newState != RecyclerView.SCROLL_STATE_SETTLING) {
openingAvatar = false;
}
if (searchItem != null) {
scrolling = newState != RecyclerView.SCROLL_STATE_IDLE;
searchItem.setEnabled(!scrolling && !isPulledDown);
}
sharedMediaLayout.scrollingByUser = listView.scrollingByUser;
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (fwdRestrictedHint != null) {
fwdRestrictedHint.hide();
}
checkListViewScroll();
if (participantsMap != null && !usersEndReached && layoutManager.findLastVisibleItemPosition() > membersEndRow - 8) {
getChannelParticipants(false);
}
sharedMediaLayout.setPinnedToTop(sharedMediaLayout.getY() == 0);
}
});
undoView = new UndoView(context);
frameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
expandAnimator = ValueAnimator.ofFloat(0f, 1f);
expandAnimator.addUpdateListener(anim -> {
final int newTop = ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0);
final float value = AndroidUtilities.lerp(expandAnimatorValues, currentExpanAnimatorFracture = anim.getAnimatedFraction());
avatarContainer.setScaleX(avatarScale);
avatarContainer.setScaleY(avatarScale);
avatarContainer.setTranslationX(AndroidUtilities.lerp(avatarX, 0f, value));
avatarContainer.setTranslationY(AndroidUtilities.lerp((float) Math.ceil(avatarY), 0f, value));
avatarImage.setRoundRadius((int) AndroidUtilities.lerp(AndroidUtilities.dpf2(21f), 0f, value));
if (searchItem != null) {
searchItem.setAlpha(1.0f - value);
searchItem.setScaleY(1.0f - value);
searchItem.setVisibility(View.VISIBLE);
searchItem.setClickable(searchItem.getAlpha() > .5f);
if (qrItem != null) {
float translation = AndroidUtilities.dp(48) * value;
// if (searchItem.getVisibility() == View.VISIBLE)
// translation += AndroidUtilities.dp(48);
qrItem.setTranslationX(translation);
avatarsViewPagerIndicatorView.setTranslationX(translation - AndroidUtilities.dp(48));
}
}
if (extraHeight > AndroidUtilities.dp(88f) && expandProgress < 0.33f) {
refreshNameAndOnlineXY();
}
if (scamDrawable != null) {
scamDrawable.setColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_avatar_subtitleInProfileBlue), Color.argb(179, 255, 255, 255), value));
}
if (lockIconDrawable != null) {
lockIconDrawable.setColorFilter(ColorUtils.blendARGB(Theme.getColor(Theme.key_chat_lockIcon), Color.WHITE, value), PorterDuff.Mode.MULTIPLY);
}
if (verifiedCrossfadeDrawable != null) {
verifiedCrossfadeDrawable.setProgress(value);
}
final float k = AndroidUtilities.dpf2(8f);
final float nameTextViewXEnd = AndroidUtilities.dpf2(16f) - nameTextView[1].getLeft();
final float nameTextViewYEnd = newTop + extraHeight - AndroidUtilities.dpf2(38f) - nameTextView[1].getBottom();
final float nameTextViewCx = k + nameX + (nameTextViewXEnd - nameX) / 2f;
final float nameTextViewCy = k + nameY + (nameTextViewYEnd - nameY) / 2f;
final float nameTextViewX = (1 - value) * (1 - value) * nameX + 2 * (1 - value) * value * nameTextViewCx + value * value * nameTextViewXEnd;
final float nameTextViewY = (1 - value) * (1 - value) * nameY + 2 * (1 - value) * value * nameTextViewCy + value * value * nameTextViewYEnd;
final float onlineTextViewXEnd = AndroidUtilities.dpf2(16f) - onlineTextView[1].getLeft();
final float onlineTextViewYEnd = newTop + extraHeight - AndroidUtilities.dpf2(18f) - onlineTextView[1].getBottom();
final float onlineTextViewCx = k + onlineX + (onlineTextViewXEnd - onlineX) / 2f;
final float onlineTextViewCy = k + onlineY + (onlineTextViewYEnd - onlineY) / 2f;
final float onlineTextViewX = (1 - value) * (1 - value) * onlineX + 2 * (1 - value) * value * onlineTextViewCx + value * value * onlineTextViewXEnd;
final float onlineTextViewY = (1 - value) * (1 - value) * onlineY + 2 * (1 - value) * value * onlineTextViewCy + value * value * onlineTextViewYEnd;
nameTextView[1].setTranslationX(nameTextViewX);
nameTextView[1].setTranslationY(nameTextViewY);
onlineTextView[1].setTranslationX(onlineTextViewX);
onlineTextView[1].setTranslationY(onlineTextViewY);
mediaCounterTextView.setTranslationX(onlineTextViewX);
mediaCounterTextView.setTranslationY(onlineTextViewY);
final Object onlineTextViewTag = onlineTextView[1].getTag();
int statusColor;
if (onlineTextViewTag instanceof String) {
statusColor = Theme.getColor((String) onlineTextViewTag);
} else {
statusColor = Theme.getColor(Theme.key_avatar_subtitleInProfileBlue);
}
onlineTextView[1].setTextColor(ColorUtils.blendARGB(statusColor, Color.argb(179, 255, 255, 255), value));
if (extraHeight > AndroidUtilities.dp(88f)) {
nameTextView[1].setPivotY(AndroidUtilities.lerp(0, nameTextView[1].getMeasuredHeight(), value));
nameTextView[1].setScaleX(AndroidUtilities.lerp(1.12f, 1.67f, value));
nameTextView[1].setScaleY(AndroidUtilities.lerp(1.12f, 1.67f, value));
}
needLayoutText(Math.min(1f, extraHeight / AndroidUtilities.dp(88f)));
nameTextView[1].setTextColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_profile_title), Color.WHITE, value));
actionBar.setItemsColor(ColorUtils.blendARGB(Theme.getColor(Theme.key_actionBarDefaultIcon), Color.WHITE, value), false);
avatarImage.setForegroundAlpha(value);
final FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) avatarContainer.getLayoutParams();
params.width = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(42f), listView.getMeasuredWidth() / avatarScale, value);
params.height = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(42f), (extraHeight + newTop) / avatarScale, value);
params.leftMargin = (int) AndroidUtilities.lerp(AndroidUtilities.dpf2(64f), 0f, value);
avatarContainer.requestLayout();
});
expandAnimator.setInterpolator(CubicBezierInterpolator.EASE_BOTH);
expandAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
actionBar.setItemsBackgroundColor(isPulledDown ? Theme.ACTION_BAR_WHITE_SELECTOR_COLOR : Theme.getColor(Theme.key_avatar_actionBarSelectorBlue), false);
avatarImage.clearForeground();
doNotSetForeground = false;
}
});
updateRowsIds();
updateSelectedMediaTabText();
fwdRestrictedHint = new HintView(getParentActivity(), 9);
fwdRestrictedHint.setAlpha(0);
frameLayout.addView(fwdRestrictedHint, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 12, 0, 12, 0));
sharedMediaLayout.setForwardRestrictedHint(fwdRestrictedHint);
ViewGroup decorView;
if (Build.VERSION.SDK_INT >= 21) {
decorView = (ViewGroup) getParentActivity().getWindow().getDecorView();
} else {
decorView = frameLayout;
}
pinchToZoomHelper = new PinchToZoomHelper(decorView, frameLayout) {
Paint statusBarPaint;
@Override
protected void invalidateViews() {
super.invalidateViews();
fragmentView.invalidate();
for (int i = 0; i < avatarsViewPager.getChildCount(); i++) {
avatarsViewPager.getChildAt(i).invalidate();
}
if (writeButton != null) {
writeButton.invalidate();
}
}
@Override
protected void drawOverlays(Canvas canvas, float alpha, float parentOffsetX, float parentOffsetY, float clipTop, float clipBottom) {
if (alpha > 0) {
AndroidUtilities.rectTmp.set(0, 0, avatarsViewPager.getMeasuredWidth(), avatarsViewPager.getMeasuredHeight() + AndroidUtilities.dp(30));
canvas.saveLayerAlpha(AndroidUtilities.rectTmp, (int) (255 * alpha), Canvas.ALL_SAVE_FLAG);
avatarContainer2.draw(canvas);
if (actionBar.getOccupyStatusBar()) {
if (statusBarPaint == null) {
statusBarPaint = new Paint();
statusBarPaint.setColor(ColorUtils.setAlphaComponent(Color.BLACK, (int) (255 * 0.2f)));
}
canvas.drawRect(actionBar.getX(), actionBar.getY(), actionBar.getX() + actionBar.getMeasuredWidth(), actionBar.getY() + AndroidUtilities.statusBarHeight, statusBarPaint);
}
canvas.save();
canvas.translate(actionBar.getX(), actionBar.getY());
actionBar.draw(canvas);
canvas.restore();
if (writeButton != null && writeButton.getVisibility() == View.VISIBLE && writeButton.getAlpha() > 0) {
canvas.save();
float s = 0.5f + 0.5f * alpha;
canvas.scale(s, s, writeButton.getX() + writeButton.getMeasuredWidth() / 2f, writeButton.getY() + writeButton.getMeasuredHeight() / 2f);
canvas.translate(writeButton.getX(), writeButton.getY());
writeButton.draw(canvas);
canvas.restore();
}
canvas.restore();
}
}
@Override
protected boolean zoomEnabled(View child, ImageReceiver receiver) {
if (!super.zoomEnabled(child, receiver)) {
return false;
}
return listView.getScrollState() != RecyclerView.SCROLL_STATE_DRAGGING;
}
};
pinchToZoomHelper.setCallback(new PinchToZoomHelper.Callback() {
@Override
public void onZoomStarted(MessageObject messageObject) {
listView.cancelClickRunnables(true);
if (sharedMediaLayout != null && sharedMediaLayout.getCurrentListView() != null) {
sharedMediaLayout.getCurrentListView().cancelClickRunnables(true);
}
Bitmap bitmap = pinchToZoomHelper.getPhotoImage() == null ? null : pinchToZoomHelper.getPhotoImage().getBitmap();
if (bitmap != null) {
topView.setBackgroundColor(ColorUtils.blendARGB(AndroidUtilities.calcBitmapColor(bitmap), Theme.getColor(Theme.key_windowBackgroundWhite), 0.1f));
}
}
});
avatarsViewPager.setPinchToZoomHelper(pinchToZoomHelper);
scrimPaint.setAlpha(0);
actionBarBackgroundPaint.setColor(Theme.getColor(Theme.key_listSelector));
return fragmentView;
}
Aggregations