update to 9.5.0

This commit is contained in:
xaxtix 2023-03-08 11:27:18 +04:00
parent 1ac56c671e
commit d374d4875d
962 changed files with 7047 additions and 5882 deletions

View file

@ -17,7 +17,7 @@ configurations.all {
}
dependencies {
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.core:core:1.9.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'

View file

@ -196,19 +196,19 @@ void TL_config::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &
notify_default_delay_ms = stream->readInt32(&error);
push_chat_period_ms = stream->readInt32(&error);
push_chat_limit = stream->readInt32(&error);
saved_gifs_limit = stream->readInt32(&error);
// saved_gifs_limit = stream->readInt32(&error);
edit_time_limit = stream->readInt32(&error);
revoke_time_limit = stream->readInt32(&error);
revoke_pm_time_limit = stream->readInt32(&error);
rating_e_decay = stream->readInt32(&error);
stickers_recent_limit = stream->readInt32(&error);
stickers_faved_limit = stream->readInt32(&error);
// stickers_faved_limit = stream->readInt32(&error);
channels_read_media_period = stream->readInt32(&error);
if ((flags & 1) != 0) {
tmp_sessions = stream->readInt32(&error);
}
pinned_dialogs_count_max = stream->readInt32(&error);
pinned_infolder_count_max = stream->readInt32(&error);
// pinned_dialogs_count_max = stream->readInt32(&error);
// pinned_infolder_count_max = stream->readInt32(&error);
call_receive_timeout_ms = stream->readInt32(&error);
call_ring_timeout_ms = stream->readInt32(&error);
call_connect_timeout_ms = stream->readInt32(&error);
@ -244,6 +244,9 @@ void TL_config::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &
if ((flags & 32768) != 0) {
reactions_default = std::unique_ptr<Reaction>(Reaction::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
}
if ((flags & 65536) != 0) {
autologin_token = stream->readString(&error);
}
}
void TL_config::serializeToStream(NativeByteBuffer *stream) {
@ -271,19 +274,19 @@ void TL_config::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(notify_default_delay_ms);
stream->writeInt32(push_chat_period_ms);
stream->writeInt32(push_chat_limit);
stream->writeInt32(saved_gifs_limit);
// stream->writeInt32(saved_gifs_limit);
stream->writeInt32(edit_time_limit);
stream->writeInt32(revoke_time_limit);
stream->writeInt32(revoke_pm_time_limit);
stream->writeInt32(rating_e_decay);
stream->writeInt32(stickers_recent_limit);
stream->writeInt32(stickers_faved_limit);
// stream->writeInt32(stickers_faved_limit);
stream->writeInt32(channels_read_media_period);
if ((flags & 1) != 0) {
stream->writeInt32(tmp_sessions);
}
stream->writeInt32(pinned_dialogs_count_max);
stream->writeInt32(pinned_infolder_count_max);
// stream->writeInt32(pinned_dialogs_count_max);
// stream->writeInt32(pinned_infolder_count_max);
stream->writeInt32(call_receive_timeout_ms);
stream->writeInt32(call_ring_timeout_ms);
stream->writeInt32(call_connect_timeout_ms);
@ -319,6 +322,9 @@ void TL_config::serializeToStream(NativeByteBuffer *stream) {
if ((flags & 32768) != 0 && reactions_default != nullptr) {
reactions_default->serializeToStream(stream);
}
if ((flags & 65536) != 0) {
stream->writeString(autologin_token);
}
}
TLObject *TL_help_getConfig::deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {

View file

@ -105,7 +105,7 @@ public:
class TL_config : public TLObject {
public:
static const uint32_t constructor = 0x232566ac;
static const uint32_t constructor = 0xcc1a241e;
int32_t flags;
int32_t date;
@ -125,17 +125,17 @@ public:
int32_t notify_default_delay_ms;
int32_t push_chat_period_ms;
int32_t push_chat_limit;
int32_t saved_gifs_limit;
// int32_t saved_gifs_limit;
int32_t edit_time_limit;
int32_t revoke_time_limit;
int32_t revoke_pm_time_limit;
int32_t rating_e_decay;
int32_t stickers_recent_limit;
int32_t stickers_faved_limit;
// int32_t stickers_faved_limit;
int32_t channels_read_media_period;
int32_t tmp_sessions;
int32_t pinned_dialogs_count_max;
int32_t pinned_infolder_count_max;
// int32_t pinned_dialogs_count_max;
// int32_t pinned_infolder_count_max;
int32_t call_receive_timeout_ms;
int32_t call_ring_timeout_ms;
int32_t call_connect_timeout_ms;
@ -153,6 +153,7 @@ public:
int32_t lang_pack_version;
int32_t base_lang_pack_version;
std::unique_ptr<Reaction> reactions_default;
std::string autologin_token;
static TL_config *TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error);
void readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error);

View file

@ -1770,6 +1770,7 @@ int32_t ConnectionsManager::sendRequestInternal(TLObject *object, onCompleteFunc
request->rpcRequest = wrapInLayer(object, getDatacenterWithId(datacenterId), request);
auto cancelledIterator = tokensToBeCancelled.find(request->requestToken);
if (cancelledIterator != tokensToBeCancelled.end()) {
if (LOGS_ENABLED) DEBUG_D("(3) request is cancelled before sending, token %d", request->requestToken);
tokensToBeCancelled.erase(cancelledIterator);
delete request;
return request->requestToken;
@ -1801,6 +1802,7 @@ int32_t ConnectionsManager::sendRequest(TLObject *object, onCompleteFunc onCompl
request->rpcRequest = wrapInLayer(object, getDatacenterWithId(datacenterId), request);
auto cancelledIterator = tokensToBeCancelled.find(request->requestToken);
if (cancelledIterator != tokensToBeCancelled.end()) {
if (LOGS_ENABLED) DEBUG_D("(1) request is cancelled before sending, token %d", requestToken);
tokensToBeCancelled.erase(cancelledIterator);
delete request;
}
@ -1847,6 +1849,7 @@ void ConnectionsManager::sendRequest(TLObject *object, onCompleteFunc onComplete
if (LOGS_ENABLED) DEBUG_D("send request wrapped %p - %s", request->rpcRequest.get(), typeid(*(request->rpcRequest.get())).name());
auto cancelledIterator = tokensToBeCancelled.find(request->requestToken);
if (cancelledIterator != tokensToBeCancelled.end()) {
if (LOGS_ENABLED) DEBUG_D("(2) request is cancelled before sending, token %d", requestToken);
tokensToBeCancelled.erase(cancelledIterator);
delete request;
return;
@ -1981,6 +1984,7 @@ bool ConnectionsManager::cancelRequestInternal(int32_t token, int64_t messageId,
}
if (token != 0 && connectionState == ConnectionStateWaitingForNetwork) {
if (LOGS_ENABLED) DEBUG_D("request is tried to be cancelled, but it does not even exist, token %d", token);
tokensToBeCancelled.insert(token);
}

View file

@ -726,6 +726,7 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeNati
bool isRtc = endpointObject.getBooleanField("isRtc");
if (isRtc) {
RtcServer rtcServer;
rtcServer.id = static_cast<uint8_t>(endpointObject.getIntField("reflectorId"));
rtcServer.host = tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("ipv4"));
rtcServer.port = static_cast<uint16_t>(endpointObject.getIntField("port"));
rtcServer.login = tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("username"));
@ -733,6 +734,16 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeNati
rtcServer.isTurn = endpointObject.getBooleanField("turn");
descriptor.rtcServers.push_back(std::move(rtcServer));
} else {
RtcServer rtcServer;
rtcServer.id = static_cast<uint8_t>(endpointObject.getIntField("reflectorId"));
rtcServer.host = tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("ipv4"));
rtcServer.port = static_cast<uint16_t>(endpointObject.getIntField("port"));
rtcServer.login = tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("username"));
rtcServer.password = tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("password"));
rtcServer.isTurn = true;
rtcServer.isTcp = endpointObject.getBooleanField("tcp");
descriptor.rtcServers.push_back(std::move(rtcServer));
Endpoint endpoint;
endpoint.endpointId = endpointObject.getLongField("id");
endpoint.host = EndpointHost{tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("ipv4")), tgvoip::jni::JavaStringToStdString(env, endpointObject.getStringField("ipv6"))};
@ -744,7 +755,7 @@ JNIEXPORT jlong JNICALL Java_org_telegram_messenger_voip_NativeInstance_makeNati
memcpy(endpoint.peerTag, peerTagBytes, 16);
env->ReleaseByteArrayElements(peerTag, peerTagBytes, JNI_ABORT);
}
descriptor.endpoints.push_back(std::move(endpoint));
descriptor.endpoints.push_back(std::move(endpoint));
}
}

View file

@ -1087,7 +1087,9 @@ public:
beginQualityTimer(0);
beginLogTimer(0);
NativeNetworkingImpl::State initialNetworkState;
initialNetworkState.isReadyToSendData = false;
onNetworkStateUpdated(initialNetworkState);
}
void beginQualityTimer(int delayMs) {

View file

@ -176,7 +176,7 @@ int32_t AudioTrackJni::StartPlayout() {
int32_t AudioTrackJni::StopPlayout() {
RTC_LOG(LS_INFO) << "StopPlayout";
RTC_DCHECK(thread_checker_.IsCurrent());
if (!initialized_ || !playing_) {
if (!initialized_ || !playing_ || j_audio_track_ == nullptr) {
return 0;
}
if (!j_audio_track_->StopPlayout()) {

View file

@ -109,6 +109,7 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
</activity-alias>
<activity-alias
@ -124,6 +125,7 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
</activity-alias>
<activity-alias
@ -139,6 +141,7 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
</activity-alias>
<activity-alias
@ -154,6 +157,7 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
</activity-alias>
<activity-alias
@ -169,6 +173,7 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
</activity-alias>
<activity-alias
@ -184,6 +189,7 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
</activity-alias>
<activity

View file

@ -13,10 +13,8 @@ chats_menuPhone=-1006632961
avatar_actionBarIconOrange=-8684677
chat_outViews=-1258291201
avatar_actionBarSelectorCyan=-8684677
chat_secretTimerBackground=1375731712
chat_outViaBotNameText=-1
profile_actionPressedBackground=-13924376
chat_inPreviewInstantSelectedText=-13464859
location_sendLocationBackground=-11492107
avatar_nameInMessageViolet=-8163354
chat_inAudioSelectedProgress=-2034434
@ -38,7 +36,6 @@ chats_menuPhoneCats=-1
chat_outPreviewLine=-1
chat_inViaBotNameText=-13464859
chat_outVoiceSeekbar=1895825407
chat_outFileIcon=-6113593
chats_menuTopShadowCats=2924287
chats_nameMessage_threeLines=-12434359
chat_inFileProgress=-1
@ -67,7 +64,6 @@ chat_topPanelLine=-364404226
chat_outInstantSelected=-1
chat_outSentCheck=-922746881
key_graySectionText=-8156525
chat_outFileSelectedIcon=-7883067
dialogButton=-13987604
actionBarDefaultSubtitle=-7630182
contextProgressInner2=-826024458
@ -107,16 +103,13 @@ chat_messagePanelSend=-12935426
windowBackgroundWhiteRedText2=-1817262
avatar_backgroundBlue=-11491866
chat_inSentClock=-5195068
chat_outLoaderPhoto=-6113080
chat_botSwitchToInlineText=-13464859
chats_nameMessageArchived=-7237231
dialogTextRed2=-1354403
chats_tabUnreadUnactiveBackground=-13655305
avatar_subtitleInProfileOrange=-16777216
chat_outSentCheckSelected=-1191182337
chat_inVenueInfoSelectedText=-7099204
dialogTextBlue2=-14772773
dialogTextBlue3=-14839830
dialogTextBlue4=-15625752
actionBarTabActiveText=-13590803
chat_topPanelMessage=-8354167
@ -206,7 +199,6 @@ wallpaperFileOffset=-1
chat_outBubbleShadow=868467
chat_outVenueNameText=-11822380
chat_outTextSelectionHighlight=1802747885
chats_menuCloudBackgroundCats=-12545584
chats_verifiedBackground=-12998152
chat_inTimeSelectedText=-7099204
chat_outFileBackgroundSelected=1351271669
@ -223,7 +215,6 @@ chat_outFileNameText=-1
picker_enabledButton=-14180619
avatar_nameInMessagePink=-3453050
windowBackgroundWhiteGrayText=-7629665
musicPicker_buttonBackground=-12212482
chat_serviceIcon=-1
avatar_actionBarSelectorViolet=-8684677
avatar_nameInMessageBlue=-13464859
@ -238,10 +229,8 @@ chat_inVenueInfoText=-6182221
chat_replyPanelIcons=-12086038
chat_outSentClockSelected=1895825407
featuredStickers_addedIcon=-13325569
musicPicker_checkbox=-12405250
chat_outFileBackground=1351271669
chat_attachSendBackground=-12608006
dialogBadgeBackground=-13852434
chat_outBubbleSelected=-13332255
avatar_backgroundInProfileBlue=-13330708
chat_lockIcon=-9211021
@ -253,7 +242,6 @@ chat_inFileInfoSelectedText=-7099204
chat_wallpaper=-2562829
chat_outMenuSelected=-1862270977
fastScrollActive=-12409618
chat_outLoaderPhotoSelected=-6113593
chat_muteIcon=1718842227
chat_selectedBackground=756261375
chat_recordedVoiceBackground=-12675093
@ -263,7 +251,6 @@ chat_addContact=-14775579
switchTrackChecked=-11884552
chat_inLoader=-12015626
chat_adminSelectedText=-6769974
chat_outPreviewInstantSelectedText=-1
avatar_actionBarIconBlue=-12433070
chat_outTimeText=-1056964609
chat_attachAudioText=-2209977
@ -277,16 +264,13 @@ chat_outReplyMediaMessageText=-1056964609
chat_textSelectBackground=1027252973
actionBarTabSelector=136982325
player_buttonActive=-13851650
chat_outLoaderPhotoIcon=-1
chat_attachFileText=-15423260
chat_outContactBackground=-1
sharedMedia_linkPlaceholder=-723724
windowBackgroundWhiteBlueText7=-12149279
chat_outLocationBackground=1352257013
windowBackgroundWhiteBlueText3=-13530406
windowBackgroundWhiteBlueText5=-12935951
windowBackgroundWhiteBlueText4=-12675352
chat_replyPanelMessage=-13355980
chat_inViewsSelected=-6373686
windowBackgroundWhiteLinkSelection=560114147
inappPlayerClose=-7563878
@ -304,7 +288,6 @@ chat_sentError=-65536
avatar_actionBarSelectorRed=-8684677
chat_inAudioDurationSelectedText=-7099204
chat_outAudioSeekbarSelected=1487394047
chat_outLoaderPhotoIconSelected=-1314571
avatar_actionBarIconGreen=-8291461
chat_outReplyMessageText=-1
chat_recordedVoiceDot=-833978

View file

@ -4,7 +4,6 @@ chat_inSentClockSelected=-7752511
chat_outViews=-259216707
chat_outViaBotNameText=-14514998
profile_actionPressedBackground=-1710619
chat_inPreviewInstantSelectedText=-12940081
avatar_nameInMessageViolet=-8360497
emptyListPlaceholder=-7565423
chats_nameMessage=-14843710
@ -19,7 +18,6 @@ chats_menuPhoneCats=-2626311
chat_outPreviewLine=-12343577
chat_inViaBotNameText=-13464881
chat_outVoiceSeekbar=-1113275169
chat_outFileIcon=-263935502
chat_adminText=-425612621
chats_nameMessage_threeLines=-14843711
chat_inFileProgress=-1
@ -36,7 +34,6 @@ chat_topPanelLine=-11949852
chat_outInstantSelected=-14770977
chat_outSentCheck=-14967834
key_graySectionText=-7762802
chat_outFileSelectedIcon=-12277262
dialogButton=-13200935
actionBarDefaultSubtitle=-2891282
chat_inContactPhoneText=-6182221
@ -53,12 +50,10 @@ chat_outAudioSelectedProgress=-7484939
chat_inInstant=-14707230
avatar_backgroundSaved=-10438409
chats_sentReadCheck=-15754010
chat_outLoaderPhoto=-263869966
chats_nameMessageArchived=-7237231
chat_outSentCheckSelected=-14968350
actionBarDefaultArchivedSelector=-10852240
dialogTextBlue2=-14510887
dialogTextBlue3=-15294488
dialogTextBlue4=-15294488
calls_callReceivedGreenIcon=-12475665
chat_inForwardedNameText=-16220470
@ -135,7 +130,6 @@ inappPlayerPlayPause=-12342549
chat_replyPanelIcons=-11951635
chat_outSentClockSelected=-260332598
chat_outFileBackground=-1295523081
dialogBadgeBackground=-13127439
chat_outBubbleSelected=-2690305
chat_inFileNameText=-15654091
chat_inInstantSelected=-14707230
@ -143,14 +137,12 @@ chat_outFileInfoText=-7953740
chat_outContactPhoneSelectedText=-9725764
chat_wallpaper=-11300655
chat_outMenuSelected=-7026959
chat_outLoaderPhotoSelected=-263935502
chat_selectedBackground=839350980
chats_actionMessage=-14843969
chat_addContact=-13789473
avatar_actionBarSelectorBlue=-12091735
switchTrackChecked=-11424793
chat_inLoader=-431707662
chat_outPreviewInstantSelectedText=-14514998
chat_outTimeText=-141776195
chat_attachAudioText=-2209977
chat_outBubble=-1641732
@ -160,10 +152,8 @@ chat_outReplyNameText=-14382642
chats_menuTopBackgroundCats=-10906430
chat_outReplyMediaMessageText=-7558467
actionBarTabSelector=-12554340
chat_outLoaderPhotoIcon=-263935502
chat_attachFileText=-15423260
chat_outContactBackground=-12277262
chat_outLocationBackground=-993533194
chat_inViewsSelected=-7752511
chat_outMediaIcon=-1
chat_outAudioCacheSeekbar=-1029190425
@ -172,7 +162,6 @@ chat_inPreviewInstantText=-14446113
chat_outLoaderSelected=-12277262
windowBackgroundWhiteGrayText2=-7565423
chat_outAudioSeekbarSelected=1196665821
chat_outLoaderPhotoIconSelected=-263935502
windowBackgroundWhiteGrayText6=-8683904
windowBackgroundWhiteGrayText3=-7565423
windowBackgroundWhiteGrayText4=-7565423

View file

@ -13,7 +13,6 @@ actionBarActionModeDefaultTop=-14536643
statisticChartHintLine=452984831
chats_menuPhone=-1816080163
chat_outViews=-7357217
chat_secretTimerBackground=-1239540194
avatar_actionBarSelectorCyan=-12758164
chat_outViaBotNameText=-7551233
chat_botKeyboardButtonText=-1
@ -21,7 +20,6 @@ profile_actionPressedBackground=-11756844
key_chat_messagePanelVoiceLock=-1
chat_secretChatStatusText=-8812137
switchTrack=-10652540
chat_inPreviewInstantSelectedText=-5648402
chat_attachAudioBackground=-626837
location_sendLocationBackground=-9919529
actionBarDefaultSubmenuBackground=-14075831
@ -43,7 +41,6 @@ player_time=-8549479
chat_outFileProgressSelected=-1
chat_outTimeSelectedText=-4268038
chat_inFileProgressSelected=-1
changephoneinfo_image=-12693922
chat_inAudioPerfomerText=-8812393
statisticChartBackZoomColor=-12145938
player_button=-1
@ -57,7 +54,6 @@ chat_inViaBotNameText=-8796932
chat_outVoiceSeekbar=-429551165
player_actionBarTitle=-1
dialogGrayLine=-15790062
chat_outFileIcon=-12689015
chats_nameMessage_threeLines=-1446156
chat_inFileProgress=-1
dialogIcon=-7627862
@ -91,7 +87,6 @@ files_folderIconBackground=-10637333
passport_authorizeBackgroundSelected=-11627561
chat_outReactionButtonBackground=-1
switchTrackBlueChecked=-8333825
player_seekBarBackground=1196577362
dialogShadowLine=335544320
groupcreate_onlineText=-10177041
profile_status=-9192457
@ -105,13 +100,10 @@ chat_outInstantSelected=-4268038
actionBarDefaultSubmenuSeparator=-14733761
chat_outSentCheck=-7878657
key_graySectionText=-8549479
player_placeholder=-10191983
chat_outFileSelectedIcon=-13925429
picker_disabledButton=-11047552
groupcreate_spanBackground=-13878194
dialogButton=-10177041
contextProgressInner1=1686212251
chat_inLoaderPhotoIconSelected=-1
actionBarDefaultSubtitle=2111566591
chat_inContactPhoneText=-8812393
chat_inlineResultIcon=-8796932
@ -150,19 +142,15 @@ groupcreate_cursor=-10177041
returnToCallBackground=-10639897
checkboxSquareUnchecked=-11245959
dialogCheckboxSquareDisabled=-12299422
player_actionBar=-14602949
chat_fieldOverlayText=-10177041
chat_messagePanelSend=-10177041
switchThumb=-12034697
windowBackgroundWhiteRedText2=-955034
passport_authorizeBackground=-12352582
chats_nameIcon=-1446156
chat_inSentClock=-10653824
key_chats_menuTopShadow=789516
avatar_nameInMessageRed=-21124
chat_outLoaderPhoto=-12623479
chat_botSwitchToInlineText=-8796932
dialogTextRed2=-1152913
chats_nameMessageArchived=-8549479
avatar_nameInMessageOrange=-13984
chats_pinnedIcon=-10982016
@ -173,8 +161,6 @@ chat_outSentCheckSelected=-4268038
dialogSearchHint=-8419182
chat_inVenueInfoSelectedText=-7490861
dialogTextBlue2=-10177041
avatar_backgroundGroupCreateSpanBlue=-13803892
dialogTextBlue3=-10177041
switchTrackBlueThumbChecked=-11632213
dialogTextBlue4=-10177041
chat_attachUnactiveTab=-9596506
@ -188,7 +174,6 @@ calls_callReceivedGreenIcon=-12001930
chats_pinnedOverlay=150994943
windowBackgroundWhiteInputField=-12035217
avatar_backgroundRed=-1545110
chat_emojiPanelIconSelector=-10177041
chat_emojiPanelBadgeBackground=-11291403
chat_inForwardedNameText=-8796932
chats_actionBackground=-10509346
@ -199,11 +184,9 @@ chat_linkSelectBackground=1516415459
windowBackgroundWhiteBlueText=-10177041
avatar_nameInMessageCyan=-10623523
chat_inLocationBackground=-13417903
statisticChartHighlightColor=-2030043137
radioBackground=-1635939431
profile_tabText=2027746559
contextProgressOuter1=-9914632
chat_inFileIcon=-14470078
avatar_backgroundActionBarPink=-14602949
dialogTextGray3=-8549479
dialogTextGray2=-8549479
@ -300,7 +283,6 @@ chat_outVenueNameText=-3019777
checkboxSquareBackground=-10177051
chat_mediaSentClock=-1291845633
files_folderIcon=-1
chats_menuCloudBackgroundCats=-11232035
switchTrackBlue=-10984850
chat_topPanelClose=1859974399
profile_adminIcon=-8549479
@ -346,7 +328,6 @@ chat_outFileBackground=-12095334
chats_name=-1446156
premiumStartSmallStarsColor=1904435967
switchTrackBlueSelector=431611386
dialogBadgeBackground=-10177041
chat_outBubbleSelected=-11829841
avatar_backgroundInProfileBlue=-11232035
chat_inFileNameText=-1
@ -358,11 +339,9 @@ groupcreate_checkboxCheck=-1
chat_outContactPhoneSelectedText=-4268038
chat_unreadMessagesStartBackground=-14339006
chat_inLoaderPhoto=-14404542
statisticChartCheckboxInactive=-6579301
chat_inFileInfoSelectedText=-7490861
chat_wallpaper=-15393241
chat_outMenuSelected=-541138950
chat_outLoaderPhotoSelected=-13208924
chat_muteIcon=1019012607
chat_selectedBackground=710909411
chat_inAudioDurationText=-8746857
@ -370,16 +349,13 @@ chat_secretTimeText=-3679765
groupcreate_sectionText=-8549479
actionBarDefaultSubmenuItem=-1
chats_actionMessage=-10178583
chat_inLoaderPhotoIcon=-1
chat_addContact=-8796932
avatar_actionBarSelectorBlue=518452735
switchTrackChecked=-10378281
player_placeholderBackground=-13615280
windowBackgroundWhiteHintText=-8549479
chat_inLoader=-10445358
chat_adminSelectedText=-7490861
groupcreate_spanText=-657931
chat_outPreviewInstantSelectedText=-4268038
player_actionBarSelector=-13483693
key_player_progressCachedBackground=-11245182
chat_outTimeText=-7357217
@ -402,16 +378,13 @@ chat_messagePanelText=-1
actionBarTabSelector=926307434
key_sheet_scrollUp=637534207
player_buttonActive=-10177041
chat_outLoaderPhotoIcon=-1
chat_outContactBackground=-9919529
sharedMedia_linkPlaceholder=-14207163
windowBackgroundWhiteBlueText7=-8796932
chat_outLocationBackground=-11175517
windowBackgroundWhiteBlueText3=-10177041
windowBackgroundWhiteBlueText2=-8796932
windowBackgroundWhiteBlueText5=-10177041
windowBackgroundWhiteBlueText4=-10177041
chat_replyPanelMessage=-7628894
chat_inViewsSelected=-7490861
windowBackgroundWhiteLinkSelection=862238205
player_background=-14734794
@ -440,8 +413,6 @@ avatar_actionBarSelectorRed=-12758164
chat_inAudioDurationSelectedText=-7490861
windowBackgroundWhiteGrayText2=1878130175
chat_outAudioSeekbarSelected=-9461802
chat_outLoaderPhotoIconSelected=-1
player_actionBarTop=-15063250
windowBackgroundWhiteGrayText8=-8549479
windowBackgroundWhiteGrayText5=-8549479
windowBackgroundWhiteGrayText6=-8549479
@ -454,7 +425,6 @@ chat_BlurAlpha=-520093696
chat_outReplyMessageText=-1
chat_recordedVoiceDot=-1221292
chat_messagePanelBackground=-14602949
chat_inLoaderPhotoSelected=-14925725
chat_inReactionButtonText=-1
chat_inVoiceSeekbarFill=-10177041
graySection=-15459033
@ -475,7 +445,6 @@ statisticChartActiveLine=855638015
chats_secretName=-9316522
chat_inMenu=2039722445
chat_recordVoiceCancel=-9192978
chat_inFileSelectedIcon=-15056797
chat_outReplyMediaMessageSelectedText=-1
chat_reportSpam=-1481631
chat_messageTextIn=-328966

View file

@ -14,10 +14,8 @@ chats_menuPhone=-1006632961
avatar_actionBarIconOrange=-8684677
chat_outViews=-3676417
avatar_actionBarSelectorCyan=-8684677
chat_secretTimerBackground=-12629421
chat_outViaBotNameText=-1
profile_actionPressedBackground=-13991200
chat_inPreviewInstantSelectedText=-15300134
location_sendLocationBackground=-11492107
avatar_nameInMessageViolet=-8163354
chat_inAudioSelectedProgress=-1
@ -39,7 +37,6 @@ chats_menuPhoneCats=-1
chat_outPreviewLine=-1
chat_inViaBotNameText=-13597734
chat_outVoiceSeekbar=-425339398
chat_outFileIcon=-6442814
chats_menuTopShadowCats=2924287
chats_nameMessage_threeLines=-12434359
chat_adminText=-7565679
@ -68,11 +65,9 @@ profile_status=-15034652
divider=-1644826
actionBarDefaultIcon=-12562858
chat_topPanelLine=-364404226
chat_botProgress=-13290187
chat_outInstantSelected=-1
chat_outSentCheck=-167772161
key_graySectionText=-8091766
chat_outFileSelectedIcon=-8479811
dialogButton=-13987604
actionBarDefaultSubtitle=-7565679
contextProgressInner2=-826024458
@ -114,16 +109,13 @@ chats_sentReadCheck=-15033105
windowBackgroundWhiteRedText2=-1817262
avatar_backgroundBlue=-11491866
chat_inSentClock=-5195068
chat_outLoaderPhoto=-6442557
chat_botSwitchToInlineText=-13464859
chats_nameMessageArchived=-7237231
dialogTextRed2=-1354403
chats_tabUnreadUnactiveBackground=-13655305
avatar_subtitleInProfileOrange=-16777216
chat_outSentCheckSelected=-167772161
chat_inVenueInfoSelectedText=-7565679
dialogTextBlue2=-14772773
dialogTextBlue3=-14839830
dialogTextBlue4=-15625752
actionBarTabActiveText=-15755027
chat_topPanelMessage=-8419703
@ -136,7 +128,6 @@ chat_emojiPanelBadgeBackground=-12081165
chat_inForwardedNameText=-13597734
chats_sentError=-65536
groupcreate_checkbox=-11415476
chat_messagePanelVideoFrame=-12800521
chats_actionBackground=-11427096
chat_outContactNameText=-1
chat_TextSelectionCursor=-10237697
@ -224,7 +215,6 @@ wallpaperFileOffset=-1
chat_outBubbleShadow=604012
chat_outVenueNameText=-11822380
chat_outTextSelectionHighlight=-1770862081
chats_menuCloudBackgroundCats=-12545584
chats_verifiedBackground=-11358728
chat_inTimeSelectedText=-7565679
chat_outFileBackgroundSelected=8369127
@ -242,7 +232,6 @@ chat_outFileNameText=-1
picker_enabledButton=-14180619
avatar_nameInMessagePink=-3453050
windowBackgroundWhiteGrayText=-7565679
musicPicker_buttonBackground=-12212482
chat_serviceIcon=-13615543
avatar_actionBarSelectorViolet=-8684677
avatar_nameInMessageBlue=-14317866
@ -257,10 +246,8 @@ chat_inVenueInfoText=-7565679
chat_replyPanelIcons=-12086038
chat_outSentClockSelected=1895825407
featuredStickers_addedIcon=-13457929
musicPicker_checkbox=-12405250
chat_outFileBackground=8369127
chat_attachSendBackground=-12608006
dialogBadgeBackground=-13852434
chat_outBubbleSelected=-12418863
avatar_backgroundInProfileBlue=-13330708
chat_lockIcon=-13816531
@ -274,7 +261,6 @@ chat_inFileInfoSelectedText=-7565679
chat_wallpaper=-1
chat_outMenuSelected=-6500865
fastScrollActive=-12409618
chat_outLoaderPhotoSelected=-6442814
chat_muteIcon=1718842227
chat_selectedBackground=134217728
chat_recordedVoiceBackground=-11689237
@ -286,7 +272,6 @@ chat_addContact=-14775579
switchTrackChecked=-12803082
chat_inLoader=-12015626
chat_adminSelectedText=-7565679
chat_outPreviewInstantSelectedText=-1
avatar_actionBarIconBlue=-12433070
chat_outTimeText=-3676417
chat_attachAudioText=-2209977
@ -300,16 +285,13 @@ chat_outReplyMediaMessageText=-3676417
chat_textSelectBackground=1668989165
actionBarTabSelector=136982325
player_buttonActive=-13851650
chat_outLoaderPhotoIcon=-1
chat_attachFileText=-15423260
chat_outContactBackground=-1
sharedMedia_linkPlaceholder=-723724
windowBackgroundWhiteBlueText7=-12149279
chat_outLocationBackground=9354985
windowBackgroundWhiteBlueText3=-13530406
windowBackgroundWhiteBlueText5=-12935951
windowBackgroundWhiteBlueText4=-12675352
chat_replyPanelMessage=-13355980
chat_inViewsSelected=-258105181
windowBackgroundWhiteLinkSelection=560114147
inappPlayerClose=-7563878
@ -330,7 +312,6 @@ chat_sentError=-65536
avatar_actionBarSelectorRed=-8684677
chat_inAudioDurationSelectedText=-7565679
chat_outAudioSeekbarSelected=1688061683
chat_outLoaderPhotoIconSelected=-1446156
chat_inTimeText=-7105127
avatar_actionBarIconGreen=-8291461
chat_outBubbleGradient=-10701088
@ -353,7 +334,6 @@ chat_outMenu=-6500865
statisticChartActiveLine=335544320
chats_secretName=-16734706
chat_outReplyMediaMessageSelectedText=-3676417
chat_inFileSelectedIcon=-8543035
chat_reportSpam=-704436
avatar_subtitleInProfileCyan=-16777216
chat_serviceText=-13092808

View file

@ -12,7 +12,6 @@ actionBarActionModeDefaultTop=-14277082
statisticChartHintLine=452984831
chats_menuPhone=-1815557944
chat_outViews=-7357217
chat_secretTimerBackground=-1239540194
avatar_actionBarSelectorCyan=-12758164
chat_outViaBotNameText=-5448193
chat_botKeyboardButtonText=-1
@ -21,7 +20,6 @@ key_chat_messagePanelVoiceLock=-1
chat_secretChatStatusText=1862270975
switchTrack=-10461088
chat_messagePanelVoicePressed=-1
chat_inPreviewInstantSelectedText=-5648402
chat_attachAudioBackground=-626837
location_sendLocationBackground=-9919529
actionBarDefaultSubmenuBackground=-14145495
@ -43,7 +41,6 @@ player_time=-8553091
chat_outFileProgressSelected=-1
chat_outTimeSelectedText=-7023626
chat_inFileProgressSelected=-1
changephoneinfo_image=-11184811
chat_inAudioPerfomerText=-8749955
statisticChartBackZoomColor=-12145938
player_button=-1
@ -58,7 +55,6 @@ chat_inViaBotNameText=-8796932
chat_outVoiceSeekbar=-10245406
player_actionBarTitle=-1
dialogGrayLine=-12040120
chat_outFileIcon=-12689015
chats_nameMessage_threeLines=-1315861
chat_adminText=-8552575
chat_inFileProgress=-1
@ -94,7 +90,6 @@ chat_messagePanelVoiceBackground=-12284980
passport_authorizeBackgroundSelected=-11627561
switchTrackBlueChecked=-8924673
sharedMedia_linkPlaceholderText=-9474192
player_seekBarBackground=1196577362
dialogShadowLine=335544320
groupcreate_onlineText=-10177041
profile_status=-9846276
@ -108,13 +103,10 @@ chat_outInstantSelected=-1
actionBarDefaultSubmenuSeparator=-14803425
chat_outSentCheck=-506859265
key_graySectionText=-8158332
player_placeholder=-10197916
chat_outFileSelectedIcon=-13925429
picker_disabledButton=-11047552
groupcreate_spanBackground=-13816531
dialogButton=-10177041
contextProgressInner1=1526726655
chat_inLoaderPhotoIconSelected=-1
actionBarDefaultSubtitle=1945301746
chat_inContactPhoneText=-8486783
chat_inlineResultIcon=-8796932
@ -157,7 +149,6 @@ avatar_background2Saved=-15038233
returnToCallBackground=-10639897
checkboxSquareUnchecked=-11245959
dialogCheckboxSquareDisabled=-12040120
player_actionBar=-14671840
chat_fieldOverlayText=-10177041
chat_messagePanelVoiceDuration=-1
chat_messagePanelSend=-11752972
@ -165,13 +156,10 @@ chats_sentReadCheck=-12145165
switchThumb=-12034697
windowBackgroundWhiteRedText2=-955034
passport_authorizeBackground=-12352582
chats_nameIcon=-1250068
chat_inSentClock=-11050909
key_chats_menuTopShadow=789516
avatar_nameInMessageRed=-21124
chat_outLoaderPhoto=-12623479
chat_botSwitchToInlineText=-8796932
dialogTextRed2=-1152913
chats_nameMessageArchived=-8553091
avatar_nameInMessageOrange=-13984
chats_pinnedIcon=-10197916
@ -183,8 +171,6 @@ dialogSearchHint=-8421505
chat_inVenueInfoSelectedText=-7490861
dialogTextBlue2=-10177041
actionBarDefaultArchivedSelector=-12698049
avatar_backgroundGroupCreateSpanBlue=-12829636
dialogTextBlue3=-10177041
switchTrackBlueThumbChecked=-13794621
dialogTextBlue4=-10177041
chat_attachUnactiveTab=-9596506
@ -200,7 +186,6 @@ chats_pinnedOverlay=201326591
windowBackgroundWhiteInputField=-11513776
avatar_backgroundRed=-2326437
avatar_background2Red=-2863816
chat_emojiPanelIconSelector=-10177041
chat_emojiPanelBadgeBackground=-11291403
chat_inForwardedNameText=-8930052
chats_actionBackground=-10575653
@ -213,11 +198,9 @@ chats_archivePullDownBackground=-14145496
windowBackgroundWhiteBlueText=-10177041
avatar_nameInMessageCyan=-10623523
chat_inLocationBackground=-12829636
statisticChartHighlightColor=-2030043137
radioBackground=-10461088
profile_tabText=2030043135
contextProgressOuter1=-11555592
chat_inFileIcon=-14145496
avatar_backgroundActionBarPink=-14602949
dialogTextGray3=-8553091
dialogTextGray2=-8553091
@ -320,7 +303,6 @@ checkboxSquareBackground=-10177051
chat_mediaSentClock=-1291845633
files_folderIcon=-1
chat_outTextSelectionHighlight=2122236141
chats_menuCloudBackgroundCats=-11232035
switchTrackBlue=-9934742
chat_topPanelClose=1694498815
profile_adminIcon=-8549479
@ -366,7 +348,6 @@ chat_outFileBackground=520093695
chats_name=-921103
premiumStartSmallStarsColor=-8290049
switchTrackBlueSelector=431611386
dialogBadgeBackground=-10177041
chat_outBubbleSelected=-11829841
avatar_backgroundInProfileBlue=-11232035
chat_inFileNameText=-1
@ -378,12 +359,10 @@ groupcreate_checkboxCheck=-1
chat_outContactPhoneSelectedText=-7023626
chat_unreadMessagesStartBackground=-14606046
chat_inLoaderPhoto=-13882324
statisticChartCheckboxInactive=-6579301
chat_inFileInfoSelectedText=-7490861
chat_wallpaper=-15790320
chat_outMenuSelected=-541138950
fastScrollActive=-13133079
chat_outLoaderPhotoSelected=-13208924
chat_muteIcon=1688577445
chat_selectedBackground=710909411
chat_inAudioDurationText=-9013641
@ -392,16 +371,13 @@ chat_secretTimeText=-3289650
groupcreate_sectionText=-8553091
actionBarDefaultSubmenuItem=-1
chats_actionMessage=-10178583
chat_inLoaderPhotoIcon=-1
chat_addContact=-8796932
avatar_actionBarSelectorBlue=436207615
switchTrackChecked=-12215069
player_placeholderBackground=-13355980
windowBackgroundWhiteHintText=-8553091
chat_inLoader=-11495191
chat_adminSelectedText=-7490861
groupcreate_spanText=-657931
chat_outPreviewInstantSelectedText=-1
player_actionBarSelector=-14013910
key_player_progressCachedBackground=-11184811
chat_outTimeText=-7023626
@ -425,16 +401,13 @@ actionBarTabSelector=827876202
key_sheet_scrollUp=637534207
player_buttonActive=-10177041
undo_cancelColor=-9652225
chat_outLoaderPhotoIcon=-1
chat_outContactBackground=-9919529
sharedMedia_linkPlaceholder=-14474460
windowBackgroundWhiteBlueText7=-8796932
chat_outLocationBackground=285212671
windowBackgroundWhiteBlueText3=-11689489
windowBackgroundWhiteBlueText2=-12935187
windowBackgroundWhiteBlueText5=-10177041
windowBackgroundWhiteBlueText4=-10177041
chat_replyPanelMessage=-8553090
stickers_menuSelector=402653183
chat_inViewsSelected=-7490861
chat_emojiBottomPanelIcon=-9539985
@ -465,8 +438,6 @@ avatar_actionBarSelectorRed=-12758164
chat_inAudioDurationSelectedText=-7490861
windowBackgroundWhiteGrayText2=1862139391
chat_outAudioSeekbarSelected=-562182145
chat_outLoaderPhotoIconSelected=-1
player_actionBarTop=-14671840
windowBackgroundWhiteGrayText8=-8553091
windowBackgroundWhiteGrayText5=-8549479
windowBackgroundWhiteGrayText6=-8553091
@ -480,7 +451,6 @@ chat_outBubbleGradient=-12874567
chat_outReplyMessageText=-1
chat_recordedVoiceDot=-1221292
chat_messagePanelBackground=-14803425
chat_inLoaderPhotoSelected=-14925725
chat_inReactionButtonText=-1
chats_messageArchived=-8224126
chat_inVoiceSeekbarFill=-10177041
@ -502,7 +472,6 @@ chat_goDownButton=-14606046
chats_secretName=-9316522
chat_inMenu=-10656924
chat_recordVoiceCancel=-10638868
chat_inFileSelectedIcon=-15056797
chat_outReplyMediaMessageSelectedText=-7023626
chat_reportSpam=-1481631
chat_messageTextIn=-328966

View file

@ -1937,7 +1937,15 @@ public class AndroidUtilities {
file = ApplicationLoader.applicationContext.getExternalCacheDir();
}
if (file != null && (file.exists() || file.mkdirs()) && file.canWrite()) {
return file;
boolean canWrite = true;
try {
AndroidUtilities.createEmptyFile(new File(file, ".nomedia"));
} catch (Exception e) {
canWrite = false;
}
if (canWrite) {
return file;
}
}
} catch (Exception e) {
FileLog.e(e);
@ -4228,44 +4236,6 @@ public class AndroidUtilities {
}
}
private static final HashMap<Window, ArrayList<Long>> flagSecureReasons = new HashMap<>();
// Sets FLAG_SECURE to true, until it gets unregistered (when returned callback is run)
// Useful for having multiple reasons to have this flag on.
public static Runnable registerFlagSecure(Window window) {
final long reasonId = (long) (Math.random() * 999999999);
final ArrayList<Long> reasonIds;
if (flagSecureReasons.containsKey(window)) {
reasonIds = flagSecureReasons.get(window);
} else {
reasonIds = new ArrayList<>();
flagSecureReasons.put(window, reasonIds);
}
reasonIds.add(reasonId);
updateFlagSecure(window);
return () -> {
reasonIds.remove(reasonId);
updateFlagSecure(window);
};
}
private static void updateFlagSecure(Window window) {
if (Build.VERSION.SDK_INT >= 23) {
if (window == null) {
return;
}
final boolean value = flagSecureReasons.containsKey(window) && flagSecureReasons.get(window).size() > 0;
try {
if (value) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE);
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
} catch (Exception ignore) {
}
}
}
public static void openSharing(BaseFragment fragment, String url) {
if (fragment == null || fragment.getParentActivity() == null) {
return;

View file

@ -50,8 +50,9 @@ public class AnimatedFileDrawableStream implements FileLoadOperationStream {
debugReportSend = true;
if (BuildVars.DEBUG_PRIVATE_VERSION) {
throw new RuntimeException("infinity stream reading!!!");
} else {
FileLog.e(new RuntimeException("infinity stream reading!!!"));
}
FileLog.e(new RuntimeException("infinity stream reading!!!"));
}
return 0;
}

View file

@ -10,9 +10,7 @@ package org.telegram.messenger;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlarmManager;
import android.app.Application;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@ -297,10 +295,6 @@ public class ApplicationLoader extends Application {
}
} else {
applicationContext.stopService(new Intent(applicationContext, NotificationsService.class));
PendingIntent pintent = PendingIntent.getService(applicationContext, 0, new Intent(applicationContext, NotificationsService.class), PendingIntent.FLAG_MUTABLE);
AlarmManager alarm = (AlarmManager)applicationContext.getSystemService(Context.ALARM_SERVICE);
alarm.cancel(pintent);
}
}

View file

@ -138,9 +138,6 @@ public class AutoDeleteMediaTask {
if (totalSize > maxCacheSize) {
ArrayList<FileInfoInternal> allFiles = new ArrayList<>();
for (int a = 0; a < paths.size(); a++) {
if (paths.keyAt(a) == FileLoader.MEDIA_DIR_CACHE) {
continue;
}
File dir = paths.valueAt(a);
fillFilesRecursive(dir, allFiles);
}

View file

@ -24,8 +24,8 @@ public class BuildVars {
public static boolean USE_CLOUD_STRINGS = true;
public static boolean CHECK_UPDATES = true;
public static boolean NO_SCOPED_STORAGE = Build.VERSION.SDK_INT <= 29;
public static int BUILD_VERSION = 3164;
public static String BUILD_VERSION_STRING = "9.4.9";
public static int BUILD_VERSION = 3195;
public static String BUILD_VERSION_STRING = "9.5.0";
public static int APP_ID = 4;
public static String APP_HASH = "014b35b6184100b085b0d0572f9b5103";

View file

@ -61,16 +61,16 @@ public class CacheByChatsController {
public static long getDaysInSeconds(int keepMedia) {
long seconds;
if (keepMedia == CacheByChatsController.KEEP_MEDIA_FOREVER) {
seconds = Long.MAX_VALUE;
} else if (keepMedia == CacheByChatsController.KEEP_MEDIA_ONE_WEEK) {
if (keepMedia == CacheByChatsController.KEEP_MEDIA_ONE_WEEK) {
seconds = 60L * 60L * 24L * 7L;
} else if (keepMedia == CacheByChatsController.KEEP_MEDIA_ONE_MONTH) {
seconds = 60L * 60L * 24L * 30L;
} else if (keepMedia == CacheByChatsController.KEEP_MEDIA_ONE_DAY) {
seconds = 60L * 60L * 24L;
} else { //one min
} else if (keepMedia == CacheByChatsController.KEEP_MEDIA_ONE_MINUTE && BuildVars.DEBUG_PRIVATE_VERSION) { //one min
seconds = 60L;
} else {
seconds = Long.MAX_VALUE;
}
return seconds;
}

View file

@ -35,10 +35,13 @@ import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.Components.Bulletin;
import java.text.CollationKey;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -121,6 +124,47 @@ public class ContactsController extends BaseController {
}
}
private static Locale cachedCollatorLocale;
private static Collator cachedCollator;
public static Collator getLocaleCollator() {
if (cachedCollator == null || cachedCollatorLocale != Locale.getDefault()) {
try {
cachedCollator = Collator.getInstance(cachedCollatorLocale = Locale.getDefault());
cachedCollator.setStrength(Collator.SECONDARY);
} catch (Exception e) {
FileLog.e(e, true);
}
}
if (cachedCollator == null) {
try {
cachedCollator = Collator.getInstance();
cachedCollator.setStrength(Collator.SECONDARY);
} catch (Exception e) {
FileLog.e(e, true);
}
}
if (cachedCollator == null) {
cachedCollator = new Collator() {
@Override
public int compare(String source, String target) {
if (source == null || target == null) {
return 0;
}
return source.compareTo(target);
}
@Override
public CollationKey getCollationKey(String source) {
return null;
}
@Override
public int hashCode() {
return 0;
}
};
}
return cachedCollator;
}
public static class Contact {
public int contact_id;
public String key;
@ -1523,12 +1567,13 @@ public class ContactsController extends BaseController {
getMessagesStorage().putContacts(contactsArr, from != 2);
}
final Collator collator = getLocaleCollator();
Collections.sort(contactsArr, (tl_contact, tl_contact2) -> {
TLRPC.User user1 = usersDict.get(tl_contact.user_id);
TLRPC.User user2 = usersDict.get(tl_contact2.user_id);
String name1 = UserObject.getFirstName(user1);
String name2 = UserObject.getFirstName(user2);
return name1.compareTo(name2);
return collator.compare(name1, name2);
});
final ConcurrentHashMap<Long, TLRPC.TL_contact> contactsDictionary = new ConcurrentHashMap<>(20, 1.0f, 2);
@ -1598,7 +1643,7 @@ public class ContactsController extends BaseController {
} else if (cv2 == '#') {
return -1;
}
return s.compareTo(s2);
return collator.compare(s, s2);
});
Collections.sort(sortedSectionsArrayMutual, (s, s2) -> {
@ -1609,7 +1654,7 @@ public class ContactsController extends BaseController {
} else if (cv2 == '#') {
return -1;
}
return s.compareTo(s2);
return collator.compare(s, s2);
});
AndroidUtilities.runOnUIThread(() -> {
@ -1712,6 +1757,7 @@ public class ContactsController extends BaseController {
arrayList.add(user);
}
}
final Collator collator = getLocaleCollator();
for (ArrayList<Object> arrayList : phoneBookSectionsDictFinal.values()) {
Collections.sort(arrayList, (o1, o2) -> {
String name1;
@ -1744,7 +1790,7 @@ public class ContactsController extends BaseController {
name2 = "";
}
return name1.compareTo(name2);
return collator.compare(name1, name2);
});
}
Collections.sort(phoneBookSectionsArrayFinal, (s, s2) -> {
@ -1755,7 +1801,7 @@ public class ContactsController extends BaseController {
} else if (cv2 == '#') {
return -1;
}
return s.compareTo(s2);
return collator.compare(s, s2);
});
AndroidUtilities.runOnUIThread(() -> {
phoneBookSectionsArray = phoneBookSectionsArrayFinal;
@ -1794,29 +1840,31 @@ public class ContactsController extends BaseController {
sortedPhoneBookContacts.add(value);
}
final Collator collator = getLocaleCollator();
Collections.sort(sortedPhoneBookContacts, (contact, contact2) -> {
String toComapre1 = contact.first_name;
if (toComapre1.length() == 0) {
toComapre1 = contact.last_name;
String toCompare1 = contact.first_name;
if (toCompare1.length() == 0) {
toCompare1 = contact.last_name;
}
String toComapre2 = contact2.first_name;
if (toComapre2.length() == 0) {
toComapre2 = contact2.last_name;
String toCompare2 = contact2.first_name;
if (toCompare2.length() == 0) {
toCompare2 = contact2.last_name;
}
return toComapre1.compareTo(toComapre2);
return collator.compare(toCompare1, toCompare2);
});
phoneBookContacts = sortedPhoneBookContacts;
}
private void buildContactsSectionsArrays(boolean sort) {
final Collator collator = getLocaleCollator();
if (sort) {
Collections.sort(contacts, (tl_contact, tl_contact2) -> {
TLRPC.User user1 = getMessagesController().getUser(tl_contact.user_id);
TLRPC.User user2 = getMessagesController().getUser(tl_contact2.user_id);
String name1 = UserObject.getFirstName(user1);
String name2 = UserObject.getFirstName(user2);
return name1.compareTo(name2);
return collator.compare(name1, name2);
});
}
@ -1860,7 +1908,7 @@ public class ContactsController extends BaseController {
} else if (cv2 == '#') {
return -1;
}
return s.compareTo(s2);
return collator.compare(s, s2);
});
usersSectionsDict = sectionsDict;
@ -2723,6 +2771,10 @@ public class ContactsController extends BaseController {
}
}
public static String formatName(TLRPC.User user) {
return formatName(user.first_name, user.last_name, 0);
}
public static String formatName(String firstName, String lastName) {
return formatName(firstName, lastName, 0);
}

View file

@ -1228,6 +1228,12 @@ public class DatabaseMigrationHelper {
version = 112;
}
if (version == 112) {
database.executeFast("CREATE TABLE app_config(data BLOB)").stepThis().dispose();
database.executeFast("PRAGMA user_version = 113").stepThis().dispose();
version = 113;
}
return version;
}

View file

@ -21,7 +21,11 @@ public abstract class Fetcher<Args, R> {
// Implement this function
}
private long requestRemotelyTimeout = 4 * 60 * 1000;
protected boolean useCache(Args arguments) {
return true;
}
private final long requestRemotelyTimeout = 4 * 60 * 1000;
private HashMap<Pair<Integer, Args>, R> cachedResults;
private HashMap<Pair<Integer, Args>, ArrayList<Utilities.Callback<R>>> loadingCallbacks;
@ -74,6 +78,9 @@ public abstract class Fetcher<Args, R> {
}
private void cacheResult(Pair<Integer, Args> key, R result) {
if (!useCache(key.second)) {
return;
}
if (cachedResults == null) {
cachedResults = new HashMap<>();
}

View file

@ -46,6 +46,7 @@ public class FileLoadOperation {
}
protected static class RequestInfo {
public long requestStartTime;
private int requestToken;
private long offset;
private TLRPC.TL_upload_file response;
@ -138,7 +139,7 @@ public class FileLoadOperation {
private volatile int state = stateIdle;
private volatile boolean paused;
private long downloadedBytes;
private long totalBytesCount;
public long totalBytesCount;
private long bytesCountPadding;
private long streamStartOffset;
private long streamPriorityStartOffset;
@ -1210,7 +1211,7 @@ public class FileLoadOperation {
for (int a = 0; a < requestInfos.size(); a++) {
RequestInfo requestInfo = requestInfos.get(a);
if (requestInfo.requestToken != 0) {
ConnectionsManager.getInstance(currentAccount).cancelRequest(requestInfo.requestToken, false);
ConnectionsManager.getInstance(currentAccount).cancelRequest(requestInfo.requestToken, true);
}
}
}
@ -1418,7 +1419,7 @@ public class FileLoadOperation {
}
Utilities.stageQueue.postRunnable(() -> {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("finished downloading file to " + cacheFileFinal + " time = " + (System.currentTimeMillis() - startTime));
FileLog.d("finished downloading file to " + cacheFileFinal + " time = " + (System.currentTimeMillis() - startTime) + " dc = " + datacenterId + " size = " + AndroidUtilities.formatFileSize(totalBytesCount));
}
if (increment) {
if (currentType == ConnectionsManager.FileTypeAudio) {
@ -2064,10 +2065,17 @@ public class FileLoadOperation {
}
}
requestInfo.forceSmallChunk = forceSmallChunk;
if (BuildVars.LOGS_ENABLED) {
requestInfo.requestStartTime = System.currentTimeMillis();
}
int datacenterId = isCdn ? cdnDatacenterId : this.datacenterId;
requestInfo.requestToken = ConnectionsManager.getInstance(currentAccount).sendRequestSync(request, (response, error) -> {
if (!requestInfos.contains(requestInfo)) {
return;
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("debug_loading: " + request.getClass().getSimpleName() + " time=" + (System.currentTimeMillis() - requestInfo.requestStartTime) + " dcId=" + datacenterId + " cdn=" + isCdn + " connectionType=" + connectionType + " " + isLast);
}
if (requestInfo == priorityRequestInfo) {
if (BuildVars.DEBUG_VERSION) {
FileLog.d("frame get request completed " + priorityRequestInfo.offset);
@ -2177,7 +2185,7 @@ public class FileLoadOperation {
}
processRequestResult(requestInfo, error);
}
}, null, null, flags, isCdn ? cdnDatacenterId : datacenterId, connectionType, isLast);
}, null, null, flags, datacenterId, connectionType, isLast);
requestsCount++;
}
}

View file

@ -146,10 +146,13 @@ public class FileLoader extends BaseController {
public static final int IMAGE_TYPE_SVG_WHITE = 4;
public static final int IMAGE_TYPE_THEME_PREVIEW = 5;
private final FileLoaderPriorityQueue largeFilesQueue = new FileLoaderPriorityQueue("large files queue", 2);
private final FileLoaderPriorityQueue filesQueue = new FileLoaderPriorityQueue("files queue", 3);
private final FileLoaderPriorityQueue imagesQueue = new FileLoaderPriorityQueue("imagesQueue queue", 6);
private final FileLoaderPriorityQueue audioQueue = new FileLoaderPriorityQueue("audioQueue queue", 3);
// private final FileLoaderPriorityQueue largeFilesQueue = new FileLoaderPriorityQueue("large files queue", 2);
// private final FileLoaderPriorityQueue filesQueue = new FileLoaderPriorityQueue("files queue", 3);
// private final FileLoaderPriorityQueue imagesQueue = new FileLoaderPriorityQueue("imagesQueue queue", 6);
// private final FileLoaderPriorityQueue audioQueue = new FileLoaderPriorityQueue("audioQueue queue", 3);
private final FileLoaderPriorityQueue[] smallFilesQueue = new FileLoaderPriorityQueue[5];
private final FileLoaderPriorityQueue[] largeFilesQueue = new FileLoaderPriorityQueue[5];
public final static long DEFAULT_MAX_FILE_SIZE = 1024L * 1024L * 2000L;
public final static long DEFAULT_MAX_FILE_SIZE_PREMIUM = DEFAULT_MAX_FILE_SIZE * 2L;
@ -159,16 +162,16 @@ public class FileLoader extends BaseController {
private volatile static DispatchQueue fileLoaderQueue = new DispatchQueue("fileUploadQueue");
private final FilePathDatabase filePathDatabase;
private LinkedList<FileUploadOperation> uploadOperationQueue = new LinkedList<>();
private LinkedList<FileUploadOperation> uploadSmallOperationQueue = new LinkedList<>();
private ConcurrentHashMap<String, FileUploadOperation> uploadOperationPaths = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, FileUploadOperation> uploadOperationPathsEnc = new ConcurrentHashMap<>();
private final LinkedList<FileUploadOperation> uploadOperationQueue = new LinkedList<>();
private final LinkedList<FileUploadOperation> uploadSmallOperationQueue = new LinkedList<>();
private final ConcurrentHashMap<String, FileUploadOperation> uploadOperationPaths = new ConcurrentHashMap<>();
private final ConcurrentHashMap<String, FileUploadOperation> uploadOperationPathsEnc = new ConcurrentHashMap<>();
private int currentUploadOperationsCount = 0;
private int currentUploadSmallOperationsCount = 0;
private ConcurrentHashMap<String, FileLoadOperation> loadOperationPaths = new ConcurrentHashMap<>();
private ConcurrentHashMap<String, LoadOperationUIObject> loadOperationPathsUI = new ConcurrentHashMap<>(10, 1, 2);
private final ConcurrentHashMap<String, FileLoadOperation> loadOperationPaths = new ConcurrentHashMap<>();
private final ConcurrentHashMap<String, LoadOperationUIObject> loadOperationPathsUI = new ConcurrentHashMap<>(10, 1, 2);
private HashMap<String, Long> uploadSizes = new HashMap<>();
private HashMap<String, Boolean> loadingVideos = new HashMap<>();
@ -199,6 +202,11 @@ public class FileLoader extends BaseController {
public FileLoader(int instance) {
super(instance);
filePathDatabase = new FilePathDatabase(instance);
for (int i = 0; i < smallFilesQueue.length; i++) {
smallFilesQueue[i] = new FileLoaderPriorityQueue("smallFilesQueue dc" + (i + 1), 5);
largeFilesQueue[i] = new FileLoaderPriorityQueue("largeFilesQueue dc" + (i + 1), 2);
}
dumpFilesQueue();
}
public static void setMediaDirs(SparseArray<File> dirs) {
@ -660,7 +668,7 @@ public class FileLoader extends BaseController {
FileLoadOperation operation = loadOperationPaths.get(fileName);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("checkFile operation fileName=" + fileName + " documentName=" + getDocumentFileName(document) + " operation=" + operation + " priority=" + priority);
FileLog.d("checkFile operation fileName=" + fileName + " documentName=" + getDocumentFileName(document) + " operation=" + operation + " priority=" + priority + " account=" + currentAccount);
}
priority = getPriorityValue(priority);
@ -723,17 +731,19 @@ public class FileLoader extends BaseController {
}
}
FileLoaderPriorityQueue loaderQueue;
if (type == MEDIA_DIR_AUDIO) {
loaderQueue = audioQueue;
} else if (secureDocument != null || location != null && (imageLocation == null || imageLocation.imageType != IMAGE_TYPE_ANIMATION) || MessageObject.isImageWebDocument(webDocument) || MessageObject.isStickerDocument(document) || MessageObject.isAnimatedStickerDocument(document, true) || MessageObject.isVideoStickerDocument(document)) {
loaderQueue = imagesQueue;
int index = Utilities.clamp(operation.getDatacenterId() - 1, 4, 0);
if (operation.totalBytesCount > 20 * 1024 * 1024) {
loaderQueue = largeFilesQueue[index];
} else {
if (document == null || document.size > 20 * 1024 * 1024) {
loaderQueue = largeFilesQueue;
} else {
loaderQueue = filesQueue;
}
loaderQueue = smallFilesQueue[index];
}
// if (type == MEDIA_DIR_AUDIO) {
// loaderQueue = audioQueue;
// } else if (secureDocument != null || location != null && (imageLocation == null || imageLocation.imageType != IMAGE_TYPE_ANIMATION) || MessageObject.isImageWebDocument(webDocument) || MessageObject.isStickerDocument(document) || MessageObject.isAnimatedStickerDocument(document, true) || MessageObject.isVideoStickerDocument(document)) {
// loaderQueue = imagesQueue;
// } else {
// }
String storeFileName = fileName;
@ -1666,4 +1676,19 @@ public class FileLoader extends BaseController {
}
return l;
}
Runnable dumpFilesQueueRunnable = () -> {
for (int i = 0; i < smallFilesQueue.length; i++) {
FileLog.d("download queue: dc" + (i + 1) + " small_operations=" + smallFilesQueue[i].allOperations.size() + " large_operations=" + largeFilesQueue[i].allOperations.size());
}
dumpFilesQueue();
};
public void dumpFilesQueue() {
if (!BuildVars.LOGS_ENABLED) {
return;
}
fileLoaderQueue.cancelRunnable(dumpFilesQueueRunnable);
fileLoaderQueue.postRunnable(dumpFilesQueueRunnable, 10_000);
}
}

View file

@ -11,7 +11,6 @@ public class FileLoaderPriorityQueue {
String name;
ArrayList<FileLoadOperation> allOperations = new ArrayList<>();
ArrayList<FileLoadOperation> activeOperations = new ArrayList<>();
private int PRIORITY_VALUE_MAX = (1 << 20);
private int PRIORITY_VALUE_NORMAL = (1 << 16);

View file

@ -17,7 +17,7 @@ import java.util.concurrent.CountDownLatch;
public class FilePathDatabase {
private final DispatchQueue dispatchQueue;
private DispatchQueue dispatchQueue;
private final int currentAccount;
private SQLiteDatabase database;
@ -32,13 +32,10 @@ public class FilePathDatabase {
public final static int MESSAGE_TYPE_VIDEO_MESSAGE = 0;
private final FileMeta metaTmp = new FileMeta();
boolean databaseCreated;
public FilePathDatabase(int currentAccount) {
this.currentAccount = currentAccount;
dispatchQueue = new DispatchQueue("files_database_queue_" + currentAccount);
dispatchQueue.postRunnable(() -> {
createDatabase(0, false);
});
}
public void createDatabase(int tryCount, boolean fromBackup) {
@ -152,8 +149,8 @@ public class FilePathDatabase {
public String getPath(long documentId, int dc, int type, boolean useQueue) {
if (useQueue) {
if (BuildVars.DEBUG_VERSION) {
if (dispatchQueue.getHandler() != null && Thread.currentThread() == dispatchQueue.getHandler().getLooper().getThread()) {
if (BuildVars.DEBUG_PRIVATE_VERSION) {
if (dispatchQueue != null && dispatchQueue.getHandler() != null && Thread.currentThread() == dispatchQueue.getHandler().getLooper().getThread()) {
throw new RuntimeException("Error, lead to infinity loop");
}
}
@ -161,7 +158,8 @@ public class FilePathDatabase {
CountDownLatch syncLatch = new CountDownLatch(1);
String[] res = new String[1];
dispatchQueue.postRunnable(() -> {
postRunnable(() -> {
ensureDatabaseCreated();
if (database != null) {
SQLiteCursor cursor = null;
try {
@ -212,11 +210,33 @@ public class FilePathDatabase {
}
}
private void ensureDatabaseCreated() {
if (!databaseCreated) {
if (!NativeLoader.loaded()) {
int tryCount = 0;
while (!NativeLoader.loaded()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
tryCount++;
if (tryCount > 5) {
break;
}
}
}
createDatabase(0, false);
databaseCreated = true;
}
}
public void putPath(long id, int dc, int type, String path) {
dispatchQueue.postRunnable(() -> {
postRunnable(() -> {
if (BuildVars.DEBUG_VERSION) {
FileLog.d("put file path id=" + id + " dc=" + dc + " type=" + type + " path=" + path);
}
ensureDatabaseCreated();
if (database == null) {
return;
}
@ -260,7 +280,8 @@ public class FilePathDatabase {
CountDownLatch syncLatch = new CountDownLatch(1);
long time = System.currentTimeMillis();
dispatchQueue.postRunnable(() -> {
postRunnable(() -> {
ensureDatabaseCreated();
try {
for (int i = 0; i < arrayListFinal.size(); i++) {
MessageObject messageObject = arrayListFinal.get(i);
@ -288,7 +309,8 @@ public class FilePathDatabase {
}
public void clear() {
dispatchQueue.postRunnable(() -> {
postRunnable(() -> {
ensureDatabaseCreated();
try {
database.executeFast("DELETE FROM paths WHERE 1").stepThis().dispose();
database.executeFast("DELETE FROM paths_by_dialog_id WHERE 1").stepThis().dispose();
@ -301,7 +323,8 @@ public class FilePathDatabase {
public boolean hasAnotherRefOnFile(String path) {
CountDownLatch syncLatch = new CountDownLatch(1);
boolean[] res = new boolean[]{false};
dispatchQueue.postRunnable(() -> {
postRunnable(() -> {
ensureDatabaseCreated();
try {
SQLiteCursor cursor = database.queryFinalized("SELECT document_id FROM paths WHERE path = '" + path + "'");
if (cursor.next()) {
@ -325,7 +348,8 @@ public class FilePathDatabase {
if (file == null || fileMeta == null) {
return;
}
dispatchQueue.postRunnable(() -> {
postRunnable(() -> {
ensureDatabaseCreated();
SQLitePreparedStatement state = null;
try {
state = database.executeFast("REPLACE INTO paths_by_dialog_id VALUES(?, ?, ?, ?)");
@ -381,12 +405,14 @@ public class FilePathDatabase {
}
public DispatchQueue getQueue() {
ensureQueueExist();
return dispatchQueue;
}
public void removeFiles(List<CacheModel.FileInfo> filesToRemove) {
dispatchQueue.postRunnable(() -> {
postRunnable(() -> {
try {
ensureDatabaseCreated();
database.beginTransaction();
for (int i = 0; i < filesToRemove.size(); i++) {
database.executeFast("DELETE FROM paths_by_dialog_id WHERE path = '" + shield(filesToRemove.get(i).file.getPath()) + "'").stepThis().dispose();
@ -402,8 +428,9 @@ public class FilePathDatabase {
public LongSparseArray<ArrayList<CacheByChatsController.KeepMediaFile>> lookupFiles(ArrayList<? extends CacheByChatsController.KeepMediaFile> keepMediaFiles) {
CountDownLatch syncLatch = new CountDownLatch(1);
LongSparseArray<ArrayList<CacheByChatsController.KeepMediaFile>> filesByDialogId = new LongSparseArray<>();
dispatchQueue.postRunnable(() -> {
postRunnable(() -> {
try {
ensureDatabaseCreated();
FileMeta fileMetaTmp = new FileMeta();
for (int i = 0; i < keepMediaFiles.size(); i++) {
FileMeta fileMeta = getFileDialogId(keepMediaFiles.get(i).file, fileMetaTmp);
@ -429,6 +456,21 @@ public class FilePathDatabase {
return filesByDialogId;
}
private void postRunnable(Runnable runnable) {
ensureQueueExist();
dispatchQueue.postRunnable(runnable);
}
private void ensureQueueExist() {
if (dispatchQueue == null) {
synchronized (this) {
if (dispatchQueue == null) {
dispatchQueue = new DispatchQueue("files_database_queue_" + currentAccount);
}
}
}
}
public static class PathData {
public final long id;
public final int dc;

View file

@ -0,0 +1,83 @@
package org.telegram.messenger;
import android.view.Window;
import android.view.WindowManager;
import java.util.HashMap;
public class FlagSecureReason {
private static HashMap<Window, Integer> currentSecureReasons;
private Window window;
private FlagSecureCondition condition;
public FlagSecureReason(Window window, FlagSecureCondition condition) {
this.window = window;
this.condition = condition;
}
private boolean attached = false;
private boolean value = false;
public void invalidate() {
boolean newValue = attached && condition != null && condition.run();
if (newValue != value) {
update((value = newValue) ? +1 : -1);
}
}
public void attach() {
if (attached) {
return;
}
attached = true;
invalidate();
}
public void detach() {
if (!attached) {
return;
}
attached = false;
invalidate();
}
private void update(int add) {
if (currentSecureReasons == null) {
currentSecureReasons = new HashMap<>();
}
Integer count = currentSecureReasons.get(window);
int newCount = Math.max(0, (count == null ? 0 : count) + add);
if (newCount <= 0) {
currentSecureReasons.remove(window);
} else {
currentSecureReasons.put(window, newCount);
}
updateWindowSecure(window);
}
private static void updateWindowSecure(Window window) {
if (window == null) {
return;
}
if (isSecuredNow(window)) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE);
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
}
public static boolean isSecuredNow(Window window) {
return currentSecureReasons != null && currentSecureReasons.get(window) != null;
}
public interface FlagSecureCondition {
boolean run();
}
}

View file

@ -30,6 +30,7 @@ import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.SparseArray;
import androidx.annotation.RequiresApi;
import androidx.exifinterface.media.ExifInterface;
import org.json.JSONArray;
@ -1420,7 +1421,7 @@ public class ImageLoader {
}
}
if (image == null) {
if (useNativeWebpLoader) {
if (useNativeWebpLoader && secureDocumentKey == null) {
RandomAccessFile file = new RandomAccessFile(cacheFileFinal, "r");
ByteBuffer buffer = file.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, cacheFileFinal.length());
@ -1432,8 +1433,11 @@ public class ImageLoader {
Utilities.loadWebpImage(image, buffer, buffer.limit(), null, !opts.inPurgeable);
file.close();
} else {
String DEBUG_TAG = "secured_document_image";
try {
if (secureDocumentKey != null || cacheImage.encryptionKeyPath != null) {
FileLog.d( DEBUG_TAG + " try get image from secured document " + secureDocumentKey + " encryption path " + cacheImage.encryptionKeyPath);
}
RandomAccessFile f = new RandomAccessFile(cacheFileFinal, "r");
int len = (int) f.length();
int offset = 0;
@ -1457,16 +1461,27 @@ public class ImageLoader {
} else if (inEncryptedFile) {
EncryptedFileInputStream.decryptBytesWithKeyFile(data, 0, len, cacheImage.encryptionKeyPath);
}
if (secureDocumentKey != null || cacheImage.encryptionKeyPath != null) {
FileLog.d(DEBUG_TAG + " check error " + error);
}
if (!error) {
image = BitmapFactory.decodeByteArray(data, offset, len, opts);
if (secureDocumentKey != null || cacheImage.encryptionKeyPath != null) {
FileLog.d( DEBUG_TAG + " image " + image);
}
}
} catch (Throwable e) {
FileLog.e(e);
}
if (image == null) {
FileInputStream is;
if (inEncryptedFile) {
if (secureDocumentKey != null || cacheImage.encryptionKeyPath != null) {
FileLog.d(DEBUG_TAG + " try get image from stream ");
}
if (secureDocumentKey != null) {
is = new EncryptedFileInputStream(cacheFileFinal, secureDocumentKey);
} else if (inEncryptedFile) {
is = new EncryptedFileInputStream(cacheFileFinal, cacheImage.encryptionKeyPath);
} else {
is = new FileInputStream(cacheFileFinal);
@ -1489,10 +1504,23 @@ public class ImageLoader {
} catch (Throwable ignore) {
}
is.getChannel().position(0);
if (secureDocumentKey != null || cacheImage.encryptionKeyPath != null) {
is.close();
if (secureDocumentKey != null) {
is = new EncryptedFileInputStream(cacheFileFinal, secureDocumentKey);
} else if (inEncryptedFile) {
is = new EncryptedFileInputStream(cacheFileFinal, cacheImage.encryptionKeyPath);
}
} else {
is.getChannel().position(0);
}
}
image = BitmapFactory.decodeStream(is, null, opts);
is.close();
if (secureDocumentKey != null || cacheImage.encryptionKeyPath != null) {
FileLog.d(DEBUG_TAG + " image2 " + image);
}
}
}
}
@ -2229,7 +2257,7 @@ public class ImageLoader {
File newPath;
try {
if (ApplicationLoader.applicationContext.getExternalMediaDirs().length > 0) {
publicMediaDir = ApplicationLoader.applicationContext.getExternalMediaDirs()[0];
publicMediaDir = getPublicStorageDir();
publicMediaDir = new File(publicMediaDir, "Telegram");
publicMediaDir.mkdirs();
}
@ -2368,6 +2396,20 @@ public class ImageLoader {
return mediaDirs;
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private File getPublicStorageDir() {
File publicMediaDir = ApplicationLoader.applicationContext.getExternalMediaDirs()[0];
if (!TextUtils.isEmpty(SharedConfig.storageCacheDir)) {
for (int i = 0; i < ApplicationLoader.applicationContext.getExternalMediaDirs().length; i++) {
File f = ApplicationLoader.applicationContext.getExternalMediaDirs()[i];
if (f != null && f.getPath().startsWith(SharedConfig.storageCacheDir)) {
publicMediaDir = ApplicationLoader.applicationContext.getExternalMediaDirs()[i];
}
}
}
return publicMediaDir;
}
private boolean canMoveFiles(File from, File to, int type) {
RandomAccessFile file = null;
try {
@ -2571,7 +2613,7 @@ public class ImageLoader {
}
}
}
}, imageReceiver.getFileLoadingPriority() == FileLoader.PRIORITY_LOW ? 0 : 1);
});
}
public BitmapDrawable getImageFromMemory(TLObject fileLocation, String httpUrl, String filter) {

View file

@ -3,8 +3,22 @@ package org.telegram.messenger;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.BatteryManager;
import android.os.Build;
import android.os.PowerManager;
import android.util.SparseArray;
import android.util.SparseIntArray;
import androidx.annotation.RequiresApi;
import androidx.core.math.MathUtils;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.AnimatedEmojiDrawable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.AnimatedEmojiDrawable;
@ -15,48 +29,59 @@ public class LiteMode {
public static final int FLAG_ANIMATED_STICKERS_CHAT = 2;
public static final int FLAGS_ANIMATED_STICKERS = FLAG_ANIMATED_STICKERS_KEYBOARD | FLAG_ANIMATED_STICKERS_CHAT;
public static final int FLAG_ANIMATED_EMOJI_KEYBOARD = 4;
public static final int FLAG_ANIMATED_EMOJI_REACTIONS = 8;
public static final int FLAG_ANIMATED_EMOJI_CHAT = 16;
public static final int FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM = 4;
public static final int FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM = 16384;
public static final int FLAG_ANIMATED_EMOJI_KEYBOARD = FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM | FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM;
public static final int FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM = 8;
public static final int FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM = 8192;
public static final int FLAG_ANIMATED_EMOJI_REACTIONS = FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM | FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM;
public static final int FLAG_ANIMATED_EMOJI_CHAT_PREMIUM = 16;
public static final int FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM = 4096;
public static final int FLAG_ANIMATED_EMOJI_CHAT = FLAG_ANIMATED_EMOJI_CHAT_PREMIUM | FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM;
public static final int FLAGS_ANIMATED_EMOJI = FLAG_ANIMATED_EMOJI_KEYBOARD | FLAG_ANIMATED_EMOJI_REACTIONS | FLAG_ANIMATED_EMOJI_CHAT;
public static final int FLAG_CHAT_BACKGROUND = 32;
public static final int FLAG_CHAT_FORUM_TWOCOLUMN = 64;
public static final int FLAG_CHAT_SPOILER = 128;
public static final int FLAG_CHAT_BLUR = 256;
public static final int FLAGS_CHAT = FLAG_CHAT_BACKGROUND | FLAG_CHAT_FORUM_TWOCOLUMN | FLAG_CHAT_SPOILER | FLAG_CHAT_BLUR;
public static final int FLAG_CHAT_SCALE = 32768;
public static final int FLAGS_CHAT = FLAG_CHAT_BACKGROUND | FLAG_CHAT_FORUM_TWOCOLUMN | FLAG_CHAT_SPOILER | FLAG_CHAT_BLUR | FLAG_CHAT_SCALE;
public static final int FLAG_CALLS_ANIMATIONS = 512;
public static final int FLAG_AUTOPLAY_VIDEOS = 1024;
public static final int FLAG_AUTOPLAY_GIFS = 2048;
public static final int ENABLED = (
public static int PRESET_LOW = (
FLAG_ANIMATED_EMOJI_CHAT_PREMIUM |
FLAG_AUTOPLAY_GIFS
); // 2064
public static int PRESET_MEDIUM = (
FLAGS_ANIMATED_STICKERS |
FLAGS_ANIMATED_EMOJI |
FLAGS_CHAT |
FLAG_CALLS_ANIMATIONS
);
public static final int PRESET_LOW = 0;
public static final int PRESET_MEDIUM = (
FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM |
FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM |
FLAG_ANIMATED_EMOJI_CHAT |
FLAG_CHAT_FORUM_TWOCOLUMN |
FLAG_CHAT_BLUR |
FLAG_CALLS_ANIMATIONS |
FLAG_AUTOPLAY_VIDEOS |
FLAG_AUTOPLAY_GIFS
); // 8031
public static int PRESET_HIGH = (
FLAGS_ANIMATED_STICKERS |
FLAGS_ANIMATED_EMOJI |
FLAGS_CHAT |
FLAG_CALLS_ANIMATIONS |
FLAG_AUTOPLAY_VIDEOS |
FLAG_AUTOPLAY_GIFS
);
public static final int PRESET_HIGH = (
FLAGS_ANIMATED_STICKERS |
FLAGS_ANIMATED_EMOJI |
FLAGS_CHAT |
FLAG_CALLS_ANIMATIONS |
FLAG_AUTOPLAY_VIDEOS |
FLAG_AUTOPLAY_GIFS
);
public static final int PRESET_POWER_SAVER = PRESET_LOW;
); // 65535
public static int PRESET_POWER_SAVER = 0;
private static boolean powerSaverEnabled;
private static int BATTERY_LOW = 10;
private static int BATTERY_MEDIUM = 10;
private static int BATTERY_HIGH = 10;
private static int powerSaverLevel;
private static boolean lastPowerSaverApplied;
private static int value;
private static boolean loaded;
@ -68,20 +93,49 @@ public class LiteMode {
public static int getValue(boolean ignorePowerSaving) {
if (!loaded) {
loadPreference();
loaded = true;
}
// if (!ignorePowerSaving && powerSaverEnabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// // TODO: cache this value for some time, because this could be executed every draw
// PowerManager powerManager = (PowerManager) ApplicationLoader.applicationContext.getSystemService(Context.POWER_SERVICE);
// if (powerManager != null && powerManager.isPowerSaveMode()) {
// return PRESET_POWER_SAVER;
// }
// }
if (!ignorePowerSaving && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (getBatteryLevel() <= powerSaverLevel && powerSaverLevel > 0) {
if (!lastPowerSaverApplied) {
onPowerSaverApplied(lastPowerSaverApplied = true);
}
return PRESET_POWER_SAVER;
}
if (lastPowerSaverApplied) {
onPowerSaverApplied(lastPowerSaverApplied = false);
}
}
return value;
}
private static int lastBatteryLevelCached = -1;
private static long lastBatteryLevelChecked;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static int getBatteryLevel() {
if (lastBatteryLevelCached < 0 || System.currentTimeMillis() - lastBatteryLevelChecked > 1000 * 12) {
BatteryManager batteryManager = (BatteryManager) ApplicationLoader.applicationContext.getSystemService(Context.BATTERY_SERVICE);
if (batteryManager != null) {
lastBatteryLevelCached = batteryManager.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY);
lastBatteryLevelChecked = System.currentTimeMillis();
}
}
return lastBatteryLevelCached;
}
private static int preprocessFlag(int flag) {
if (flag == FLAG_ANIMATED_EMOJI_KEYBOARD) {
return UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_KEYBOARD_PREMIUM : FLAG_ANIMATED_EMOJI_KEYBOARD_NOT_PREMIUM;
} else if (flag == FLAG_ANIMATED_EMOJI_REACTIONS) {
return UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_REACTIONS_PREMIUM : FLAG_ANIMATED_EMOJI_REACTIONS_NOT_PREMIUM;
} else if (flag == FLAG_ANIMATED_EMOJI_CHAT) {
return UserConfig.hasPremiumOnAccounts() ? FLAG_ANIMATED_EMOJI_CHAT_PREMIUM : FLAG_ANIMATED_EMOJI_CHAT_NOT_PREMIUM;
}
return flag;
}
public static boolean isEnabled(int flag) {
return (getValue() & flag) > 0;
return (getValue() & preprocessFlag(flag)) > 0;
}
public static boolean isEnabledSetting(int flag) {
@ -93,90 +147,177 @@ public class LiteMode {
}
public static void toggleFlag(int flag, boolean enabled) {
setAllFlags(enabled ? getValue() | flag : getValue() & ~flag);
setAllFlags(enabled ? getValue(true) | flag : getValue(true) & ~flag);
}
public static void setAllFlags(int flags) {
int changedFlags = ~getValue() & flags;
// in settings it is already handled. would you handle it? 🫵
// onFlagsUpdate(value, flags);
value = flags;
savePreference();
}
public static void updatePresets(TLRPC.TL_jsonObject json) {
for (int i = 0; i < json.value.size(); ++i) {
TLRPC.TL_jsonObjectValue kv = json.value.get(i);
if ("settings_mask".equals(kv.key) && kv.value instanceof TLRPC.TL_jsonArray) {
ArrayList<TLRPC.JSONValue> array = ((TLRPC.TL_jsonArray) kv.value).value;
try {
PRESET_LOW = (int) ((TLRPC.TL_jsonNumber) array.get(0)).value;
PRESET_MEDIUM = (int) ((TLRPC.TL_jsonNumber) array.get(1)).value;
PRESET_HIGH = (int) ((TLRPC.TL_jsonNumber) array.get(2)).value;
} catch (Exception e) {
FileLog.e(e);
}
} else if ("battery_low".equals(kv.key) && kv.value instanceof TLRPC.TL_jsonArray) {
ArrayList<TLRPC.JSONValue> array = ((TLRPC.TL_jsonArray) kv.value).value;
try {
BATTERY_LOW = (int) ((TLRPC.TL_jsonNumber) array.get(0)).value;
BATTERY_MEDIUM = (int) ((TLRPC.TL_jsonNumber) array.get(1)).value;
BATTERY_HIGH = (int) ((TLRPC.TL_jsonNumber) array.get(2)).value;
} catch (Exception e) {
FileLog.e(e);
}
}
}
loadPreference();
}
public static void loadPreference() {
int defaultValue = PRESET_HIGH, batteryDefaultValue = BATTERY_HIGH;
if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW) {
defaultValue = PRESET_LOW;
batteryDefaultValue = BATTERY_LOW;
} else if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_AVERAGE) {
defaultValue = PRESET_MEDIUM;
batteryDefaultValue = BATTERY_MEDIUM;
}
final SharedPreferences preferences = MessagesController.getGlobalMainSettings();
if (!preferences.contains("lite_mode2")) {
if (preferences.contains("lite_mode")) {
defaultValue = preferences.getInt("lite_mode", defaultValue);
if (defaultValue == 4095) {
defaultValue = PRESET_HIGH;
}
} else {
if (preferences.contains("light_mode")) {
boolean prevLiteModeEnabled = (preferences.getInt("light_mode", SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW ? 1 : 0) & 1) > 0;
if (prevLiteModeEnabled) {
defaultValue = PRESET_LOW;
} else {
defaultValue = PRESET_HIGH;
}
}
// migrate settings
if (preferences.contains("loopStickers")) {
boolean loopStickers = preferences.getBoolean("loopStickers", true);
if (loopStickers) {
defaultValue |= FLAG_ANIMATED_STICKERS_CHAT;
} else {
defaultValue &= ~FLAG_ANIMATED_STICKERS_CHAT;
}
}
if (preferences.contains("autoplay_video")) {
boolean autoplayVideo = preferences.getBoolean("autoplay_video", true) || preferences.getBoolean("autoplay_video_liteforce", false);
if (autoplayVideo) {
defaultValue |= FLAG_AUTOPLAY_VIDEOS;
} else {
defaultValue &= ~FLAG_AUTOPLAY_VIDEOS;
}
}
if (preferences.contains("autoplay_gif")) {
boolean autoplayGif = preferences.getBoolean("autoplay_gif", true);
if (autoplayGif) {
defaultValue |= FLAG_AUTOPLAY_GIFS;
} else {
defaultValue &= ~FLAG_AUTOPLAY_GIFS;
}
}
if (preferences.contains("chatBlur")) {
boolean chatBlur = preferences.getBoolean("chatBlur", true);
if (chatBlur) {
defaultValue |= FLAG_CHAT_BLUR;
} else {
defaultValue &= ~FLAG_CHAT_BLUR;
}
}
}
}
int prevValue = value;
value = preferences.getInt("lite_mode2", defaultValue);
if (loaded) {
onFlagsUpdate(prevValue, value);
}
powerSaverLevel = preferences.getInt("lite_mode_battery_level", batteryDefaultValue);
loaded = true;
}
public static void savePreference() {
MessagesController.getGlobalMainSettings().edit().putInt("lite_mode", value).putInt("lite_mode_battery_level", powerSaverLevel).apply();
}
public static int getPowerSaverLevel() {
if (!loaded) {
loadPreference();
}
return powerSaverLevel;
}
public static void setPowerSaverLevel(int value) {
powerSaverLevel = MathUtils.clamp(value, 0, 100);
savePreference();
// check power saver applied
getValue(false);
}
public static boolean isPowerSaverApplied() {
getValue(false);
return lastPowerSaverApplied;
}
private static void onPowerSaverApplied(boolean powerSaverApplied) {
if (powerSaverApplied) {
onFlagsUpdate(getValue(true), PRESET_POWER_SAVER);
} else {
onFlagsUpdate(PRESET_POWER_SAVER, getValue(true));
}
if (onPowerSaverAppliedListeners != null) {
AndroidUtilities.runOnUIThread(() -> {
Iterator<Utilities.Callback<Boolean>> i = onPowerSaverAppliedListeners.iterator();
while (i.hasNext()) {
Utilities.Callback<Boolean> callback = i.next();
if (callback != null) {
callback.run(powerSaverApplied);
}
}
});
}
}
private static void onFlagsUpdate(int oldValue, int newValue) {
int changedFlags = ~oldValue & newValue;
if ((changedFlags & FLAGS_ANIMATED_EMOJI) > 0) {
AnimatedEmojiDrawable.updateAll();
}
if ((changedFlags & FLAG_CHAT_BACKGROUND) > 0) {
Theme.reloadWallpaper();
}
value = flags;
savePreference();
}
public static void loadPreference() {
int defaultValue = PRESET_HIGH;
if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW) {
defaultValue = PRESET_LOW;
} else if (SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_AVERAGE) {
defaultValue = PRESET_MEDIUM;
private static HashSet<Utilities.Callback<Boolean>> onPowerSaverAppliedListeners;
public static void addOnPowerSaverAppliedListener(Utilities.Callback<Boolean> listener) {
if (onPowerSaverAppliedListeners == null) {
onPowerSaverAppliedListeners = new HashSet<>();
}
onPowerSaverAppliedListeners.add(listener);
}
final SharedPreferences preferences = MessagesController.getGlobalMainSettings();
if (!preferences.contains("lite_mode")) {
if (preferences.contains("light_mode")) {
boolean prevLiteModeEnabled = (preferences.getInt("light_mode", SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW ? 1 : 0) & 1) > 0;
if (prevLiteModeEnabled) {
defaultValue = PRESET_LOW;
} else {
defaultValue = PRESET_HIGH;
}
}
// migrate settings
if (preferences.contains("loopStickers")) {
boolean loopStickers = preferences.getBoolean("loopStickers", true);
if (loopStickers) {
defaultValue |= FLAG_ANIMATED_STICKERS_CHAT;
} else {
defaultValue &= ~FLAG_ANIMATED_STICKERS_CHAT;
}
}
if (preferences.contains("autoplay_video")) {
boolean autoplayVideo = preferences.getBoolean("autoplay_video", true);
boolean autoplayVideoForce = preferences.getBoolean("autoplay_video_liteforce", false);
if (autoplayVideo || autoplayVideoForce) {
defaultValue |= FLAG_AUTOPLAY_VIDEOS;
} else {
defaultValue &= ~FLAG_AUTOPLAY_VIDEOS;
}
}
if (preferences.contains("autoplay_gif")) {
boolean autoplayGif = preferences.getBoolean("autoplay_gif", true);
if (autoplayGif) {
defaultValue |= FLAG_AUTOPLAY_GIFS;
} else {
defaultValue &= ~FLAG_AUTOPLAY_GIFS;
}
}
if (preferences.contains("chatBlur")) {
boolean chatBlur = preferences.getBoolean("chatBlur", true);
if (chatBlur) {
defaultValue |= FLAG_CHAT_BLUR;
} else {
defaultValue &= ~FLAG_CHAT_BLUR;
}
}
public static void removeOnPowerSaverAppliedListener(Utilities.Callback<Boolean> listener) {
if (onPowerSaverAppliedListeners != null) {
onPowerSaverAppliedListeners.remove(listener);
}
value = preferences.getInt("lite_mode", defaultValue);
powerSaverEnabled = preferences.getBoolean("lite_mode_power_saver", true);
}
public static void savePreference() {
MessagesController.getGlobalMainSettings().edit().putInt("lite_mode", value).putBoolean("lite_mode_power_saver", powerSaverEnabled).apply();
}
public static boolean isPowerSaverEnabled() {
return powerSaverEnabled;
}
public static void setPowerSaverEnabled(boolean enabled) {
powerSaverEnabled = enabled;
savePreference();
}
}

View file

@ -483,7 +483,7 @@ public class LocaleController {
langCode = langCode.replace("-", "_");
}
if (langCode == null || currentLocaleInfo != null && (langCode.equals(currentLocaleInfo.shortName) || langCode.equals(currentLocaleInfo.baseLangCode))) {
applyRemoteLanguage(currentLocaleInfo, langCode, force, force, currentAccount, onDone);
applyRemoteLanguage(currentLocaleInfo, langCode, force, currentAccount, onDone);
}
}
@ -493,11 +493,11 @@ public class LocaleController {
}
if (currentLocaleInfo.hasBaseLang()) {
if (currentLocaleInfo.baseVersion < baseVersion) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, false, currentAccount, null);
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.baseLangCode, false, currentAccount, null);
}
}
if (currentLocaleInfo.version < version) {
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, false, currentAccount, null);
applyRemoteLanguage(currentLocaleInfo, currentLocaleInfo.shortName, false, currentAccount, null);
}
}
@ -654,7 +654,7 @@ public class LocaleController {
saveOtherLanguages();
}
localeValues = stringMap;
applyLanguage(localeInfo, true, false, true, false, false, currentAccount, null);
applyLanguage(localeInfo, true, false, true, false, currentAccount, null);
return true;
}
} catch (Exception e) {
@ -849,10 +849,10 @@ public class LocaleController {
}
public int applyLanguage(LocaleInfo localeInfo, boolean override, boolean init, final int currentAccount) {
return applyLanguage(localeInfo, override, init, false, false, false, currentAccount, null);
return applyLanguage(localeInfo, override, init, false, false, currentAccount, null);
}
public int applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, boolean forceFullDifference, final int currentAccount, Runnable onDone) {
public int applyLanguage(final LocaleInfo localeInfo, boolean override, boolean init, boolean fromFile, boolean force, final int currentAccount, Runnable onDone) {
if (localeInfo == null) {
return 0;
}
@ -881,13 +881,13 @@ public class LocaleController {
boolean isLoadingRemote = false;
if ((localeInfo.isRemote() || localeInfo.isUnofficial()) && (force || !pathToFile.exists() || hasBase && !pathToBaseFile.exists())) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("reload locale because one of file doesn't exist" + pathToFile + " " + pathToBaseFile);
FileLog.d("reload locale because one of file doesn't exist " + pathToFile + " " + pathToBaseFile);
}
isLoadingRemote = true;
if (init) {
AndroidUtilities.runOnUIThread(() -> applyRemoteLanguage(localeInfo, null, true, forceFullDifference, currentAccount, onDone));
AndroidUtilities.runOnUIThread(() -> applyRemoteLanguage(localeInfo, null, true, currentAccount, onDone));
} else {
requestId = applyRemoteLanguage(localeInfo, null, true, forceFullDifference, currentAccount, onDone);
requestId = applyRemoteLanguage(localeInfo, null, true, currentAccount, onDone);
}
}
try {
@ -944,10 +944,13 @@ public class LocaleController {
ApplicationLoader.applicationContext.getResources().updateConfiguration(config, ApplicationLoader.applicationContext.getResources().getDisplayMetrics());
changingConfiguration = false;
if (reloadLastFile) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("reload locale because one of file is corrupted " + pathToFile + " " + pathToBaseFile);
}
if (init) {
AndroidUtilities.runOnUIThread(() -> reloadCurrentRemoteLocale(currentAccount, null, force, null));
AndroidUtilities.runOnUIThread(() -> reloadCurrentRemoteLocale(currentAccount, null, true, null));
} else {
reloadCurrentRemoteLocale(currentAccount, null, force, null);
reloadCurrentRemoteLocale(currentAccount, null, true, null);
}
reloadLastFile = false;
}
@ -1585,6 +1588,31 @@ public class LocaleController {
return "LOC_ERR";
}
public static String formatSeenDate(long date) {
try {
date *= 1000;
Calendar rightNow = Calendar.getInstance();
int day = rightNow.get(Calendar.DAY_OF_YEAR);
int year = rightNow.get(Calendar.YEAR);
rightNow.setTimeInMillis(date);
int dateDay = rightNow.get(Calendar.DAY_OF_YEAR);
int dateYear = rightNow.get(Calendar.YEAR);
if (dateDay == day && year == dateYear) {
return LocaleController.formatString("TodayAtFormattedWithToday", R.string.TodayAtFormattedWithToday, getInstance().formatterDay.format(new Date(date)));
} else if (dateDay + 1 == day && year == dateYear) {
return LocaleController.formatString("YesterdayAtFormatted", R.string.YesterdayAtFormatted, getInstance().formatterDay.format(new Date(date)));
} else if (Math.abs(System.currentTimeMillis() - date) < 31536000000L) {
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterDayMonth.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
} else {
return LocaleController.formatString("formatDateAtTime", R.string.formatDateAtTime, getInstance().formatterYear.format(new Date(date)), getInstance().formatterDay.format(new Date(date)));
}
} catch (Exception e) {
FileLog.e(e);
}
return "LOC_ERR";
}
public static String formatDateCallLog(long date) {
try {
date *= 1000;
@ -2094,8 +2122,10 @@ public class LocaleController {
try {
final HashMap<String, String> values;
if (difference.from_version == 0) {
FileLog.d("saveRemoteLocaleStrings: difference is straight from the beginning");
values = new HashMap<>();
} else {
FileLog.d("saveRemoteLocaleStrings: difference is from version " + difference.from_version + " ours " + localeInfo.version + " (base version " + localeInfo.baseLangCode + ")");
values = getLocaleFileStrings(finalFile, true);
}
for (int a = 0; a < difference.strings.size(); a++) {
@ -2113,9 +2143,7 @@ public class LocaleController {
values.remove(string.key);
}
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("save locale file to " + finalFile);
}
FileLog.d("save locale file to " + finalFile);
BufferedWriter writer = new BufferedWriter(new FileWriter(finalFile));
writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
writer.write("<resources>\n");
@ -2129,6 +2157,7 @@ public class LocaleController {
if (hasBase) {
valuesToSet.putAll(getLocaleFileStrings(localeInfo.getPathToFile()));
}
FileLog.d("saved locale file to " + finalFile);
AndroidUtilities.runOnUIThread(() -> {
if (type == 0) {
localeInfo.version = difference.version;
@ -2177,6 +2206,8 @@ public class LocaleController {
config.locale = currentLocale;
ApplicationLoader.applicationContext.getResources().updateConfiguration(config, ApplicationLoader.applicationContext.getResources().getDisplayMetrics());
changingConfiguration = false;
} else {
FileLog.d("saveRemoteLocaleStrings: currentLocaleInfo != localeInfo, do nothing");
}
} catch (Exception e) {
FileLog.e(e);
@ -2188,8 +2219,8 @@ public class LocaleController {
onDone.run();
}
});
} catch (Exception ignore) {
} catch (Exception e) {
FileLog.e(e);
}
}
@ -2272,11 +2303,11 @@ public class LocaleController {
}, ConnectionsManager.RequestFlagWithoutLogin);
}
private int applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean force, boolean forceFullDifference, final int currentAccount, Runnable onDone) {
private int applyRemoteLanguage(LocaleInfo localeInfo, String langCode, boolean force, final int currentAccount, Runnable onDone) {
if (localeInfo == null || !localeInfo.isRemote() && !localeInfo.isUnofficial()) {
return 0;
}
FileLog.d("applyRemoteLanguage " + langCode + " force=" + force + " forceFullDifference=" + forceFullDifference + " currentAccount=" + currentAccount);
FileLog.d("applyRemoteLanguage " + langCode + " force=" + force + " currentAccount=" + currentAccount);
int[] requested = new int[1], received = new int[1];
requested[0] = received[0] = 0;
Runnable onPartlyDone = () -> {
@ -2286,7 +2317,7 @@ public class LocaleController {
}
};
if (localeInfo.hasBaseLang() && (langCode == null || langCode.equals(localeInfo.baseLangCode))) {
if (localeInfo.baseVersion != 0 && !forceFullDifference) {
if (localeInfo.baseVersion != 0 && !force) {
if (localeInfo.hasBaseLang()) {
FileLog.d("applyRemoteLanguage getDifference of base");
TLRPC.TL_langpack_getDifference req = new TLRPC.TL_langpack_getDifference();
@ -2315,7 +2346,7 @@ public class LocaleController {
}
}
if (langCode == null || langCode.equals(localeInfo.shortName)) {
if (localeInfo.version != 0 && !forceFullDifference) {
if (localeInfo.version != 0 && !force) {
FileLog.d("applyRemoteLanguage getDifference");
TLRPC.TL_langpack_getDifference req = new TLRPC.TL_langpack_getDifference();
req.from_version = localeInfo.version;

View file

@ -1628,8 +1628,8 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
if (raisedToBack == minCount || accelerometerVertical) {
lastAccelerometerDetected = System.currentTimeMillis();
}
if (proximityTouched && (raisedToBack == minCount || accelerometerVertical || System.currentTimeMillis() - lastAccelerometerDetected < 60) && !NotificationsController.audioManager.isWiredHeadsetOn() && !VoIPService.isAnyKindOfCallActive()) {
if (playingMessageObject == null && recordStartRunnable == null && recordingAudio == null && !PhotoViewer.getInstance().isVisible() && ApplicationLoader.isScreenOn && !inputFieldHasText && allowStartRecord && raiseChat != null && !callInProgress) {
if (proximityTouched && (raisedToBack == minCount || accelerometerVertical || System.currentTimeMillis() - lastAccelerometerDetected < 60) && !NotificationsController.audioManager.isWiredHeadsetOn() && !NotificationsController.audioManager.isBluetoothA2dpOn() && !VoIPService.isAnyKindOfCallActive()) {
if (SharedConfig.raiseToSpeak && playingMessageObject == null && recordStartRunnable == null && recordingAudio == null && !PhotoViewer.getInstance().isVisible() && ApplicationLoader.isScreenOn && !inputFieldHasText && allowStartRecord && raiseChat != null && !callInProgress) {
if (!raiseToEarRecord) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("start record");
@ -1667,7 +1667,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
countLess = 0;
} else if (proximityTouched && ((accelerometerSensor == null || linearSensor == null) && gravitySensor == null) && !VoIPService.isAnyKindOfCallActive()) {
if (playingMessageObject != null && !ApplicationLoader.mainInterfacePaused && (playingMessageObject.isVoice() || playingMessageObject.isRoundVideo())) {
if (!useFrontSpeaker && !NotificationsController.audioManager.isWiredHeadsetOn()) {
if (!useFrontSpeaker && !NotificationsController.audioManager.isWiredHeadsetOn() && !NotificationsController.audioManager.isBluetoothA2dpOn()) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("start listen by proximity only");
}
@ -2434,7 +2434,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
public void setVoiceMessagesPlaylist(ArrayList<MessageObject> playlist, boolean unread) {
voiceMessagesPlaylist = playlist;
voiceMessagesPlaylist = playlist != null ? new ArrayList<>(playlist) : null;
if (voiceMessagesPlaylist != null) {
voiceMessagesPlaylistUnread = unread;
voiceMessagesPlaylistMap = new SparseArray<>();
@ -2594,9 +2594,9 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
}
if (audioPlayer != null) {
audioPlayer.setPlaybackSpeed(speed);
audioPlayer.setPlaybackSpeed(Math.round(speed * 10f) / 10f);
} else if (videoPlayer != null) {
videoPlayer.setPlaybackSpeed(speed);
videoPlayer.setPlaybackSpeed(Math.round(speed * 10f) / 10f);
}
MessagesController.getGlobalMainSettings().edit()
.putFloat(music ? "musicPlaybackSpeed" : "playbackSpeed", speed)
@ -2768,12 +2768,13 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
isPaused = false;
lastProgress = 0;
MessageObject oldMessageObject = playingMessageObject;
playingMessageObject = messageObject;
if (!SharedConfig.raiseToSpeak) {
startRaiseToEarSensors(raiseChat);
}
startProgressTimer(playingMessageObject);
NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidStart, messageObject);
NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidStart, messageObject, oldMessageObject);
/*try {
if (playingMessageObject.audioProgress != 0) {
@ -2943,6 +2944,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
MessagesController.getInstance(messageObject.currentAccount).markMessageContentAsRead(messageObject);
}
boolean notify = !playMusicAgain;
MessageObject oldMessageObject = playingMessageObject;
if (playingMessageObject != null) {
notify = false;
if (!playMusicAgain) {
@ -3148,7 +3150,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
if (messageObject.isRoundVideo()) {
videoPlayer.setStreamType(useFrontSpeaker ? AudioManager.STREAM_VOICE_CALL : AudioManager.STREAM_MUSIC);
if (Math.abs(currentPlaybackSpeed - 1.0f) > 0.001f) {
videoPlayer.setPlaybackSpeed(currentPlaybackSpeed);
videoPlayer.setPlaybackSpeed(Math.round(currentPlaybackSpeed * 10f) / 10f);
}
if (messageObject.forceSeekTo >= 0) {
@ -3257,7 +3259,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
shouldSavePositionForCurrentAudio = name;
}
if (Math.abs(currentPlaybackSpeed - 1.0f) > 0.001f) {
audioPlayer.setPlaybackSpeed(currentPlaybackSpeed);
audioPlayer.setPlaybackSpeed(Math.round(currentPlaybackSpeed * 10f) / 10f);
}
audioInfo = null;
clearPlaylist();
@ -3276,7 +3278,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
}
shouldSavePositionForCurrentAudio = name;
if (Math.abs(currentMusicPlaybackSpeed - 1.0f) > 0.001f) {
audioPlayer.setPlaybackSpeed(currentMusicPlaybackSpeed);
audioPlayer.setPlaybackSpeed(Math.round(currentMusicPlaybackSpeed * 10f) / 10f);
}
}
}
@ -3326,7 +3328,7 @@ public class MediaController implements AudioManager.OnAudioFocusChangeListener,
// proximityWakeLock.acquire();
}
startProgressTimer(playingMessageObject);
NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidStart, messageObject);
NotificationCenter.getInstance(messageObject.currentAccount).postNotificationName(NotificationCenter.messagePlayingDidStart, messageObject, oldMessageObject);
if (videoPlayer != null) {
try {

View file

@ -5455,35 +5455,41 @@ public class MediaDataController extends BaseController {
if (ids == null) {
continue;
}
SQLiteCursor cursor;
if (scheduled) {
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data, mid, date, uid FROM scheduled_messages_v2 WHERE mid IN(%s) AND uid = %d", TextUtils.join(",", ids), dialogId));
} else {
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data, mid, date, uid FROM messages_v2 WHERE mid IN(%s) AND uid = %d", TextUtils.join(",", ids), dialogId));
}
while (cursor.next()) {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
TLRPC.Message message = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
message.id = cursor.intValue(1);
message.date = cursor.intValue(2);
message.dialog_id = dialogId;
MessagesStorage.addUsersAndChatsFromMessage(message, usersToLoad, chatsToLoad, null);
result.add(message);
for (int i = 0; i < 2; i++) {
if (i == 1 && !scheduled) {
continue;
}
boolean findInScheduled = i == 1;
SQLiteCursor cursor;
if (findInScheduled) {
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data, mid, date, uid FROM scheduled_messages_v2 WHERE mid IN(%s) AND uid = %d", TextUtils.join(",", ids), dialogId));
} else {
cursor = getMessagesStorage().getDatabase().queryFinalized(String.format(Locale.US, "SELECT data, mid, date, uid FROM messages_v2 WHERE mid IN(%s) AND uid = %d", TextUtils.join(",", ids), dialogId));
}
while (cursor.next()) {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
TLRPC.Message message = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
message.id = cursor.intValue(1);
message.date = cursor.intValue(2);
message.dialog_id = dialogId;
MessagesStorage.addUsersAndChatsFromMessage(message, usersToLoad, chatsToLoad, null);
result.add(message);
long channelId = message.peer_id != null ? message.peer_id.channel_id : 0;
ArrayList<Integer> mids = dialogReplyMessagesIds.get(channelId);
if (mids != null) {
mids.remove((Integer) message.id);
if (mids.isEmpty()) {
dialogReplyMessagesIds.remove(channelId);
long channelId = message.peer_id != null ? message.peer_id.channel_id : 0;
ArrayList<Integer> mids = dialogReplyMessagesIds.get(channelId);
if (mids != null) {
mids.remove((Integer) message.id);
if (mids.isEmpty()) {
dialogReplyMessagesIds.remove(channelId);
}
}
}
}
cursor.dispose();
}
cursor.dispose();
}
if (!usersToLoad.isEmpty()) {
@ -5506,15 +5512,55 @@ public class MediaDataController extends BaseController {
TLRPC.messages_Messages messagesRes = (TLRPC.messages_Messages) response;
for (int i = 0; i < messagesRes.messages.size(); i++) {
TLRPC.Message message = messagesRes.messages.get(i);
if (message.dialog_id == 0) {
message.dialog_id = dialogId;
if (message instanceof TLRPC.TL_messageEmpty) {
messagesRes.messages.remove(i);
i--;
}
}
MessageObject.fixMessagePeer(messagesRes.messages, channelId);
ImageLoader.saveMessagesThumbs(messagesRes.messages);
broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
if (messagesRes.messages.size() < req.id.size()) {
TLObject req2;
if (channelId != 0) {
TLRPC.TL_channels_getMessages reqInner = new TLRPC.TL_channels_getMessages();
reqInner.channel = getMessagesController().getInputChannel(channelId);
reqInner.id = req.id;
req2 = reqInner;
} else {
TLRPC.TL_messages_getMessages reqInner = new TLRPC.TL_messages_getMessages();
reqInner.id = req.id;
req2 = reqInner;
}
getConnectionsManager().sendRequest(req2, (response2, error2) -> {
if (error == null) {
TLRPC.messages_Messages messagesRes2 = (TLRPC.messages_Messages) response2;
messagesRes.messages.addAll(messagesRes2.messages);
messagesRes.users.addAll(messagesRes2.users);
messagesRes.chats.addAll(messagesRes2.chats);
for (int i = 0; i < messagesRes.messages.size(); i++) {
TLRPC.Message message = messagesRes.messages.get(i);
if (message.dialog_id == 0) {
message.dialog_id = dialogId;
}
}
MessageObject.fixMessagePeer(messagesRes.messages, channelId);
ImageLoader.saveMessagesThumbs(messagesRes.messages);
broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
});
} else {
for (int i = 0; i < messagesRes.messages.size(); i++) {
TLRPC.Message message = messagesRes.messages.get(i);
if (message.dialog_id == 0) {
message.dialog_id = dialogId;
}
}
MessageObject.fixMessagePeer(messagesRes.messages, channelId);
ImageLoader.saveMessagesThumbs(messagesRes.messages);
broadcastReplyMessages(messagesRes.messages, replyMessageOwners, messagesRes.users, messagesRes.chats, dialogId, false);
getMessagesStorage().putUsersAndChats(messagesRes.users, messagesRes.chats, true, true);
saveReplyMessages(replyMessageOwners, messagesRes.messages, scheduled);
}
}
if (callback != null) {
AndroidUtilities.runOnUIThread(callback);

View file

@ -179,6 +179,7 @@ public class MessageObject {
public String sponsoredChatInviteHash;
public boolean sponsoredShowPeerPhoto;
public boolean sponsoredRecommended;
public String sponsoredInfo, sponsoredAdditionalInfo;
public TLRPC.TL_forumTopic replyToForumTopic; // used only for reply message in view all messages
@ -3410,7 +3411,7 @@ public class MessageObject {
messageText = LocaleController.formatString("MessageLifetimeRemoved", R.string.MessageLifetimeRemoved, UserObject.getFirstName(fromUser));
}
}
} else if (messageOwner.action instanceof TLRPC.TL_messageActionAttachMenuBotAllowed) {
} else if (messageOwner.action instanceof TLRPC.TL_messageActionAttachMenuBotAllowed || messageOwner.action instanceof TLRPC.TL_messageActionBotAllowed && ((TLRPC.TL_messageActionBotAllowed) messageOwner.action).attach_menu) {
messageText = LocaleController.getString(R.string.ActionAttachMenuBotAllowed);
} else if (messageOwner.action instanceof TLRPC.TL_messageActionRequestedPeer) {
TLRPC.Peer peer = ((TLRPC.TL_messageActionRequestedPeer) messageOwner.action).peer;
@ -6088,7 +6089,7 @@ public class MessageObject {
}
public static boolean canAutoplayAnimatedSticker(TLRPC.Document document) {
return (isAnimatedStickerDocument(document, true) || isVideoStickerDocument(document)) && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW && LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_STICKERS_CHAT);
return (isAnimatedStickerDocument(document, true) || isVideoStickerDocument(document)) && SharedConfig.getDevicePerformanceClass() != SharedConfig.PERFORMANCE_CLASS_LOW && LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_STICKERS_KEYBOARD);
}
public static boolean isMaskDocument(TLRPC.Document document) {

View file

@ -94,7 +94,7 @@ public class MessagesStorage extends BaseController {
}
}
public final static int LAST_DB_VERSION = 112;
public final static int LAST_DB_VERSION = 113;
private boolean databaseMigrationInProgress;
public boolean showClearDatabaseAlert;
private LongSparseIntArray dialogIsForum = new LongSparseIntArray();
@ -646,6 +646,7 @@ public class MessagesStorage extends BaseController {
database.executeFast("CREATE INDEX IF NOT EXISTS reaction_mentions_topics_did ON reaction_mentions_topics(dialog_id, topic_id);").stepThis().dispose();
database.executeFast("CREATE TABLE emoji_groups(type INTEGER PRIMARY KEY, data BLOB)").stepThis().dispose();
database.executeFast("CREATE TABLE app_config(data BLOB)").stepThis().dispose();
database.executeFast("PRAGMA user_version = " + MessagesStorage.LAST_DB_VERSION).stepThis().dispose();
@ -3203,34 +3204,40 @@ public class MessagesStorage extends BaseController {
}
SQLiteCursor cursor = null;
try {
if (scheduled) {
cursor = database.queryFinalized(String.format(Locale.US, "SELECT data, mid, date, uid FROM scheduled_messages_v2 WHERE mid IN(%s) AND uid = %d", TextUtils.join(",", ids), dialogId));
} else {
cursor = database.queryFinalized(String.format(Locale.US, "SELECT data, mid, date, uid FROM messages_v2 WHERE mid IN(%s) AND uid = %d", TextUtils.join(",", ids), dialogId));
}
while (cursor.next()) {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
TLRPC.Message message = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
message.id = cursor.intValue(1);
message.date = cursor.intValue(2);
message.dialog_id = cursor.longValue(3);
for (int i = 0; i < 2; i++) {
if (i == 1 && !scheduled) {
continue;
}
boolean findInScheduled = i == 1;
if (findInScheduled) {
cursor = database.queryFinalized(String.format(Locale.US, "SELECT data, mid, date, uid FROM scheduled_messages_v2 WHERE mid IN(%s) AND uid = %d", TextUtils.join(",", ids), dialogId));
} else {
cursor = database.queryFinalized(String.format(Locale.US, "SELECT data, mid, date, uid FROM messages_v2 WHERE mid IN(%s) AND uid = %d", TextUtils.join(",", ids), dialogId));
}
while (cursor.next()) {
NativeByteBuffer data = cursor.byteBufferValue(0);
if (data != null) {
TLRPC.Message message = TLRPC.Message.TLdeserialize(data, data.readInt32(false), false);
message.readAttachPath(data, getUserConfig().clientUserId);
data.reuse();
message.id = cursor.intValue(1);
message.date = cursor.intValue(2);
message.dialog_id = cursor.longValue(3);
addUsersAndChatsFromMessage(message, usersToLoad, chatsToLoad, null);
addUsersAndChatsFromMessage(message, usersToLoad, chatsToLoad, null);
ArrayList<TLRPC.Message> arrayList = owners.get(message.id);
if (arrayList != null) {
for (int a = 0, N = arrayList.size(); a < N; a++) {
TLRPC.Message m = arrayList.get(a);
m.replyMessage = message;
MessageObject.getDialogId(message);
ArrayList<TLRPC.Message> arrayList = owners.get(message.id);
if (arrayList != null) {
for (int a = 0, N = arrayList.size(); a < N; a++) {
TLRPC.Message m = arrayList.get(a);
m.replyMessage = message;
MessageObject.getDialogId(message);
}
}
}
}
cursor.dispose();
}
cursor.dispose();
} catch (Exception e) {
throw e;
} finally {

View file

@ -210,5 +210,9 @@ public class NativeLoader {
}
private static native void init(String path, boolean enable);
public static boolean loaded() {
return nativeLoaded;
}
//public static native void crash();
}

View file

@ -209,6 +209,7 @@ public class NotificationCenter {
public static final int updateBotMenuButton = totalEvents++;
public static final int didUpdatePremiumGiftStickers = totalEvents++;
public static final int didUpdatePremiumGiftFieldIcon = totalEvents++;
//global
public static final int pushMessagesUpdated = totalEvents++;

View file

@ -744,9 +744,6 @@ public class NotificationsController extends BaseController {
boolean updated = false;
for (int a = 0, N = editedMessages.size(); a < N; a++) {
long dialogId = editedMessages.keyAt(a);
if (pushDialogs.indexOfKey(dialogId) < 0) {
continue;
}
ArrayList<MessageObject> messages = editedMessages.valueAt(a);
for (int b = 0, N2 = messages.size(); b < N2; b++) {
MessageObject messageObject = messages.get(b);
@ -3416,7 +3413,7 @@ public class NotificationsController extends BaseController {
if (sound != null) {
notificationChannel.setSound(sound, builder.build());
} else {
notificationChannel.setSound(null, null);
// notificationChannel.setSound(null, null);
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("create new channel " + channelId);

View file

@ -169,7 +169,7 @@ public class SaveToGallerySettingsHelper {
private boolean needSave(FilePathDatabase.FileMeta meta, MessageObject messageObject, int currentAccount) {
LongSparseArray<DialogException> exceptions = UserConfig.getInstance(currentAccount).getSaveGalleryExceptions(type);
DialogException exception = exceptions.get(meta.dialogId);
if (messageObject != null && messageObject.isOutOwner()) {
if (messageObject != null && (messageObject.isOutOwner() || messageObject.isSecretMedia())) {
return false;
}
boolean isVideo = (messageObject != null && messageObject.isVideo()) || meta.messageType == MessageObject.TYPE_VIDEO;

View file

@ -3624,7 +3624,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
}
params.put("ve", ve);
}
if (encryptedChat != null && document.dc_id > 0 && !MessageObject.isStickerDocument(document) && !MessageObject.isAnimatedStickerDocument(document, true)) {
if (encryptedChat != null && document.dc_id > 0 && !MessageObject.isStickerDocument(document) && !MessageObject.isAnimatedStickerDocument(document, true) && !MessageObject.isGifDocument(document)) {
newMsg.attachPath = FileLoader.getInstance(currentAccount).getPathToAttach(document).toString();
} else {
newMsg.attachPath = path;
@ -6016,7 +6016,7 @@ public class SendMessagesHelper extends BaseController implements NotificationCe
}
}
if (newMsg.attachPath != null && newMsg.attachPath.startsWith(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE).getAbsolutePath())) {
if (newMsg.attachPath != null && newMsg.attachPath.startsWith(FileLoader.getDirectory(FileLoader.MEDIA_DIR_CACHE).getAbsolutePath()) && !MessageObject.isGifDocument(sentMessage.media.document)) {
File cacheFile = new File(newMsg.attachPath);
File cacheFile2 = FileLoader.getInstance(currentAccount).getPathToAttach(sentMessage.media.document, sentMessage.media.ttl_seconds != 0);
if (!cacheFile.renameTo(cacheFile2)) {

View file

@ -109,7 +109,6 @@ public class SharedConfig {
public static boolean stickersReorderingHintUsed;
public static boolean disableVoiceAudioEffects;
public static boolean forceDisableTabletMode;
public static boolean useLNavigation;
public static boolean updateStickersOrderOnSend = true;
private static int lastLocalId = -210000;
@ -137,11 +136,9 @@ public class SharedConfig {
public static boolean streamAllVideo = false;
public static boolean streamMkv = false;
public static boolean saveStreamMedia = true;
public static boolean smoothKeyboard = true;
public static boolean pauseMusicOnRecord = false;
public static boolean noiseSupression;
public static boolean noStatusBar = true;
public static boolean forceRtmpStream;
public static final boolean noStatusBar = true;
public static boolean debugWebView;
public static boolean sortContactsByName;
public static boolean sortFilesByName;
@ -347,7 +344,6 @@ public class SharedConfig {
editor = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Context.MODE_PRIVATE).edit();
editor.putBoolean("hasEmailLogin", hasEmailLogin);
editor.putBoolean("useLNavigation", useLNavigation);
editor.putBoolean("floatingDebugActive", isFloatingDebugActive);
editor.putBoolean("record_via_sco", recordViaSco);
editor.apply();
@ -469,7 +465,6 @@ public class SharedConfig {
useSystemEmoji = preferences.getBoolean("useSystemEmoji", false);
streamMedia = preferences.getBoolean("streamMedia", true);
saveStreamMedia = preferences.getBoolean("saveStreamMedia", true);
smoothKeyboard = preferences.getBoolean("smoothKeyboard2", true);
pauseMusicOnRecord = preferences.getBoolean("pauseMusicOnRecord", false);
forceDisableTabletMode = preferences.getBoolean("forceDisableTabletMode", false);
streamAllVideo = preferences.getBoolean("streamAllVideo", BuildVars.DEBUG_VERSION);
@ -486,8 +481,6 @@ public class SharedConfig {
archiveHidden = preferences.getBoolean("archiveHidden", false);
distanceSystemType = preferences.getInt("distanceSystemType", 0);
keepMedia = preferences.getInt("keep_media", CacheByChatsController.KEEP_MEDIA_ONE_MONTH);
noStatusBar = preferences.getBoolean("noStatusBar", true);
forceRtmpStream = preferences.getBoolean("forceRtmpStream", false);
debugWebView = preferences.getBoolean("debugWebView", false);
lastKeepMediaCheckTime = preferences.getInt("lastKeepMediaCheckTime", 0);
lastLogsCheckTime = preferences.getInt("lastLogsCheckTime", 0);
@ -508,7 +501,6 @@ public class SharedConfig {
fastScrollHintCount = preferences.getInt("fastScrollHintCount", 3);
dontAskManageStorage = preferences.getBoolean("dontAskManageStorage", false);
hasEmailLogin = preferences.getBoolean("hasEmailLogin", false);
useLNavigation = preferences.getBoolean("useLNavigation", false);
isFloatingDebugActive = preferences.getBoolean("floatingDebugActive", false);
updateStickersOrderOnSend = preferences.getBoolean("updateStickersOrderOnSend", true);
@ -839,14 +831,6 @@ public class SharedConfig {
editor.commit();
}
public static void toggleForceRTMPStream() {
forceRtmpStream = !forceRtmpStream;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("forceRtmpStream", forceRtmpStream);
editor.apply();
}
public static void toggleDebugWebView() {
debugWebView = !debugWebView;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
@ -858,14 +842,6 @@ public class SharedConfig {
editor.apply();
}
public static void toggleNoStatusBar() {
noStatusBar = !noStatusBar;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("noStatusBar", noStatusBar);
editor.commit();
}
public static void toggleLoopStickers() {
LiteMode.toggleFlag(LiteMode.FLAG_ANIMATED_STICKERS_CHAT);
}
@ -1046,14 +1022,6 @@ public class SharedConfig {
editor.commit();
}
public static void toggleSmoothKeyboard() {
smoothKeyboard = !smoothKeyboard;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("smoothKeyboard2", smoothKeyboard);
editor.commit();
}
public static void togglePauseMusicOnRecord() {
pauseMusicOnRecord = !pauseMusicOnRecord;
SharedPreferences preferences = MessagesController.getGlobalMainSettings();

View file

@ -620,7 +620,7 @@ public class TranslateController extends BaseController {
pendingLanguageChecks.add(hash);
Utilities.getStageQueue().postRunnable(() -> {
Utilities.stageQueue.postRunnable(() -> {
LanguageDetector.detectLanguage(messageObject.messageOwner.message, lng -> AndroidUtilities.runOnUIThread(() -> {
String detectedLanguage = lng;
if (detectedLanguage == null) {

View file

@ -33,7 +33,6 @@ public class Utilities {
public static Random fastRandom = new Xoroshiro128PlusRandom(random.nextLong());
public static volatile DispatchQueue stageQueue = new DispatchQueue("stageQueue");
public static volatile DispatchQueue stageQueue2 = new DispatchQueue("stageQueue2");
public static volatile DispatchQueue globalQueue = new DispatchQueue("globalQueue");
public static volatile DispatchQueue cacheClearQueue = new DispatchQueue("cacheClearQueue");
public static volatile DispatchQueue searchQueue = new DispatchQueue("searchQueue");
@ -41,14 +40,6 @@ public class Utilities {
public static volatile DispatchQueue themeQueue = new DispatchQueue("themeQueue");
public static volatile DispatchQueue externalNetworkQueue = new DispatchQueue("externalNetworkQueue");
private static final Object lock = new Object();
private static volatile int stageQueueI = 0;
public static DispatchQueue getStageQueue() {
synchronized (lock) {
return stageQueueI++ % 2 == 0 ? stageQueue : stageQueue2;
}
}
private final static String RANDOM_STRING_CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();

View file

@ -41,6 +41,7 @@ import android.os.Looper;
import android.os.Message;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.util.Log;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.Surface;
@ -50,6 +51,7 @@ import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.core.graphics.ColorUtils;
import org.telegram.messenger.AndroidUtilities;
@ -60,6 +62,7 @@ import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.Utilities;
import org.telegram.messenger.video.MP4Builder;
import org.telegram.messenger.video.Mp4Movie;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.InstantCameraView;
import org.telegram.ui.Components.LayoutHelper;
@ -88,6 +91,7 @@ public class CameraView extends FrameLayout implements TextureView.SurfaceTextur
private Size pictureSize;
CameraInfo info;
private boolean mirror;
private boolean lazy;
private TextureView textureView;
private ImageView blurredStubView;
private CameraSession cameraSession;
@ -99,6 +103,7 @@ public class CameraView extends FrameLayout implements TextureView.SurfaceTextur
private Matrix txform = new Matrix();
private Matrix matrix = new Matrix();
private int focusAreaSize;
private Drawable thumbDrawable;
private boolean useMaxPreview;
@ -250,11 +255,18 @@ public class CameraView extends FrameLayout implements TextureView.SurfaceTextur
}
public CameraView(Context context, boolean frontface) {
this(context, frontface, false);
}
public CameraView(Context context, boolean frontface, boolean lazy) {
super(context, null);
initialFrontface = isFrontface = frontface;
textureView = new TextureView(context);
textureView.setSurfaceTextureListener(this);
addView(textureView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
if (!(this.lazy = lazy)) {
initTexture();
}
setWillNotDraw(!lazy);
blurredStubView = new ImageView(context);
addView(blurredStubView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
@ -266,6 +278,17 @@ public class CameraView extends FrameLayout implements TextureView.SurfaceTextur
innerPaint.setColor(0x7fffffff);
}
private boolean textureInited = false;
public void initTexture() {
if (textureInited) {
return;
}
textureView.setSurfaceTextureListener(this);
addView(textureView, 0, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
textureInited = true;
}
public void setOptimizeForBarcode(boolean value) {
optimizeForBarcode = value;
if (cameraSession != null) {
@ -273,6 +296,40 @@ public class CameraView extends FrameLayout implements TextureView.SurfaceTextur
}
}
Rect bounds = new Rect();
@Override
protected void onDraw(Canvas canvas) {
if (thumbDrawable != null) {
bounds.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
int W = thumbDrawable.getIntrinsicWidth(), H = thumbDrawable.getIntrinsicHeight();
float scale = 1f / Math.min(W / (float) Math.max(1, bounds.width()), H / (float) Math.max(1, bounds.height()));
thumbDrawable.setBounds(
(int) (bounds.centerX() - W * scale / 2f),
(int) (bounds.centerY() - H * scale / 2f),
(int) (bounds.centerX() + W * scale / 2f),
(int) (bounds.centerY() + H * scale / 2f)
);
thumbDrawable.draw(canvas);
}
super.onDraw(canvas);
}
@Override
protected boolean verifyDrawable(@NonNull Drawable who) {
return who == thumbDrawable || super.verifyDrawable(who);
}
public void setThumbDrawable(Drawable drawable) {
if (thumbDrawable != null) {
thumbDrawable.setCallback(null);
}
thumbDrawable = drawable;
if (thumbDrawable != null) {
thumbDrawable.setCallback(this);
}
}
private int measurementsCount = 0;
@Override
protected void onAttachedToWindow() {
@ -477,6 +534,39 @@ public class CameraView extends FrameLayout implements TextureView.SurfaceTextur
delegate.onCameraInit();
}
inited = true;
if (lazy) {
textureView.setAlpha(0);
showTexture(true, true);
}
}
}
private ValueAnimator textureViewAnimator;
public void showTexture(boolean show, boolean animated) {
if (textureView == null) {
return;
}
if (textureViewAnimator != null) {
textureViewAnimator.cancel();
textureViewAnimator = null;
}
if (animated) {
textureViewAnimator = ValueAnimator.ofFloat(textureView.getAlpha(), show ? 1 : 0);
textureViewAnimator.addUpdateListener(anm -> {
final float t = (float) anm.getAnimatedValue();
textureView.setAlpha(t);
});
textureViewAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
textureView.setAlpha(show ? 1 : 0);
textureViewAnimator = null;
}
});
textureViewAnimator.start();
} else {
textureView.setAlpha(show ? 1 : 0);
}
}
@ -500,7 +590,7 @@ public class CameraView extends FrameLayout implements TextureView.SurfaceTextur
};
private void checkPreviewMatrix() {
if (previewSize == null) {
if (previewSize == null || textureView == null) {
return;
}

View file

@ -1,5 +1,7 @@
package org.telegram.messenger.voip;
import com.google.android.exoplayer2.util.Util;
import org.json.JSONException;
import org.json.JSONObject;
import org.telegram.messenger.ApplicationLoader;
@ -203,6 +205,7 @@ public final class Instance {
public final String username;
public final String password;
public final boolean tcp;
public int reflectorId;
public Endpoint(boolean isRtc, long id, String ipv4, String ipv6, int port, int type, byte[] peerTag, boolean turn, boolean stun, String username, String password, boolean tcp) {
this.isRtc = isRtc;
@ -214,8 +217,16 @@ public final class Instance {
this.peerTag = peerTag;
this.turn = turn;
this.stun = stun;
this.username = username;
this.password = password;
if (isRtc) {
this.username = username;
this.password = password;
} else if (peerTag != null) {
this.username = "reflector";
this.password = Util.toHexString(peerTag);
} else {
this.username = null;
this.password = null;
}
this.tcp = tcp;
}

View file

@ -43,6 +43,8 @@ import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.media.AudioAttributes;
import android.media.AudioDeviceCallback;
import android.media.AudioDeviceInfo;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioTrack;
@ -57,7 +59,9 @@ import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.Vibrator;
@ -133,6 +137,8 @@ import java.lang.reflect.Method;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -319,6 +325,9 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
am.abandonAudioFocus(VoIPService.this);
am.unregisterMediaButtonEventReceiver(new ComponentName(VoIPService.this, VoIPMediaButtonReceiver.class));
if (audioDeviceCallback != null) {
am.unregisterAudioDeviceCallback(audioDeviceCallback);
}
if (!USE_CONNECTION_SERVICE && sharedInstance == null) {
if (isBtHeadsetConnected) {
am.stopBluetoothSco();
@ -375,6 +384,8 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
}
};
private AudioDeviceCallback audioDeviceCallback;
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
@ -2355,9 +2366,23 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
final boolean forceTcp = preferences.getBoolean("dbg_force_tcp_in_calls", false);
final int endpointType = forceTcp ? Instance.ENDPOINT_TYPE_TCP_RELAY : Instance.ENDPOINT_TYPE_UDP_RELAY;
final Instance.Endpoint[] endpoints = new Instance.Endpoint[privateCall.connections.size()];
ArrayList<Long> reflectorIds = new ArrayList<>();
for (int i = 0; i < endpoints.length; i++) {
final TLRPC.PhoneConnection connection = privateCall.connections.get(i);
endpoints[i] = new Instance.Endpoint(connection instanceof TLRPC.TL_phoneConnectionWebrtc, connection.id, connection.ip, connection.ipv6, connection.port, endpointType, connection.peer_tag, connection.turn, connection.stun, connection.username, connection.password, connection.tcp);
if (connection instanceof TLRPC.TL_phoneConnection) {
reflectorIds.add(((TLRPC.TL_phoneConnection) connection).id);
}
}
if (!reflectorIds.isEmpty()) {
Collections.sort(reflectorIds);
HashMap<Long, Integer> reflectorIdMapping = new HashMap<>();
for (int i = 0; i < reflectorIds.size(); i++) {
reflectorIdMapping.put(reflectorIds.get(i), i + 1);
}
for (int i = 0; i < endpoints.length; i++) {
endpoints[i].reflectorId = reflectorIdMapping.getOrDefault(endpoints[i].id, 0);
}
}
if (forceTcp) {
AndroidUtilities.runOnUIThread(() -> Toast.makeText(VoIPService.this, "This call uses TCP which will degrade its quality.", Toast.LENGTH_SHORT).show());
@ -3072,6 +3097,9 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
} catch (Exception e) {
FileLog.e(e);
}
if (audioDeviceCallback != null) {
am.unregisterAudioDeviceCallback(audioDeviceCallback);
}
if (hasAudioFocus) {
am.abandonAudioFocus(this);
}
@ -3473,33 +3501,31 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
registerReceiver(receiver, filter);
fetchBluetoothDeviceName();
am.registerMediaButtonEventReceiver(new ComponentName(this, VoIPMediaButtonReceiver.class));
if (!USE_CONNECTION_SERVICE && btAdapter != null && btAdapter.isEnabled()) {
if (audioDeviceCallback == null) {
try {
MediaRouter mr = (MediaRouter) getSystemService(Context.MEDIA_ROUTER_SERVICE);
if (Build.VERSION.SDK_INT < 24) {
int headsetState = btAdapter.getProfileConnectionState(BluetoothProfile.HEADSET);
updateBluetoothHeadsetState(headsetState == BluetoothProfile.STATE_CONNECTED);
for (StateListener l : stateListeners) {
l.onAudioSettingsChanged();
audioDeviceCallback = new AudioDeviceCallback() {
@Override
public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
checkUpdateBluetoothHeadset();
}
} else {
MediaRouter.RouteInfo ri = mr.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_AUDIO);
if (ri.getDeviceType() == MediaRouter.RouteInfo.DEVICE_TYPE_BLUETOOTH) {
int headsetState = btAdapter.getProfileConnectionState(BluetoothProfile.HEADSET);
updateBluetoothHeadsetState(headsetState == BluetoothProfile.STATE_CONNECTED);
for (StateListener l : stateListeners) {
l.onAudioSettingsChanged();
}
} else {
updateBluetoothHeadsetState(false);
@Override
public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
checkUpdateBluetoothHeadset();
}
}
};
} catch (Throwable e) {
//java.lang.NoClassDefFoundError on some devices
FileLog.e(e);
audioDeviceCallback = null;
}
}
if (audioDeviceCallback != null) {
am.registerAudioDeviceCallback(audioDeviceCallback, new Handler(Looper.getMainLooper()));
}
am.registerMediaButtonEventReceiver(new ComponentName(this, VoIPMediaButtonReceiver.class));
checkUpdateBluetoothHeadset();
} catch (Exception x) {
if (BuildVars.LOGS_ENABLED) {
FileLog.e("error initializing voip controller", x);
@ -3520,6 +3546,34 @@ public class VoIPService extends Service implements SensorEventListener, AudioMa
}
}
private void checkUpdateBluetoothHeadset() {
if (!USE_CONNECTION_SERVICE && btAdapter != null && btAdapter.isEnabled()) {
try {
MediaRouter mr = (MediaRouter) getSystemService(Context.MEDIA_ROUTER_SERVICE);
if (Build.VERSION.SDK_INT < 24) {
int headsetState = btAdapter.getProfileConnectionState(BluetoothProfile.HEADSET);
updateBluetoothHeadsetState(headsetState == BluetoothProfile.STATE_CONNECTED);
for (StateListener l : stateListeners) {
l.onAudioSettingsChanged();
}
} else {
MediaRouter.RouteInfo ri = mr.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_AUDIO);
if (ri.getDeviceType() == MediaRouter.RouteInfo.DEVICE_TYPE_BLUETOOTH) {
int headsetState = btAdapter.getProfileConnectionState(BluetoothProfile.HEADSET);
updateBluetoothHeadsetState(headsetState == BluetoothProfile.STATE_CONNECTED);
for (StateListener l : stateListeners) {
l.onAudioSettingsChanged();
}
} else {
updateBluetoothHeadsetState(false);
}
}
} catch (Throwable e) {
FileLog.e(e);
}
}
}
private void loadResources() {
if (Build.VERSION.SDK_INT >= 21) {
WebRtcAudioTrack.setAudioTrackUsageAttribute(AudioAttributes.USAGE_VOICE_COMMUNICATION);

View file

@ -71,7 +71,7 @@ public class TLRPC {
public static final int MESSAGE_FLAG_HAS_BOT_ID = 0x00000800;
public static final int MESSAGE_FLAG_EDITED = 0x00008000;
public static final int LAYER = 152;
public static final int LAYER = 155;
public static class TL_stats_megagroupStats extends TLObject {
public static int constructor = 0xef7ff916;
@ -2510,9 +2510,6 @@ public class TLRPC {
record_video_active = (flags & 2048) != 0;
rtmp_stream = (flags & 4096) != 0;
listeners_hidden = (flags & 8192) != 0;
if (SharedConfig.forceRtmpStream) {
rtmp_stream = true;
}
id = stream.readInt64(exception);
access_hash = stream.readInt64(exception);
participants_count = stream.readInt32(exception);
@ -2683,13 +2680,18 @@ public class TLRPC {
public boolean unread;
public Peer peer_id;
public Reaction reaction;
public int date;
public boolean dateIsSeen; //custom
public static MessagePeerReaction TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
MessagePeerReaction result = null;
switch (constructor) {
case 0xb156fe9c:
case 0x8c79b63c:
result = new TL_messagePeerReaction();
break;
case 0xb156fe9c:
result = new TL_messagePeerReaction_layer154();
break;
case 0x51b67eff:
result = new TL_messagePeerReaction_layer144();
break;
@ -2708,6 +2710,29 @@ public class TLRPC {
}
public static class TL_messagePeerReaction extends MessagePeerReaction {
public static int constructor = 0x8c79b63c;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
big = (flags & 1) != 0;
unread = (flags & 2) != 0;
peer_id = Peer.TLdeserialize(stream, stream.readInt32(exception), exception);
date = stream.readInt32(exception);
reaction = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = big ? (flags | 1) : (flags &~ 1);
flags = unread ? (flags | 2) : (flags &~ 2);
stream.writeInt32(flags);
peer_id.serializeToStream(stream);
stream.writeInt32(date);
reaction.serializeToStream(stream);
}
}
public static class TL_messagePeerReaction_layer154 extends MessagePeerReaction {
public static int constructor = 0xb156fe9c;
public void readParams(AbstractSerializedData stream, boolean exception) {
@ -7164,6 +7189,37 @@ public class TLRPC {
}
}
public static class TL_readParticipantDate extends TLObject {
public static int constructor = 0x4a4ff172;
public long user_id;
public int date;
public static TL_readParticipantDate TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_readParticipantDate.constructor != constructor) {
if (exception) {
throw new RuntimeException(String.format("can't parse magic %x in TL_readParticipantDate", constructor));
} else {
return null;
}
}
TL_readParticipantDate result = new TL_readParticipantDate();
result.readParams(stream, exception);
return result;
}
public void readParams(AbstractSerializedData stream, boolean exception) {
user_id = stream.readInt64(exception);
date = stream.readInt32(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt64(user_id);
stream.writeInt32(date);
}
}
public static class TL_statsGroupTopInviter extends TLObject {
public static int constructor = 0x535f779d;
@ -9500,6 +9556,54 @@ public class TLRPC {
}
}
public static abstract class help_AppConfig extends TLObject {
public static help_AppConfig TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
help_AppConfig result = null;
switch (constructor) {
case 0xdd18782e:
result = new TL_help_appConfig();
break;
case 0x7cde641d:
result = new TL_help_appConfigNotModified();
break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in help_AppConfig", constructor));
}
if (result != null) {
result.readParams(stream, exception);
}
return result;
}
}
public static class TL_help_appConfig extends help_AppConfig {
public static int constructor = 0xdd18782e;
public int hash;
public JSONValue config;
public void readParams(AbstractSerializedData stream, boolean exception) {
hash = stream.readInt32(exception);
config = JSONValue.TLdeserialize(stream, stream.readInt32(exception), exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(hash);
config.serializeToStream(stream);
}
}
public static class TL_help_appConfigNotModified extends help_AppConfig {
public static int constructor = 0x7cde641d;
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static abstract class messages_DhConfig extends TLObject {
public byte[] random;
public int g;
@ -24391,6 +24495,9 @@ public class TLRPC {
result = new TL_messageActionChatEditTitle();
break;
case 0xabe9affe:
result = new TL_messageActionBotAllowed_layer153();
break;
case 0xc516d679:
result = new TL_messageActionBotAllowed();
break;
case 0x96163f56:
@ -24641,7 +24748,7 @@ public class TLRPC {
}
public static class TL_messages_getMessageReadParticipants extends TLObject {
public static int constructor = 0x2c6f97b7;
public static int constructor = 0x31c1c44f;
public InputPeer peer;
public int msg_id;
@ -24650,7 +24757,11 @@ public class TLRPC {
Vector vector = new Vector();
int size = stream.readInt32(exception);
for (int a = 0; a < size; a++) {
vector.objects.add(stream.readInt64(exception));
TL_readParticipantDate object = TL_readParticipantDate.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return vector;
}
vector.objects.add(object);
}
return vector;
}
@ -25312,6 +25423,37 @@ public class TLRPC {
}
public static class TL_messageActionBotAllowed extends MessageAction {
public static int constructor = 0xc516d679;
public boolean attach_menu;
public String domain;
public BotApp app;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
attach_menu = (flags & 2) != 0;
if ((flags & 1) != 0) {
domain = stream.readString(exception);
}
if ((flags & 4) != 0) {
app = BotApp.TLdeserialize(stream, stream.readInt32(exception), exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = attach_menu ? (flags | 2) : (flags &~ 2);
stream.writeInt32(flags);
if ((flags & 1) != 0) {
stream.writeString(domain);
}
if ((flags & 4) != 0) {
app.serializeToStream(stream);
}
}
}
public static class TL_messageActionBotAllowed_layer153 extends MessageAction {
public static int constructor = 0xabe9affe;
public String domain;
@ -31343,6 +31485,9 @@ public class TLRPC {
case 0x20529438:
result = new TL_updateUser();
break;
case 0xccf08ad6:
result = new TL_updateGroupInvitePrivacyForbidden();
break;
case 0x17b7a20b:
result = new TL_updateAttachMenuBots();
break;
@ -36206,17 +36351,15 @@ public class TLRPC {
}
}
public static class TL_config extends TLObject {
public static int constructor = 0x232566ac;
public static int constructor = 0xcc1a241e;
public int flags;
public boolean phonecalls_enabled;
public boolean default_p2p_contacts;
public boolean preload_featured_stickers;
public boolean ignore_phone_entities;
public boolean revoke_pm_inbox;
public boolean blocked_mode;
public boolean pfs_enabled;
public boolean force_try_ipv6;
public int date;
public int expires;
@ -36235,17 +36378,13 @@ public class TLRPC {
public int notify_default_delay_ms;
public int push_chat_period_ms;
public int push_chat_limit;
public int saved_gifs_limit;
public int edit_time_limit;
public int revoke_time_limit;
public int revoke_pm_time_limit;
public int rating_e_decay;
public int stickers_recent_limit;
public int stickers_faved_limit;
public int channels_read_media_period;
public int tmp_sessions;
public int pinned_dialogs_count_max;
public int pinned_infolder_count_max;
public int call_receive_timeout_ms;
public int call_ring_timeout_ms;
public int call_connect_timeout_ms;
@ -36263,6 +36402,7 @@ public class TLRPC {
public int lang_pack_version;
public int base_lang_pack_version;
public Reaction reactions_default;
public String autologin_token;
public static TL_config TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_config.constructor != constructor) {
@ -36279,13 +36419,10 @@ public class TLRPC {
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
phonecalls_enabled = (flags & 2) != 0;
default_p2p_contacts = (flags & 8) != 0;
preload_featured_stickers = (flags & 16) != 0;
ignore_phone_entities = (flags & 32) != 0;
revoke_pm_inbox = (flags & 64) != 0;
blocked_mode = (flags & 256) != 0;
pfs_enabled = (flags & 8192) != 0;
force_try_ipv6 = (flags & 16384) != 0;
date = stream.readInt32(exception);
expires = stream.readInt32(exception);
@ -36318,19 +36455,15 @@ public class TLRPC {
notify_default_delay_ms = stream.readInt32(exception);
push_chat_period_ms = stream.readInt32(exception);
push_chat_limit = stream.readInt32(exception);
saved_gifs_limit = stream.readInt32(exception);
edit_time_limit = stream.readInt32(exception);
revoke_time_limit = stream.readInt32(exception);
revoke_pm_time_limit = stream.readInt32(exception);
rating_e_decay = stream.readInt32(exception);
stickers_recent_limit = stream.readInt32(exception);
stickers_faved_limit = stream.readInt32(exception);
channels_read_media_period = stream.readInt32(exception);
if ((flags & 1) != 0) {
tmp_sessions = stream.readInt32(exception);
}
pinned_dialogs_count_max = stream.readInt32(exception);
pinned_infolder_count_max = stream.readInt32(exception);
call_receive_timeout_ms = stream.readInt32(exception);
call_ring_timeout_ms = stream.readInt32(exception);
call_connect_timeout_ms = stream.readInt32(exception);
@ -36366,17 +36499,17 @@ public class TLRPC {
if ((flags & 32768) != 0) {
reactions_default = Reaction.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 65536) != 0) {
autologin_token = stream.readString(exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = phonecalls_enabled ? (flags | 2) : (flags &~ 2);
flags = default_p2p_contacts ? (flags | 8) : (flags &~ 8);
flags = preload_featured_stickers ? (flags | 16) : (flags &~ 16);
flags = ignore_phone_entities ? (flags | 32) : (flags &~ 32);
flags = revoke_pm_inbox ? (flags | 64) : (flags &~ 64);
flags = blocked_mode ? (flags | 256) : (flags &~ 256);
flags = pfs_enabled ? (flags | 8192) : (flags &~ 8192);
flags = force_try_ipv6 ? (flags | 16384) : (flags &~ 16384);
stream.writeInt32(flags);
stream.writeInt32(date);
@ -36401,19 +36534,15 @@ public class TLRPC {
stream.writeInt32(notify_default_delay_ms);
stream.writeInt32(push_chat_period_ms);
stream.writeInt32(push_chat_limit);
stream.writeInt32(saved_gifs_limit);
stream.writeInt32(edit_time_limit);
stream.writeInt32(revoke_time_limit);
stream.writeInt32(revoke_pm_time_limit);
stream.writeInt32(rating_e_decay);
stream.writeInt32(stickers_recent_limit);
stream.writeInt32(stickers_faved_limit);
stream.writeInt32(channels_read_media_period);
if ((flags & 1) != 0) {
stream.writeInt32(tmp_sessions);
}
stream.writeInt32(pinned_dialogs_count_max);
stream.writeInt32(pinned_infolder_count_max);
stream.writeInt32(call_receive_timeout_ms);
stream.writeInt32(call_ring_timeout_ms);
stream.writeInt32(call_connect_timeout_ms);
@ -36449,6 +36578,9 @@ public class TLRPC {
if ((flags & 32768) != 0) {
reactions_default.serializeToStream(stream);
}
if ((flags & 65536) != 0) {
stream.writeString(autologin_token);
}
}
}
@ -37076,6 +37208,7 @@ public class TLRPC {
public ArrayList<BotInlineResult> results = new ArrayList<>();
public int cache_time;
public ArrayList<User> users = new ArrayList<>();
public TL_inlineBotWebView switch_webview;
public static messages_BotResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
messages_BotResults result = null;
@ -37084,6 +37217,9 @@ public class TLRPC {
result = new TL_messages_botResults_layer71();
break;
case 0x947ca848:
result = new TL_messages_botResults_layer153();
break;
case 0xe021f2f6:
result = new TL_messages_botResults();
break;
}
@ -37097,7 +37233,7 @@ public class TLRPC {
}
}
public static class TL_messages_botResults_layer71 extends TL_messages_botResults {
public static class TL_messages_botResults_layer71 extends TL_messages_botResults_layer153 {
public static int constructor = 0xccd3563d;
@ -37151,6 +37287,99 @@ public class TLRPC {
}
public static class TL_messages_botResults extends messages_BotResults {
public static int constructor = 0xe021f2f6;
public static TL_messages_botResults TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_messages_botResults.constructor != constructor) {
if (exception) {
throw new RuntimeException(String.format("can't parse magic %x in TL_messages_botResults", constructor));
} else {
return null;
}
}
TL_messages_botResults result = new TL_messages_botResults();
result.readParams(stream, exception);
return result;
}
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
gallery = (flags & 1) != 0;
query_id = stream.readInt64(exception);
if ((flags & 2) != 0) {
next_offset = stream.readString(exception);
}
if ((flags & 4) != 0) {
switch_pm = TL_inlineBotSwitchPM.TLdeserialize(stream, stream.readInt32(exception), exception);
}
if ((flags & 8) != 0) {
switch_webview = TL_inlineBotWebView.TLdeserialize(stream, stream.readInt32(exception), exception);
}
int magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
int count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
BotInlineResult object = BotInlineResult.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
results.add(object);
}
cache_time = stream.readInt32(exception);
magic = stream.readInt32(exception);
if (magic != 0x1cb5c415) {
if (exception) {
throw new RuntimeException(String.format("wrong Vector magic, got %x", magic));
}
return;
}
count = stream.readInt32(exception);
for (int a = 0; a < count; a++) {
User object = User.TLdeserialize(stream, stream.readInt32(exception), exception);
if (object == null) {
return;
}
users.add(object);
}
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = gallery ? (flags | 1) : (flags &~ 1);
stream.writeInt32(flags);
stream.writeInt64(query_id);
if ((flags & 2) != 0) {
stream.writeString(next_offset);
}
if ((flags & 4) != 0) {
switch_pm.serializeToStream(stream);
}
if ((flags & 8) != 0) {
switch_webview.serializeToStream(stream);
}
stream.writeInt32(0x1cb5c415);
int count = results.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
results.get(a).serializeToStream(stream);
}
stream.writeInt32(cache_time);
stream.writeInt32(0x1cb5c415);
count = users.size();
stream.writeInt32(count);
for (int a = 0; a < count; a++) {
users.get(a).serializeToStream(stream);
}
}
}
public static class TL_messages_botResults_layer153 extends messages_BotResults {
public static int constructor = 0x947ca848;
@ -38016,9 +38245,11 @@ public class TLRPC {
}
public static class TL_sponsoredMessage extends TLObject {
public static int constructor = 0x3a836df8;
public static int constructor = 0xfc25b828;
public int flags;
public boolean recommended;
public boolean show_peer_photo;
public byte[] random_id;
public Peer from_id;
public ChatInvite chat_invite;
@ -38027,8 +38258,8 @@ public class TLRPC {
public String start_param;
public String message;
public ArrayList<MessageEntity> entities = new ArrayList<>();
public boolean recommended;
public boolean show_peer_photo;
public String sponsor_info;
public String additional_info;
public static TL_sponsoredMessage TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_sponsoredMessage.constructor != constructor) {
@ -38081,6 +38312,12 @@ public class TLRPC {
entities.add(object);
}
}
if ((flags & 128) != 0) {
sponsor_info = stream.readString(exception);
}
if ((flags & 256) != 0) {
additional_info = stream.readString(exception);
}
}
public void serializeToStream(AbstractSerializedData stream) {
@ -38113,6 +38350,12 @@ public class TLRPC {
entities.get(a).serializeToStream(stream);
}
}
if ((flags & 128) != 0) {
stream.writeString(sponsor_info);
}
if ((flags & 256) != 0) {
stream.writeString(additional_info);
}
}
}
@ -52586,18 +52829,21 @@ public class TLRPC {
}
public static class TL_help_getAppConfig extends TLObject {
public static int constructor = 0x98914110;
public static int constructor = 0x61e3f854;
public int hash;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return JSONValue.TLdeserialize(stream, constructor, exception);
return help_AppConfig.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(hash);
}
}
public static class TL_help_saveAppLog extends TLObject {
public static int constructor = 0x6f02f748;
@ -64240,10 +64486,59 @@ public class TLRPC {
}
}
public static class TL_messages_getBotApp extends TLObject {
public static int constructor = 0x34fdc5c3;
public InputBotApp app;
public long hash;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return TL_messages_botApp.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
app.serializeToStream(stream);
stream.writeInt64(hash);
}
}
public static class TL_messages_requestAppWebView extends TLObject {
public static int constructor = 0x8c5a3b3c;
public int flags;
public boolean write_allowed;
public InputPeer peer;
public InputBotApp app;
public String start_param;
public TL_dataJSON theme_params;
public String platform;
public TLObject deserializeResponse(AbstractSerializedData stream, int constructor, boolean exception) {
return TL_appWebViewResultUrl.TLdeserialize(stream, constructor, exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = write_allowed ? (flags | 1) : (flags &~ 1);
stream.writeInt32(flags);
peer.serializeToStream(stream);
app.serializeToStream(stream);
if ((flags & 2) != 0) {
stream.writeString(start_param);
}
if ((flags & 4) != 0) {
theme_params.serializeToStream(stream);
}
stream.writeString(platform);
}
}
public static class TL_messages_requestSimpleWebView extends TLObject {
public static int constructor = 0x299bec8e;
public int flags;
public boolean from_switch_webview;
public InputUser bot;
public String url;
public TL_dataJSON theme_params;
@ -64255,6 +64550,7 @@ public class TLRPC {
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = from_switch_webview ? (flags | 2) : (flags &~ 2);
stream.writeInt32(flags);
bot.serializeToStream(stream);
stream.writeString(url);
@ -64793,6 +65089,237 @@ public class TLRPC {
}
}
public static abstract class InputBotApp extends TLObject {
public static InputBotApp TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
InputBotApp result = null;
switch (constructor) {
case 0xa920bd7a:
result = new TL_inputBotAppID();
break;
case 0x908c0407:
result = new TL_inputBotAppShortName();
break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in InputBotApp", constructor));
}
if (result != null) {
result.readParams(stream, exception);
}
return result;
}
}
public static class TL_inputBotAppID extends InputBotApp {
public static int constructor = 0xa920bd7a;
public long id;
public long access_hash;
public void readParams(AbstractSerializedData stream, boolean exception) {
id = stream.readInt64(exception);
access_hash = stream.readInt64(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt64(id);
stream.writeInt64(access_hash);
}
}
public static class TL_inputBotAppShortName extends InputBotApp {
public static int constructor = 0x908c0407;
public InputUser bot_id;
public String short_name;
public void readParams(AbstractSerializedData stream, boolean exception) {
bot_id = InputUser.TLdeserialize(stream, stream.readInt32(exception), exception);
short_name = stream.readString(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
bot_id.serializeToStream(stream);
stream.writeString(short_name);
}
}
public static abstract class BotApp extends TLObject {
public int flags;
public long id;
public long access_hash;
public String short_name;
public String title;
public String description;
public Photo photo;
public Document document;
public long hash;
public static BotApp TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
BotApp result = null;
switch (constructor) {
case 0x5da674b7:
result = new TL_botAppNotModified();
break;
case 0x95fcd1d6:
result = new TL_botApp();
break;
}
if (result == null && exception) {
throw new RuntimeException(String.format("can't parse magic %x in BotApp", constructor));
}
if (result != null) {
result.readParams(stream, exception);
}
return result;
}
}
public static class TL_botAppNotModified extends BotApp {
public static int constructor = 0x5da674b7;
public void readParams(AbstractSerializedData stream, boolean exception) {
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
}
}
public static class TL_botApp extends BotApp {
public static int constructor = 0x95fcd1d6;
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
id = stream.readInt64(exception);
access_hash = stream.readInt64(exception);
short_name = stream.readString(exception);
title = stream.readString(exception);
description = stream.readString(exception);
photo = Photo.TLdeserialize(stream, stream.readInt32(exception), exception);
if ((flags & 1) != 0) {
document = Document.TLdeserialize(stream, stream.readInt32(exception), exception);
}
hash = stream.readInt64(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt32(flags);
stream.writeInt64(id);
stream.writeInt64(access_hash);
stream.writeString(short_name);
stream.writeString(title);
stream.writeString(description);
photo.serializeToStream(stream);
if ((flags & 1) != 0) {
document.serializeToStream(stream);
}
stream.writeInt64(hash);
}
}
public static class TL_messages_botApp extends TLObject {
public static int constructor = 0xeb50adf5;
public int flags;
public boolean inactive;
public boolean request_write_access;
public BotApp app;
public static TL_messages_botApp TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_messages_botApp.constructor != constructor) {
if (exception) {
throw new RuntimeException(String.format("can't parse magic %x in TL_messages_botApp", constructor));
} else {
return null;
}
}
TL_messages_botApp result = new TL_messages_botApp();
result.readParams(stream, exception);
return result;
}
public void readParams(AbstractSerializedData stream, boolean exception) {
flags = stream.readInt32(exception);
inactive = (flags & 1) != 0;
request_write_access = (flags & 2) != 0;
app = BotApp.TLdeserialize(stream, stream.readInt32(exception), exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
flags = inactive ? (flags | 1) : (flags &~ 1);
flags = request_write_access ? (flags | 2) : (flags &~ 2);
stream.writeInt32(flags);
app.serializeToStream(stream);
}
}
public static class TL_appWebViewResultUrl extends TLObject {
public static int constructor = 0x3c1b4f0d;
public String url;
public static TL_appWebViewResultUrl TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_appWebViewResultUrl.constructor != constructor) {
if (exception) {
throw new RuntimeException(String.format("can't parse magic %x in TL_appWebViewResultUrl", constructor));
} else {
return null;
}
}
TL_appWebViewResultUrl result = new TL_appWebViewResultUrl();
result.readParams(stream, exception);
return result;
}
public void readParams(AbstractSerializedData stream, boolean exception) {
url = stream.readString(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeString(url);
}
}
public static class TL_inlineBotWebView extends TLObject {
public static int constructor = 0xb57295d5;
public String text;
public String url;
public static TL_inlineBotWebView TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
if (TL_inlineBotWebView.constructor != constructor) {
if (exception) {
throw new RuntimeException(String.format("can't parse magic %x in TL_inlineBotWebView", constructor));
} else {
return null;
}
}
TL_inlineBotWebView result = new TL_inlineBotWebView();
result.readParams(stream, exception);
return result;
}
public void readParams(AbstractSerializedData stream, boolean exception) {
text = stream.readString(exception);
url = stream.readString(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeString(text);
stream.writeString(url);
}
}
public static abstract class account_SavedRingtone extends TLObject {
public static account_SavedRingtone TLdeserialize(AbstractSerializedData stream, int constructor, boolean exception) {
@ -66432,6 +66959,21 @@ public class TLRPC {
}
}
public static class TL_updateGroupInvitePrivacyForbidden extends Update {
public static int constructor = 0xccf08ad6;
public long user_id;
public void readParams(AbstractSerializedData stream, boolean exception) {
user_id = stream.readInt64(exception);
}
public void serializeToStream(AbstractSerializedData stream) {
stream.writeInt32(constructor);
stream.writeInt64(user_id);
}
}
//functions
public static class Vector extends TLObject {

View file

@ -1436,7 +1436,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
}
};
}
AndroidUtilities.runOnUIThread(waitingForKeyboardCloseRunnable, SharedConfig.smoothKeyboard ? 250 : 200);
AndroidUtilities.runOnUIThread(waitingForKeyboardCloseRunnable, 250);
} else if (fragment.needDelayOpenAnimation()) {
delayedOpenAnimationRunnable = new Runnable() {
@Override
@ -2384,7 +2384,7 @@ public class ActionBarLayout extends FrameLayout implements INavigationLayout, F
}
@Override
public ViewGroup getOverlayContainerView() {
public FrameLayout getOverlayContainerView() {
return this;
}

View file

@ -49,6 +49,7 @@ import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.annotation.Nullable;
@ -60,6 +61,7 @@ import org.telegram.messenger.LocaleController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.Adapters.FiltersView;
import org.telegram.ui.Components.BackupImageView;
@ -184,6 +186,7 @@ public class ActionBarMenuItem extends FrameLayout {
private ArrayList<FiltersView.MediaFilterData> currentSearchFilters = new ArrayList<>();
private int selectedFilterIndex = -1;
private int notificationIndex = -1;
private float dimMenu;
private float transitionOffset;
private View showSubMenuFrom;
@ -702,7 +705,7 @@ public class ActionBarMenuItem extends FrameLayout {
linearLayout.setOrientation(LinearLayout.VERTICAL);
FrameLayout frameLayout = new FrameLayout(getContext());
frameLayout.setAlpha(0f);
frameLayout.animate().alpha(1f).setDuration(100).start();
frameLayout.animate().alpha(1f).setDuration(100).setStartDelay(popupLayout.shownFromBottom ? 165 : 0).start();
if (topView.getParent() instanceof ViewGroup) {
((ViewGroup) topView.getParent()).removeView(topView);
}
@ -713,7 +716,7 @@ public class ActionBarMenuItem extends FrameLayout {
}
frameLayout.addView(topView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
linearLayout.addView(frameLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
linearLayout.addView(popupLayout, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 0, -AndroidUtilities.dp(4), 0, 0));
linearLayout.addView(popupLayout, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, 0, 0, -10, 0, 0));
container = linearLayout;
popupLayout.setTopView(frameLayout);
}
@ -760,11 +763,29 @@ public class ActionBarMenuItem extends FrameLayout {
popupLayout.getSwipeBack().closeForeground(false);
}
popupWindow.startAnimation();
if (dimMenu > 0) {
popupWindow.dimBehind(dimMenu);
}
}
public void setDimMenu(float dimAmount) {
dimMenu = dimAmount;
}
public void toggleSubMenu() {
toggleSubMenu(null, null);
}
public void setOnMenuDismiss(Utilities.Callback<Boolean> onMenuDismiss) {
if (popupWindow != null) {
popupWindow.setOnDismissListener(() -> {
if (onMenuDismiss != null) {
onMenuDismiss.run(processedPopupClick);
}
});
}
}
public void openSearch(boolean openKeyboard) {
checkCreateSearchField();
if (searchContainer == null || searchContainer.getVisibility() == VISIBLE || parentMenu == null) {
@ -1433,7 +1454,7 @@ public class ActionBarMenuItem extends FrameLayout {
}
});
searchField.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN | EditorInfo.IME_ACTION_SEARCH);
searchField.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN | EditorInfo.IME_ACTION_SEARCH | EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS | EditorInfo.IME_FLAG_NAVIGATE_NEXT);
searchField.setTextIsSelectable(false);
searchField.setHighlightColor(getThemedColor(Theme.key_chat_inTextSelectionHighlight));
searchField.setHandlesColor(getThemedColor(Theme.key_chat_TextSelectionCursor));

View file

@ -11,29 +11,47 @@ import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.LinearGradient;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Pair;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.core.graphics.ColorUtils;
import androidx.core.math.MathUtils;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.Utilities;
import org.telegram.ui.Components.AnimatedFloat;
import org.telegram.ui.Components.AnimatedTextView;
import org.telegram.ui.Components.CubicBezierInterpolator;
import org.telegram.ui.Components.FloatSeekBarAccessibilityDelegate;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.MotionBackgroundDrawable;
import org.telegram.ui.Components.SeekBarAccessibilityDelegate;
import org.telegram.ui.Components.SeekBarView;
import org.telegram.ui.Components.SpeedIconDrawable;
public class ActionBarMenuSlider extends FrameLayout {
@ -42,6 +60,8 @@ public class ActionBarMenuSlider extends FrameLayout {
private float value = .5f;
private Utilities.Callback2<Float, Boolean> onValueChange;
private AnimatedTextView.AnimatedTextDrawable textDrawable;
private AnimatedFloat blurBitmapAlpha = new AnimatedFloat(1, this, 0, 320, CubicBezierInterpolator.EASE_OUT_QUINT);
private Bitmap blurBitmap;
private BitmapShader blurBitmapShader;
@ -49,17 +69,19 @@ public class ActionBarMenuSlider extends FrameLayout {
private int[] location = new int[2];
private float roundRadiusDp = 6f;
private boolean drawShadow;
private float roundRadiusDp = 0;
private boolean drawShadow, drawBlur;
private Theme.ResourcesProvider resourcesProvider;
protected Theme.ResourcesProvider resourcesProvider;
private Paint shadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint backgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint blurPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint brightenBlurPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint darkenBlurPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint pseudoBlurPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private boolean backgroundDark;
private boolean blurIsInChat = true;
@ -72,24 +94,49 @@ public class ActionBarMenuSlider extends FrameLayout {
this(context, null);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return false;
}
public ActionBarMenuSlider(Context context, Theme.ResourcesProvider resourcesProvider) {
super(context);
this.resourcesProvider = resourcesProvider;
setWillNotDraw(false);
textDrawable = new AnimatedTextView.AnimatedTextDrawable(false, true, true) {
@Override
public void invalidateSelf() {
ActionBarMenuSlider.this.invalidate();
}
};
textDrawable.setCallback(this);
textDrawable.setTypeface(AndroidUtilities.getTypeface(AndroidUtilities.TYPEFACE_ROBOTO_MEDIUM));
textDrawable.setAnimationProperties(.3f, 0, 165, CubicBezierInterpolator.EASE_OUT_QUINT);
textDrawable.setTextSize(AndroidUtilities.dpf2(14));
textDrawable.getPaint().setStyle(Paint.Style.FILL_AND_STROKE);
textDrawable.getPaint().setStrokeWidth(AndroidUtilities.dpf2(.3f));
textDrawable.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
shadowPaint.setColor(Color.TRANSPARENT);
shadowPaint.setShadowLayer(dpf2(1.33f), 0, dpf2(.33f), 0x3f000000);
setDrawShadow(true);
ColorMatrix colorMatrix = new ColorMatrix();
AndroidUtilities.adjustSaturationColorMatrix(colorMatrix, -0.4f);
AndroidUtilities.adjustBrightnessColorMatrix(colorMatrix, .1f);
pseudoBlurPaint.setColorFilter(new ColorMatrixColorFilter(colorMatrix));
backgroundPaint.setColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, resourcesProvider));
backgroundDark = AndroidUtilities.computePerceivedBrightness(backgroundPaint.getColor()) <= 0.721f;
textDrawable.setTextColor(backgroundDark ? 0xffffffff : 0xff000000);
darkenBlurPaint.setColor(Theme.multAlpha(0xff000000, .025f));
brightenBlurPaint.setColor(Theme.multAlpha(0xffffffff, .35f));
}
public float getValue() {
return value;
}
private ValueAnimator valueAnimator;
public void setValue(float value, boolean animated) {
@ -98,11 +145,13 @@ public class ActionBarMenuSlider extends FrameLayout {
valueAnimator = null;
}
value = MathUtils.clamp(value, 0, 1);
if (!animated) {
this.value = MathUtils.clamp(value, 0, 1);
this.value = value;
invalidate();
} else {
final float newValue = MathUtils.clamp(value, 0, 1);
final float newValue = value;
valueAnimator = ValueAnimator.ofFloat(this.value, newValue);
valueAnimator.addUpdateListener(anm -> {
ActionBarMenuSlider.this.value = (float) anm.getAnimatedValue();
@ -120,6 +169,31 @@ public class ActionBarMenuSlider extends FrameLayout {
valueAnimator.setDuration(220);
valueAnimator.start();
}
String stringValue = getStringValue(value);
if (stringValue != null && !TextUtils.equals(textDrawable.getText(), stringValue)) {
textDrawable.cancelAnimation();
textDrawable.setText(stringValue, true);
}
fillPaint.setColor(getColorValue(value));
}
public void setBackgroundColor(int color) {
backgroundPaint.setColor(color);
backgroundDark = AndroidUtilities.computePerceivedBrightness(backgroundPaint.getColor()) <= 0.721f;
textDrawable.setTextColor(backgroundDark ? 0xffffffff : 0xff000000);
}
public void setTextColor(int color) {
textDrawable.setTextColor(color);
}
protected String getStringValue(float value) {
return null;
}
protected int getColorValue(float value) {
return Color.WHITE;
}
private void updateValue(float value, boolean isFinal) {
@ -140,6 +214,11 @@ public class ActionBarMenuSlider extends FrameLayout {
invalidate();
}
public void setDrawBlur(boolean draw) {
drawBlur = draw;
invalidate();
}
public void setRoundRadiusDp(float roundRadiusDp) {
this.roundRadiusDp = roundRadiusDp;
invalidate();
@ -169,10 +248,10 @@ public class ActionBarMenuSlider extends FrameLayout {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec) + getPaddingRight() + getPaddingLeft(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(dp(44) + getPaddingTop() + getPaddingBottom(), MeasureSpec.EXACTLY));
super.onMeasure(drawShadow ? MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec) + getPaddingRight() + getPaddingLeft(), MeasureSpec.EXACTLY) : widthMeasureSpec, MeasureSpec.makeMeasureSpec(dp(44) + getPaddingTop() + getPaddingBottom(), MeasureSpec.EXACTLY));
final boolean canDoBlur = SharedConfig.getDevicePerformanceClass() >= SharedConfig.PERFORMANCE_CLASS_HIGH && LiteMode.isEnabled(LiteMode.FLAG_CHAT_BLUR);
if (blurBitmap == null && !preparingBlur && canDoBlur) {
if (drawBlur && blurBitmap == null && !preparingBlur && canDoBlur) {
this.prepareBlur.run();
// removeCallbacks(this.prepareBlur);
// post(this.prepareBlur);
@ -220,40 +299,65 @@ public class ActionBarMenuSlider extends FrameLayout {
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), shadowPaint);
}
final float blurAlpha = blurBitmapAlpha.set(blurBitmap != null ? 1 : 0);
if (blurAlpha < 1f) {
if (pseudoBlurMatrix == null || pseudoBlurWidth != (int) AndroidUtilities.rectTmp.width()) {
if (pseudoBlurMatrix == null) {
pseudoBlurMatrix = new Matrix();
} else {
pseudoBlurMatrix.reset();
if (drawBlur) {
final float blurAlpha = blurBitmapAlpha.set(blurBitmap != null ? 1 : 0);
if (blurAlpha < 1f) {
if (pseudoBlurMatrix == null || pseudoBlurWidth != (int) AndroidUtilities.rectTmp.width()) {
if (pseudoBlurMatrix == null) {
pseudoBlurMatrix = new Matrix();
} else {
pseudoBlurMatrix.reset();
}
pseudoBlurMatrix.postScale(pseudoBlurWidth = (int) AndroidUtilities.rectTmp.width(), 1);
pseudoBlurGradient.setLocalMatrix(pseudoBlurMatrix);
}
pseudoBlurMatrix.postScale(pseudoBlurWidth = (int) AndroidUtilities.rectTmp.width(), 1);
pseudoBlurGradient.setLocalMatrix(pseudoBlurMatrix);
pseudoBlurPaint.setAlpha((int) (0xFF * (1f - blurAlpha)));
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), pseudoBlurPaint);
}
pseudoBlurPaint.setAlpha((int) (0xFF * (1f - blurAlpha)));
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), pseudoBlurPaint);
if (blurBitmap != null && value < 1 && blurAlpha > 0) {
blurPaint.setAlpha((int) (0xFF * blurAlpha));
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), blurPaint);
}
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), brightenBlurPaint);
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), darkenBlurPaint);
fillPaint.setColor(Color.WHITE);
} else {
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), backgroundPaint);
}
if (blurBitmap != null && value < 1 && blurAlpha > 0) {
blurPaint.setAlpha((int) (0xFF * blurAlpha));
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), blurPaint);
if (!backgroundDark) {
drawText(canvas, false);
}
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), brightenBlurPaint);
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), darkenBlurPaint);
// fillPaint.setColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, resourcesProvider));
fillPaint.setColor(Color.WHITE);
if (value < 1) {
canvas.save();
canvas.clipRect(getPaddingLeft(), getPaddingTop(), getPaddingLeft() + (getWidth() - getPaddingLeft() - getPaddingRight()) * value, getHeight() - getPaddingBottom());
}
canvas.drawRoundRect(AndroidUtilities.rectTmp, dp(roundRadiusDp), dp(roundRadiusDp), fillPaint);
if (!backgroundDark) {
drawText(canvas, true);
}
if (value < 1) {
canvas.restore();
}
if (backgroundDark) {
drawText(canvas, false);
}
}
private ColorFilter whiteColorFilter;
private void drawText(Canvas canvas, boolean white) {
textDrawable.setColorFilter(white ? (whiteColorFilter == null ? whiteColorFilter = new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN) : whiteColorFilter) : null);
textDrawable.setBounds(getPaddingLeft() + dp(20), getMeasuredHeight() / 2, getMeasuredWidth() - getPaddingRight() - dp(20), getMeasuredHeight() / 2);
textDrawable.draw(canvas);
}
private Pair<Integer, Integer> getBitmapGradientColors(Bitmap bitmap) {
@ -331,13 +435,11 @@ public class ActionBarMenuSlider extends FrameLayout {
fromX = x;
fromValue = value;
tapStart = System.currentTimeMillis();
return true;
} else if (action == MotionEvent.ACTION_MOVE || action == MotionEvent.ACTION_UP) {
if (action == MotionEvent.ACTION_UP) {
dragging = false;
if (System.currentTimeMillis() - tapStart < ViewConfiguration.getTapTimeout()) {
final float value = (x - getPaddingLeft()) / (getWidth() - getPaddingLeft() - getPaddingRight());
// setValue(value, true);
if (onValueChange != null) {
onValueChange.run(value, true);
}
@ -346,9 +448,110 @@ public class ActionBarMenuSlider extends FrameLayout {
}
final float value = fromValue + (x - fromX) / Math.max(1, getWidth() - getPaddingLeft() - getPaddingRight());
updateValue(value, !dragging);
return true;
}
return super.onTouchEvent(event);
return true;
}
public static class SpeedSlider extends ActionBarMenuSlider {
private final SeekBarAccessibilityDelegate seekBarAccessibilityDelegate;
public static final float MIN_SPEED = 0.2f;
public static final float MAX_SPEED = 2.5f;
public SpeedSlider(Context context, Theme.ResourcesProvider resourcesProvider) {
super(context, resourcesProvider);
setFocusable(true);
setFocusableInTouchMode(true);
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
setAccessibilityDelegate(seekBarAccessibilityDelegate = new FloatSeekBarAccessibilityDelegate(false) {
@Override
public float getProgress() {
return getSpeed();
}
@Override
public void setProgress(float progress) {
setSpeed(progress, true);
}
@Override
protected float getMinValue() {
return MIN_SPEED;
}
@Override
protected float getMaxValue() {
return MAX_SPEED;
}
@Override
protected float getDelta() {
return 0.2f;
}
@Override
public CharSequence getContentDescription(View host) {
return SpeedIconDrawable.formatNumber(getSpeed()) + "x " + LocaleController.getString("AccDescrSpeedSlider", R.string.AccDescrSpeedSlider);
}
});
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
seekBarAccessibilityDelegate.onInitializeAccessibilityNodeInfoInternal(this, info);
}
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
return super.performAccessibilityAction(action, arguments) || seekBarAccessibilityDelegate.performAccessibilityActionInternal(this, action, arguments);
}
public float getSpeed(float value) {
return MIN_SPEED + (MAX_SPEED - MIN_SPEED) * value;
}
public float getSpeed() {
return getSpeed(getValue());
}
public void setSpeed(float speed, boolean animated) {
setValue((speed - MIN_SPEED) / (MAX_SPEED - MIN_SPEED), animated);
}
@Override
protected String getStringValue(float value) {
return SpeedIconDrawable.formatNumber(MIN_SPEED + value * (MAX_SPEED - MIN_SPEED)) + "x";
}
@Override
protected int getColorValue(float value) {
final float speed = MIN_SPEED + value * (MAX_SPEED - MIN_SPEED);
// if (speed <= 0.3f) {
// return Theme.getColor(Theme.key_color_red, resourcesProvider);
// } else if (speed <= 0.5f) {
// return ColorUtils.blendARGB(
// Theme.getColor(Theme.key_color_red, resourcesProvider),
// Theme.getColor(Theme.key_color_yellow, resourcesProvider),
// (speed - 0.3f) / (0.5f - 0.3f)
// );
// } else if (speed <= 1f) {
// return ColorUtils.blendARGB(
// Theme.getColor(Theme.key_color_yellow, resourcesProvider),
// Theme.getColor(Theme.key_color_lightblue, resourcesProvider),
// MathUtils.clamp((speed - 0.5f) / (1f - 0.5f), 0, 1)
// );
// } else {
return ColorUtils.blendARGB(
Theme.getColor(Theme.key_color_lightblue, resourcesProvider),
Theme.getColor(Theme.key_color_blue, resourcesProvider),
MathUtils.clamp((speed - 1f) / (2f - 1f), 0, 1)
);
// }
}
}
}

View file

@ -257,9 +257,7 @@ public class ActionBarMenuSubItem extends FrameLayout {
}
void updateBackground() {
int topBackgroundRadius = top ? 6 : 0;
int bottomBackgroundRadius = bottom ? 6 : 0;
setBackground(Theme.createRadSelectorDrawable(selectorColor, topBackgroundRadius, bottomBackgroundRadius));
setBackground(Theme.createRadSelectorDrawable(selectorColor, top ? 6 : 0, bottom ? 6 : 0));
}
private int getThemedColor(String key) {

View file

@ -21,7 +21,6 @@ import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
@ -106,7 +105,7 @@ public class ActionBarPopupWindow extends PopupWindow {
private boolean startAnimationPending = false;
private int backAlpha = 255;
private int lastStartedChild = 0;
private boolean shownFromBottom;
public boolean shownFromBottom;
private boolean animationEnabled = allowAnimation;
private ArrayList<AnimatorSet> itemAnimators;
private HashMap<View, Integer> positions = new HashMap<>();
@ -295,16 +294,6 @@ public class ActionBarPopupWindow extends PopupWindow {
}
}
public void translateChildrenAfter(int index, float ty) {
subtractBackgroundHeight = (int) -ty;
for (int i = index + 1; i < linearLayout.getChildCount(); ++i) {
View child = linearLayout.getChildAt(i);
if (child != null) {
child.setTranslationY(ty);
}
}
}
@Keep
public void setBackScaleY(float value) {
if (backScaleY != value) {
@ -728,12 +717,16 @@ public class ActionBarPopupWindow extends PopupWindow {
}
public void dimBehind() {
dimBehind(0.2f);
}
public void dimBehind(float amount) {
View container = getContentView().getRootView();
Context context = getContentView().getContext();
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams p = (WindowManager.LayoutParams) container.getLayoutParams();
p.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
p.dimAmount = 0.2f;
p.dimAmount = amount;
wm.updateViewLayout(container, p);
}
@ -1050,21 +1043,20 @@ public class ActionBarPopupWindow extends PopupWindow {
public static class GapView extends FrameLayout {
Theme.ResourcesProvider resourcesProvider;
String colorKey;
Drawable shadowDrawable;
public GapView(Context context, Theme.ResourcesProvider resourcesProvider) {
this(context, resourcesProvider, Theme.key_actionBarDefaultSubmenuSeparator);
}
public GapView(Context context, Theme.ResourcesProvider resourcesProvider, String colorKey) {
public GapView(Context context, int color, int shadowColor) {
super(context);
this.resourcesProvider = resourcesProvider;
this.colorKey = colorKey;
this.shadowDrawable = Theme.getThemedDrawable(getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow, resourcesProvider);
setBackgroundColor(Theme.getColor(colorKey, resourcesProvider));
this.shadowDrawable = Theme.getThemedDrawable(getContext(), R.drawable.greydivider, shadowColor);
setBackgroundColor(color);
}
public GapView(Context context, Theme.ResourcesProvider resourcesProvider, String colorKey) {
this(context, Theme.getColor(colorKey, resourcesProvider), Theme.getColor(Theme.key_windowBackgroundGrayShadow, resourcesProvider));
}
public void setColor(int color) {

View file

@ -86,10 +86,6 @@ public class AdjustPanLayoutHelper {
ViewTreeObserver.OnPreDrawListener onPreDrawListener = new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
if (!SharedConfig.smoothKeyboard) {
onDetach();
return true;
}
int contentHeight = parent.getHeight();
if (contentHeight - startOffset() == previousHeight - previousStartOffset || contentHeight == previousHeight || animator != null) {
if (animator == null) {
@ -280,9 +276,6 @@ public class AdjustPanLayoutHelper {
}
public void onAttach() {
if (!SharedConfig.smoothKeyboard) {
return;
}
onDetach();
Context context = parent.getContext();
Activity activity = getActivity(context);

View file

@ -75,7 +75,6 @@ import java.util.Map;
public class AlertDialog extends Dialog implements Drawable.Callback, NotificationCenter.NotificationCenterDelegate {
public static final int ALERT_TYPE_MESSAGE = 0;
public static final int ALERT_TYPE_SPINNER_DETAIL = 1; // not used?
public static final int ALERT_TYPE_LOADING = 2;
public static final int ALERT_TYPE_SPINNER = 3;
@ -200,7 +199,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
public void redPositive() {
TextView button = (TextView) getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(getThemedColor(Theme.key_dialogTextRed2));
button.setTextColor(getThemedColor(Theme.key_dialogTextRed));
}
}
@ -279,7 +278,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
backgroundPaddings = new Rect();
if (progressStyle != ALERT_TYPE_SPINNER || blurredBackground) {
shadowDrawable = context.getResources().getDrawable(R.drawable.popup_fixed_alert3).mutate();
blurOpacity = progressStyle == ALERT_TYPE_SPINNER ? 0.55f : (isDark ? 0.80f : 0.97f);
blurOpacity = progressStyle == ALERT_TYPE_SPINNER ? 0.55f : (isDark ? 0.80f : 0.985f);
shadowDrawable.setColorFilter(new PorterDuffColorFilter(backgroundColor, PorterDuff.Mode.MULTIPLY));
shadowDrawable.getPadding(backgroundPaddings);
}
@ -736,18 +735,7 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
messageTextView.setEnabled(false);
}
messageTextView.setGravity((topAnimationIsNew ? Gravity.CENTER_HORIZONTAL : LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP);
if (progressViewStyle == ALERT_TYPE_SPINNER_DETAIL) {
progressViewContainer = new FrameLayout(getContext());
containerView.addView(progressViewContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 44, Gravity.LEFT | Gravity.TOP, 23, title == null ? 24 : 0, 23, 24));
RadialProgressView progressView = new RadialProgressView(getContext(), resourcesProvider);
progressView.setProgressColor(getThemedColor(Theme.key_dialogProgressCircle));
progressViewContainer.addView(progressView, LayoutHelper.createFrame(44, 44, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP));
messageTextView.setLines(1);
messageTextView.setEllipsize(TextUtils.TruncateAt.END);
progressViewContainer.addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL, (LocaleController.isRTL ? 0 : 62), 0, (LocaleController.isRTL ? 62 : 0), 0));
} else if (progressViewStyle == ALERT_TYPE_LOADING) {
if (progressViewStyle == ALERT_TYPE_LOADING) {
containerView.addView(messageTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 24, title == null ? 19 : 0, 24, 20));
lineProgressView = new LineProgressView(getContext());
@ -1225,10 +1213,6 @@ public class AlertDialog extends Dialog implements Drawable.Callback, Notificati
}
}
public void setProgressStyle(int style) {
progressViewStyle = style;
}
public void setDismissDialogByButtons(boolean value) {
dismissDialogByButtons = value;
}

View file

@ -466,11 +466,6 @@ public class BottomSheet extends Dialog {
}
}
@Override
public void requestLayout() {
super.requestLayout();
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
layoutCount--;
@ -1100,7 +1095,8 @@ public class BottomSheet extends Dialog {
containerView.setClipChildren(false);
container.setClipToPadding(false);
container.setClipChildren(false);
containerView.addView(customView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, customViewGravity, 0, -backgroundPaddingTop + topOffset, 0, 0));
containerView.addView(customView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, customViewGravity, 0, topOffset, 0, 0));
((ViewGroup.MarginLayoutParams) customView.getLayoutParams()).topMargin = -backgroundPaddingTop + AndroidUtilities.dp(topOffset);
} else {
containerView.addView(customView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, customViewGravity, 0, topOffset, 0, 0));
}
@ -1239,7 +1235,7 @@ public class BottomSheet extends Dialog {
}
public int getBackgroundPaddingTop() {
return backgroundPaddingTop;
return backgroundPaddingTop ;
}
public void setAllowDrawContent(boolean value) {

View file

@ -40,6 +40,8 @@ import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.gms.vision.Frame;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
@ -50,7 +52,7 @@ public class DrawerLayoutContainer extends FrameLayout {
private static final int MIN_DRAWER_MARGIN = 64;
private ViewGroup drawerLayout;
private FrameLayout drawerLayout;
private INavigationLayout parentActionBarLayout;
private boolean maybeStartTracking;
@ -174,7 +176,7 @@ public class DrawerLayoutContainer extends FrameLayout {
return 0;
}
public void setDrawerLayout(ViewGroup layout) {
public void setDrawerLayout(FrameLayout layout) {
drawerLayout = layout;
addView(drawerLayout);
drawerLayout.setVisibility(INVISIBLE);
@ -303,7 +305,7 @@ public class DrawerLayoutContainer extends FrameLayout {
return scrimOpacity;
}
public View getDrawerLayout() {
public FrameLayout getDrawerLayout() {
return drawerLayout;
}
@ -318,6 +320,10 @@ public class DrawerLayoutContainer extends FrameLayout {
closeDrawer(false);
}
public INavigationLayout getParentActionBarLayout() {
return parentActionBarLayout;
}
public void openStatusSelect() {
}

View file

@ -8,10 +8,9 @@ import android.graphics.drawable.Drawable;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import org.telegram.messenger.SharedConfig;
import org.telegram.ui.Components.BackButtonMenu;
import org.telegram.ui.LNavigation.LNavigation;
import java.util.ArrayList;
import java.util.HashMap;
@ -49,7 +48,7 @@ public interface INavigationLayout {
void expandPreviewFragment();
void finishPreviewFragment();
void setFragmentPanTranslationOffset(int offset);
ViewGroup getOverlayContainerView();
FrameLayout getOverlayContainerView();
void setHighlightActionButtons(boolean highlight);
float getCurrentPreviewFragmentAlpha();
void drawCurrentPreviewFragment(Canvas canvas, Drawable foregroundDrawable);
@ -77,7 +76,7 @@ public interface INavigationLayout {
void setPulledDialogs(List<BackButtonMenu.PulledDialog> pulledDialogs);
static INavigationLayout newLayout(Context context) {
return SharedConfig.useLNavigation ? new LNavigation(context) : new ActionBarLayout(context);
return new ActionBarLayout(context);
}
default void removeFragmentFromStack(BaseFragment fragment) {

View file

@ -32,6 +32,8 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import androidx.annotation.NonNull;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.LocaleController;
@ -538,6 +540,11 @@ public class SimpleTextView extends View implements Drawable.Callback {
}
}
@Override
protected boolean verifyDrawable(@NonNull Drawable who) {
return who == rightDrawable || who == leftDrawable || super.verifyDrawable(who);
}
public void replaceTextWithDrawable(Drawable drawable, String replacedText) {
if (replacedDrawable == drawable) {
return;

View file

@ -65,6 +65,8 @@ import android.util.LongSparseArray;
import android.util.SparseArray;
import android.util.StateSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -99,6 +101,8 @@ import org.telegram.tgnet.SerializedData;
import org.telegram.tgnet.TLRPC;
import org.telegram.ui.Components.AudioVisualizerDrawable;
import org.telegram.ui.Components.BackgroundGradientDrawable;
import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.ChoosingStickerStatusDrawable;
import org.telegram.ui.Components.CombinedDrawable;
import org.telegram.ui.Components.FragmentContextViewWavesDrawable;
@ -117,6 +121,7 @@ import org.telegram.ui.Components.StatusDrawable;
import org.telegram.ui.Components.ThemeEditorView;
import org.telegram.ui.Components.TypingDotsDrawable;
import org.telegram.ui.RoundVideoProgressShadow;
import org.telegram.ui.ThemeActivity;
import java.io.File;
import java.io.FileInputStream;
@ -757,6 +762,10 @@ public class Theme {
}
if (invalidatePath || overrideRoundRadius != 0) {
path.rewind();
int heightHalf = (bounds.height() - padding) >> 1;
if (rad > heightHalf) {
rad = heightHalf;
}
if (isOut) {
if (drawFullBubble || currentType == TYPE_PREVIEW || paintToUse != null || drawFullBottom) {
if (currentType == TYPE_MEDIA) {
@ -1489,7 +1498,6 @@ public class Theme {
currentColors.put(key_chat_outInstant, textColor);
currentColors.put(key_chat_outInstantSelected, textColor);
currentColors.put(key_chat_outPreviewInstantText, textColor);
currentColors.put(key_chat_outPreviewInstantSelectedText, textColor);
currentColors.put(key_chat_outViews, textColor);
currentColors.put(key_chat_outViewsSelected, textColor);
@ -3030,7 +3038,6 @@ public class Theme {
public static Paint chat_docBackPaint;
public static Paint chat_deleteProgressPaint;
public static Paint chat_botProgressPaint;
public static Paint chat_urlPaint;
public static Paint chat_outUrlPaint;
public static Paint chat_textSearchSelectionPaint;
@ -3183,8 +3190,7 @@ public class Theme {
public static RLottieDrawable[] chat_attachButtonDrawables = new RLottieDrawable[6];
public static Drawable[] chat_locationDrawable = new Drawable[2];
public static Drawable[] chat_contactDrawable = new Drawable[2];
public static Drawable[][] chat_fileStatesDrawable = new Drawable[10][2];
public static Drawable[][] chat_photoStatesDrawables = new Drawable[13][2];
public static Drawable[][] chat_fileStatesDrawable = new Drawable[5][2];
public static Drawable calllog_msgCallUpRedDrawable;
public static Drawable calllog_msgCallUpGreenDrawable;
@ -3205,10 +3211,8 @@ public class Theme {
public static final String key_dialogTextLink = "dialogTextLink";
public static final String key_dialogLinkSelection = "dialogLinkSelection";
public static final String key_dialogTextRed = "dialogTextRed";
public static final String key_dialogTextRed2 = "dialogTextRed2";
public static final String key_dialogTextBlue = "dialogTextBlue";
public static final String key_dialogTextBlue2 = "dialogTextBlue2";
public static final String key_dialogTextBlue3 = "dialogTextBlue3";
public static final String key_dialogTextBlue4 = "dialogTextBlue4";
public static final String key_dialogTextGray = "dialogTextGray";
public static final String key_dialogTextGray2 = "dialogTextGray2";
@ -3224,11 +3228,8 @@ public class Theme {
public static final String key_dialogScrollGlow = "dialogScrollGlow";
public static final String key_dialogRoundCheckBox = "dialogRoundCheckBox";
public static final String key_dialogRoundCheckBoxCheck = "dialogRoundCheckBoxCheck";
public static final String key_dialogBadgeBackground = "dialogBadgeBackground";
public static final String key_dialogBadgeText = "dialogBadgeText";
public static final String key_dialogRadioBackground = "dialogRadioBackground";
public static final String key_dialogRadioBackgroundChecked = "dialogRadioBackgroundChecked";
public static final String key_dialogProgressCircle = "dialogProgressCircle";
public static final String key_dialogLineProgress = "dialogLineProgress";
public static final String key_dialogLineProgressBackground = "dialogLineProgressBackground";
public static final String key_dialogButton = "dialogButton";
@ -3278,8 +3279,6 @@ public class Theme {
public static final String key_windowBackgroundWhiteRedText3 = "windowBackgroundWhiteRedText3";
public static final String key_windowBackgroundWhiteRedText4 = "windowBackgroundWhiteRedText4";
public static final String key_windowBackgroundWhiteRedText5 = "windowBackgroundWhiteRedText5";
public static final String key_windowBackgroundWhiteRedText6 = "windowBackgroundWhiteRedText6";
public static final String key_windowBackgroundWhiteYellowText = "windowBackgroundWhiteYellowText";
public static final String key_windowBackgroundWhiteGrayText = "windowBackgroundWhiteGrayText";
public static final String key_windowBackgroundWhiteGrayText2 = "windowBackgroundWhiteGrayText2";
public static final String key_windowBackgroundWhiteGrayText3 = "windowBackgroundWhiteGrayText3";
@ -3288,7 +3287,6 @@ public class Theme {
public static final String key_windowBackgroundWhiteGrayText6 = "windowBackgroundWhiteGrayText6";
public static final String key_windowBackgroundWhiteGrayText7 = "windowBackgroundWhiteGrayText7";
public static final String key_windowBackgroundWhiteGrayText8 = "windowBackgroundWhiteGrayText8";
public static final String key_windowBackgroundWhiteGrayLine = "windowBackgroundWhiteGrayLine";
public static final String key_windowBackgroundWhiteBlackText = "windowBackgroundWhiteBlackText";
public static final String key_windowBackgroundWhiteHintText = "windowBackgroundWhiteHintText";
public static final String key_windowBackgroundWhiteValueText = "windowBackgroundWhiteValueText";
@ -3385,7 +3383,6 @@ public class Theme {
public static final String key_actionBarDefaultSelector = "actionBarDefaultSelector";
public static final String key_actionBarWhiteSelector = "actionBarWhiteSelector";
public static final String key_actionBarDefaultIcon = "actionBarDefaultIcon";
public static final String key_actionBarTipBackground = "actionBarTipBackground";
public static final String key_actionBarActionModeDefault = "actionBarActionModeDefault";
public static final String key_actionBarActionModeDefaultTop = "actionBarActionModeDefaultTop";
public static final String key_actionBarActionModeDefaultIcon = "actionBarActionModeDefaultIcon";
@ -3419,7 +3416,6 @@ public class Theme {
public static final String key_chats_nameArchived = "chats_nameArchived";
public static final String key_chats_secretName = "chats_secretName";
public static final String key_chats_secretIcon = "chats_secretIcon";
public static final String key_chats_nameIcon = "chats_nameIcon";
public static final String key_chats_pinnedIcon = "chats_pinnedIcon";
public static final String key_chats_archiveBackground = "chats_archiveBackground";
public static final String key_chats_archivePinBackground = "chats_archivePinBackground";
@ -3458,21 +3454,14 @@ public class Theme {
public static final String key_chats_menuPhoneCats = "chats_menuPhoneCats";
public static final String key_chats_menuTopBackgroundCats = "chats_menuTopBackgroundCats";
public static final String key_chats_menuTopBackground = "chats_menuTopBackground";
public static final String key_chats_menuCloud = "chats_menuCloud";
public static final String key_chats_menuCloudBackgroundCats = "chats_menuCloudBackgroundCats";
public static final String key_chats_actionIcon = "chats_actionIcon";
public static final String key_chats_actionBackground = "chats_actionBackground";
public static final String key_chats_actionPressedBackground = "chats_actionPressedBackground";
public static final String key_chats_actionUnreadIcon = "chats_actionUnreadIcon";
public static final String key_chats_actionUnreadBackground = "chats_actionUnreadBackground";
public static final String key_chats_actionUnreadPressedBackground = "chats_actionUnreadPressedBackground";
public static final String key_chats_archivePullDownBackground = "chats_archivePullDownBackground";
public static final String key_chats_archivePullDownBackgroundActive = "chats_archivePullDownBackgroundActive";
public static final String key_chats_tabUnreadActiveBackground = "chats_tabUnreadActiveBackground";
public static final String key_chats_tabUnreadUnactiveBackground = "chats_tabUnreadUnactiveBackground";
public static final String key_chat_attachMediaBanBackground = "chat_attachMediaBanBackground";
public static final String key_chat_attachMediaBanText = "chat_attachMediaBanText";
public static final String key_chat_attachCheckBoxCheck = "chat_attachCheckBoxCheck";
public static final String key_chat_attachCheckBoxBackground = "chat_attachCheckBoxBackground";
public static final String key_chat_attachPhotoBackground = "chat_attachPhotoBackground";
@ -3488,23 +3477,18 @@ public class Theme {
public static final String key_chat_inPollWrongAnswer = "chat_inPollWrongAnswer";
public static final String key_chat_outPollWrongAnswer = "chat_outPollWrongAnswer";
public static final String key_chat_attachIcon = "chat_attachIcon";
public static final String key_chat_attachGalleryBackground = "chat_attachGalleryBackground";
public static final String key_chat_attachGalleryIcon = "chat_attachGalleryIcon";
public static final String key_chat_attachGalleryText = "chat_attachGalleryText";
public static final String key_chat_attachAudioBackground = "chat_attachAudioBackground";
public static final String key_chat_attachAudioIcon = "chat_attachAudioIcon";
public static final String key_chat_attachAudioText = "chat_attachAudioText";
public static final String key_chat_attachFileBackground = "chat_attachFileBackground";
public static final String key_chat_attachFileIcon = "chat_attachFileIcon";
public static final String key_chat_attachFileText = "chat_attachFileText";
public static final String key_chat_attachContactBackground = "chat_attachContactBackground";
public static final String key_chat_attachContactIcon = "chat_attachContactIcon";
public static final String key_chat_attachContactText = "chat_attachContactText";
public static final String key_chat_attachLocationBackground = "chat_attachLocationBackground";
public static final String key_chat_attachLocationIcon = "chat_attachLocationIcon";
public static final String key_chat_attachLocationText = "chat_attachLocationText";
public static final String key_chat_attachPollBackground = "chat_attachPollBackground";
public static final String key_chat_attachPollIcon = "chat_attachPollIcon";
public static final String key_chat_attachPollText = "chat_attachPollText";
public static final String key_chat_status = "chat_status";
@ -3572,12 +3556,9 @@ public class Theme {
public static final String key_chat_previewGameText = "chat_previewGameText";
public static final String key_chat_inPreviewInstantText = "chat_inPreviewInstantText";
public static final String key_chat_outPreviewInstantText = "chat_outPreviewInstantText";
public static final String key_chat_inPreviewInstantSelectedText = "chat_inPreviewInstantSelectedText";
public static final String key_chat_outPreviewInstantSelectedText = "chat_outPreviewInstantSelectedText";
public static final String key_chat_secretTimeText = "chat_secretTimeText";
public static final String key_chat_stickerNameText = "chat_stickerNameText";
public static final String key_chat_botButtonText = "chat_botButtonText";
public static final String key_chat_botProgress = "chat_botProgress";
public static final String key_chat_inForwardedNameText = "chat_inForwardedNameText";
public static final String key_chat_outForwardedNameText = "chat_outForwardedNameText";
public static final String key_chat_inPsaNameText = "chat_inPsaNameText";
@ -3683,7 +3664,6 @@ public class Theme {
public static final String key_chat_messagePanelVoiceLock = "key_chat_messagePanelVoiceLock";
public static final String key_chat_messagePanelVoiceLockBackground = "key_chat_messagePanelVoiceLockBackground";
public static final String key_chat_messagePanelVoiceLockShadow = "key_chat_messagePanelVoiceLockShadow";
public static final String key_chat_messagePanelVideoFrame = "chat_messagePanelVideoFrame";
public static final String key_chat_topPanelBackground = "chat_topPanelBackground";
public static final String key_chat_topPanelClose = "chat_topPanelClose";
public static final String key_chat_topPanelLine = "chat_topPanelLine";
@ -3696,33 +3676,20 @@ public class Theme {
public static final String key_chat_outLoader = "chat_outLoader";
public static final String key_chat_outLoaderSelected = "chat_outLoaderSelected";
public static final String key_chat_inLoaderPhoto = "chat_inLoaderPhoto";
public static final String key_chat_inLoaderPhotoSelected = "chat_inLoaderPhotoSelected";
public static final String key_chat_inLoaderPhotoIcon = "chat_inLoaderPhotoIcon";
public static final String key_chat_inLoaderPhotoIconSelected = "chat_inLoaderPhotoIconSelected";
public static final String key_chat_outLoaderPhoto = "chat_outLoaderPhoto";
public static final String key_chat_outLoaderPhotoSelected = "chat_outLoaderPhotoSelected";
public static final String key_chat_outLoaderPhotoIcon = "chat_outLoaderPhotoIcon";
public static final String key_chat_outLoaderPhotoIconSelected = "chat_outLoaderPhotoIconSelected";
public static final String key_chat_mediaLoaderPhoto = "chat_mediaLoaderPhoto";
public static final String key_chat_mediaLoaderPhotoSelected = "chat_mediaLoaderPhotoSelected";
public static final String key_chat_mediaLoaderPhotoIcon = "chat_mediaLoaderPhotoIcon";
public static final String key_chat_mediaLoaderPhotoIconSelected = "chat_mediaLoaderPhotoIconSelected";
public static final String key_chat_inLocationBackground = "chat_inLocationBackground";
public static final String key_chat_inLocationIcon = "chat_inLocationIcon";
public static final String key_chat_outLocationBackground = "chat_outLocationBackground";
public static final String key_chat_outLocationIcon = "chat_outLocationIcon";
public static final String key_chat_inContactBackground = "chat_inContactBackground";
public static final String key_chat_inContactIcon = "chat_inContactIcon";
public static final String key_chat_outContactBackground = "chat_outContactBackground";
public static final String key_chat_outContactIcon = "chat_outContactIcon";
public static final String key_chat_inFileIcon = "chat_inFileIcon";
public static final String key_chat_inFileSelectedIcon = "chat_inFileSelectedIcon";
public static final String key_chat_outFileIcon = "chat_outFileIcon";
public static final String key_chat_outFileSelectedIcon = "chat_outFileSelectedIcon";
public static final String key_chat_replyPanelIcons = "chat_replyPanelIcons";
public static final String key_chat_replyPanelClose = "chat_replyPanelClose";
public static final String key_chat_replyPanelName = "chat_replyPanelName";
public static final String key_chat_replyPanelMessage = "chat_replyPanelMessage";
public static final String key_chat_replyPanelLine = "chat_replyPanelLine";
public static final String key_chat_searchPanelIcons = "chat_searchPanelIcons";
public static final String key_chat_searchPanelText = "chat_searchPanelText";
@ -3735,21 +3702,16 @@ public class Theme {
public static final String key_chat_unreadMessagesStartBackground = "chat_unreadMessagesStartBackground";
public static final String key_chat_inlineResultIcon = "chat_inlineResultIcon";
public static final String key_chat_emojiPanelBackground = "chat_emojiPanelBackground";
public static final String key_chat_emojiPanelBadgeBackground = "chat_emojiPanelBadgeBackground";
public static final String key_chat_emojiPanelBadgeText = "chat_emojiPanelBadgeText";
public static final String key_chat_emojiSearchBackground = "chat_emojiSearchBackground";
public static final String key_chat_emojiSearchIcon = "chat_emojiSearchIcon";
public static final String key_chat_emojiPanelShadowLine = "chat_emojiPanelShadowLine";
public static final String key_chat_emojiPanelEmptyText = "chat_emojiPanelEmptyText";
public static final String key_chat_emojiPanelIcon = "chat_emojiPanelIcon";
public static final String key_chat_emojiPanelIconSelector = "chat_emojiPanelIconSelector";
public static final String key_chat_emojiBottomPanelIcon = "chat_emojiBottomPanelIcon";
public static final String key_chat_emojiPanelIconSelected = "chat_emojiPanelIconSelected";
public static final String key_chat_emojiPanelStickerPackSelector = "chat_emojiPanelStickerPackSelector";
public static final String key_chat_emojiPanelStickerPackSelectorLine = "chat_emojiPanelStickerPackSelectorLine";
public static final String key_chat_emojiPanelBackspace = "chat_emojiPanelBackspace";
public static final String key_chat_emojiPanelMasksIcon = "chat_emojiPanelMasksIcon";
public static final String key_chat_emojiPanelMasksIconSelected = "chat_emojiPanelMasksIconSelected";
public static final String key_chat_emojiPanelTrendingTitle = "chat_emojiPanelTrendingTitle";
public static final String key_chat_emojiPanelStickerSetName = "chat_emojiPanelStickerSetName";
public static final String key_chat_emojiPanelStickerSetNameHighlight = "chat_emojiPanelStickerSetNameHighlight";
@ -3774,15 +3736,11 @@ public class Theme {
public static final String key_chat_gifSaveHintText = "chat_gifSaveHintText";
public static final String key_chat_gifSaveHintBackground = "chat_gifSaveHintBackground";
public static final String key_chat_goDownButton = "chat_goDownButton";
public static final String key_chat_goDownButtonShadow = "chat_goDownButtonShadow";
public static final String key_chat_goDownButtonIcon = "chat_goDownButtonIcon";
public static final String key_chat_goDownButtonCounter = "chat_goDownButtonCounter";
public static final String key_chat_goDownButtonCounterBackground = "chat_goDownButtonCounterBackground";
public static final String key_chat_secretTimerBackground = "chat_secretTimerBackground";
public static final String key_chat_secretTimerText = "chat_secretTimerText";
public static final String key_chat_outTextSelectionHighlight = "chat_outTextSelectionHighlight";
public static final String key_chat_inTextSelectionHighlight = "chat_inTextSelectionHighlight";
public static final String key_chat_recordedVoiceHighlight = "key_chat_recordedVoiceHighlight";
public static final String key_chat_TextSelectionCursor = "chat_TextSelectionCursor";
public static final String key_chat_outTextSelectionCursor = "chat_outTextSelectionCursor";
public static final String key_chat_inBubbleLocationPlaceholder = "chat_inBubbleLocationPlaceholder";
@ -3792,9 +3750,7 @@ public class Theme {
public static final String key_voipgroup_listSelector = "voipgroup_listSelector";
public static final String key_voipgroup_inviteMembersBackground = "voipgroup_inviteMembersBackground";
public static final String key_voipgroup_actionBar = "voipgroup_actionBar";
public static final String key_voipgroup_emptyView = "voipgroup_emptyView";
public static final String key_voipgroup_actionBarItems = "voipgroup_actionBarItems";
public static final String key_voipgroup_actionBarSubtitle = "voipgroup_actionBarSubtitle";
public static final String key_voipgroup_actionBarItemsSelector = "voipgroup_actionBarItemsSelector";
public static final String key_voipgroup_actionBarUnscrolled = "voipgroup_actionBarUnscrolled";
public static final String key_voipgroup_listViewBackgroundUnscrolled = "voipgroup_listViewBackgroundUnscrolled";
@ -3827,7 +3783,6 @@ public class Theme {
public static final String key_voipgroup_disabledButtonActive = "voipgroup_disabledButtonActive";
public static final String key_voipgroup_disabledButtonActiveScrolled = "voipgroup_disabledButtonActiveScrolled";
public static final String key_voipgroup_connectingProgress = "voipgroup_connectingProgress";
public static final String key_voipgroup_blueText = "voipgroup_blueText";
public static final String key_voipgroup_scrollUp = "voipgroup_scrollUp";
public static final String key_voipgroup_searchPlaceholder = "voipgroup_searchPlaceholder";
public static final String key_voipgroup_searchBackground = "voipgroup_searchBackground";
@ -3877,7 +3832,6 @@ public class Theme {
public static final String key_sharedMedia_linkPlaceholder = "sharedMedia_linkPlaceholder";
public static final String key_sharedMedia_linkPlaceholderText = "sharedMedia_linkPlaceholderText";
public static final String key_sharedMedia_photoPlaceholder = "sharedMedia_photoPlaceholder";
public static final String key_sharedMedia_actionMode = "sharedMedia_actionMode";
public static final String key_featuredStickers_addedIcon = "featuredStickers_addedIcon";
public static final String key_featuredStickers_buttonProgress = "featuredStickers_buttonProgress";
@ -3890,7 +3844,6 @@ public class Theme {
public static final String key_stickers_menu = "stickers_menu";
public static final String key_stickers_menuSelector = "stickers_menuSelector";
public static final String key_changephoneinfo_image = "changephoneinfo_image";
public static final String key_changephoneinfo_image2 = "changephoneinfo_image2";
public static final String key_groupcreate_hintText = "groupcreate_hintText";
@ -3907,11 +3860,6 @@ public class Theme {
public static final String key_login_progressInner = "login_progressInner";
public static final String key_login_progressOuter = "login_progressOuter";
public static final String key_musicPicker_checkbox = "musicPicker_checkbox";
public static final String key_musicPicker_checkboxCheck = "musicPicker_checkboxCheck";
public static final String key_musicPicker_buttonBackground = "musicPicker_buttonBackground";
public static final String key_musicPicker_buttonIcon = "musicPicker_buttonIcon";
public static final String key_picker_enabledButton = "picker_enabledButton";
public static final String key_picker_disabledButton = "picker_disabledButton";
public static final String key_picker_badge = "picker_badge";
@ -3948,41 +3896,14 @@ public class Theme {
public static final String key_sheet_scrollUp = "key_sheet_scrollUp";
public static final String key_sheet_other = "key_sheet_other";
public static final String key_wallet_blackBackground = "wallet_blackBackground";
public static final String key_wallet_graySettingsBackground = "wallet_graySettingsBackground";
public static final String key_wallet_grayBackground = "wallet_grayBackground";
public static final String key_wallet_whiteBackground = "wallet_whiteBackground";
public static final String key_wallet_blackBackgroundSelector = "wallet_blackBackgroundSelector";
public static final String key_wallet_whiteText = "wallet_whiteText";
public static final String key_wallet_blackText = "wallet_blackText";
public static final String key_wallet_statusText = "wallet_statusText";
public static final String key_wallet_grayText = "wallet_grayText";
public static final String key_wallet_grayText2 = "wallet_grayText2";
public static final String key_wallet_greenText = "wallet_greenText";
public static final String key_wallet_redText = "wallet_redText";
public static final String key_wallet_dateText = "wallet_dateText";
public static final String key_wallet_commentText = "wallet_commentText";
public static final String key_wallet_releaseBackground = "wallet_releaseBackground";
public static final String key_wallet_pullBackground = "wallet_pullBackground";
public static final String key_wallet_buttonBackground = "wallet_buttonBackground";
public static final String key_wallet_buttonPressedBackground = "wallet_buttonPressedBackground";
public static final String key_wallet_buttonText = "wallet_buttonText";
public static final String key_wallet_addressConfirmBackground = "wallet_addressConfirmBackground";
//ununsed
public static final String key_chat_outBroadcast = "chat_outBroadcast";
public static final String key_chat_mediaBroadcast = "chat_mediaBroadcast";
public static final String key_player_actionBar = "player_actionBar";
public static final String key_player_actionBarSelector = "player_actionBarSelector";
public static final String key_player_actionBarTitle = "player_actionBarTitle";
public static final String key_player_actionBarTop = "player_actionBarTop";
public static final String key_player_actionBarSubtitle = "player_actionBarSubtitle";
public static final String key_player_actionBarItems = "player_actionBarItems";
public static final String key_player_background = "player_background";
public static final String key_player_time = "player_time";
public static final String key_player_progressBackground = "player_progressBackground";
public static final String key_player_progressBackground2 = "player_progressBackground2";
public static final String key_player_progressCachedBackground = "key_player_progressCachedBackground";
public static final String key_player_progress = "player_progress";
public static final String key_player_button = "player_button";
@ -3994,35 +3915,31 @@ public class Theme {
public static final String key_statisticChartActiveLine = "statisticChartActiveLine";
public static final String key_statisticChartInactivePickerChart = "statisticChartInactivePickerChart";
public static final String key_statisticChartActivePickerChart = "statisticChartActivePickerChart";
public static final String key_statisticChartPopupBackground = "statisticChartPopupBackground";
public static final String key_statisticChartRipple = "statisticChartRipple";
public static final String key_statisticChartBackZoomColor = "statisticChartBackZoomColor";
public static final String key_statisticChartCheckboxInactive = "statisticChartCheckboxInactive";
public static final String key_statisticChartNightIconColor = "statisticChartNightIconColor";
public static final String key_statisticChartChevronColor = "statisticChartChevronColor";
public static final String key_statisticChartHighlightColor = "statisticChartHighlightColor";
public final static String key_statisticChartLine_blue = "statisticChartLine_blue";
public final static String key_statisticChartLine_green = "statisticChartLine_green";
public final static String key_statisticChartLine_red = "statisticChartLine_red";
public final static String key_statisticChartLine_golden = "statisticChartLine_golden";
public final static String key_statisticChartLine_lightblue = "statisticChartLine_lightblue";
public final static String key_statisticChartLine_lightgreen = "statisticChartLine_lightgreen";
public final static String key_statisticChartLine_orange = "statisticChartLine_orange";
public final static String key_statisticChartLine_indigo = "statisticChartLine_indigo";
public final static String key_statisticChartLine_purple = "statisticChartLine_purple";
public final static String key_statisticChartLine_cyan = "statisticChartLine_cyan";
public final static String key_statisticChartLineEmpty = "statisticChartLineEmpty";
public static final String key_statisticChartLine_blue = "statisticChartLine_blue";
public static final String key_statisticChartLine_green = "statisticChartLine_green";
public static final String key_statisticChartLine_red = "statisticChartLine_red";
public static final String key_statisticChartLine_golden = "statisticChartLine_golden";
public static final String key_statisticChartLine_lightblue = "statisticChartLine_lightblue";
public static final String key_statisticChartLine_lightgreen = "statisticChartLine_lightgreen";
public static final String key_statisticChartLine_orange = "statisticChartLine_orange";
public static final String key_statisticChartLine_indigo = "statisticChartLine_indigo";
public static final String key_statisticChartLine_purple = "statisticChartLine_purple";
public static final String key_statisticChartLine_cyan = "statisticChartLine_cyan";
public static final String key_statisticChartLineEmpty = "statisticChartLineEmpty";
public final static String key_color_lightblue = "color_lightblue";
public final static String key_color_blue = "color_blue";
public final static String key_color_green = "color_green";
public final static String key_color_lightgreen = "color_lightgreen";
public final static String key_color_red = "color_red";
public final static String key_color_orange = "color_orange";
public final static String key_color_yellow = "color_yellow";
public final static String key_color_purple = "color_purple";
public final static String key_color_cyan = "color_cyan";
public final static String[] keys_colors = { key_color_lightblue, key_color_blue, key_color_green, key_color_lightgreen, key_color_red, key_color_orange, key_color_yellow, key_color_purple, key_color_cyan };
public static final String key_color_lightblue = "color_lightblue";
public static final String key_color_blue = "color_blue";
public static final String key_color_green = "color_green";
public static final String key_color_lightgreen = "color_lightgreen";
public static final String key_color_red = "color_red";
public static final String key_color_orange = "color_orange";
public static final String key_color_yellow = "color_yellow";
public static final String key_color_purple = "color_purple";
public static final String key_color_cyan = "color_cyan";
public static final String[] keys_colors = { key_color_lightblue, key_color_blue, key_color_green, key_color_lightgreen, key_color_red, key_color_orange, key_color_yellow, key_color_purple, key_color_cyan };
public static final String key_chat_outReactionButtonBackground = "chat_outReactionButtonBackground";
public static final String key_chat_inReactionButtonBackground = "chat_inReactionButtonBackground";
@ -4142,10 +4059,8 @@ public class Theme {
defaultColors.put(key_dialogTextLink, 0xff2678b6);
defaultColors.put(key_dialogLinkSelection, 0x3362a9e3);
defaultColors.put(key_dialogTextRed, 0xffcd5a5a);
defaultColors.put(key_dialogTextRed2, 0xffde3a3a);
defaultColors.put(key_dialogTextBlue, 0xff2f8cc9);
defaultColors.put(key_dialogTextBlue2, 0xff3a95d5);
defaultColors.put(key_dialogTextBlue3, 0xff3ec1f9);
defaultColors.put(key_dialogTextBlue4, 0xff19a7e8);
defaultColors.put(key_dialogTextGray, 0xff348bc1);
defaultColors.put(key_dialogTextGray2, 0xff757575);
@ -4164,7 +4079,6 @@ public class Theme {
defaultColors.put(key_dialogCheckboxSquareDisabled, 0xffb0b0b0);
defaultColors.put(key_dialogRadioBackground, 0xffb3b3b3);
defaultColors.put(key_dialogRadioBackgroundChecked, 0xff37a9f0);
defaultColors.put(key_dialogProgressCircle, 0xff0A0D0F);
defaultColors.put(key_dialogLineProgress, 0xff527da3);
defaultColors.put(key_dialogLineProgressBackground, 0xffdbdbdb);
defaultColors.put(key_dialogButton, 0xff4991cc);
@ -4172,8 +4086,6 @@ public class Theme {
defaultColors.put(key_dialogScrollGlow, 0xfff5f6f7);
defaultColors.put(key_dialogRoundCheckBox, 0xff4cb4f5);
defaultColors.put(key_dialogRoundCheckBoxCheck, 0xffffffff);
defaultColors.put(key_dialogBadgeBackground, 0xff3ec1f9);
defaultColors.put(key_dialogBadgeText, 0xffffffff);
defaultColors.put(key_dialogCameraIcon, 0xffffffff);
defaultColors.put(key_dialog_inlineProgressBackground, 0xf6f0f2f5);
defaultColors.put(key_dialog_inlineProgress, 0xff6b7378);
@ -4212,8 +4124,6 @@ public class Theme {
defaultColors.put(key_windowBackgroundWhiteRedText3, 0xffd24949);
defaultColors.put(key_windowBackgroundWhiteRedText4, 0xffcf3030);
defaultColors.put(key_windowBackgroundWhiteRedText5, 0xffed3939);
defaultColors.put(key_windowBackgroundWhiteRedText6, 0xffff6666);
defaultColors.put(key_windowBackgroundWhiteYellowText, 0xffD87B29);
defaultColors.put(key_windowBackgroundWhiteGrayText, 0xff838c96);
defaultColors.put(key_windowBackgroundWhiteGrayText2, 0xff82868a);
defaultColors.put(key_windowBackgroundWhiteGrayText3, 0xff999999);
@ -4222,7 +4132,6 @@ public class Theme {
defaultColors.put(key_windowBackgroundWhiteGrayText6, 0xff757575);
defaultColors.put(key_windowBackgroundWhiteGrayText7, 0xffc6c6c6);
defaultColors.put(key_windowBackgroundWhiteGrayText8, 0xff6d6d72);
defaultColors.put(key_windowBackgroundWhiteGrayLine, 0xffdbdbdb);
defaultColors.put(key_windowBackgroundWhiteBlackText, 0xff222222);
defaultColors.put(key_windowBackgroundWhiteHintText, 0xffa8a8a8);
defaultColors.put(key_windowBackgroundWhiteValueText, 0xff3a95d5);
@ -4344,7 +4253,6 @@ public class Theme {
defaultColors.put(key_chats_nameArchived, 0xff525252);
defaultColors.put(key_chats_secretName, 0xff00a60e);
defaultColors.put(key_chats_secretIcon, 0xff19b126);
defaultColors.put(key_chats_nameIcon, 0xff242424);
defaultColors.put(key_chats_pinnedIcon, 0xffa8a8a8);
defaultColors.put(key_chats_message, 0xff8b8d8f);
defaultColors.put(key_chats_messageArchived, 0xff919191);
@ -4375,20 +4283,13 @@ public class Theme {
defaultColors.put(key_chats_menuName, 0xffffffff);
defaultColors.put(key_chats_menuPhone, 0xffffffff);
defaultColors.put(key_chats_menuPhoneCats, 0xffc2e5ff);
defaultColors.put(key_chats_menuCloud, 0xffffffff);
defaultColors.put(key_chats_menuCloudBackgroundCats, 0xff427ba9);
defaultColors.put(key_chats_actionIcon, 0xffffffff);
defaultColors.put(key_chats_actionBackground, 0xff65a9e0);
defaultColors.put(key_chats_actionPressedBackground, 0xff569dd6);
defaultColors.put(key_chats_actionUnreadIcon, 0xff737373);
defaultColors.put(key_chats_actionUnreadBackground, 0xffffffff);
defaultColors.put(key_chats_actionUnreadPressedBackground, 0xfff2f2f2);
defaultColors.put(key_chats_menuTopBackgroundCats, 0xff598fba);
defaultColors.put(key_chats_archivePullDownBackground, 0xffc6c9cc);
defaultColors.put(key_chats_archivePullDownBackgroundActive, 0xff66a9e0);
defaultColors.put(key_chat_attachMediaBanBackground, 0xff464646);
defaultColors.put(key_chat_attachMediaBanText, 0xffffffff);
defaultColors.put(key_chat_attachCheckBoxCheck, 0xffffffff);
defaultColors.put(key_chat_attachCheckBoxBackground, 0xff39b2f7);
defaultColors.put(key_chat_attachPhotoBackground, 0x0c000000);
@ -4399,24 +4300,19 @@ public class Theme {
defaultColors.put(key_chat_attachPermissionText, 0xff6f777a);
defaultColors.put(key_chat_attachEmptyImage, 0xffcccccc);
defaultColors.put(key_chat_attachIcon, 0xffffffff);
defaultColors.put(key_chat_attachGalleryBackground, 0xff459df5);
defaultColors.put(key_chat_attachGalleryText, 0xff2e8de9);
defaultColors.put(key_chat_attachGalleryIcon, 0xffffffff);
defaultColors.put(key_chat_attachAudioBackground, 0xffeb6060);
defaultColors.put(key_chat_attachAudioText, 0xffde4747);
defaultColors.put(key_chat_attachAudioIcon, 0xffffffff);
defaultColors.put(key_chat_attachFileBackground, 0xff34b9f1);
defaultColors.put(key_chat_attachFileText, 0xff14a8e4);
defaultColors.put(key_chat_attachFileIcon, 0xffffffff);
defaultColors.put(key_chat_attachContactBackground, 0xfff2c04b);
defaultColors.put(key_chat_attachContactText, 0xffdfa000);
defaultColors.put(key_chat_attachContactIcon, 0xffffffff);
defaultColors.put(key_chat_attachLocationBackground, 0xff60c255);
defaultColors.put(key_chat_attachLocationText, 0xff3cab2f);
defaultColors.put(key_chat_attachLocationIcon, 0xffffffff);
defaultColors.put(key_chat_attachPollBackground, 0xfff2c04b);
defaultColors.put(key_chat_attachPollText, 0xffdfa000);
defaultColors.put(key_chat_attachPollIcon, 0xffffffff);
defaultColors.put(key_chat_inPollCorrectAnswer, 0xff60c255);
defaultColors.put(key_chat_outPollCorrectAnswer, 0xff60c255);
@ -4479,12 +4375,9 @@ public class Theme {
defaultColors.put(key_chat_previewGameText, 0xffffffff);
defaultColors.put(key_chat_inPreviewInstantText, 0xff3a8ccf);
defaultColors.put(key_chat_outPreviewInstantText, 0xff55ab4f);
defaultColors.put(key_chat_inPreviewInstantSelectedText, 0xff3079b5);
defaultColors.put(key_chat_outPreviewInstantSelectedText, 0xff489943);
defaultColors.put(key_chat_secretTimeText, 0xffe4e2e0);
defaultColors.put(key_chat_stickerNameText, 0xffffffff);
defaultColors.put(key_chat_botButtonText, 0xffffffff);
defaultColors.put(key_chat_botProgress, 0xffffffff);
defaultColors.put(key_chat_inForwardedNameText, 0xff3886c7);
defaultColors.put(key_chat_outForwardedNameText, 0xff55ab4f);
defaultColors.put(key_chat_inPsaNameText, 0xff5a9c39);
@ -4576,21 +4469,16 @@ public class Theme {
defaultColors.put(key_chat_outLinkSelectBackground, 0x3362a9e3);
defaultColors.put(key_chat_textSelectBackground, 0x6662a9e3);
defaultColors.put(key_chat_emojiPanelBackground, 0xfff0f2f5);
defaultColors.put(key_chat_emojiPanelBadgeBackground, 0xff4da6ea);
defaultColors.put(key_chat_emojiPanelBadgeText, 0xffffffff);
defaultColors.put(key_chat_emojiSearchBackground, 0xffe5e9ee);
defaultColors.put(key_chat_emojiSearchIcon, 0xff94a1af);
defaultColors.put(key_chat_emojiPanelShadowLine, 0x12000000);
defaultColors.put(key_chat_emojiPanelEmptyText, 0xff949ba1);
defaultColors.put(key_chat_emojiPanelIcon, 0xff9da4ab);
defaultColors.put(key_chat_emojiPanelIconSelector, 0x0b000000);
defaultColors.put(key_chat_emojiBottomPanelIcon, 0xff8c9197);
defaultColors.put(key_chat_emojiPanelIconSelected, 0xff5E6976);
defaultColors.put(key_chat_emojiPanelStickerPackSelector, 0xffe2e5e7);
defaultColors.put(key_chat_emojiPanelStickerPackSelectorLine, 0xff56abf0);
defaultColors.put(key_chat_emojiPanelBackspace, 0xff8c9197);
defaultColors.put(key_chat_emojiPanelMasksIcon, 0xffffffff);
defaultColors.put(key_chat_emojiPanelMasksIconSelected, 0xff62bfe8);
defaultColors.put(key_chat_emojiPanelTrendingTitle, 0xff222222);
defaultColors.put(key_chat_emojiPanelStickerSetName, 0xff828b94);
defaultColors.put(key_chat_emojiPanelStickerSetNameHighlight, 0xff278ddb);
@ -4602,20 +4490,13 @@ public class Theme {
defaultColors.put(key_chat_unreadMessagesStartArrowIcon, 0xffa2b5c7);
defaultColors.put(key_chat_unreadMessagesStartText, 0xff5695cc);
defaultColors.put(key_chat_unreadMessagesStartBackground, 0xffffffff);
defaultColors.put(key_chat_inFileIcon, 0xffa2b5c7);
defaultColors.put(key_chat_inFileSelectedIcon, 0xff87b6c5);
defaultColors.put(key_chat_outFileIcon, 0xff85bf78);
defaultColors.put(key_chat_outFileSelectedIcon, 0xff85bf78);
defaultColors.put(key_chat_inLocationBackground, 0xffebf0f5);
defaultColors.put(key_chat_inLocationIcon, 0xffa2b5c7);
defaultColors.put(key_chat_outLocationBackground, 0xffdaf5c3);
defaultColors.put(key_chat_outLocationIcon, 0xff87bf78);
defaultColors.put(key_chat_inContactBackground, 0xff72b5e8);
defaultColors.put(key_chat_inContactIcon, 0xffffffff);
defaultColors.put(key_chat_outContactBackground, 0xff78c272);
defaultColors.put(key_chat_outContactIcon, 0xffefffde);
defaultColors.put(key_chat_outBroadcast, 0xff46aa36);
defaultColors.put(key_chat_mediaBroadcast, 0xffffffff);
defaultColors.put(key_chat_searchPanelIcons, 0xff676a6f);
defaultColors.put(key_chat_searchPanelText, 0xff676a6f);
defaultColors.put(key_chat_secretChatStatusText, 0xff7f7f7f);
@ -4624,7 +4505,6 @@ public class Theme {
defaultColors.put(key_chat_replyPanelIcons, 0xff57a8e6);
defaultColors.put(key_chat_replyPanelClose, 0xff8e959b);
defaultColors.put(key_chat_replyPanelName, 0xff3a8ccf);
defaultColors.put(key_chat_replyPanelMessage, 0xff222222);
defaultColors.put(key_chat_replyPanelLine, 0xffe8e8e8);
defaultColors.put(key_chat_messagePanelBackground, 0xffffffff);
defaultColors.put(key_chat_messagePanelText, 0xff000000);
@ -4638,7 +4518,6 @@ public class Theme {
defaultColors.put(key_chat_recordedVoiceProgress, 0xffB1DEFF);
defaultColors.put(key_chat_recordedVoiceProgressInner, 0xffffffff);
defaultColors.put(key_chat_recordVoiceCancel, 0xff3A95D4);
defaultColors.put(key_chat_recordedVoiceHighlight, 0x64ffffff);
defaultColors.put(key_chat_messagePanelSend, 0xff62b0eb);
defaultColors.put(key_chat_messagePanelVoiceLock, 0xffa4a4a4);
defaultColors.put(key_chat_messagePanelVoiceLockBackground, 0xffffffff);
@ -4648,7 +4527,6 @@ public class Theme {
defaultColors.put(key_chat_gifSaveHintText, 0xffffffff);
defaultColors.put(key_chat_gifSaveHintBackground, 0xcc111111);
defaultColors.put(key_chat_goDownButton, 0xffffffff);
defaultColors.put(key_chat_goDownButtonShadow, 0xff000000);
defaultColors.put(key_chat_goDownButtonIcon, 0xff8e959b);
defaultColors.put(key_chat_goDownButtonCounter, 0xffffffff);
defaultColors.put(key_chat_goDownButtonCounterBackground, 0xff4da2e8);
@ -4670,19 +4548,10 @@ public class Theme {
defaultColors.put(key_chat_outLoader, 0xff78c272);
defaultColors.put(key_chat_outLoaderSelected, 0xff6ab564);
defaultColors.put(key_chat_inLoaderPhoto, 0xffa2b8c8);
defaultColors.put(key_chat_inLoaderPhotoSelected, 0xffa2b5c7);
defaultColors.put(key_chat_inLoaderPhotoIcon, 0xfffcfcfc);
defaultColors.put(key_chat_inLoaderPhotoIconSelected, 0xffebf0f5);
defaultColors.put(key_chat_outLoaderPhoto, 0xff85bf78);
defaultColors.put(key_chat_outLoaderPhotoSelected, 0xff7db870);
defaultColors.put(key_chat_outLoaderPhotoIcon, 0xffdaf5c3);
defaultColors.put(key_chat_outLoaderPhotoIconSelected, 0xffc0e8a4);
defaultColors.put(key_chat_mediaLoaderPhoto, 0x66000000);
defaultColors.put(key_chat_mediaLoaderPhotoSelected, 0x7f000000);
defaultColors.put(key_chat_mediaLoaderPhotoIcon, 0xffffffff);
defaultColors.put(key_chat_mediaLoaderPhotoIconSelected, 0xffd9d9d9);
defaultColors.put(key_chat_secretTimerBackground, 0xcc3e648e);
defaultColors.put(key_chat_secretTimerText, 0xffffffff);
defaultColors.put(key_chat_serviceBackgroundSelector, 0x20ffffff);
defaultColors.put(key_profile_creatorIcon, 0xff3a95d5);
@ -4699,16 +4568,13 @@ public class Theme {
defaultColors.put(key_profile_tabSelectedLine, 0xff4fa6e9);
defaultColors.put(key_profile_tabSelector, 0x0f000000);
defaultColors.put(key_player_actionBar, 0xffffffff);
defaultColors.put(key_player_actionBarSelector, 0x0f000000);
defaultColors.put(key_player_actionBarTitle, 0xff2f3438);
defaultColors.put(key_player_actionBarTop, 0x99000000);
defaultColors.put(key_player_actionBarSubtitle, 0xff8a8a8a);
defaultColors.put(key_player_actionBarItems, 0xff8a8a8a);
defaultColors.put(key_player_background, 0xffffffff);
defaultColors.put(key_player_time, 0xff8c9296);
defaultColors.put(key_player_progressBackground, 0xffEBEDF0);
defaultColors.put(key_player_progressBackground2, 0xffCCD3DB);
defaultColors.put(key_player_progressCachedBackground, 0xffC5DCF0);
defaultColors.put(key_player_progress, 0xff54AAEB);
defaultColors.put(key_player_button, 0xff333333);
@ -4767,7 +4633,6 @@ public class Theme {
defaultColors.put(key_sharedMedia_linkPlaceholder, 0xfff0f3f5);
defaultColors.put(key_sharedMedia_linkPlaceholderText, 0xffb7bec3);
defaultColors.put(key_sharedMedia_photoPlaceholder, 0xffedf3f7);
defaultColors.put(key_sharedMedia_actionMode, 0xff4687b3);
defaultColors.put(key_checkbox, 0xff5ec245);
defaultColors.put(key_checkboxCheck, 0xffffffff);
@ -4776,7 +4641,6 @@ public class Theme {
defaultColors.put(key_stickers_menu, 0xffb6bdc5);
defaultColors.put(key_stickers_menuSelector, 0x0f000000);
defaultColors.put(key_changephoneinfo_image, 0xffb8bfc5);
defaultColors.put(key_changephoneinfo_image2, 0xff50a7ea);
defaultColors.put(key_groupcreate_hintText, 0xffa1aab3);
@ -4793,10 +4657,6 @@ public class Theme {
defaultColors.put(key_login_progressInner, 0xffe1eaf2);
defaultColors.put(key_login_progressOuter, 0xff62a0d0);
defaultColors.put(key_musicPicker_checkbox, 0xff29b6f7);
defaultColors.put(key_musicPicker_checkboxCheck, 0xffffffff);
defaultColors.put(key_musicPicker_buttonBackground, 0xff5cafea);
defaultColors.put(key_musicPicker_buttonIcon, 0xffffffff);
defaultColors.put(key_picker_enabledButton, 0xff19a7e8);
defaultColors.put(key_picker_disabledButton, 0xff999999);
defaultColors.put(key_picker_badge, 0xff29b6f7);
@ -4808,26 +4668,6 @@ public class Theme {
defaultColors.put(key_undo_cancelColor, 0xff85caff);
defaultColors.put(key_undo_infoColor, 0xffffffff);
defaultColors.put(key_wallet_blackBackground, 0xff000000);
defaultColors.put(key_wallet_graySettingsBackground, 0xfff0f0f0);
defaultColors.put(key_wallet_grayBackground, 0xff292929);
defaultColors.put(key_wallet_whiteBackground, 0xffffffff);
defaultColors.put(key_wallet_blackBackgroundSelector, 0x40ffffff);
defaultColors.put(key_wallet_whiteText, 0xffffffff);
defaultColors.put(key_wallet_blackText, 0xff222222);
defaultColors.put(key_wallet_statusText, 0xff808080);
defaultColors.put(key_wallet_grayText, 0xff777777);
defaultColors.put(key_wallet_grayText2, 0xff666666);
defaultColors.put(key_wallet_greenText, 0xff37a818);
defaultColors.put(key_wallet_redText, 0xffdb4040);
defaultColors.put(key_wallet_dateText, 0xff999999);
defaultColors.put(key_wallet_commentText, 0xff999999);
defaultColors.put(key_wallet_releaseBackground, 0xff307cbb);
defaultColors.put(key_wallet_pullBackground, 0xff212121);
defaultColors.put(key_wallet_buttonBackground, 0xff47a1e6);
defaultColors.put(key_wallet_buttonPressedBackground, 0xff2b8cd6);
defaultColors.put(key_wallet_buttonText, 0xffffffff);
defaultColors.put(key_wallet_addressConfirmBackground, 0x0d000000);
defaultColors.put(key_chat_outTextSelectionHighlight, 0x2E3F9923);
defaultColors.put(key_chat_inTextSelectionHighlight, 0x5062A9E3);
defaultColors.put(key_chat_TextSelectionCursor, 0xFF419FE8);
@ -4845,11 +4685,7 @@ public class Theme {
defaultColors.put(key_statisticChartRipple, 0x2c7e9db7);
defaultColors.put(key_statisticChartBackZoomColor, 0xff108BE3);
defaultColors.put(key_statisticChartCheckboxInactive, 0xffBDBDBD);
defaultColors.put(key_statisticChartNightIconColor, 0xff8E8E93);
defaultColors.put(key_statisticChartChevronColor, 0xffD2D5D7);
defaultColors.put(key_statisticChartHighlightColor, 0x20ececec);
defaultColors.put(key_statisticChartPopupBackground,0xffffffff);
defaultColors.put(key_statisticChartLine_blue, 0xff327FE5);
defaultColors.put(key_statisticChartLine_green, 0xff61C752);
@ -4862,7 +4698,6 @@ public class Theme {
defaultColors.put(key_statisticChartLine_purple, 0xff9F79E8);
defaultColors.put(key_statisticChartLine_cyan, 0xff40D0CA);
defaultColors.put(key_statisticChartLineEmpty, 0xFFEEEEEE);
defaultColors.put(key_actionBarTipBackground, 0xFF446F94);
defaultColors.put(key_color_blue, 0xff327FE5);
defaultColors.put(key_color_green, 0xff61C752);
@ -4902,9 +4737,7 @@ public class Theme {
defaultColors.put(key_voipgroup_lastSeenTextUnscrolled, 0xff858D94);
defaultColors.put(key_voipgroup_mutedIconUnscrolled, 0xff7E868C);
defaultColors.put(key_voipgroup_actionBar, 0xff0F1317);
defaultColors.put(key_voipgroup_emptyView, 0xff1A1D21);
defaultColors.put(key_voipgroup_actionBarItems, 0xffffffff);
defaultColors.put(key_voipgroup_actionBarSubtitle, 0xff8A8A8A);
defaultColors.put(key_voipgroup_actionBarItemsSelector, 0x1eBADBFF);
defaultColors.put(key_voipgroup_mutedByAdminIcon, 0xffFF7070);
defaultColors.put(key_voipgroup_mutedIcon, 0xff6F7980);
@ -4981,15 +4814,11 @@ public class Theme {
fallbackKeys.put(key_chat_outMediaIcon, key_chat_outBubble);
fallbackKeys.put(key_chat_inMediaIconSelected, key_chat_inBubbleSelected);
fallbackKeys.put(key_chat_outMediaIconSelected, key_chat_outBubbleSelected);
fallbackKeys.put(key_chats_actionUnreadIcon, key_profile_actionIcon);
fallbackKeys.put(key_chats_actionUnreadBackground, key_profile_actionBackground);
fallbackKeys.put(key_chats_actionUnreadPressedBackground, key_profile_actionPressedBackground);
fallbackKeys.put(key_dialog_inlineProgressBackground, key_windowBackgroundGray);
fallbackKeys.put(key_dialog_inlineProgress, key_chats_menuItemIcon);
fallbackKeys.put(key_groupcreate_spanDelete, key_chats_actionIcon);
fallbackKeys.put(key_sharedMedia_photoPlaceholder, key_windowBackgroundGray);
fallbackKeys.put(key_chat_attachPollBackground, key_chat_attachAudioBackground);
fallbackKeys.put(key_chat_attachPollIcon, key_chat_attachAudioIcon);
fallbackKeys.put(key_chats_onlineCircle, key_windowBackgroundWhiteBlueText);
fallbackKeys.put(key_windowBackgroundWhiteBlueButton, key_windowBackgroundWhiteValueText);
fallbackKeys.put(key_windowBackgroundWhiteBlueIcon, key_windowBackgroundWhiteValueText);
@ -5011,7 +4840,6 @@ public class Theme {
fallbackKeys.put(key_chat_emojiSearchIcon, key_chat_emojiPanelIcon);
fallbackKeys.put(key_chat_emojiPanelStickerSetNameHighlight, key_windowBackgroundWhiteBlueText4);
fallbackKeys.put(key_chat_emojiPanelStickerPackSelectorLine, key_chat_emojiPanelIconSelected);
fallbackKeys.put(key_sharedMedia_actionMode, key_actionBarDefault);
fallbackKeys.put(key_sheet_scrollUp, key_chat_emojiPanelStickerPackSelector);
fallbackKeys.put(key_sheet_other, key_player_actionBarItems);
fallbackKeys.put(key_dialogSearchBackground, key_chat_emojiPanelStickerPackSelector);
@ -5022,7 +4850,6 @@ public class Theme {
fallbackKeys.put(key_dialogFloatingButtonPressed, key_dialogRoundCheckBox);
fallbackKeys.put(key_dialogFloatingIcon, key_dialogRoundCheckBoxCheck);
fallbackKeys.put(key_dialogShadowLine, key_chat_emojiPanelShadowLine);
fallbackKeys.put(key_chat_emojiPanelIconSelector, key_listSelector);
fallbackKeys.put(key_actionBarDefaultArchived, key_actionBarDefault);
fallbackKeys.put(key_actionBarDefaultArchivedSelector, key_actionBarDefaultSelector);
fallbackKeys.put(key_actionBarDefaultArchivedIcon, key_actionBarDefaultIcon);
@ -5084,13 +4911,11 @@ public class Theme {
fallbackKeys.put(key_chat_outPollCorrectAnswer, key_chat_attachLocationBackground);
fallbackKeys.put(key_chat_inPollWrongAnswer, key_chat_attachAudioBackground);
fallbackKeys.put(key_chat_outPollWrongAnswer, key_chat_attachAudioBackground);
fallbackKeys.put(key_windowBackgroundWhiteYellowText, key_avatar_nameInMessageOrange);
fallbackKeys.put(key_profile_tabText, key_windowBackgroundWhiteGrayText);
fallbackKeys.put(key_profile_tabSelectedText, key_windowBackgroundWhiteBlueHeader);
fallbackKeys.put(key_profile_tabSelectedLine, key_windowBackgroundWhiteBlueHeader);
fallbackKeys.put(key_profile_tabSelector, key_listSelector);
fallbackKeys.put(key_statisticChartPopupBackground, key_dialogBackground);
fallbackKeys.put(key_chat_attachGalleryText, key_chat_attachGalleryBackground);
fallbackKeys.put(key_chat_attachAudioText, key_chat_attachAudioBackground);
@ -5162,7 +4987,6 @@ public class Theme {
themeAccentExclusionKeys.add(key_voipgroup_searchBackground);
themeAccentExclusionKeys.add(key_voipgroup_leaveCallMenu);
themeAccentExclusionKeys.add(key_voipgroup_scrollUp);
themeAccentExclusionKeys.add(key_voipgroup_blueText);
themeAccentExclusionKeys.add(key_voipgroup_soundButton);
themeAccentExclusionKeys.add(key_voipgroup_soundButtonActive);
themeAccentExclusionKeys.add(key_voipgroup_soundButtonActiveScrolled);
@ -5182,9 +5006,7 @@ public class Theme {
themeAccentExclusionKeys.add(key_voipgroup_lastSeenTextUnscrolled);
themeAccentExclusionKeys.add(key_voipgroup_mutedIconUnscrolled);
themeAccentExclusionKeys.add(key_voipgroup_actionBar);
themeAccentExclusionKeys.add(key_voipgroup_emptyView);
themeAccentExclusionKeys.add(key_voipgroup_actionBarItems);
themeAccentExclusionKeys.add(key_voipgroup_actionBarSubtitle);
themeAccentExclusionKeys.add(key_voipgroup_actionBarItemsSelector);
themeAccentExclusionKeys.add(key_voipgroup_mutedByAdminIcon);
themeAccentExclusionKeys.add(key_voipgroup_mutedIcon);
@ -5244,7 +5066,6 @@ public class Theme {
myMessagesColorKeys.add(key_chat_outInstant);
myMessagesColorKeys.add(key_chat_outInstantSelected);
myMessagesColorKeys.add(key_chat_outPreviewInstantText);
myMessagesColorKeys.add(key_chat_outPreviewInstantSelectedText);
myMessagesColorKeys.add(key_chat_outForwardedNameText);
myMessagesColorKeys.add(key_chat_outViaBotNameText);
myMessagesColorKeys.add(key_chat_outReplyLine);
@ -5284,17 +5105,9 @@ public class Theme {
myMessagesColorKeys.add(key_chat_outVenueInfoSelectedText);
myMessagesColorKeys.add(key_chat_outLoader);
myMessagesColorKeys.add(key_chat_outLoaderSelected);
myMessagesColorKeys.add(key_chat_outLoaderPhoto);
myMessagesColorKeys.add(key_chat_outLoaderPhotoSelected);
myMessagesColorKeys.add(key_chat_outLoaderPhotoIcon);
myMessagesColorKeys.add(key_chat_outLoaderPhotoIconSelected);
myMessagesColorKeys.add(key_chat_outLocationBackground);
myMessagesColorKeys.add(key_chat_outLocationIcon);
myMessagesColorKeys.add(key_chat_outContactBackground);
myMessagesColorKeys.add(key_chat_outContactIcon);
myMessagesColorKeys.add(key_chat_outFileIcon);
myMessagesColorKeys.add(key_chat_outFileSelectedIcon);
myMessagesColorKeys.add(key_chat_outBroadcast);
myMessagesColorKeys.add(key_chat_messageTextOut);
myMessagesColorKeys.add(key_chat_messageLinkOut);
@ -9211,9 +9024,6 @@ public class Theme {
chat_docNamePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
chat_docBackPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_deleteProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_botProgressPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
chat_botProgressPaint.setStrokeCap(Paint.Cap.ROUND);
chat_botProgressPaint.setStyle(Paint.Style.STROKE);
chat_locationTitlePaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
chat_locationTitlePaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
chat_locationAddressPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
@ -9460,39 +9270,6 @@ public class Theme {
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[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_contactDrawable[0] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_contact);
chat_contactDrawable[1] = createCircleDrawableWithIcon(AndroidUtilities.dp(44), R.drawable.msg_contact);
@ -9580,8 +9357,7 @@ public class Theme {
applyChatTheme(fontsOnly, false);
}
if (!fontsOnly && chat_botProgressPaint != null) {
chat_botProgressPaint.setStrokeWidth(AndroidUtilities.dp(2));
if (!fontsOnly && chat_infoPaint != null) {
chat_infoPaint.setTextSize(AndroidUtilities.dp(12));
chat_stickerCommentCountPaint.setTextSize(AndroidUtilities.dp(11));
chat_docNamePaint.setTextSize(AndroidUtilities.dp(15));
@ -9630,24 +9406,24 @@ public class Theme {
if (a == 0) {
chat_attachButtonDrawables[a].setLayerColor("Color_Mount.**", getNonAnimatedColor(key_chat_attachGalleryBackground));
chat_attachButtonDrawables[a].setLayerColor("Color_PhotoShadow.**", getNonAnimatedColor(key_chat_attachGalleryBackground));
chat_attachButtonDrawables[a].setLayerColor("White_Photo.**", getNonAnimatedColor(key_chat_attachGalleryIcon));
chat_attachButtonDrawables[a].setLayerColor("White_BackPhoto.**", getNonAnimatedColor(key_chat_attachGalleryIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Photo.**", getNonAnimatedColor(key_chat_attachIcon));
chat_attachButtonDrawables[a].setLayerColor("White_BackPhoto.**", getNonAnimatedColor(key_chat_attachIcon));
} else if (a == 1) {
chat_attachButtonDrawables[a].setLayerColor("White_Play1.**", getNonAnimatedColor(key_chat_attachAudioIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Play2.**", getNonAnimatedColor(key_chat_attachAudioIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Play1.**", getNonAnimatedColor(key_chat_attachIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Play2.**", getNonAnimatedColor(key_chat_attachIcon));
} else if (a == 2) {
chat_attachButtonDrawables[a].setLayerColor("Color_Corner.**", getNonAnimatedColor(key_chat_attachFileBackground));
chat_attachButtonDrawables[a].setLayerColor("White_List.**", getNonAnimatedColor(key_chat_attachFileIcon));
chat_attachButtonDrawables[a].setLayerColor("White_List.**", getNonAnimatedColor(key_chat_attachIcon));
} else if (a == 3) {
chat_attachButtonDrawables[a].setLayerColor("White_User1.**", getNonAnimatedColor(key_chat_attachContactIcon));
chat_attachButtonDrawables[a].setLayerColor("White_User2.**", getNonAnimatedColor(key_chat_attachContactIcon));
chat_attachButtonDrawables[a].setLayerColor("White_User1.**", getNonAnimatedColor(key_chat_attachIcon));
chat_attachButtonDrawables[a].setLayerColor("White_User2.**", getNonAnimatedColor(key_chat_attachIcon));
} else if (a == 4) {
chat_attachButtonDrawables[a].setLayerColor("Color_Oval.**", getNonAnimatedColor(key_chat_attachLocationBackground));
chat_attachButtonDrawables[a].setLayerColor("White_Pin.**", getNonAnimatedColor(key_chat_attachLocationIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Pin.**", getNonAnimatedColor(key_chat_attachIcon));
} else if (a == 5) {
chat_attachButtonDrawables[a].setLayerColor("White_Column 1.**", getNonAnimatedColor(key_chat_attachPollIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Column 2.**", getNonAnimatedColor(key_chat_attachPollIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Column 3.**", getNonAnimatedColor(key_chat_attachPollIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Column 1.**", getNonAnimatedColor(key_chat_attachIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Column 2.**", getNonAnimatedColor(key_chat_attachIcon));
chat_attachButtonDrawables[a].setLayerColor("White_Column 3.**", getNonAnimatedColor(key_chat_attachIcon));
}
chat_attachButtonDrawables[a].commitApplyLayerColors();
}
@ -9665,7 +9441,6 @@ public class Theme {
chat_botButtonPaint.setColor(getColor(key_chat_botButtonText));
chat_urlPaint.setColor(getColor(key_chat_linkSelectBackground));
chat_outUrlPaint.setColor(getColor(key_chat_outLinkSelectBackground));
chat_botProgressPaint.setColor(getColor(key_chat_botProgress));
chat_deleteProgressPaint.setColor(getColor(key_chat_secretTimeText));
chat_textSearchSelectionPaint.setColor(getColor(key_chat_textSelectBackground));
chat_msgErrorPaint.setColor(getColor(key_chat_sentError));
@ -9760,30 +9535,10 @@ public class Theme {
}
for (int a = 0; a < 5; a++) {
setCombinedDrawableColor(chat_fileStatesDrawable[a][0], getColor(key_chat_outLoader), false);
setCombinedDrawableColor(chat_fileStatesDrawable[a][0], getColor(key_chat_outMediaIcon), true);
setCombinedDrawableColor(chat_fileStatesDrawable[a][1], getColor(key_chat_outLoaderSelected), false);
setCombinedDrawableColor(chat_fileStatesDrawable[a][1], getColor(key_chat_outMediaIconSelected), true);
setCombinedDrawableColor(chat_fileStatesDrawable[5 + a][0], getColor(key_chat_inLoader), false);
setCombinedDrawableColor(chat_fileStatesDrawable[5 + a][0], getColor(key_chat_inMediaIcon), true);
setCombinedDrawableColor(chat_fileStatesDrawable[5 + a][1], getColor(key_chat_inLoaderSelected), false);
setCombinedDrawableColor(chat_fileStatesDrawable[5 + a][1], getColor(key_chat_inMediaIconSelected), true);
}
for (int a = 0; a < 4; a++) {
setCombinedDrawableColor(chat_photoStatesDrawables[a][0], getColor(key_chat_mediaLoaderPhoto), false);
setCombinedDrawableColor(chat_photoStatesDrawables[a][0], getColor(key_chat_mediaLoaderPhotoIcon), true);
setCombinedDrawableColor(chat_photoStatesDrawables[a][1], getColor(key_chat_mediaLoaderPhotoSelected), false);
setCombinedDrawableColor(chat_photoStatesDrawables[a][1], getColor(key_chat_mediaLoaderPhotoIconSelected), true);
}
for (int a = 0; a < 2; a++) {
setCombinedDrawableColor(chat_photoStatesDrawables[7 + a][0], getColor(key_chat_outLoaderPhoto), false);
setCombinedDrawableColor(chat_photoStatesDrawables[7 + a][0], getColor(key_chat_outLoaderPhotoIcon), true);
setCombinedDrawableColor(chat_photoStatesDrawables[7 + a][1], getColor(key_chat_outLoaderPhotoSelected), false);
setCombinedDrawableColor(chat_photoStatesDrawables[7 + a][1], getColor(key_chat_outLoaderPhotoIconSelected), true);
setCombinedDrawableColor(chat_photoStatesDrawables[10 + a][0], getColor(key_chat_inLoaderPhoto), false);
setCombinedDrawableColor(chat_photoStatesDrawables[10 + a][0], getColor(key_chat_inLoaderPhotoIcon), true);
setCombinedDrawableColor(chat_photoStatesDrawables[10 + a][1], getColor(key_chat_inLoaderPhotoSelected), false);
setCombinedDrawableColor(chat_photoStatesDrawables[10 + a][1], getColor(key_chat_inLoaderPhotoIconSelected), true);
setCombinedDrawableColor(chat_fileStatesDrawable[a][0], getColor(key_chat_inLoader), false);
setCombinedDrawableColor(chat_fileStatesDrawable[a][0], getColor(key_chat_inMediaIcon), true);
setCombinedDrawableColor(chat_fileStatesDrawable[a][1], getColor(key_chat_inLoaderSelected), false);
setCombinedDrawableColor(chat_fileStatesDrawable[a][1], getColor(key_chat_inMediaIconSelected), true);
}
setCombinedDrawableColor(chat_contactDrawable[0], getColor(key_chat_inContactBackground), false);
@ -11123,6 +10878,38 @@ public class Theme {
return false;
}
public static void turnOffAutoNight(BaseFragment fragment) {
turnOffAutoNight(fragment != null ? fragment.getLayoutContainer() : null, () -> {
INavigationLayout nav = fragment != null ? fragment.getParentLayout() : null;
if (nav != null) {
nav.presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_NIGHT));
}
});
}
public static void turnOffAutoNight(FrameLayout container, Runnable openSettings) {
if (selectedAutoNightType != AUTO_NIGHT_TYPE_NONE) {
if (container != null && openSettings != null) {
try {
BulletinFactory.of(container, null).createSimpleBulletin(
R.raw.auto_night_off,
selectedAutoNightType == AUTO_NIGHT_TYPE_SYSTEM ?
LocaleController.getString("AutoNightSystemModeOff", R.string.AutoNightSystemModeOff) :
LocaleController.getString("AutoNightModeOff", R.string.AutoNightModeOff),
LocaleController.getString("Settings", R.string.Settings),
Bulletin.DURATION_PROLONG,
openSettings
).show();
} catch (Exception e) {
FileLog.e(e);
}
}
selectedAutoNightType = AUTO_NIGHT_TYPE_NONE;
saveAutoNightThemeConfig();
cancelAutoNightThemeCallbacks();
}
}
public static Paint DEBUG_RED = new Paint(); static { DEBUG_RED.setColor(0xffff0000); }
public static Paint DEBUG_BLUE = new Paint(); static { DEBUG_BLUE.setColor(0xff0000ff); }
}

View file

@ -341,9 +341,6 @@ public class ThemeDescription {
((ActionBar) viewToInvalidate).setPopupBackgroundColor(color, false);
}
}
if (viewToInvalidate instanceof VideoTimelineView) {
((VideoTimelineView) viewToInvalidate).setColor(color);
}
if (viewToInvalidate instanceof EmptyTextProgressView) {
if ((changeFlags & FLAG_TEXTCOLOR) != 0) {
((EmptyTextProgressView) viewToInvalidate).setTextColor(color);

View file

@ -920,7 +920,6 @@ public class ActionIntroActivity extends BaseFragment implements LocationControl
themeDescriptions.add(new ThemeDescription(desctiptionLines[4], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
themeDescriptions.add(new ThemeDescription(desctiptionLines[5], ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
themeDescriptions.add(new ThemeDescription(null, ThemeDescription.FLAG_TEXTCOLOR, null, null, new Drawable[]{drawable1}, null, Theme.key_changephoneinfo_image));
themeDescriptions.add(new ThemeDescription(null, ThemeDescription.FLAG_TEXTCOLOR, null, null, new Drawable[]{drawable2}, null, Theme.key_changephoneinfo_image2));
return themeDescriptions;

View file

@ -77,9 +77,13 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
disableSections = value;
}
public static final int SORT_TYPE_NONE = 0;
public static final int SORT_TYPE_BY_NAME = 1;
public static final int SORT_TYPE_BY_TIME = 2;
public void setSortType(int value, boolean force) {
sortType = value;
if (sortType == 2) {
if (sortType == SORT_TYPE_BY_TIME) {
if (onlineContacts == null || force) {
onlineContacts = new ArrayList<>(ContactsController.getInstance(currentAccount).contacts);
long selfId = UserConfig.getInstance(currentAccount).clientUserId;
@ -173,7 +177,7 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
if (section == 0) {
return null;
} else {
if (sortType == 2) {
if (sortType == SORT_TYPE_BY_TIME) {
if (section == 1) {
if (position < onlineContacts.size()) {
return MessagesController.getInstance(currentAccount).getUser(onlineContacts.get(position).user_id);
@ -221,7 +225,7 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
if (isEmpty) {
return false;
}
if (sortType == 2) {
if (sortType == SORT_TYPE_BY_TIME) {
if (section == 1) {
return row < onlineContacts.size();
}
@ -240,7 +244,7 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
public int getSectionCount() {
int count;
isEmpty = false;
if (sortType == 2) {
if (sortType == SORT_TYPE_BY_TIME) {
count = 1;
isEmpty = onlineContacts.isEmpty();
} else {
@ -293,7 +297,7 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
if (isEmpty) {
return 1;
}
if (sortType == 2) {
if (sortType == SORT_TYPE_BY_TIME) {
if (section == 1) {
return onlineContacts.isEmpty() ? 0 : onlineContacts.size() + 1;
}
@ -324,7 +328,7 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
view = new LetterSectionCell(mContext);
}
LetterSectionCell cell = (LetterSectionCell) view;
if (sortType == 2 || disableSections || isEmpty) {
if (sortType == SORT_TYPE_BY_TIME || disableSections || isEmpty) {
cell.setLetter("");
} else {
if (onlyUsers != 0 && !isAdmin) {
@ -412,9 +416,9 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
switch (holder.getItemViewType()) {
case 0:
UserCell userCell = (UserCell) holder.itemView;
userCell.setAvatarPadding(sortType == 2 || disableSections ? 6 : 58);
userCell.setAvatarPadding(sortType == SORT_TYPE_BY_TIME || disableSections ? 6 : 58);
ArrayList<TLRPC.TL_contact> arr;
if (sortType == 2) {
if (sortType == SORT_TYPE_BY_TIME) {
arr = onlineContacts;
} else {
HashMap<String, ArrayList<TLRPC.TL_contact>> usersSectionsDict = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).usersMutualSectionsDict : ContactsController.getInstance(currentAccount).usersSectionsDict;
@ -471,9 +475,9 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
break;
case 2:
GraySectionCell sectionCell = (GraySectionCell) holder.itemView;
if (sortType == 0) {
if (sortType == SORT_TYPE_NONE) {
sectionCell.setText(LocaleController.getString("Contacts", R.string.Contacts));
} else if (sortType == 1) {
} else if (sortType == SORT_TYPE_BY_NAME) {
sectionCell.setText(LocaleController.getString("SortedByName", R.string.SortedByName));
} else {
sectionCell.setText(LocaleController.getString("SortedByLastSeen", R.string.SortedByLastSeen));
@ -509,7 +513,7 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
if (isEmpty) {
return 4;
}
if (sortType == 2) {
if (sortType == SORT_TYPE_BY_TIME) {
if (section == 1) {
return position < onlineContacts.size() ? 0 : 3;
}
@ -526,7 +530,7 @@ public class ContactsAdapter extends RecyclerListView.SectionsAdapter {
@Override
public String getLetter(int position) {
if (sortType == 2 || isEmpty) {
if (sortType == SORT_TYPE_BY_TIME || isEmpty) {
return null;
}
ArrayList<String> sortedUsersSectionsArray = onlyUsers == 2 ? ContactsController.getInstance(currentAccount).sortedUsersMutualSectionsArray : ContactsController.getInstance(currentAccount).sortedUsersSectionsArray;

View file

@ -906,7 +906,7 @@ public class DialogsSearchAdapter extends RecyclerListView.SelectionAdapter {
}
}
if (resentSearchAvailable()) {
if (resentSearchAvailable() && !(obj instanceof TLRPC.EncryptedChat)) {
boolean foundInRecent = false;
if (delegate != null && delegate.getSearchForumDialogId() == dialogId) {
foundInRecent = true;

View file

@ -92,6 +92,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
private ArrayList<TLRPC.User> searchResultCommandsUsers;
private ArrayList<TLRPC.BotInlineResult> searchResultBotContext;
private TLRPC.TL_inlineBotSwitchPM searchResultBotContextSwitch;
private TLRPC.TL_inlineBotWebView searchResultBotWebViewSwitch;
private MentionsAdapterDelegate delegate;
private LongSparseArray<TLRPC.BotInfo> botInfo;
private int resultStartPosition;
@ -197,6 +198,10 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
}
}
public TLRPC.User getFoundContextBot() {
return foundContextBot;
}
@Override
public void didReceivedNotification(int id, int account, final Object... args) {
if (id == NotificationCenter.fileLoaded || id == NotificationCenter.fileLoadFailed) {
@ -477,6 +482,10 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
return searchResultBotContextSwitch;
}
public TLRPC.TL_inlineBotWebView getBotWebViewSwitch() {
return searchResultBotWebViewSwitch;
}
public long getContextBotId() {
return foundContextBot != null ? foundContextBot.id : 0;
}
@ -731,6 +740,9 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
if (searchResultBotContextSwitch == null) {
searchResultBotContextSwitch = res.switch_pm;
}
if (searchResultBotWebViewSwitch == null) {
searchResultBotWebViewSwitch = res.switch_webview;
}
for (int a = 0; a < res.results.size(); a++) {
TLRPC.BotInlineResult result = res.results.get(a);
if (!(result.document instanceof TLRPC.TL_document) && !(result.photo instanceof TLRPC.TL_photo) && !"game".equals(result.type) && result.content == null && result.send_message instanceof TLRPC.TL_botInlineMessageMediaAuto) {
@ -762,9 +774,9 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
searchResultSuggestions = null;
searchResultCommandsHelp = null;
searchResultCommandsUsers = null;
delegate.needChangePanelVisibility(!searchResultBotContext.isEmpty() || searchResultBotContextSwitch != null);
delegate.needChangePanelVisibility(!searchResultBotContext.isEmpty() || searchResultBotContextSwitch != null || searchResultBotWebViewSwitch != null);
if (added) {
boolean hasTop = searchResultBotContextSwitch != null;
boolean hasTop = searchResultBotContextSwitch != null || searchResultBotWebViewSwitch != null;
notifyItemChanged(searchResultBotContext.size() - res.results.size() + (hasTop ? 1 : 0) - 1);
notifyItemRangeInserted(searchResultBotContext.size() - res.results.size() + (hasTop ? 1 : 0), res.results.size());
} else {
@ -1225,7 +1237,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
for (int a = 0; a < res.participants.size(); a++) {
TLRPC.ChannelParticipant participant = res.participants.get(a);
long peerId = MessageObject.getPeerId(participant.peer);
if (searchResultUsernamesMap.indexOfKey(peerId) >= 0 || !isSearchingMentions && peerId == currentUserId) {
if (searchResultUsernamesMap.indexOfKey(peerId) >= 0 || peerId == 0 && searchResultUsernamesMap.indexOfKey(currentUserId) >= 0 || !isSearchingMentions && (peerId == currentUserId || peerId == 0)) {
continue;
}
if (peerId >= 0) {
@ -1388,7 +1400,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
if (stickers != null) {
return stickers.size();
} else if (searchResultBotContext != null) {
return searchResultBotContext.size() + (searchResultBotContextSwitch != null ? 1 : 0);
return searchResultBotContext.size() + (searchResultBotContextSwitch != null || searchResultBotWebViewSwitch != null ? 1 : 0);
} else if (searchResultUsernames != null) {
return searchResultUsernames.size();
} else if (searchResultHashtags != null) {
@ -1413,6 +1425,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
searchResultBotContext.clear();
}
searchResultBotContextSwitch = null;
searchResultBotWebViewSwitch = null;
if (searchResultUsernames != null) {
searchResultUsernames.clear();
}
@ -1435,7 +1448,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
} else if (foundContextBot != null && !inlineMediaEnabled) {
return 3;
} else if (searchResultBotContext != null) {
if (position == 0 && searchResultBotContextSwitch != null) {
if (position == 0 && (searchResultBotContextSwitch != null || searchResultBotWebViewSwitch != null)) {
return 2;
}
return 1;
@ -1449,7 +1462,7 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
}
public int getItemPosition(int i) {
if (searchResultBotContext != null && searchResultBotContextSwitch != null) {
if (searchResultBotContext != null && (searchResultBotContextSwitch != null || searchResultBotWebViewSwitch != null)) {
i--;
}
return i;
@ -1463,7 +1476,13 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
if (stickers != null) {
return i >= 0 && i < stickers.size() ? stickers.get(i).sticker : null;
} else if (searchResultBotContext != null) {
if (searchResultBotContextSwitch != null) {
if (searchResultBotWebViewSwitch != null) {
if (i == 0) {
return searchResultBotWebViewSwitch;
} else {
i--;
}
} else if (searchResultBotContextSwitch != null) {
if (i == 0) {
return searchResultBotContextSwitch;
} else {
@ -1585,10 +1604,10 @@ public class MentionsAdapter extends RecyclerListView.SelectionAdapter implement
}
}
} else if (searchResultBotContext != null) {
boolean hasTop = searchResultBotContextSwitch != null;
boolean hasTop = searchResultBotContextSwitch != null || searchResultBotWebViewSwitch != null;
if (holder.getItemViewType() == 2) {
if (hasTop) {
((BotSwitchCell) holder.itemView).setText(searchResultBotContextSwitch.text);
((BotSwitchCell) holder.itemView).setText(searchResultBotContextSwitch != null ? searchResultBotContextSwitch.text : searchResultBotWebViewSwitch.text);
}
} else {
if (hasTop) {

View file

@ -1112,7 +1112,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
ActionBarMenuItem otherItem = actionBar.createMenu().addItem(other_id, R.drawable.ic_ab_other);
clearDatabaseItem = otherItem.addSubItem(clear_database_id, R.drawable.msg_delete, LocaleController.getString("ClearLocalDatabase", R.string.ClearLocalDatabase));
clearDatabaseItem.setIconColor(Theme.getColor(Theme.key_dialogRedIcon));
clearDatabaseItem.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
clearDatabaseItem.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
updateDatabaseItemSize();
listAdapter = new ListAdapter(context);
@ -1253,7 +1253,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
@ -1423,7 +1423,7 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
@ -1759,8 +1759,17 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
protected boolean verifyDrawable(@NonNull Drawable who) {
return who == valueTextView || who == textView || super.verifyDrawable(who);
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName("android.widget.Button");
}
};
button.setBackground(Theme.AdaptiveRipple.filledRect(Theme.key_featuredStickers_addButton, 8));
button.setFocusable(true);
button.setFocusableInTouchMode(true);
button.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
if (LocaleController.isRTL) {
rtlTextView = new TextView(context);
@ -1810,6 +1819,8 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
valueTextView.setText(size <= 0 ? "" : AndroidUtilities.formatFileSize(size));
setDisabled(size <= 0);
button.invalidate();
button.setContentDescription(TextUtils.concat(textView.getText(), "\t", valueTextView.getText()));
}
public void setDisabled(boolean disabled) {
@ -2362,7 +2373,6 @@ public class CacheControlActivity extends BaseFragment implements NotificationCe
arrayList.add(new ThemeDescription(listView, 0, new Class[]{StorageUsageView.class}, new String[]{"telegramCacheTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText));
arrayList.add(new ThemeDescription(listView, 0, new Class[]{StorageUsageView.class}, new String[]{"freeSizeTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText));
arrayList.add(new ThemeDescription(listView, 0, new Class[]{StorageUsageView.class}, new String[]{"calculationgTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText));
arrayList.add(new ThemeDescription(listView, 0, new Class[]{StorageUsageView.class}, new String[]{"paintProgress2"}, null, null, null, Theme.key_player_progressBackground2));
arrayList.add(new ThemeDescription(listView, 0, new Class[]{SlideChooseView.class}, null, null, null, Theme.key_switchTrack));
arrayList.add(new ThemeDescription(listView, 0, new Class[]{SlideChooseView.class}, null, null, null, Theme.key_switchTrackChecked));

View file

@ -99,9 +99,9 @@ public class CachedMediaLayout extends FrameLayout implements NestedSizeNotifier
this.parentFragment = parentFragment;
int CacheTabChats;
allPages[PAGE_TYPE_CHATS] = new Page(LocaleController.getString("Chats", R.string.Chats), PAGE_TYPE_CHATS, new DialogsAdapter());
allPages[PAGE_TYPE_CHATS] = new Page(LocaleController.getString("FilterChats", R.string.FilterChats), PAGE_TYPE_CHATS, new DialogsAdapter());
allPages[PAGE_TYPE_MEDIA] = new Page(LocaleController.getString("MediaTab", R.string.MediaTab), PAGE_TYPE_MEDIA, new MediaAdapter());
allPages[PAGE_TYPE_DOCUMENTS] = new Page(LocaleController.getString("Files", R.string.Files), PAGE_TYPE_DOCUMENTS, new DocumentsAdapter());
allPages[PAGE_TYPE_DOCUMENTS] = new Page(LocaleController.getString("SharedFilesTab2", R.string.SharedFilesTab2), PAGE_TYPE_DOCUMENTS, new DocumentsAdapter());
allPages[PAGE_TYPE_MUSIC] = new Page(LocaleController.getString("Music", R.string.Music), PAGE_TYPE_MUSIC, new MusicAdapter());
// allPages[PAGE_TYPE_VOICE] = new Page(LocaleController.getString("Voice", R.string.Voice), PAGE_TYPE_VOICE, new VoiceAdapter());

View file

@ -625,7 +625,7 @@ public class CallLogActivity extends BaseFragment implements NotificationCenter.
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}

View file

@ -473,7 +473,7 @@ public class CameraScanActivity extends BaseFragment {
actionBar.setTitleColor(0xffffffff);
actionBar.setItemsColor(0xffffffff, false);
actionBar.setItemsBackgroundColor(0x22ffffff, false);
viewGroup.setBackgroundColor(Theme.getColor(Theme.key_wallet_blackBackground));
viewGroup.setBackgroundColor(0xFF000000);
viewGroup.addView(actionBar);
}

View file

@ -53,7 +53,6 @@ import android.text.TextUtils;
import android.text.style.CharacterStyle;
import android.text.style.ClickableSpan;
import android.text.style.URLSpan;
import android.util.Log;
import android.util.Property;
import android.util.SparseArray;
import android.util.StateSet;
@ -65,6 +64,7 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewStructure;
import android.view.Window;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
@ -90,6 +90,7 @@ import org.telegram.messenger.DownloadController;
import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.FlagSecureReason;
import org.telegram.messenger.ImageLoader;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
@ -246,7 +247,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
post(() -> {
avatarDrawable.setInfo(currentUser);
avatarImage.setForUserOrChat(currentUser, avatarDrawable, null, true, VectorAvatarThumbDrawable.TYPE_SMALL);
avatarImage.setForUserOrChat(currentUser, avatarDrawable, null, LiteMode.isEnabled(LiteMode.FLAGS_CHAT), VectorAvatarThumbDrawable.TYPE_SMALL);
});
} else if (currentChat != null) {
if (currentChat.photo != null) {
@ -1200,7 +1201,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
private AnimatedFloat roundVideoPlayPipFloat = new AnimatedFloat(this, 200, CubicBezierInterpolator.EASE_OUT);
private Paint roundVideoPipPaint;
private Runnable unregisterFlagSecure;
private FlagSecureReason flagSecure;
private Runnable diceFinishCallback = new Runnable() {
@Override
@ -3924,9 +3925,8 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
reactionsLayoutInBubble.onDetachFromWindow();
statusDrawableAnimationInProgress = false;
if (unregisterFlagSecure != null) {
unregisterFlagSecure.run();
unregisterFlagSecure = null;
if (flagSecure != null) {
flagSecure.detach();
}
if (topicButton != null) {
topicButton.onDetached(this);
@ -4001,6 +4001,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
toSeekBarProgress = showSeekbar ? 1f : 0f;
}
reactionsLayoutInBubble.onAttachToWindow();
if (flagSecure != null) {
flagSecure.attach();
}
updateFlagSecure();
if (currentMessageObject != null && currentMessageObject.type == MessageObject.TYPE_EXTENDED_MEDIA_PREVIEW && unlockLayout != null) {
@ -6562,8 +6565,13 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
}
} else if (messageObject.isAnimatedEmoji()) {
if (messageObject.emojiAnimatedSticker == null && messageObject.emojiAnimatedStickerId != null) {
filter = String.format(Locale.US, "%d_%d_nr_messageId=%d", w, h, messageObject.stableId);
if (!LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_CHAT)) {
filter = String.format(Locale.US, "%d_%d_nr_messageId=%d" + messageObject.emojiAnimatedStickerColor, w, h, messageObject.stableId);
thumb = DocumentObject.getCircleThumb(.4f, Theme.key_chat_serviceBackground, resourcesProvider, 0.65f);
photoImage.setAutoRepeat(3);
messageObject.loadAnimatedEmojiDocument();
} else if (messageObject.emojiAnimatedSticker == null && messageObject.emojiAnimatedStickerId != null) {
filter = String.format(Locale.US, "%d_%d_nr_messageId=%d" + messageObject.emojiAnimatedStickerColor, w, h, messageObject.stableId);
thumb = DocumentObject.getCircleThumb(.4f, Theme.key_chat_serviceBackground, resourcesProvider, 0.65f);
photoImage.setAutoRepeat(1);
messageObject.loadAnimatedEmojiDocument();
@ -7835,13 +7843,18 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
private void updateFlagSecure() {
boolean flagSecure = currentMessageObject != null && currentMessageObject.messageOwner != null && (currentMessageObject.messageOwner.noforwards || currentMessageObject.hasRevealedExtendedMedia());
Activity activity = AndroidUtilities.findActivity(getContext());
if (flagSecure && unregisterFlagSecure == null && activity != null) {
unregisterFlagSecure = AndroidUtilities.registerFlagSecure(activity.getWindow());
} else if (!flagSecure && unregisterFlagSecure != null) {
unregisterFlagSecure.run();
unregisterFlagSecure = null;
if (flagSecure == null) {
Activity activity = AndroidUtilities.findActivity(getContext());
Window window = activity == null ? null : activity.getWindow();
if (window != null) {
flagSecure = new FlagSecureReason(window, () -> currentMessageObject != null && currentMessageObject.messageOwner != null && (currentMessageObject.messageOwner.noforwards || currentMessageObject.hasRevealedExtendedMedia()));
if (attachedToWindow) {
flagSecure.attach();
}
}
}
if (flagSecure != null) {
flagSecure.invalidate();
}
}
@ -8241,7 +8254,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
(!currentMessageObject.isOutOwner() || currentMessageObject.isSent()) &&
(
UserConfig.getInstance(currentAccount).isPremium() ||
!MessagesController.getInstance(currentAccount).didPressTranscribeButtonEnough() && (
!MessagesController.getInstance(currentAccount).didPressTranscribeButtonEnough() && !currentMessageObject.isOutOwner() && (
currentMessageObject.messageOwner != null && currentMessageObject.messageOwner.voiceTranscriptionForce ||
currentMessageObject.getDuration() >= 60
) && !MessagesController.getInstance(currentAccount).premiumLocked
@ -13787,6 +13800,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
if (currentNameStatusDrawable != null && drawNameLayout && nameLayout != null) {
int color;
float nameX, nameY;
if (currentMessageObject.shouldDrawWithoutBackground()) {
color = getThemedColor(Theme.key_chat_stickerNameText);
if (currentMessageObject.isOutOwner()) {
@ -13798,9 +13812,9 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
nameX -= nameOffsetX;
} else {
if (mediaBackground || currentMessageObject.isOutOwner()) {
nameX = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(11) - nameOffsetX + getExtraTextX();
nameX = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(11) + getExtraTextX();
} else {
nameX = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(!mediaBackground && drawPinnedBottom ? 11 : 17) - nameOffsetX + getExtraTextX();
nameX = backgroundDrawableLeft + transitionParams.deltaLeft + AndroidUtilities.dp(!mediaBackground && drawPinnedBottom ? 11 : 17) + getExtraTextX();
}
if (currentUser != null) {
if (currentBackgroundDrawable != null && currentBackgroundDrawable.hasGradient()) {
@ -13841,7 +13855,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
}
currentNameStatusDrawable.setBounds(
(int) (Math.abs(nx) + nameLayoutWidth + AndroidUtilities.dp(2)),
(int) nameY + nameLayout.getHeight() / 2 - AndroidUtilities.dp(10),
(int) (nameY + nameLayout.getHeight() / 2 - AndroidUtilities.dp(10)),
(int) (Math.abs(nx) + nameLayoutWidth + AndroidUtilities.dp(22)),
(int) (nameY + nameLayout.getHeight() / 2 + AndroidUtilities.dp(10))
);

View file

@ -36,11 +36,13 @@ import org.telegram.messenger.FileLog;
import org.telegram.messenger.ImageLoader;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.R;
import org.telegram.messenger.SharedConfig;
import org.telegram.messenger.SvgHelper;
import org.telegram.messenger.UserConfig;
import org.telegram.messenger.Utilities;
@ -321,6 +323,10 @@ public class ContextLinkCell extends FrameLayout implements DownloadController.F
width = (int) (w / (h / (float) AndroidUtilities.dp(80)));
if (documentAttachType == DOCUMENT_ATTACH_TYPE_GIF) {
currentPhotoFilterThumb = currentPhotoFilter = String.format(Locale.US, "%d_%d_b", (int) (width / AndroidUtilities.density), 80);
if (!SharedConfig.isAutoplayGifs()) {
currentPhotoFilterThumb += "_firstframe";
currentPhotoFilter += "_firstframe";
}
} else {
currentPhotoFilter = String.format(Locale.US, "%d_%d", (int) (width / AndroidUtilities.density), 80);
currentPhotoFilterThumb = currentPhotoFilter + "_b";
@ -334,13 +340,13 @@ public class ContextLinkCell extends FrameLayout implements DownloadController.F
if (documentAttach != null) {
TLRPC.VideoSize thumb = MessageObject.getDocumentVideoThumb(documentAttach);
if (thumb != null) {
linkImageView.setImage(ImageLocation.getForDocument(thumb, documentAttach), "100_100", ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, -1, ext, parentObject, 1);
linkImageView.setImage(ImageLocation.getForDocument(thumb, documentAttach), "100_100" + (!SharedConfig.isAutoplayGifs() ? "_firstframe" : ""), ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, -1, ext, parentObject, 1);
} else {
ImageLocation location = ImageLocation.getForDocument(documentAttach);
if (isForceGif) {
location.imageType = FileLoader.IMAGE_TYPE_ANIMATION;
}
linkImageView.setImage(location, "100_100", ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, documentAttach.size, ext, parentObject, 0);
linkImageView.setImage(location, "100_100" + (!SharedConfig.isAutoplayGifs() ? "_firstframe" : ""), ImageLocation.getForDocument(currentPhotoObject, documentAttach), currentPhotoFilter, documentAttach.size, ext, parentObject, 0);
}
} else if (webFile != null) {
linkImageView.setImage(ImageLocation.getForWebFile(webFile), "100_100", ImageLocation.getForPhoto(currentPhotoObject, photoAttach), currentPhotoFilter, -1, ext, parentObject, 1);
@ -372,6 +378,13 @@ public class ContextLinkCell extends FrameLayout implements DownloadController.F
linkImageView.setImage(ImageLocation.getForPath(urlLocation), currentPhotoFilter, ImageLocation.getForPhoto(currentPhotoObjectThumb, photoAttach), currentPhotoFilterThumb, -1, ext, parentObject, 1);
}
}
if (SharedConfig.isAutoplayGifs()) {
linkImageView.setAllowStartAnimation(true);
linkImageView.startAnimation();
} else {
linkImageView.setAllowStartAnimation(false);
linkImageView.stopAnimation();
}
drawLinkImageView = true;
}

View file

@ -391,6 +391,7 @@ public class DialogCell extends BaseCell {
private int messageTop;
private int messageLeft;
private int buttonLeft;
private int typingLeft;
private StaticLayout messageLayout;
private StaticLayout typingLayout;
@ -1817,11 +1818,11 @@ public class DialogCell extends BaseCell {
messageWidth = getMeasuredWidth() - AndroidUtilities.dp(messagePaddingStart + 21);
if (LocaleController.isRTL) {
typingLeft = messageLeft = messageNameLeft = AndroidUtilities.dp(16);
buttonLeft = typingLeft = messageLeft = messageNameLeft = AndroidUtilities.dp(16);
avatarLeft = getMeasuredWidth() - AndroidUtilities.dp(66);
thumbLeft = avatarLeft - AndroidUtilities.dp(13 + 18);
} else {
typingLeft = messageLeft = messageNameLeft = AndroidUtilities.dp(messagePaddingStart + 6);
buttonLeft = typingLeft = messageLeft = messageNameLeft = AndroidUtilities.dp(messagePaddingStart + 6);
avatarLeft = AndroidUtilities.dp(10);
thumbLeft = avatarLeft + AndroidUtilities.dp(56 + 13);
}
@ -1840,11 +1841,11 @@ public class DialogCell extends BaseCell {
messageWidth = getMeasuredWidth() - AndroidUtilities.dp(messagePaddingStart + 23 - (LocaleController.isRTL ? 0 : 12));
if (LocaleController.isRTL) {
typingLeft = messageLeft = messageNameLeft = AndroidUtilities.dp(22);
buttonLeft = typingLeft = messageLeft = messageNameLeft = AndroidUtilities.dp(22);
avatarLeft = getMeasuredWidth() - AndroidUtilities.dp(64);
thumbLeft = avatarLeft - AndroidUtilities.dp(11 + (thumbsCount * (thumbSize + 2) - 2));
} else {
typingLeft = messageLeft = messageNameLeft = AndroidUtilities.dp(messagePaddingStart + 4);
buttonLeft = typingLeft = messageLeft = messageNameLeft = AndroidUtilities.dp(messagePaddingStart + 4);
avatarLeft = AndroidUtilities.dp(10);
thumbLeft = avatarLeft + AndroidUtilities.dp(56 + 11);
}
@ -2069,7 +2070,7 @@ public class DialogCell extends BaseCell {
} else {
if (thumbsCount > 0) {
messageWidth += AndroidUtilities.dp((thumbsCount * (thumbSize + 2) - 2) + 5);
if (LocaleController.isRTL) {
if (LocaleController.isRTL && !isForumCell()) {
messageLeft -= AndroidUtilities.dp((thumbsCount * (thumbSize + 2) - 2) + 5);
}
}
@ -2115,6 +2116,8 @@ public class DialogCell extends BaseCell {
nameMuteLeft = (int) (nameLeft + (nameWidth - widthpx - left) - AndroidUtilities.dp(24));
} else if (drawScam != 0) {
nameMuteLeft = (int) (nameLeft + (nameWidth - widthpx) - AndroidUtilities.dp(6) - (drawScam == 1 ? Theme.dialogs_scamDrawable : Theme.dialogs_fakeDrawable).getIntrinsicWidth());
} else {
nameMuteLeft = 0;
}
if (left == 0) {
if (widthpx < nameWidth) {
@ -2200,6 +2203,16 @@ public class DialogCell extends BaseCell {
messageLeft -= left;
}
}
if (buttonLayout != null) {
int lineCount = buttonLayout.getLineCount();
if (lineCount > 0) {
left = Integer.MAX_VALUE;
for (int a = 0; a < lineCount; a++) {
left = Math.min(left, buttonLayout.getLineLeft(a));
}
buttonLeft -= left;
}
}
if (typingLayout != null) {
int lineCount = typingLayout.getLineCount();
if (lineCount > 0) {
@ -2235,6 +2248,7 @@ public class DialogCell extends BaseCell {
private void updateThumbsPosition() {
if (thumbsCount > 0) {
StaticLayout layout = isForumCell() ? buttonLayout : messageLayout;
int left = isForumCell() ? buttonLeft : messageLeft;
if (layout == null) {
return;
}
@ -2255,7 +2269,7 @@ public class DialogCell extends BaseCell {
offset += AndroidUtilities.dp(3);
}
for (int i = 0; i < thumbsCount; ++i) {
thumbImage[i].setImageX(messageLeft + offset + AndroidUtilities.dp((thumbSize + 2) * i));
thumbImage[i].setImageX(left + offset + AndroidUtilities.dp((thumbSize + 2) * i));
}
}
}
@ -2513,6 +2527,7 @@ public class DialogCell extends BaseCell {
public boolean update(int mask, boolean animated) {
boolean requestLayout = false;
boolean rebuildLayout = false;
boolean oldIsForumCell = isForumCell();
drawAvatarSelector = false;
ttlPeriod = 0;
@ -2735,7 +2750,6 @@ public class DialogCell extends BaseCell {
dialogMuted = isDialogCell && MessagesController.getInstance(currentAccount).isDialogMuted(currentDialogId, getTopicId());
}
dialogId = currentDialogId;
}
@ -2877,7 +2891,7 @@ public class DialogCell extends BaseCell {
avatarImage.setRoundRadius(chat != null && chat.forum && currentDialogFolderId == 0 && !useFromUserAsAvatar ? AndroidUtilities.dp(16) : AndroidUtilities.dp(28));
}
if (!isTopic && (getMeasuredWidth() != 0 || getMeasuredHeight() != 0)) {
buildLayout();
rebuildLayout = true;
} else {
//requestLayout();
}
@ -2893,6 +2907,9 @@ public class DialogCell extends BaseCell {
if (isForumCell() != oldIsForumCell) {
requestLayout = true;
}
if (rebuildLayout) {
buildLayout();
}
return requestLayout;
}
@ -3410,14 +3427,14 @@ public class DialogCell extends BaseCell {
if (!buttonCreated) {
canvasButton.rewind();
if (topMessageTopicEndIndex != topMessageTopicStartIndex && topMessageTopicEndIndex > 0) {
AndroidUtilities.rectTmp.set(messageLeft + AndroidUtilities.dp(2), messageTop, messageLeft + messageLayout.getPrimaryHorizontal(Math.min(messageLayout.getText().length(), topMessageTopicEndIndex)) - AndroidUtilities.dp(3), buttonTop - AndroidUtilities.dp(4));
AndroidUtilities.rectTmp.set(messageLeft + AndroidUtilities.dp(2) + messageLayout.getPrimaryHorizontal(0), messageTop, messageLeft + messageLayout.getPrimaryHorizontal(Math.min(messageLayout.getText().length(), topMessageTopicEndIndex)) - AndroidUtilities.dp(3), buttonTop - AndroidUtilities.dp(4));
AndroidUtilities.rectTmp.inset(-AndroidUtilities.dp(8), -AndroidUtilities.dp(4));
if (AndroidUtilities.rectTmp.right > AndroidUtilities.rectTmp.left) {
canvasButton.addRect(AndroidUtilities.rectTmp);
}
}
AndroidUtilities.rectTmp.set(messageLeft + AndroidUtilities.dp(2), buttonTop + AndroidUtilities.dp(2), messageLeft + buttonLayout.getLineWidth(0) + AndroidUtilities.dp(12), buttonTop + buttonLayout.getHeight());
AndroidUtilities.rectTmp.set(buttonLeft + AndroidUtilities.dp(2), buttonTop + AndroidUtilities.dp(2), buttonLeft + buttonLayout.getLineWidth(0) + AndroidUtilities.dp(12), buttonTop + buttonLayout.getHeight());
AndroidUtilities.rectTmp.inset(-AndroidUtilities.dp(8), -AndroidUtilities.dp(3));
canvasButton.addRect(AndroidUtilities.rectTmp);
}
@ -3429,7 +3446,7 @@ public class DialogCell extends BaseCell {
}
canvas.translate(messageLeft - buttonLayout.getLineLeft(0), buttonTop);
canvas.translate(buttonLeft, buttonTop);
if (!spoilers2.isEmpty()) {
try {
canvas.save();

View file

@ -139,6 +139,7 @@ public class DrawerActionCell extends FrameLayout {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setClassName("android.widget.Button");
info.addAction(AccessibilityNodeInfo.ACTION_CLICK);
info.addAction(AccessibilityNodeInfo.ACTION_LONG_CLICK);
info.setText(textView.getText());

View file

@ -226,13 +226,15 @@ public class DrawerProfileCell extends FrameLayout implements NotificationCenter
sunDrawable.setCustomEndFrame(0);
}
darkThemeView.playAnimation();
if (Theme.selectedAutoNightType != Theme.AUTO_NIGHT_TYPE_NONE) {
Toast.makeText(getContext(), LocaleController.getString("AutoNightModeOff", R.string.AutoNightModeOff), Toast.LENGTH_SHORT).show();
Theme.selectedAutoNightType = Theme.AUTO_NIGHT_TYPE_NONE;
Theme.saveAutoNightThemeConfig();
Theme.cancelAutoNightThemeCallbacks();
}
switchTheme(themeInfo, toDark);
if (drawerLayoutContainer != null ) {
FrameLayout layout = drawerLayoutContainer.getParent() instanceof FrameLayout ? (FrameLayout) drawerLayoutContainer.getParent() : null;
Theme.turnOffAutoNight(layout, () -> {
drawerLayoutContainer.closeDrawer(false);
drawerLayoutContainer.presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_NIGHT));
});
}
});
darkThemeView.setOnLongClickListener(e -> {
if (drawerLayoutContainer != null) {

View file

@ -433,6 +433,9 @@ public class GroupCallUserCell extends FrameLayout {
if (animatorSet != null) {
animatorSet.cancel();
}
if (rightDrawable != null) {
rightDrawable.detach();
}
}
public boolean isSelfUser() {
@ -538,6 +541,9 @@ public class GroupCallUserCell extends FrameLayout {
protected void onAttachedToWindow() {
super.onAttachedToWindow();
applyParticipantChanges(false);
if (rightDrawable != null) {
rightDrawable.attach();
}
}
public TLRPC.TL_groupCallParticipant getParticipant() {

View file

@ -264,11 +264,11 @@ public class GroupCreateUserCell extends FrameLayout {
}
avatarImageView.getLayoutParams().width = avatarImageView.getLayoutParams().height = AndroidUtilities.dp(46);
if (checkBox != null) {
((LayoutParams) checkBox.getLayoutParams()).topMargin = AndroidUtilities.dp(33) + padding;
((LayoutParams) checkBox.getLayoutParams()).topMargin = AndroidUtilities.dp(29) + padding;
if (LocaleController.isRTL) {
((LayoutParams) checkBox.getLayoutParams()).rightMargin = AndroidUtilities.dp(39) + padding;
} else {
((LayoutParams) checkBox.getLayoutParams()).leftMargin = AndroidUtilities.dp(40) + padding;
((LayoutParams) checkBox.getLayoutParams()).leftMargin = AndroidUtilities.dp(45) + padding;
}
}

View file

@ -14,6 +14,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -91,6 +92,10 @@ public class PhotoAttachCameraCell extends FrameLayout {
}
}
public Drawable getDrawable() {
return backgroundView.getDrawable();
}
protected int getThemedColor(String key) {
Integer color = resourcesProvider != null ? resourcesProvider.getColor(key) : null;
return color != null ? color : Theme.getColor(key);

View file

@ -280,16 +280,16 @@ public class SharedDocumentCell extends FrameLayout implements DownloadControlle
String backKey;
if (resId == R.drawable.files_storage) {
backKey = Theme.key_chat_attachLocationBackground;
iconKey = Theme.key_chat_attachLocationIcon;
iconKey = Theme.key_chat_attachIcon;
} else if (resId == R.drawable.files_gallery) {
backKey = Theme.key_chat_attachContactBackground;
iconKey = Theme.key_chat_attachContactIcon;
iconKey = Theme.key_chat_attachIcon;
} else if (resId == R.drawable.files_music) {
backKey = Theme.key_chat_attachAudioBackground;
iconKey = Theme.key_chat_attachAudioIcon;
iconKey = Theme.key_chat_attachIcon;
} else if (resId == R.drawable.files_internal) {
backKey = Theme.key_chat_attachGalleryBackground;
iconKey = Theme.key_chat_attachGalleryIcon;
iconKey = Theme.key_chat_attachIcon;
} else {
backKey = Theme.key_files_folderIconBackground;
iconKey = Theme.key_files_folderIcon;

View file

@ -30,6 +30,7 @@ import android.widget.TextView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.DownloadController;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.ApplicationLoader;

View file

@ -26,6 +26,7 @@ import org.telegram.messenger.Emoji;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
import org.telegram.messenger.LiteMode;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaDataController;
import org.telegram.messenger.MessageObject;

View file

@ -91,12 +91,7 @@ public class StickerSetCell extends FrameLayout {
imageView.setLayerNum(1);
addView(imageView, LayoutHelper.createFrame(40, 40, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 13, 9, LocaleController.isRTL ? 13 : 0, 0));
if (option == 2) {
progressView = new RadialProgressView(getContext());
progressView.setProgressColor(Theme.getColor(Theme.key_dialogProgressCircle));
progressView.setSize(AndroidUtilities.dp(30));
addView(progressView, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, LocaleController.isRTL ? 0 : 12, 5, LocaleController.isRTL ? 12 : 0, 0));
} else if (option != 0) {
if (option != 0) {
optionsButton = new ImageView(context);
optionsButton.setFocusable(false);
optionsButton.setScaleType(ImageView.ScaleType.CENTER);
@ -548,7 +543,7 @@ public class StickerSetCell extends FrameLayout {
public void updateRightMargin() {
sideButtons.measure(MeasureSpec.makeMeasureSpec(999999, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(58), MeasureSpec.EXACTLY));
final int margin = sideButtons.getMeasuredWidth();
final int margin = AndroidUtilities.dp(26) + sideButtons.getMeasuredWidth();
if (LocaleController.isRTL) {
((MarginLayoutParams) textView.getLayoutParams()).leftMargin = margin;
((MarginLayoutParams) valueTextView.getLayoutParams()).leftMargin = margin;

View file

@ -56,6 +56,7 @@ public class TextCell extends FrameLayout {
private float loadingProgress;
private float drawLoadingProgress;
private int lastWidth;
public TextCell(Context context) {
this(context, 23, false, false, null);
@ -165,6 +166,11 @@ public class TextCell extends FrameLayout {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = AndroidUtilities.dp(heightDp);
if (lastWidth != 0 && lastWidth != width && valueText != null) {
valueTextView.setText(TextUtils.ellipsize(valueText, valueTextView.getPaint(), AndroidUtilities.displaySize.x / 2.5f, TextUtils.TruncateAt.END), false);
}
lastWidth = width;
int valueWidth;
if (prioritizeTitleOverValue) {
textView.measure(MeasureSpec.makeMeasureSpec(width - AndroidUtilities.dp(71 + leftPadding), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY));
@ -175,7 +181,7 @@ public class TextCell extends FrameLayout {
valueTextView.measure(MeasureSpec.makeMeasureSpec(width - AndroidUtilities.dp(leftPadding), LocaleController.isRTL ? MeasureSpec.AT_MOST : MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY));
valueSpoilersTextView.measure(MeasureSpec.makeMeasureSpec(width - AndroidUtilities.dp(leftPadding), LocaleController.isRTL ? MeasureSpec.AT_MOST : MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY));
valueWidth = Math.max(valueTextView.width(), valueSpoilersTextView.getTextWidth());
textView.measure(MeasureSpec.makeMeasureSpec(width - AndroidUtilities.dp(71 + leftPadding) - valueWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY));
textView.measure(MeasureSpec.makeMeasureSpec(Math.max(0, width - AndroidUtilities.dp(71 + leftPadding) - valueWidth), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY));
subtitleView.measure(MeasureSpec.makeMeasureSpec(width - AndroidUtilities.dp(71 + leftPadding) - valueWidth, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(20), MeasureSpec.EXACTLY));
}
if (imageView.getVisibility() == VISIBLE) {
@ -204,7 +210,7 @@ public class TextCell extends FrameLayout {
int width = right - left;
int viewTop = (height - Math.max(valueSpoilersTextView.getTextHeight(), valueTextView.getTextHeight())) / 2;
int viewLeft = LocaleController.isRTL ? AndroidUtilities.dp(leftPadding) : 0;
int viewLeft = LocaleController.isRTL ? AndroidUtilities.dp(leftPadding) : width - valueTextView.getMeasuredWidth() - AndroidUtilities.dp(leftPadding);
if (prioritizeTitleOverValue && !LocaleController.isRTL) {
viewLeft = width - valueTextView.getMeasuredWidth() - AndroidUtilities.dp(leftPadding);
}
@ -257,10 +263,12 @@ public class TextCell extends FrameLayout {
}
}
private CharSequence valueText;
public void setText(String text, boolean divider) {
imageLeft = 21;
textView.setText(text);
valueTextView.setText(null, false);
valueTextView.setText(valueText = null, false);
imageView.setVisibility(GONE);
valueTextView.setVisibility(GONE);
valueSpoilersTextView.setVisibility(GONE);
@ -273,7 +281,7 @@ public class TextCell extends FrameLayout {
imageLeft = 21;
offsetFromImage = 71;
textView.setText(text);
valueTextView.setText(null, false);
valueTextView.setText(valueText = null, false);
imageView.setImageResource(resId);
imageView.setVisibility(VISIBLE);
valueTextView.setVisibility(GONE);
@ -288,7 +296,7 @@ public class TextCell extends FrameLayout {
imageLeft = 21;
offsetFromImage = 71;
textView.setText(text);
valueTextView.setText(null, false);
valueTextView.setText(valueText = null, false);
setColorfulIcon(color, resId);
valueTextView.setVisibility(GONE);
valueImageView.setVisibility(GONE);
@ -300,7 +308,7 @@ public class TextCell extends FrameLayout {
offsetFromImage = 68;
imageLeft = 18;
textView.setText(text);
valueTextView.setText(null, false);
valueTextView.setText(valueText = null, false);
imageView.setColorFilter(null);
if (drawable instanceof RLottieDrawable) {
imageView.setAnimation((RLottieDrawable) drawable);
@ -331,7 +339,7 @@ public class TextCell extends FrameLayout {
imageLeft = 21;
offsetFromImage = 71;
textView.setText(text);
valueTextView.setText(value, animated);
valueTextView.setText(TextUtils.ellipsize(valueText = value, valueTextView.getPaint(), AndroidUtilities.displaySize.x / 2.5f, TextUtils.TruncateAt.END), animated);
valueTextView.setVisibility(VISIBLE);
valueSpoilersTextView.setVisibility(GONE);
imageView.setVisibility(GONE);
@ -347,7 +355,7 @@ public class TextCell extends FrameLayout {
imageLeft = 21;
offsetFromImage = 71;
textView.setText(text);
valueTextView.setText(value, animated);
valueTextView.setText(TextUtils.ellipsize(valueText = value, valueTextView.getPaint(), AndroidUtilities.displaySize.x / 2.5f, TextUtils.TruncateAt.END), animated);
valueTextView.setVisibility(VISIBLE);
valueSpoilersTextView.setVisibility(GONE);
setColorfulIcon(color, resId);
@ -359,6 +367,26 @@ public class TextCell extends FrameLayout {
}
}
public void setTextAndSpoilersValueAndIcon(String text, CharSequence value, int resId, boolean divider) {
imageLeft = 21;
offsetFromImage = 71;
textView.setText(text);
valueSpoilersTextView.setVisibility(VISIBLE);
valueSpoilersTextView.setText(value);
valueTextView.setVisibility(GONE);
valueImageView.setVisibility(GONE);
imageView.setVisibility(VISIBLE);
imageView.setTranslationX(0);
imageView.setTranslationY(0);
imageView.setPadding(0, AndroidUtilities.dp(7), 0, 0);
imageView.setImageResource(resId);
needDivider = divider;
setWillNotDraw(!needDivider);
if (checkBox != null) {
checkBox.setVisibility(GONE);
}
}
public void setTextAndSpoilersValueAndColorfulIcon(String text, CharSequence value, int resId, int color, boolean divider) {
imageLeft = 21;
offsetFromImage = 71;
@ -383,7 +411,7 @@ public class TextCell extends FrameLayout {
imageLeft = 21;
offsetFromImage = 71;
textView.setText(text);
valueTextView.setText(value, animated);
valueTextView.setText(TextUtils.ellipsize(valueText = value, valueTextView.getPaint(), AndroidUtilities.displaySize.x / 2.5f, TextUtils.TruncateAt.END), animated);
valueTextView.setVisibility(VISIBLE);
valueSpoilersTextView.setVisibility(GONE);
valueImageView.setVisibility(GONE);
@ -465,7 +493,7 @@ public class TextCell extends FrameLayout {
imageLeft = 21;
offsetFromImage = 71;
textView.setText(text);
valueTextView.setText(null, false);
valueTextView.setText(valueText = null, false);
valueImageView.setVisibility(VISIBLE);
valueImageView.setImageDrawable(drawable);
valueTextView.setVisibility(GONE);
@ -489,12 +517,26 @@ public class TextCell extends FrameLayout {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
final CharSequence text = textView.getText();
CharSequence text = textView.getText();
if (!TextUtils.isEmpty(text)) {
final CharSequence valueText = valueTextView.getText();
if (!TextUtils.isEmpty(valueText)) {
info.setText(text + ": " + valueText);
} else {
text = TextUtils.concat(text, ": ", valueText);
}
}
if (checkBox != null) {
info.setClassName("android.widget.Switch");
info.setCheckable(true);
info.setChecked(checkBox.isChecked());
StringBuilder sb = new StringBuilder();
sb.append(textView.getText());
if (!TextUtils.isEmpty(valueTextView.getText())) {
sb.append('\n');
sb.append(valueTextView.getText());
}
info.setContentDescription(sb);
} else {
if (!TextUtils.isEmpty(text)) {
info.setText(text);
}
}

View file

@ -77,6 +77,7 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
private ArrayList<Theme.ThemeInfo> defaultThemes;
private int currentType;
private int prevCount;
private BaseFragment fragment;
private class ThemesListAdapter extends RecyclerListView.SelectionAdapter {
@ -683,12 +684,13 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
}
}
public ThemesHorizontalListCell(Context context, int type, ArrayList<Theme.ThemeInfo> def, ArrayList<Theme.ThemeInfo> custom) {
public ThemesHorizontalListCell(Context context, BaseFragment fragment, int type, ArrayList<Theme.ThemeInfo> def, ArrayList<Theme.ThemeInfo> custom) {
super(context);
customThemes = custom;
defaultThemes = def;
currentType = type;
this.fragment = fragment;
if (type == ThemeActivity.THEME_TYPE_OTHER) {
setBackgroundColor(Theme.getColor(Theme.key_dialogBackground));
@ -731,7 +733,9 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
return;
}
if (themeInfo.info.document == null) {
presentFragment(new ThemeSetUrlActivity(themeInfo, null, true));
if (fragment != null) {
fragment.presentFragment(new ThemeSetUrlActivity(themeInfo, null, true));
}
return;
}
}
@ -764,6 +768,10 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
}
}
EmojiThemes.saveCustomTheme(themeInfo, themeInfo.currentAccentId);
if (currentType != ThemeActivity.THEME_TYPE_NIGHT) {
Theme.turnOffAutoNight(fragment);
}
}
public void setDrawDivider(boolean draw) {
@ -889,10 +897,6 @@ public class ThemesHorizontalListCell extends RecyclerListView implements Notifi
}
protected void presentFragment(BaseFragment fragment) {
}
protected void updateRows() {
}

View file

@ -3126,12 +3126,9 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_gamePaint, null, null, Theme.key_chat_previewGameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewInstantText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewInstantText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewInstantSelectedText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewInstantSelectedText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_deleteProgressPaint, null, null, Theme.key_chat_secretTimeText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_botButtonPaint, null, null, Theme.key_chat_botButtonText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_botProgressPaint, null, null, Theme.key_chat_botProgress));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inForwardedNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outForwardedNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inViaBotNameText));
@ -3219,25 +3216,12 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inMediaIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLoaderSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inMediaIconSelected));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][0], Theme.chat_photoStatesDrawables[1][0], Theme.chat_photoStatesDrawables[2][0], Theme.chat_photoStatesDrawables[3][0]}, null, Theme.key_chat_mediaLoaderPhoto));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][0], Theme.chat_photoStatesDrawables[1][0], Theme.chat_photoStatesDrawables[2][0], Theme.chat_photoStatesDrawables[3][0]}, null, Theme.key_chat_mediaLoaderPhotoIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][1], Theme.chat_photoStatesDrawables[1][1], Theme.chat_photoStatesDrawables[2][1], Theme.chat_photoStatesDrawables[3][1]}, null, Theme.key_chat_mediaLoaderPhotoSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][1], Theme.chat_photoStatesDrawables[1][1], Theme.chat_photoStatesDrawables[2][1], Theme.chat_photoStatesDrawables[3][1]}, null, Theme.key_chat_mediaLoaderPhotoIconSelected));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][0], Theme.chat_photoStatesDrawables[8][0]}, null, Theme.key_chat_outLoaderPhoto));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][0], Theme.chat_photoStatesDrawables[8][0]}, null, Theme.key_chat_outLoaderPhotoIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][1], Theme.chat_photoStatesDrawables[8][1]}, null, Theme.key_chat_outLoaderPhotoSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][1], Theme.chat_photoStatesDrawables[8][1]}, null, Theme.key_chat_outLoaderPhotoIconSelected));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][0], Theme.chat_photoStatesDrawables[11][0]}, null, Theme.key_chat_inLoaderPhoto));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][0], Theme.chat_photoStatesDrawables[11][0]}, null, Theme.key_chat_inLoaderPhotoIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][1], Theme.chat_photoStatesDrawables[11][1]}, null, Theme.key_chat_inLoaderPhotoSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][1], Theme.chat_photoStatesDrawables[11][1]}, null, Theme.key_chat_inLoaderPhotoIconSelected));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[0]}, null, Theme.key_chat_inContactBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[0]}, null, Theme.key_chat_inContactIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[1]}, null, Theme.key_chat_outContactBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[1]}, null, Theme.key_chat_outContactIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLocationBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[0]}, null, Theme.key_chat_inLocationIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outLocationBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[1]}, null, Theme.key_chat_outLocationIcon));
themeDescriptions.add(new ThemeDescription(bottomOverlayChat, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground));
@ -3256,9 +3240,6 @@ public class ChannelAdminLogActivity extends BaseFragment implements Notificatio
themeDescriptions.add(new ThemeDescription(progressView2, ThemeDescription.FLAG_SERVICEBACKGROUND, null, null, null, null, Theme.key_chat_serviceBackground));
themeDescriptions.add(new ThemeDescription(emptyView, ThemeDescription.FLAG_SERVICEBACKGROUND, null, null, null, null, Theme.key_chat_serviceBackground));
themeDescriptions.add(new ThemeDescription(avatarContainer != null ? avatarContainer.getTimeItem() : null, 0, null, null, null, null, Theme.key_chat_secretTimerBackground));
themeDescriptions.add(new ThemeDescription(avatarContainer != null ? avatarContainer.getTimeItem() : null, 0, null, null, null, null, Theme.key_chat_secretTimerText));
themeDescriptions.add(new ThemeDescription(undoView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_undo_background));
themeDescriptions.add(new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"undoImageView"}, null, null, null, Theme.key_undo_cancelColor));
themeDescriptions.add(new ThemeDescription(undoView, 0, new Class[]{UndoView.class}, new String[]{"undoTextView"}, null, null, null, Theme.key_undo_cancelColor));

View file

@ -131,6 +131,7 @@ import org.telegram.messenger.Emoji;
import org.telegram.messenger.EmojiData;
import org.telegram.messenger.FileLoader;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.FlagSecureReason;
import org.telegram.messenger.ForwardingMessagesParams;
import org.telegram.messenger.ImageLocation;
import org.telegram.messenger.ImageReceiver;
@ -203,6 +204,7 @@ import org.telegram.ui.Components.BlurBehindDrawable;
import org.telegram.ui.Components.BluredView;
import org.telegram.ui.Components.BlurredFrameLayout;
import org.telegram.ui.Components.BotCommandsMenuView;
import org.telegram.ui.Components.BotWebViewSheet;
import org.telegram.ui.Components.Bulletin;
import org.telegram.ui.Components.BulletinFactory;
import org.telegram.ui.Components.ChatActivityEnterTopView;
@ -295,7 +297,6 @@ import org.telegram.ui.Components.ViewHelper;
import org.telegram.ui.Components.spoilers.SpoilerEffect;
import org.telegram.ui.Components.voip.VoIPHelper;
import org.telegram.ui.Delegates.ChatActivityMemberRequestsDelegate;
import org.telegram.ui.LNavigation.LNavigation;
import java.io.BufferedWriter;
import java.io.File;
@ -525,8 +526,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private boolean showPinBulletin;
private int pinBullerinTag;
protected boolean openKeyboardOnAttachMenuClose;
private Runnable unregisterFlagSecurePasscode;
private Runnable unregisterFlagSecureNoforwards;
private FlagSecureReason flagSecure;
private boolean isFullyVisible;
private MessageObject hintMessageObject;
@ -692,7 +692,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private SparseArray<MessageObject> repliesMessagesDict = new SparseArray<>();
private SparseArray<ArrayList<Integer>> replyMessageOwners = new SparseArray<>();
private HashMap<String, ArrayList<MessageObject>> messagesByDays = new HashMap<>();
public ArrayList<MessageObject> messages = new ArrayList<MessageObject>();
public ArrayList<MessageObject> messages = new ArrayList<>();
private SparseArray<MessageObject> waitingForReplies = new SparseArray<>();
private LongSparseArray<ArrayList<MessageObject>> polls = new LongSparseArray<>();
private LongSparseArray<MessageObject.GroupedMessages> groupedMessagesMap = new LongSparseArray<>();
@ -739,6 +739,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
skeletonOutlinePaint.setStrokeWidth(AndroidUtilities.dp(1));
}
private String inlineQueryForInput;
private boolean premiumInvoiceBot;
private boolean showScrollToMessageError;
private int startLoadFromMessageId;
@ -2033,6 +2034,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
attachMenuBotStartCommand = arguments.getString("attach_bot_start_command", null);
inlineReturn = arguments.getLong("inline_return", 0);
String inlineQuery = arguments.getString("inline_query");
inlineQueryForInput = arguments.getString("inline_query_input");
premiumInvoiceBot = arguments.getBoolean("premium_bot", false);
startLoadFromMessageId = arguments.getInt("message_id", 0);
startLoadFromDate = arguments.getInt("start_from_date", 0);
@ -2615,13 +2617,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
MediaController.getInstance().stopMediaObserver();
}
if (unregisterFlagSecureNoforwards != null) {
unregisterFlagSecureNoforwards.run();
unregisterFlagSecureNoforwards = null;
}
if (unregisterFlagSecurePasscode != null) {
unregisterFlagSecurePasscode.run();
unregisterFlagSecurePasscode = null;
if (flagSecure != null) {
flagSecure.detach();
}
if (currentUser != null) {
getMessagesController().cancelLoadFullUser(currentUser.id);
@ -5926,6 +5923,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
sendBotInlineResult(result, true, 0);
}
}
} else if (object instanceof TLRPC.TL_inlineBotWebView) {
processInlineBotWebView((TLRPC.TL_inlineBotWebView) object);
} else if (object instanceof TLRPC.TL_inlineBotSwitchPM) {
processInlineBotContextPM((TLRPC.TL_inlineBotSwitchPM) object);
} else if (object instanceof MediaDataController.KeywordResult) {
@ -5963,6 +5962,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (getParentActivity() == null || !mentionContainer.getAdapter().isLongClickEnabled()) {
return false;
}
if (position == 0 || mentionContainer.getAdapter().isBannedInline()) {
return false;
}
position--;
Object object = mentionContainer.getAdapter().getItem(position);
if (object instanceof String) {
if (mentionContainer.getAdapter().isBotCommands()) {
@ -6000,7 +6003,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
drawable = Theme.createCircleDrawable(AndroidUtilities.dp(42), getThemedColor(Theme.key_chat_goDownButton));
}
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.pagedown_shadow).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_goDownButtonShadow), PorterDuff.Mode.MULTIPLY));
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(42), AndroidUtilities.dp(42));
drawable = combinedDrawable;
@ -6055,7 +6058,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
drawable = Theme.createCircleDrawable(AndroidUtilities.dp(42), getThemedColor(Theme.key_chat_goDownButton));
}
shadowDrawable = context.getResources().getDrawable(R.drawable.pagedown_shadow).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_goDownButtonShadow), PorterDuff.Mode.MULTIPLY));
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(42), AndroidUtilities.dp(42));
drawable = combinedDrawable;
@ -6131,7 +6134,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
drawable = Theme.createCircleDrawable(AndroidUtilities.dp(42), getThemedColor(Theme.key_chat_goDownButton));
}
shadowDrawable = context.getResources().getDrawable(R.drawable.pagedown_shadow).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_goDownButtonShadow), PorterDuff.Mode.MULTIPLY));
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(42), AndroidUtilities.dp(42));
drawable = combinedDrawable;
@ -6377,6 +6380,10 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatActivityEnterView.updateBotWebView(false);
chatActivityEnterView.setMinimumHeight(AndroidUtilities.dp(51));
chatActivityEnterView.setAllowStickersAndGifs(true, true, currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 46);
if (inlineQueryForInput != null) {
chatActivityEnterView.setFieldText(inlineQueryForInput);
inlineQueryForInput = null;
}
if (inPreviewMode) {
chatActivityEnterView.setVisibility(View.INVISIBLE);
}
@ -6846,12 +6853,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
chatScrollHelper.setScrollListener(this::invalidateMessagesVisiblePart);
chatScrollHelper.setAnimationCallback(chatScrollHelperCallback);
if (currentEncryptedChat != null && (SharedConfig.passcodeHash.length() == 0 || SharedConfig.allowScreenCapture)) {
unregisterFlagSecurePasscode = AndroidUtilities.registerFlagSecure(getParentActivity().getWindow());
}
if (getMessagesController().isChatNoForwards(currentChat)) {
unregisterFlagSecureNoforwards = AndroidUtilities.registerFlagSecure(getParentActivity().getWindow());
}
flagSecure = new FlagSecureReason(getParentActivity().getWindow(), () -> currentEncryptedChat != null || SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture || getMessagesController().isChatNoForwards(currentChat));
if (oldMessage != null) {
chatActivityEnterView.setFieldText(oldMessage);
}
@ -7271,16 +7274,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
long chatId = chatInfo.id;
InviteMembersBottomSheet bottomSheet = new InviteMembersBottomSheet(getContext(), currentAccount, users, chatInfo.id, ChatActivity.this, themeDelegate);
bottomSheet.setDelegate((users1, fwdCount) -> {
int N = users1.size();
int[] finished = new int[1];
for (int a = 0; a < N; a++) {
TLRPC.User user = users1.get(a);
getMessagesController().addUserToChat(chatId, user, fwdCount, null, ChatActivity.this, () -> {
if (++finished[0] == N) {
BulletinFactory.of(ChatActivity.this).createUsersAddedBulletin(users1, currentChat).show();
}
});
}
getMessagesController().addUsersToChat(currentChat, ChatActivity.this, users1, fwdCount, null, null, null);
getMessagesController().hidePeerSettingsBar(dialog_id, currentUser, currentChat);
updateTopPanel(true);
updateInfoTopView(true);
@ -8409,7 +8403,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(getThemedColor(Theme.key_dialogTextRed2));
button.setTextColor(getThemedColor(Theme.key_dialogTextRed));
}
}
@ -9258,6 +9252,13 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
public void processInlineBotWebView(TLRPC.TL_inlineBotWebView object) {
BotWebViewSheet webViewSheet = new BotWebViewSheet(getContext(), getResourceProvider());
webViewSheet.setParentActivity(getParentActivity());
webViewSheet.requestWebView(currentAccount, currentUser != null ? currentUser.id : currentChat.id, mentionContainer.getAdapter().getFoundContextBot().id, object.text, object.url, BotWebViewSheet.TYPE_SIMPLE_WEB_VIEW_BUTTON, 0, false, BotWebViewSheet.FLAG_FROM_INLINE_SWITCH);
webViewSheet.show();
}
public void processInlineBotContextPM(TLRPC.TL_inlineBotSwitchPM object) {
if (object == null || mentionContainer == null) {
return;
@ -11664,7 +11665,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
public void updateMessagesVisiblePart(boolean inLayout) {
if (chatListView == null) {
if (chatListView == null || fragmentView == null) {
return;
}
int count = chatListView.getChildCount();
@ -13537,7 +13538,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int size = ((ExtendedGridLayoutManager) layoutManager).getRowsCount(widthSize);
int maxHeight = size * 102;
if (mentionContainer.getAdapter().isBotContext()) {
if (mentionContainer.getAdapter().getBotContextSwitch() != null) {
if (mentionContainer.getAdapter().getBotContextSwitch() != null || mentionContainer.getAdapter().getBotWebViewSwitch() != null) {
maxHeight += 34;
}
}
@ -13547,7 +13548,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
int size = mentionContainer.getAdapter().getLastItemCount();
int maxHeight = 0;
if (mentionContainer.getAdapter().isBotContext()) {
if (mentionContainer.getAdapter().getBotContextSwitch() != null) {
if (mentionContainer.getAdapter().getBotContextSwitch() != null || mentionContainer.getAdapter().getBotWebViewSwitch() != null) {
maxHeight += 36;
size -= 1;
}
@ -13625,9 +13626,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else {
paddingBottom = keyboardSize <= AndroidUtilities.dp(20) && !AndroidUtilities.isInMultiwindow && !inBubbleMode ? chatActivityEnterView.getEmojiPadding() : 0;
}
if (!SharedConfig.smoothKeyboard) {
setBottomClip(paddingBottom);
}
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
@ -13818,6 +13816,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
suggestEmojiPanel.forceClose();
}
} else {
createEmptyView();
if (currentEncryptedChat == null || bigEmptyView == null) {
bottomOverlay.setVisibility(View.INVISIBLE);
if (suggestEmojiPanel != null && chatActivityEnterView != null && chatActivityEnterView.hasText()) {
@ -14965,7 +14964,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
object.viewX = coords[0];
object.viewY = coords[1] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight);
object.parentView = chatListView;
object.animatingImageView = !SharedConfig.smoothKeyboard && pagedownButton != null && pagedownButton.getTag() != null && view instanceof ChatMessageCell ? animatingImageView : null;
object.animatingImageView = null;
object.imageReceiver = imageReceiver;
if (needPreview) {
object.thumb = imageReceiver.getBitmapSafe();
@ -15123,7 +15122,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
private boolean isSkeletonVisible() {
if (justCreatedTopic || justCreatedChat || currentUser != null || chatListView == null || !SharedConfig.animationsEnabled() || !LiteMode.isEnabled(LiteMode.FLAG_CHAT_BACKGROUND)) {
if (justCreatedTopic || justCreatedChat || currentUser != null || chatListView == null || !SharedConfig.animationsEnabled() || !LiteMode.isEnabled(LiteMode.FLAGS_CHAT)) {
return false;
}
int childHeight = 0;
@ -15497,6 +15496,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
firstLoading = false;
AndroidUtilities.runOnUIThread(() -> {
getNotificationCenter().runDelayedNotifications();
resumeDelayedFragmentAnimation();
AndroidUtilities.cancelRunOnUIThread(fragmentTransitionRunnable);
fragmentTransitionRunnable.run();
});
}
if (isThreadChat() && !isTopic && (load_type == 2 || load_type == 3) && !isCache) {
@ -16243,16 +16248,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
chatWasReset = false;
if (isFirstLoading) {
AndroidUtilities.runOnUIThread(() -> {
resumeDelayedFragmentAnimation();
AndroidUtilities.cancelRunOnUIThread(fragmentTransitionRunnable);
fragmentTransitionRunnable.run();
getNotificationCenter().runDelayedNotifications();
});
}
} else if (id == NotificationCenter.invalidateMotionBackground) {
if (chatListView != null) {
chatListView.invalidateViews();
@ -16361,18 +16356,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (chatActivityEnterView != null) {
chatActivityEnterView.setDialogId(dialog_id, currentAccount);
}
if (currentEncryptedChat != null && SharedConfig.passcodeHash.length() == 0 && !SharedConfig.allowScreenCapture && unregisterFlagSecurePasscode == null) {
unregisterFlagSecurePasscode = AndroidUtilities.registerFlagSecure(getParentActivity().getWindow());
}
if (fwdChanged) {
boolean value = getMessagesController().isChatNoForwards(currentChat);
if (!value && unregisterFlagSecureNoforwards != null) {
unregisterFlagSecureNoforwards.run();
unregisterFlagSecureNoforwards = null;
} else if (value && unregisterFlagSecureNoforwards == null) {
unregisterFlagSecureNoforwards = AndroidUtilities.registerFlagSecure(getParentActivity().getWindow());
}
if (flagSecure != null) {
flagSecure.invalidate();
}
}
if (avatarContainer != null && updateSubtitle) {
@ -17074,6 +17059,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
} else if (id == NotificationCenter.messagePlayingDidStart) {
MessageObject messageObject = (MessageObject) args[0];
MessageObject oldPlayingObject = (MessageObject) args[1];
if (messageObject.eventId != 0) {
return;
}
@ -17082,7 +17068,19 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if ((messageObject.isRoundVideo() || messageObject.isVideo()) && fragmentView != null && fragmentView.getParent() != null) {
if (!messageObject.isVoiceTranscriptionOpen()) {
MediaController.getInstance().setTextureView(createTextureView(true), aspectRatioFrameLayout, videoPlayerContainer, true);
updateTextureViewPosition(true, true);
boolean needScroll = false;
if (oldPlayingObject != null) {
int index1 = messages.indexOf(oldPlayingObject);
int index2 = messages.indexOf(messageObject);
if (index1 >= 0 && index2 >= 0 && Math.abs(index1 - index2) < 5) {
needScroll = true;
}
}
updateTextureViewPosition(true, needScroll);
if (!needScroll) {
checkTextureViewPosition = true;
updateMessagesVisiblePart(false);
}
} else {
MediaController.getInstance().setTextureView(createTextureView(true), aspectRatioFrameLayout, videoPlayerContainer, true);
}
@ -17985,6 +17983,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
checkThemeEmoticon();
if (chatActivityEnterView != null) {
chatActivityEnterView.checkChannelRights();
chatActivityEnterView.updateGiftButton(true);
}
if (headerItem != null) {
showAudioCallAsIcon = userInfo.phone_calls_available && !inPreviewMode;
@ -18963,7 +18962,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
}
if (messageObject.wasJustSent && (getUserConfig().isPremium() || messageObject.isAnimatedAnimatedEmoji()) && !(SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW || !LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_STICKERS_CHAT))) {
if (messageObject.wasJustSent && (getUserConfig().isPremium() || messageObject.isAnimatedAnimatedEmoji()) && !(SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW || !LiteMode.isEnabled(messageObject.isAnimatedAnimatedEmoji() ? LiteMode.FLAG_ANIMATED_EMOJI_CHAT : LiteMode.FLAG_ANIMATED_STICKERS_CHAT))) {
messageObject.forcePlayEffect = true;
}
}
@ -20133,6 +20132,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
progressDialogCurrent.cancel();
progressDialogCurrent = null;
}
flagSecure.detach();
}
public void saveKeyboardPositionBeforeTransition() {
@ -20203,9 +20204,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
@Override
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
super.onTransitionAnimationEnd(isOpen, backward);
if (getParentLayout() instanceof LNavigation && ((LNavigation) getParentLayout()).doShowOpenChat()) {
Toast.makeText(getParentActivity(), "Opened chat fragment in " + (System.currentTimeMillis() - startMs) + "ms", Toast.LENGTH_SHORT).show();
}
if (isOpen) {
if (backward) {
if (showPinBulletin && pinBulletin != null) {
@ -20362,7 +20360,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
openAttachBotLayout(user.id, attachMenuBotStartCommand);
} else {
AttachBotIntroTopView introTopView = new AttachBotIntroTopView(getParentActivity());
introTopView.setColor(Theme.getColor(Theme.key_chat_attachContactIcon));
introTopView.setColor(Theme.getColor(Theme.key_chat_attachIcon));
introTopView.setBackgroundColor(Theme.getColor(Theme.key_dialogTopBackground));
introTopView.setAttachBot(attachMenuBot);
@ -22471,6 +22469,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
pullingDownOffset = 0;
chatListView.invalidate();
}
flagSecure.attach();
}
public float getPullingDownOffset() {
@ -23199,7 +23199,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
final ArrayList<Integer> options = new ArrayList<>();
View optionsView = null;
if (AndroidUtilities.isAccessibilityScreenReaderEnabled() && message.messageOwner != null && message.messageOwner.from_id.user_id != getUserConfig().clientUserId) {
if (AndroidUtilities.isAccessibilityScreenReaderEnabled() && message.messageOwner != null && message.messageOwner.from_id != null && message.messageOwner.from_id.user_id != getUserConfig().clientUserId) {
items.add(LocaleController.getString(R.string.OpenProfile));
options.add(OPTION_OPEN_PROFILE);
icons.add(R.drawable.msg_user_search);
@ -23745,10 +23745,11 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
} else {
isReactionsAvailable = !message.isSecretMedia() && !isSecretChat() && !isInScheduleMode() && message.isReactionsAvailable() && (chatInfo != null && !(chatInfo.available_reactions instanceof TLRPC.TL_chatReactionsNone) || (chatInfo == null && !ChatObject.isChannel(currentChat)) || currentUser != null) && !availableReacts.isEmpty();
}
boolean showMessageSeen = !isReactionsViewAvailable && !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().chatReadMarkExpirePeriod) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && chatInfo != null && chatInfo.participants_count <= getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell);
boolean showMessageSeen = !isReactionsViewAvailable && !isInScheduleMode() && currentChat != null && message.isOutOwner() && message.isSent() && !message.isEditing() && !message.isSending() && !message.isSendError() && !message.isContentUnread() && !message.isUnread() && (ConnectionsManager.getInstance(currentAccount).getCurrentTime() - message.messageOwner.date < getMessagesController().chatReadMarkExpirePeriod) && (ChatObject.isMegagroup(currentChat) || !ChatObject.isChannel(currentChat)) && !ChatObject.isForum(currentChat) && chatInfo != null && chatInfo.participants_count <= getMessagesController().chatReadMarkSizeThreshold && !(message.messageOwner.action instanceof TLRPC.TL_messageActionChatJoinedByRequest) && (v instanceof ChatMessageCell);
boolean showSponsorInfo = selectedObject != null && selectedObject.isSponsored() && (selectedObject.sponsoredInfo != null || selectedObject.sponsoredAdditionalInfo != null);
int flags = 0;
if (isReactionsViewAvailable || showMessageSeen) {
if (isReactionsViewAvailable || showMessageSeen || showSponsorInfo) {
flags |= ActionBarPopupWindow.ActionBarPopupWindowLayout.FLAG_USE_SWIPEBACK;
}
@ -23776,7 +23777,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
ReactedUsersListView.ContainerLinerLayout linearLayout = new ReactedUsersListView.ContainerLinerLayout(contentView.getContext());
linearLayout.hasHeader = hasHeader;
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setLayoutParams(new FrameLayout.LayoutParams(AndroidUtilities.dp(200), AndroidUtilities.dp(6 * 48 + (hasHeader ? 44 * 2 + 8 : 44)) + (!hasHeader ? 1 : 0)));
linearLayout.setLayoutParams(new FrameLayout.LayoutParams(AndroidUtilities.dp(200), AndroidUtilities.dp(6 * ReactedUsersListView.ITEM_HEIGHT_DP + (hasHeader ? 44 * 2 + 8 : 44)) + (!hasHeader ? 1 : 0)));
ActionBarMenuSubItem backCell = new ActionBarMenuSubItem(getParentActivity(), true, false, themeDelegate);
backCell.setItemHeight(44);
backCell.setTextAndIcon(LocaleController.getString("Back", R.string.Back), R.drawable.msg_arrow_back);
@ -23952,9 +23953,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
});
linearLayout.addView(pager, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 0, 1f));
} else {
View gap = new FrameLayout(contentView.getContext());
gap.setBackgroundColor(getThemedColor(Theme.key_actionBarDefaultSubmenuSeparator));
linearLayout.addView(gap, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8));
linearLayout.addView(new ActionBarPopupWindow.GapView(contentView.getContext(), themeDelegate), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8));
reactedUsersListView = new ReactedUsersListView(contentView.getContext(), themeDelegate, currentAccount, message, null, false)
.setSeenUsers(reactedView.getSeenUsers())
@ -24015,6 +24014,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
RecyclerListView listView2 = finalMessageSeenView.createListView();
backContainer.addView(cell);
linearLayout.addView(backContainer);
linearLayout.addView(new ActionBarPopupWindow.GapView(contentView.getContext(), themeDelegate), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8));
backContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -24030,7 +24030,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (scrimPopupWindow == null || finalMessageSeenView.users.isEmpty()) {
return;
}
if (finalMessageSeenView.users.size() == 1) {
if (finalMessageSeenView.users.size() == 1 && (finalMessageSeenView.dates.size() <= 0 || finalMessageSeenView.dates.get(0) <= 0)) {
TLRPC.User user = finalMessageSeenView.users.get(0);
if (user == null) {
return;
@ -24043,8 +24043,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
return;
}
int totalHeight = contentView.getHeightWithKeyboard();
if (SharedConfig.messageSeenHintCount > 0 && contentView.getKeyboardHeight() < AndroidUtilities.dp(20)) {
messageSeenPrivacyBulletin = BulletinFactory.of(Bulletin.BulletinWindow.make(getContext()), themeDelegate).createErrorBulletin(AndroidUtilities.replaceTags(LocaleController.getString("MessageSeenTooltipMessage", R.string.MessageSeenTooltipMessage)));
messageSeenPrivacyBulletin.setDuration(4000);
@ -24065,6 +24063,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if (user == null) {
return;
}
closeMenu(true);
Bundle args = new Bundle();
args.putLong("user_id", user.id);
ProfileActivity fragment = new ProfileActivity(args);
@ -24203,38 +24202,127 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
final boolean translateButtonEnabled = MessagesController.getInstance(currentAccount).getTranslateController().isContextTranslateEnabled();
scrimPopupWindowItems = new ActionBarMenuSubItem[items.size() + (selectedObject != null && selectedObject.isSponsored() ? 1 : 0)];
for (int a = 0, N = items.size(); a < N; a++) {
if (a == 0 && selectedObject != null && selectedObject.isSponsored()) {
if (selectedObject != null && selectedObject.isSponsored()) {
if (selectedObject.sponsoredInfo != null || selectedObject.sponsoredAdditionalInfo != null) {
LinearLayout linearLayout = new LinearLayout(getParentActivity());
linearLayout.setOrientation(LinearLayout.VERTICAL);
ActionBarMenuSubItem backCell = new ActionBarMenuSubItem(getParentActivity(), true, false, themeDelegate);
backCell.setItemHeight(44);
backCell.setTextAndIcon(LocaleController.getString("Back", R.string.Back), R.drawable.msg_arrow_back);
backCell.getTextView().setPadding(LocaleController.isRTL ? 0 : AndroidUtilities.dp(40), 0, LocaleController.isRTL ? AndroidUtilities.dp(40) : 0, 0);
backCell.setOnClickListener(v1 -> popupLayout.getSwipeBack().closeForeground());
linearLayout.addView(backCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
linearLayout.addView(new ActionBarPopupWindow.GapView(contentView.getContext(), themeDelegate), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8));
if (selectedObject.sponsoredInfo != null) {
TextView textView = new TextView(getParentActivity());
textView.setTextColor(getThemedColor(Theme.key_actionBarDefaultSubmenuItem));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
textView.setPadding(AndroidUtilities.dp(18), AndroidUtilities.dp(10), AndroidUtilities.dp(18), AndroidUtilities.dp(10));
textView.setMaxWidth(AndroidUtilities.dp(300));
textView.setText(selectedObject.sponsoredInfo);
textView.setBackground(Theme.createRadSelectorDrawable(getThemedColor(Theme.key_listSelector), 0, selectedObject.sponsoredAdditionalInfo == null ? 6 : 0));
textView.setOnClickListener(e -> {
if (AndroidUtilities.addToClipboard(selectedObject.sponsoredInfo)) {
BulletinFactory.of(Bulletin.BulletinWindow.make(getParentActivity()), themeDelegate).createCopyBulletin(LocaleController.getString("TextCopied", R.string.TextCopied)).show();
}
});
linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
if (selectedObject.sponsoredInfo != null && selectedObject.sponsoredAdditionalInfo != null) {
FrameLayout separator = new FrameLayout(getParentActivity());
separator.setBackgroundColor(getThemedColor(Theme.key_divider));
LinearLayout.LayoutParams params = LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 1);
params.height = 1;
linearLayout.addView(separator, params);
}
if (selectedObject.sponsoredAdditionalInfo != null) {
TextView textView = new TextView(getParentActivity());
textView.setTextColor(getThemedColor(Theme.key_actionBarDefaultSubmenuItem));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
textView.setPadding(AndroidUtilities.dp(18), AndroidUtilities.dp(10), AndroidUtilities.dp(18), AndroidUtilities.dp(10));
textView.setMaxWidth(AndroidUtilities.dp(300));
textView.setText(selectedObject.sponsoredAdditionalInfo);
textView.setBackground(Theme.createRadSelectorDrawable(getThemedColor(Theme.key_listSelector), 0, 6));
textView.setOnClickListener(e -> {
if (AndroidUtilities.addToClipboard(selectedObject.sponsoredAdditionalInfo)) {
BulletinFactory.of(Bulletin.BulletinWindow.make(getParentActivity()), themeDelegate).createCopyBulletin(LocaleController.getString("TextCopied", R.string.TextCopied)).show();
}
});
linearLayout.addView(textView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
final int foregroundIndex = popupLayout.addViewToSwipeBack(linearLayout);
ActionBarMenuSubItem cell = new ActionBarMenuSubItem(getParentActivity(), true, true, themeDelegate);
cell.setTextAndIcon(LocaleController.getString("SponsoredMessageInfo", R.string.SponsoredMessageInfo), R.drawable.msg_info);
cell.setItemHeight(56);
cell.setTag(R.id.width_tag, 240);
cell.setMultiline();
scrimPopupWindowItems[scrimPopupWindowItems.length - 1] = cell;
cell.setTextAndIcon(LocaleController.getString("SponsoredMessageSponsor", R.string.SponsoredMessageSponsor), R.drawable.msg_channel);
popupLayout.addView(cell);
cell.setOnClickListener(v1 -> {
if (contentView == null || getParentActivity() == null) {
return;
}
BottomSheet.Builder builder = new BottomSheet.Builder(contentView.getContext());
builder.setCustomView(new SponsoredMessageInfoView(getParentActivity(), themeDelegate));
builder.show();
popupLayout.getSwipeBack().openForeground(foregroundIndex);
});
View gap = new View(getParentActivity());
gap.setMinimumWidth(AndroidUtilities.dp(196));
gap.setTag(1000);
gap.setTag(R.id.object_tag, 1);
popupLayout.addView(gap);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) cell.getLayoutParams();
if (LocaleController.isRTL) {
layoutParams.gravity = Gravity.RIGHT;
}
layoutParams.width = LayoutHelper.MATCH_PARENT;
layoutParams.height = AndroidUtilities.dp(6);
gap.setLayoutParams(layoutParams);
popupLayout.addView(new ActionBarPopupWindow.GapView(contentView.getContext(), themeDelegate), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8));
}
FrameLayout sponsoredAbout = new FrameLayout(getParentActivity()) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
};
sponsoredAbout.setMinimumHeight(AndroidUtilities.dp(56));
sponsoredAbout.setBackground(Theme.createRadSelectorDrawable(getThemedColor(Theme.key_dialogButtonSelector), popupLayout.getItemsCount() <= 0 ? 6 : 0, 0));
sponsoredAbout.setPadding(AndroidUtilities.dp(18), 0, AndroidUtilities.dp(18), 0);
ImageView infoImage = new ImageView(getParentActivity());
infoImage.setScaleType(ImageView.ScaleType.CENTER);
infoImage.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_actionBarDefaultSubmenuItemIcon), PorterDuff.Mode.MULTIPLY));
infoImage.setImageResource(R.drawable.msg_info);
sponsoredAbout.addView(infoImage, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, 40, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));
TextView infoText = new TextView(getParentActivity()) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.AT_MOST && getLayout() != null) {
Layout layout = getLayout();
int width = 0;
for (int i = 0; i < layout.getLineCount(); ++i) {
width = Math.max(width, (int) layout.getLineWidth(i));
}
widthMeasureSpec = MeasureSpec.makeMeasureSpec(getPaddingLeft() + width + getPaddingRight(), MeasureSpec.EXACTLY);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
};
infoText.setMaxLines(3);
infoText.setGravity(Gravity.LEFT);
infoText.setEllipsize(TextUtils.TruncateAt.END);
infoText.setTextColor(getThemedColor(Theme.key_actionBarDefaultSubmenuItem));
infoText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
infoText.setMaxWidth(AndroidUtilities.dp(240));
infoText.setText(LocaleController.getString("SponsoredMessageInfo", R.string.SponsoredMessageInfo).replace('\n', ' '));
infoText.setPadding(LocaleController.isRTL ? 0 : AndroidUtilities.dp(43), 0, LocaleController.isRTL ? AndroidUtilities.dp(43) : 0, 0);
sponsoredAbout.addView(infoText, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));
popupLayout.addView(sponsoredAbout);
sponsoredAbout.setOnClickListener(v1 -> {
if (contentView == null || getParentActivity() == null) {
return;
}
BottomSheet.Builder builder = new BottomSheet.Builder(contentView.getContext());
builder.setCustomView(new SponsoredMessageInfoView(getParentActivity(), themeDelegate));
builder.show();
});
popupLayout.addView(new ActionBarPopupWindow.GapView(contentView.getContext(), themeDelegate), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 8));
}
scrimPopupWindowItems = new ActionBarMenuSubItem[items.size()];
for (int a = 0, N = items.size(); a < N; a++) {
ActionBarMenuSubItem cell = new ActionBarMenuSubItem(getParentActivity(), a == 0, a == N - 1, themeDelegate);
cell.setMinimumWidth(AndroidUtilities.dp(200));
cell.setTextAndIcon(items.get(a), icons.get(a));
@ -30145,12 +30233,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_gamePaint, null, null, Theme.key_chat_previewGameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewInstantText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewInstantText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPreviewInstantSelectedText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPreviewInstantSelectedText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_deleteProgressPaint, null, null, Theme.key_chat_secretTimeText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_stickerNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, getThemedPaint(Theme.key_paint_chatBotButton), null, null, Theme.key_chat_botButtonText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, Theme.chat_botProgressPaint, null, null, Theme.key_chat_botProgress));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, getThemedPaint(Theme.key_paint_chatTimeBackground), null, null, Theme.key_chat_mediaTimeBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inForwardedNameText));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outForwardedNameText));
@ -30250,27 +30335,12 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inMediaIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLoaderSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inMediaIconSelected));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][0], Theme.chat_photoStatesDrawables[1][0], Theme.chat_photoStatesDrawables[2][0], Theme.chat_photoStatesDrawables[3][0]}, null, Theme.key_chat_mediaLoaderPhoto));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][0], Theme.chat_photoStatesDrawables[1][0], Theme.chat_photoStatesDrawables[2][0], Theme.chat_photoStatesDrawables[3][0]}, null, Theme.key_chat_mediaLoaderPhotoIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][1], Theme.chat_photoStatesDrawables[1][1], Theme.chat_photoStatesDrawables[2][1], Theme.chat_photoStatesDrawables[3][1]}, null, Theme.key_chat_mediaLoaderPhotoSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[0][1], Theme.chat_photoStatesDrawables[1][1], Theme.chat_photoStatesDrawables[2][1], Theme.chat_photoStatesDrawables[3][1]}, null, Theme.key_chat_mediaLoaderPhotoIconSelected));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][0], Theme.chat_photoStatesDrawables[8][0]}, null, Theme.key_chat_outLoaderPhoto));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][0], Theme.chat_photoStatesDrawables[8][0]}, null, Theme.key_chat_outLoaderPhotoIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][1], Theme.chat_photoStatesDrawables[8][1]}, null, Theme.key_chat_outLoaderPhotoSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[7][1], Theme.chat_photoStatesDrawables[8][1]}, null, Theme.key_chat_outLoaderPhotoIconSelected));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][0], Theme.chat_photoStatesDrawables[11][0]}, null, Theme.key_chat_inLoaderPhoto));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][0], Theme.chat_photoStatesDrawables[11][0]}, null, Theme.key_chat_inLoaderPhotoIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][1], Theme.chat_photoStatesDrawables[11][1]}, null, Theme.key_chat_inLoaderPhotoSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[10][1], Theme.chat_photoStatesDrawables[11][1]}, null, Theme.key_chat_inLoaderPhotoIconSelected));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[12][0]}, null, Theme.key_chat_inFileIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_photoStatesDrawables[12][1]}, null, Theme.key_chat_inFileSelectedIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[0]}, null, Theme.key_chat_inContactBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[0]}, null, Theme.key_chat_inContactIcon));
themeDescriptions.add(new ThemeDescription(chatListView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[1]}, null, Theme.key_chat_outContactBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_contactDrawable[1]}, null, Theme.key_chat_outContactIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inLocationBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[0]}, null, Theme.key_chat_inLocationIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outLocationBackground));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, new Drawable[]{Theme.chat_locationDrawable[1]}, null, Theme.key_chat_outLocationIcon));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_inPollCorrectAnswer));
themeDescriptions.add(new ThemeDescription(chatListView, 0, new Class[]{ChatMessageCell.class}, null, null, null, Theme.key_chat_outPollCorrectAnswer));
@ -30327,7 +30397,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{ChatActivityEnterView.class}, new String[]{"attachButton"}, null, null, null, Theme.key_listSelector));
// themeDescriptions.add(new ThemeDescription(chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"audioSendButton"}, null, null, null, Theme.key_chat_messagePanelIcons));
// themeDescriptions.add(new ThemeDescription(chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"videoSendButton"}, null, null, null, Theme.key_chat_messagePanelIcons));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"notifyButton"}, null, null, null, Theme.key_chat_messagePanelVideoFrame));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_USEBACKGROUNDDRAWABLE | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[]{ChatActivityEnterView.class}, new String[]{"notifyButton"}, null, null, null, Theme.key_listSelector));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView, 0, new Class[]{ChatActivityEnterView.class}, new String[]{"videoTimelineView"}, null, null, null, Theme.key_chat_messagePanelSend));
//themeDescriptions.add(new ThemeDescription(chatActivityEnterView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"doneButtonImage"}, null, null, null, Theme.key_chat_messagePanelBackground));
@ -30363,8 +30432,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(chatActivityEnterView != null ? chatActivityEnterView.getEmojiView() : null, 0, new Class[]{EmojiView.class}, null, null, null, selectedBackgroundDelegate, Theme.key_chat_emojiPanelBackspace));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView != null ? chatActivityEnterView.getEmojiView() : null, 0, new Class[]{EmojiView.class}, null, null, null, selectedBackgroundDelegate, Theme.key_chat_emojiPanelTrendingTitle));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView != null ? chatActivityEnterView.getEmojiView() : null, 0, new Class[]{EmojiView.class}, null, null, null, selectedBackgroundDelegate, Theme.key_chat_emojiPanelTrendingDescription));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView != null ? chatActivityEnterView.getEmojiView() : null, 0, new Class[]{EmojiView.class}, null, null, null, selectedBackgroundDelegate, Theme.key_chat_emojiPanelBadgeText));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView != null ? chatActivityEnterView.getEmojiView() : null, 0, new Class[]{EmojiView.class}, null, null, null, selectedBackgroundDelegate, Theme.key_chat_emojiPanelBadgeBackground));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView != null ? chatActivityEnterView.getEmojiView() : null, 0, new Class[]{EmojiView.class}, null, null, null, selectedBackgroundDelegate, Theme.key_chat_emojiBottomPanelIcon));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView != null ? chatActivityEnterView.getEmojiView() : null, 0, new Class[]{EmojiView.class}, null, null, null, selectedBackgroundDelegate, Theme.key_chat_emojiSearchIcon));
themeDescriptions.add(new ThemeDescription(chatActivityEnterView != null ? chatActivityEnterView.getEmojiView() : null, 0, new Class[]{EmojiView.class}, null, null, null, selectedBackgroundDelegate, Theme.key_chat_emojiPanelStickerSetNameHighlight));
@ -30483,8 +30550,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(gifHintTextView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_gifSaveHintBackground));
themeDescriptions.add(new ThemeDescription(gifHintTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_gifSaveHintText));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachMediaBanBackground));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachMediaBanText));
themeDescriptions.add(new ThemeDescription(noSoundHintView, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{HintView.class}, new String[]{"textView"}, null, null, null, Theme.key_chat_gifSaveHintText));
themeDescriptions.add(new ThemeDescription(noSoundHintView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{HintView.class}, new String[]{"imageView"}, null, null, null, Theme.key_chat_gifSaveHintText));
@ -30496,39 +30561,34 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
themeDescriptions.add(new ThemeDescription(pagedownButtonCounter, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButtonCounterBackground));
themeDescriptions.add(new ThemeDescription(pagedownButtonCounter, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_goDownButtonCounter));
themeDescriptions.add(new ThemeDescription(pagedownButtonImage, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButton));
themeDescriptions.add(new ThemeDescription(pagedownButtonImage, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chat_goDownButtonShadow));
themeDescriptions.add(new ThemeDescription(pagedownButtonImage, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_goDownButtonIcon));
themeDescriptions.add(new ThemeDescription(mentiondownButtonCounter, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButtonCounterBackground));
themeDescriptions.add(new ThemeDescription(mentiondownButtonCounter, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_chat_goDownButtonCounter));
themeDescriptions.add(new ThemeDescription(mentiondownButtonImage, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chat_goDownButton));
themeDescriptions.add(new ThemeDescription(mentiondownButtonImage, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chat_goDownButtonShadow));
themeDescriptions.add(new ThemeDescription(mentiondownButtonImage, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chat_goDownButtonIcon));
themeDescriptions.add(new ThemeDescription(avatarContainer != null ? avatarContainer.getTimeItem() : null, 0, null, null, null, null, Theme.key_chat_secretTimerBackground));
themeDescriptions.add(new ThemeDescription(avatarContainer != null ? avatarContainer.getTimeItem() : null, 0, null, null, null, null, Theme.key_chat_secretTimerText));
themeDescriptions.add(new ThemeDescription(floatingDateView, 0, null, null, null, null, Theme.key_chat_serviceText));
themeDescriptions.add(new ThemeDescription(floatingDateView, 0, null, null, null, null, Theme.key_chat_serviceBackground));
themeDescriptions.add(new ThemeDescription(infoTopView, 0, null, null, null, null, Theme.key_chat_serviceText));
themeDescriptions.add(new ThemeDescription(infoTopView, 0, null, null, null, null, Theme.key_chat_serviceBackground));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachGalleryIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachGalleryBackground));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachGalleryText));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachAudioIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachAudioBackground));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachAudioText));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachFileIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachFileBackground));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachFileText));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachContactIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachContactBackground));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachContactText));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachLocationIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachLocationBackground));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachLocationText));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachPollIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachIcon));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachPollBackground));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, selectedBackgroundDelegate, Theme.key_chat_attachPollText));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, new Drawable[]{Theme.chat_attachEmptyDrawable}, null, Theme.key_chat_attachEmptyImage));

View file

@ -465,7 +465,7 @@ public class ChatLinkActivity extends BaseFragment implements NotificationCenter
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
}

View file

@ -1020,7 +1020,7 @@ public class ChatRightsEditActivity extends BaseFragment {
}), ConnectionsManager.RequestFlagWithoutLogin);
} else if (error.text.equals("CHANNELS_TOO_MUCH")) {
if (getParentActivity() != null && !AccountInstance.getInstance(currentAccount).getUserConfig().isPremium()) {
showDialog(new LimitReachedBottomSheet(this, getParentActivity(), LimitReachedBottomSheet.TYPE_TO_MANY_COMMUNITIES, currentAccount));
showDialog(new LimitReachedBottomSheet(this, getParentActivity(), LimitReachedBottomSheet.TYPE_TO0_MANY_COMMUNITIES, currentAccount));
} else {
presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_EDIT));
}

View file

@ -34,7 +34,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ApplicationLoader;
import org.telegram.messenger.BotWebViewVibrationEffect;
import org.telegram.messenger.ChatObject;
import org.telegram.messenger.FileLog;
@ -859,79 +858,34 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
if (fragment.getParentActivity() == null) {
return;
}
final int count = users.size();
final int[] processed = new int[1];
final ArrayList<TLRPC.User> userRestrictedPrivacy = new ArrayList<>();
processed[0] = 0;
final Runnable showUserRestrictedPrivacyAlert = () -> {
CharSequence title, description;
if (userRestrictedPrivacy.size() == 1) {
if (count > 1) {
title = LocaleController.getString("InviteToGroupErrorTitleAUser", R.string.InviteToGroupErrorTitleAUser);
getMessagesController().addUsersToChat(currentChat, ChatUsersActivity.this, users, fwdCount, user -> {
ChatUsersActivity.DiffCallback savedState = saveState();
ArrayList<TLObject> array = contactsMap != null && contactsMap.size() != 0 ? contacts : participants;
LongSparseArray<TLObject> map = contactsMap != null && contactsMap.size() != 0 ? contactsMap : participantsMap;
if (map.get(user.id) == null) {
if (ChatObject.isChannel(currentChat)) {
TLRPC.TL_channelParticipant channelParticipant1 = new TLRPC.TL_channelParticipant();
channelParticipant1.inviter_id = getUserConfig().getClientUserId();
channelParticipant1.peer = new TLRPC.TL_peerUser();
channelParticipant1.peer.user_id = user.id;
channelParticipant1.date = getConnectionsManager().getCurrentTime();
array.add(0, channelParticipant1);
map.put(user.id, channelParticipant1);
} else {
title = LocaleController.getString("InviteToGroupErrorTitleThisUser", R.string.InviteToGroupErrorTitleThisUser);
TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant();
participant.user_id = user.id;
participant.inviter_id = getUserConfig().getClientUserId();
array.add(0, participant);
map.put(user.id, participant);
}
description = AndroidUtilities.replaceTags(LocaleController.formatString("InviteToGroupErrorMessageSingle", R.string.InviteToGroupErrorMessageSingle, UserObject.getFirstName(userRestrictedPrivacy.get(0))));
} else if (userRestrictedPrivacy.size() == 2) {
title = LocaleController.getString("InviteToGroupErrorTitleSomeUsers", R.string.InviteToGroupErrorTitleSomeUsers);
description = AndroidUtilities.replaceTags(LocaleController.formatString("InviteToGroupErrorMessageDouble", R.string.InviteToGroupErrorMessageDouble, UserObject.getFirstName(userRestrictedPrivacy.get(0)), UserObject.getFirstName(userRestrictedPrivacy.get(1))));
} else if (userRestrictedPrivacy.size() == count) {
title = LocaleController.getString("InviteToGroupErrorTitleTheseUsers", R.string.InviteToGroupErrorTitleTheseUsers);
description = LocaleController.getString("InviteToGroupErrorMessageMultipleAll", R.string.InviteToGroupErrorMessageMultipleAll);
} else {
title = LocaleController.getString("InviteToGroupErrorTitleSomeUsers", R.string.InviteToGroupErrorTitleSomeUsers);
description = LocaleController.getString("InviteToGroupErrorMessageMultipleSome", R.string.InviteToGroupErrorMessageMultipleSome);
}
new AlertDialog.Builder(fragment.getParentActivity())
.setTitle(title)
.setMessage(description)
.setPositiveButton(LocaleController.getString("OK", R.string.OK), null)
.show();
};
for (int a = 0; a < count; a++) {
final TLRPC.User user = users.get(a);
getMessagesController().addUserToChat(chatId, user, fwdCount, null, ChatUsersActivity.this, false, () -> {
processed[0]++;
if (processed[0] >= count && userRestrictedPrivacy.size() > 0) {
showUserRestrictedPrivacyAlert.run();
}
DiffCallback savedState = saveState();
ArrayList<TLObject> array = contactsMap != null && contactsMap.size() != 0 ? contacts : participants;
LongSparseArray<TLObject> map = contactsMap != null && contactsMap.size() != 0 ? contactsMap : participantsMap;
if (map.get(user.id) == null) {
if (ChatObject.isChannel(currentChat)) {
TLRPC.TL_channelParticipant channelParticipant1 = new TLRPC.TL_channelParticipant();
channelParticipant1.inviter_id = getUserConfig().getClientUserId();
channelParticipant1.peer = new TLRPC.TL_peerUser();
channelParticipant1.peer.user_id = user.id;
channelParticipant1.date = getConnectionsManager().getCurrentTime();
array.add(0, channelParticipant1);
map.put(user.id, channelParticipant1);
} else {
TLRPC.ChatParticipant participant = new TLRPC.TL_chatParticipant();
participant.user_id = user.id;
participant.inviter_id = getUserConfig().getClientUserId();
array.add(0, participant);
map.put(user.id, participant);
}
}
if (array == participants) {
sortAdmins(participants);
}
updateListAnimated(savedState);
}, err -> {
processed[0]++;
boolean privacyRestricted;
if (privacyRestricted = err != null && "USER_PRIVACY_RESTRICTED".equals(err.text)) {
userRestrictedPrivacy.add(user);
}
if (processed[0] >= count && userRestrictedPrivacy.size() > 0) {
showUserRestrictedPrivacyAlert.run();
}
return !privacyRestricted;
});
getMessagesController().putUser(user, false);
}
if (array == participants) {
sortAdmins(participants);
}
updateListAnimated(savedState);
}, user -> {
}, null);
}
@Override
@ -1804,7 +1758,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
if (hasRemove) {
alertDialog.setItemColor(items.size() - 1, Theme.getColor(Theme.key_dialogTextRed2), Theme.getColor(Theme.key_dialogRedIcon));
alertDialog.setItemColor(items.size() - 1, Theme.getColor(Theme.key_dialogTextRed), Theme.getColor(Theme.key_dialogRedIcon));
}
} else {
CharSequence[] items;
@ -1947,7 +1901,7 @@ public class ChatUsersActivity extends BaseFragment implements NotificationCente
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
if (type == TYPE_ADMIN) {
alertDialog.setItemColor(items.length - 1, Theme.getColor(Theme.key_dialogTextRed2), Theme.getColor(Theme.key_dialogRedIcon));
alertDialog.setItemColor(items.length - 1, Theme.getColor(Theme.key_dialogTextRed), Theme.getColor(Theme.key_dialogRedIcon));
}
}
return true;

View file

@ -1,17 +1,34 @@
package org.telegram.ui;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.core.graphics.ColorUtils;
import androidx.core.math.MathUtils;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MediaController;
import org.telegram.messenger.R;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.ActionBarMenuSlider;
import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
import org.telegram.ui.ActionBar.ActionBarPopupWindow;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.Components.LayoutHelper;
import org.telegram.ui.Components.PopupSwipeBackLayout;
import org.telegram.ui.Components.SpeedIconDrawable;
public class ChooseSpeedLayout {
ActionBarPopupWindow.ActionBarPopupWindowLayout speedSwipeBackLayout;
ActionBarMenuSlider.SpeedSlider slider;
private static final float MIN_SPEED = 0.2f;
private static final float MAX_SPEED = 2.5f;
ActionBarMenuSubItem[] speedItems = new ActionBarMenuSubItem[5];
public ChooseSpeedLayout(Context context, PopupSwipeBackLayout swipeBackLayout, Callback callback) {
@ -25,10 +42,55 @@ public class ChooseSpeedLayout {
backItem.setColors(0xfffafafa, 0xfffafafa);
backItem.setSelectorColor(0x0fffffff);
FrameLayout gap = new FrameLayout(context) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
};
gap.setMinimumWidth(AndroidUtilities.dp(196));
gap.setBackgroundColor(0xff181818);
speedSwipeBackLayout.addView(gap);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) gap.getLayoutParams();
if (LocaleController.isRTL) {
layoutParams.gravity = Gravity.RIGHT;
}
layoutParams.width = LayoutHelper.MATCH_PARENT;
layoutParams.height = AndroidUtilities.dp(8);
gap.setLayoutParams(layoutParams);
slider = new ActionBarMenuSlider.SpeedSlider(context, null);
slider.setMinimumWidth(AndroidUtilities.dp(196));
slider.setDrawShadow(false);
slider.setBackgroundColor(0xff222222);
slider.setTextColor(0xffffffff);
slider.setOnValueChange((value, isFinal) -> {
final float speed = MIN_SPEED + (MAX_SPEED - MIN_SPEED) * value;
callback.onSpeedSelected(speed, isFinal, false);
});
speedSwipeBackLayout.addView(slider, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 44));
gap = new FrameLayout(context) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
};
gap.setMinimumWidth(AndroidUtilities.dp(196));
gap.setBackgroundColor(0xff181818);
speedSwipeBackLayout.addView(gap);
layoutParams = (LinearLayout.LayoutParams) gap.getLayoutParams();
if (LocaleController.isRTL) {
layoutParams.gravity = Gravity.RIGHT;
}
layoutParams.width = LayoutHelper.MATCH_PARENT;
layoutParams.height = AndroidUtilities.dp(8);
gap.setLayoutParams(layoutParams);
ActionBarMenuSubItem item = ActionBarMenuItem.addItem(speedSwipeBackLayout, R.drawable.msg_speed_0_2, LocaleController.getString("SpeedVerySlow", R.string.SpeedVerySlow), false, null);
item.setColors(0xfffafafa, 0xfffafafa);
item.setOnClickListener((view) -> {
callback.onSpeedSelected(0.25f);
callback.onSpeedSelected(0.2f, true, true);
});
item.setSelectorColor(0x0fffffff);
speedItems[0] = item;
@ -36,7 +98,7 @@ public class ChooseSpeedLayout {
item = ActionBarMenuItem.addItem(speedSwipeBackLayout, R.drawable.msg_speed_slow, LocaleController.getString("SpeedSlow", R.string.SpeedSlow), false, null);
item.setColors(0xfffafafa, 0xfffafafa);
item.setOnClickListener((view) -> {
callback.onSpeedSelected(0.5f);
callback.onSpeedSelected(0.5f, true, true);
});
item.setSelectorColor(0x0fffffff);
speedItems[1] = item;
@ -44,7 +106,7 @@ public class ChooseSpeedLayout {
item = ActionBarMenuItem.addItem(speedSwipeBackLayout, R.drawable.msg_speed_normal, LocaleController.getString("SpeedNormal", R.string.SpeedNormal), false, null);
item.setColors(0xfffafafa, 0xfffafafa);
item.setOnClickListener((view) -> {
callback.onSpeedSelected(1f);
callback.onSpeedSelected(1f, true, true);
});
item.setSelectorColor(0x0fffffff);
speedItems[2] = item;
@ -52,7 +114,7 @@ public class ChooseSpeedLayout {
item = ActionBarMenuItem.addItem(speedSwipeBackLayout, R.drawable.msg_speed_fast, LocaleController.getString("SpeedFast", R.string.SpeedFast), false, null);
item.setColors(0xfffafafa, 0xfffafafa);
item.setOnClickListener((view) -> {
callback.onSpeedSelected(1.5f);
callback.onSpeedSelected(1.5f, true, true);
});
item.setSelectorColor(0x0fffffff);
speedItems[3] = item;
@ -60,27 +122,31 @@ public class ChooseSpeedLayout {
item = ActionBarMenuItem.addItem(speedSwipeBackLayout, R.drawable.msg_speed_superfast, LocaleController.getString("SpeedVeryFast", R.string.SpeedVeryFast), false, null);
item.setColors(0xfffafafa, 0xfffafafa);
item.setOnClickListener((view) -> {
callback.onSpeedSelected(2f);
callback.onSpeedSelected(2f, true, true);
});
item.setSelectorColor(0x0fffffff);
speedItems[4] = item;
}
public void update(float currentVideoSpeed) {
public void update(float currentVideoSpeed, boolean isFinal) {
for (int a = 0; a < speedItems.length; a++) {
if (a == 0 && Math.abs(currentVideoSpeed - 0.25f) < 0.001f ||
a == 1 && Math.abs(currentVideoSpeed - 0.5f) < 0.001f ||
a == 2 && Math.abs(currentVideoSpeed - 1.0f) < 0.001f ||
a == 3 && Math.abs(currentVideoSpeed - 1.5f) < 0.001f ||
a == 4 && Math.abs(currentVideoSpeed - 2.0f) < 0.001f) {
if (isFinal && (
a == 0 && Math.abs(currentVideoSpeed - 0.2f) < 0.01f ||
a == 1 && Math.abs(currentVideoSpeed - 0.5f) < 0.1f ||
a == 2 && Math.abs(currentVideoSpeed - 1.0f) < 0.1f ||
a == 3 && Math.abs(currentVideoSpeed - 1.5f) < 0.1f ||
a == 4 && Math.abs(currentVideoSpeed - 2.0f) < 0.1f
)) {
speedItems[a].setColors(0xff6BB6F9, 0xff6BB6F9);
} else {
speedItems[a].setColors(0xfffafafa, 0xfffafafa);
}
}
slider.setSpeed(currentVideoSpeed, true);
}
public interface Callback {
void onSpeedSelected(float speed);
void onSpeedSelected(float speed, boolean isFinal, boolean closeMenu);
}
}

View file

@ -109,6 +109,11 @@ public class CodeFieldContainer extends LinearLayout {
public void setNumbersCount(int length, int currentType) {
if (codeField == null || codeField.length != length) {
if (codeField != null) {
for (CodeNumberField f : codeField) {
removeView(f);
}
}
codeField = new CodeNumberField[length];
for (int a = 0; a < length; a++) {
final int num = a;

View file

@ -293,7 +293,7 @@ public class AlertsCreator {
request instanceof TLRPC.TL_phone_inviteToGroupCall) {
if (fragment != null && error.text.equals("CHANNELS_TOO_MUCH")) {
if (fragment.getParentActivity() != null) {
fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO_MANY_COMMUNITIES, currentAccount));
fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO0_MANY_COMMUNITIES, currentAccount));
} else {
if (request instanceof TLRPC.TL_channels_joinChannel || request instanceof TLRPC.TL_channels_inviteToChannel) {
fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_JOIN));
@ -312,7 +312,7 @@ public class AlertsCreator {
} else if (request instanceof TLRPC.TL_messages_createChat) {
if (error.text.equals("CHANNELS_TOO_MUCH")) {
if (fragment.getParentActivity() != null) {
fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO_MANY_COMMUNITIES, currentAccount));
fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO0_MANY_COMMUNITIES, currentAccount));
} else {
fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE));
}
@ -325,7 +325,7 @@ public class AlertsCreator {
} else if (request instanceof TLRPC.TL_channels_createChannel) {
if (error.text.equals("CHANNELS_TOO_MUCH")) {
if (fragment.getParentActivity() != null) {
fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO_MANY_COMMUNITIES, currentAccount));
fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO0_MANY_COMMUNITIES, currentAccount));
} else {
fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_CREATE));
}
@ -420,7 +420,7 @@ public class AlertsCreator {
showSimpleAlert(fragment, LocaleController.getString("JoinToGroupErrorFull", R.string.JoinToGroupErrorFull));
} else if (error.text.equals("CHANNELS_TOO_MUCH")) {
if (fragment.getParentActivity() != null) {
fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO_MANY_COMMUNITIES, currentAccount));
fragment.showDialog(new LimitReachedBottomSheet(fragment, fragment.getParentActivity(), LimitReachedBottomSheet.TYPE_TO0_MANY_COMMUNITIES, currentAccount));
} else {
fragment.presentFragment(new TooManyCommunitiesActivity(TooManyCommunitiesActivity.TYPE_JOIN));
}
@ -628,7 +628,7 @@ public class AlertsCreator {
localeInfo.pathToFile = "unofficial";
}
}
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, true, UserConfig.selectedAccount, null);
LocaleController.getInstance().applyLanguage(localeInfo, true, false, false, true, UserConfig.selectedAccount, null);
activity.rebuildAllFragments(true);
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
@ -838,7 +838,7 @@ public class AlertsCreator {
fragment.showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
@ -927,7 +927,7 @@ public class AlertsCreator {
fragment.showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
@ -1681,7 +1681,7 @@ public class AlertsCreator {
fragment.showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
@ -1792,7 +1792,7 @@ public class AlertsCreator {
fragment.showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
@ -2253,6 +2253,36 @@ public class AlertsCreator {
return popupWindow;
}
public static void checkRestrictedInviteUsers(int currentAccount, TLRPC.Chat currentChat, TLRPC.Updates updates) {
if (updates == null || updates.updates == null || currentChat == null) {
return;
}
ArrayList<TLRPC.User> arrayList = null;
for (int i = 0; i < updates.updates.size(); i++) {
if (updates.updates.get(i) instanceof TLRPC.TL_updateGroupInvitePrivacyForbidden) {
TLRPC.TL_updateGroupInvitePrivacyForbidden restrictedUpdate = (TLRPC.TL_updateGroupInvitePrivacyForbidden) updates.updates.get(i);
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(restrictedUpdate.user_id);
if (user != null) {
if (arrayList == null) {
arrayList = new ArrayList<>();
}
arrayList.add(user);
}
}
}
if (arrayList != null) {
ArrayList<TLRPC.User> finalArrayList = arrayList;
AndroidUtilities.runOnUIThread(() -> {
BaseFragment lastFragment = LaunchActivity.getLastFragment();
if (lastFragment != null && lastFragment.getParentActivity() != null) {
LimitReachedBottomSheet restricterdUsersBottomSheet = new LimitReachedBottomSheet(lastFragment, lastFragment.getParentActivity(), LimitReachedBottomSheet.TYPE_ADD_MEMBERS_RESTRICTED, currentAccount);
restricterdUsersBottomSheet.setRestrictedUsers(currentChat, finalArrayList);
restricterdUsersBottomSheet.show();
}
}, 200);
}
}
public interface BlockDialogCallback {
void run(boolean report, boolean delete);
}
@ -2311,7 +2341,7 @@ public class AlertsCreator {
fragment.showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
@ -5481,7 +5511,7 @@ public class AlertsCreator {
fragment.showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed));
}
}
@ -5492,7 +5522,7 @@ public class AlertsCreator {
Context context = fragment.getParentActivity();
final EditTextBoldCursor editText = new EditTextBoldCursor(context);
editText.setBackground(null);
editText.setLineColors(Theme.getColor(Theme.key_dialogInputField), Theme.getColor(Theme.key_dialogInputFieldActivated), Theme.getColor(Theme.key_dialogTextRed2));
editText.setLineColors(Theme.getColor(Theme.key_dialogInputField), Theme.getColor(Theme.key_dialogInputFieldActivated), Theme.getColor(Theme.key_dialogTextRed));
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(LocaleController.getString("NewTheme", R.string.NewTheme));

View file

@ -73,7 +73,7 @@ public class AnimatedEmojiDrawable extends Drawable {
public int rawDrawIndex;
private static SparseArray<LongSparseArray<AnimatedEmojiDrawable>> globalEmojiCache;
private boolean LOG_MEMORY_LEAK = false;
private static boolean LOG_MEMORY_LEAK = false;
@NonNull
public static AnimatedEmojiDrawable make(int account, int cacheType, long documentId) {
@ -477,7 +477,7 @@ public class AnimatedEmojiDrawable extends Drawable {
imageReceiver.setUniqKeyPrefix(cacheType + "_");
}
imageReceiver.setVideoThumbIsSame(true);
boolean onlyStaticPreview = SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW && cacheType == CACHE_TYPE_ALERT_PREVIEW_TAB_STRIP || (cacheType == CACHE_TYPE_KEYBOARD || cacheType == CACHE_TYPE_ALERT_PREVIEW) && !LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD);
boolean onlyStaticPreview = SharedConfig.getDevicePerformanceClass() == SharedConfig.PERFORMANCE_CLASS_LOW && cacheType == CACHE_TYPE_ALERT_PREVIEW_TAB_STRIP || cacheType == CACHE_TYPE_KEYBOARD && !LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_KEYBOARD) || cacheType == CACHE_TYPE_ALERT_PREVIEW && !LiteMode.isEnabled(LiteMode.FLAG_ANIMATED_EMOJI_REACTIONS);
if (cacheType == CACHE_TYPE_ALERT_PREVIEW_STATIC) {
onlyStaticPreview = true;
}
@ -714,13 +714,13 @@ public class AnimatedEmojiDrawable extends Drawable {
attachedDrawable = new ArrayList<>();
}
if (attached) {
attachedCount--;
attachedDrawable.remove(this);
} else {
attachedCount++;
attachedDrawable.add(this);
} else {
attachedCount--;
attachedDrawable.remove(this);
}
Log.d("animatedDrable", "attached count " + attachedCount);
Log.d("animatedDrawable", "attached count " + attachedCount);
}
}
@ -1194,6 +1194,7 @@ public class AnimatedEmojiDrawable extends Drawable {
if (secondParent != null) {
secondParent.invalidate();
}
invalidateSelf();
}
public void setSecondParent(View secondParent) {

View file

@ -382,6 +382,10 @@ public class AnimatedTextView extends View {
return currentWidth;
}
public float getAnimateToWidth() {
return currentWidth;
}
public float getHeight() {
return currentHeight;
}
@ -715,7 +719,7 @@ public class AnimatedTextView extends View {
}
private AnimatedTextDrawable drawable;
private int lastMaxWidth;
private int lastMaxWidth, maxWidth;
private CharSequence toSetText;
private boolean toSetMoveDown;
@ -739,10 +743,17 @@ public class AnimatedTextView extends View {
});
}
public void setMaxWidth(int width) {
maxWidth = width;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
if (maxWidth > 0) {
width = Math.min(width, maxWidth);
}
if (lastMaxWidth != width && getLayoutParams().width != 0) {
drawable.setBounds(getPaddingLeft(), getPaddingTop(), width - getPaddingRight(), height - getPaddingBottom());
setText(drawable.getText(), false);

View file

@ -85,6 +85,7 @@ import org.telegram.tgnet.TLRPC;
import org.telegram.ui.ActionBar.ActionBar;
import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.ActionBarMenuSlider;
import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
@ -129,6 +130,9 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
private SeekBarView seekBarView;
private SimpleTextView timeTextView;
private ActionBarMenuItem playbackSpeedButton;
private SpeedIconDrawable speedIcon;
private ActionBarMenuSlider.SpeedSlider speedSlider;
private boolean slidingSpeed;
private ActionBarMenuSubItem[] speedItems = new ActionBarMenuSubItem[6];
private TextView durationTextView;
private ActionBarMenuItem repeatButton;
@ -183,15 +187,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
private boolean wasLight;
private final static float[] speeds = new float[] {
.5f, 1f, 1.2f, 1.5f, 1.65f, 1.8f
};
private final static int[] speedIcons = new int[] {
R.drawable.voice_mini_0_5,
R.drawable.voice_mini_1_0,
R.drawable.voice_mini_1_2,
R.drawable.voice_mini_1_5,
R.drawable.voice_mini_1_7,
R.drawable.voice_mini_2_0
.5f, 1f, 1.2f, 1.5f, 1.7f, 2f
};
private final Runnable forwardSeek = new Runnable() {
@ -439,7 +435,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
containerView.invalidate();
}
};
actionBar.setBackgroundColor(getThemedColor(Theme.key_player_actionBar));
actionBar.setBackgroundColor(getThemedColor(Theme.key_dialogBackground));
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setItemsColor(getThemedColor(Theme.key_player_actionBarTitle), false);
actionBar.setItemsBackgroundColor(getThemedColor(Theme.key_player_actionBarSelector), false);
@ -694,7 +690,15 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
MediaController.getInstance().setPlaybackSpeed(true, speeds[id]);
updatePlaybackButton(true);
});
final float[] toggleSpeeds = new float[] { 1.0F, 1.5F, 1.8F };
playbackSpeedButton.setIcon(speedIcon = new SpeedIconDrawable(true));
final float[] toggleSpeeds = new float[] { 1.0F, 1.5F, 2F };
speedSlider = new ActionBarMenuSlider.SpeedSlider(getContext(), resourcesProvider);
speedSlider.setRoundRadiusDp(6);
speedSlider.setDrawShadow(true);
speedSlider.setOnValueChange((value, isFinal) -> {
slidingSpeed = !isFinal;
MediaController.getInstance().setPlaybackSpeed(true, speedSlider.getSpeed(value));
});
speedItems[0] = playbackSpeedButton.addSubItem(0, R.drawable.msg_speed_slow, LocaleController.getString("SpeedSlow", R.string.SpeedSlow));
speedItems[1] = playbackSpeedButton.addSubItem(1, R.drawable.msg_speed_normal, LocaleController.getString("SpeedNormal", R.string.SpeedNormal));
speedItems[2] = playbackSpeedButton.addSubItem(2, R.drawable.msg_speed_medium, LocaleController.getString("SpeedMedium", R.string.SpeedMedium));
@ -705,6 +709,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
playbackSpeedButton.setPadding(0, 1, 0, 0);
}
playbackSpeedButton.setAdditionalXOffset(AndroidUtilities.dp(8));
playbackSpeedButton.setAdditionalYOffset(-AndroidUtilities.dp(400));
playbackSpeedButton.setShowedFromBottom(true);
playerLayout.addView(playbackSpeedButton, LayoutHelper.createFrame(36, 36, Gravity.TOP | Gravity.RIGHT, 0, 86, 20, 0));
playbackSpeedButton.setOnClickListener(v -> {
@ -721,9 +726,17 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
index = 0;
}
MediaController.getInstance().setPlaybackSpeed(true, toggleSpeeds[index]);
checkSpeedHint();
});
playbackSpeedButton.setOnLongClickListener(view -> {
playbackSpeedButton.toggleSubMenu();
final float speed = MediaController.getInstance().getPlaybackSpeed(true);
speedSlider.setSpeed(speed, false);
speedSlider.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground, resourcesProvider));
updatePlaybackButton(false);
playbackSpeedButton.setDimMenu(.15f);
playbackSpeedButton.toggleSubMenu(speedSlider, null);
MessagesController.getGlobalNotificationsSettings().edit().putInt("speedhint", -15).apply();
return true;
});
updatePlaybackButton(false);
@ -1351,6 +1364,45 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
}
}
private HintView speedHintView;
private long lastPlaybackClick;
private void checkSpeedHint() {
final long now = System.currentTimeMillis();
if (now - lastPlaybackClick > 300) {
int hintValue = MessagesController.getGlobalNotificationsSettings().getInt("speedhint", 0);
hintValue++;
if (hintValue > 2) {
hintValue = -10;
}
MessagesController.getGlobalNotificationsSettings().edit().putInt("speedhint", hintValue).apply();
if (hintValue >= 0) {
showSpeedHint();
}
}
lastPlaybackClick = now;
}
private void showSpeedHint() {
if (containerView != null) {
speedHintView = new HintView(getContext(), 5, false) {
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
if (visibility != View.VISIBLE) {
try {
((ViewGroup) getParent()).removeView(this);
} catch (Exception e) {}
}
}
};
speedHintView.setExtraTranslationY(AndroidUtilities.dp(6));
speedHintView.setText(LocaleController.getString("SpeedHint"));
playerLayout.addView(speedHintView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP, 0, 0, 6, 0));
speedHintView.showForView(playbackSpeedButton, true);
}
}
private void updateSubMenu() {
setMenuItemChecked(shuffleListItem, SharedConfig.shuffleMusic);
setMenuItemChecked(reverseOrderItem, SharedConfig.playOrderReversed);
@ -1359,7 +1411,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
}
private boolean equals(float a, float b) {
return Math.abs(a - b) < 0.001f;
return Math.abs(a - b) < 0.05f;
}
private void updatePlaybackButton(boolean animated) {
@ -1367,20 +1419,15 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
return;
}
float currentPlaybackSpeed = MediaController.getInstance().getPlaybackSpeed(true);
int index = -1;
for (int i = 0; i < speeds.length; ++i) {
if (equals(speeds[i], currentPlaybackSpeed)) {
index = i;
break;
}
}
if (index >= 0) {
playbackSpeedButton.setIcon(speedIcons[index], animated);
}
speedIcon.setValue(currentPlaybackSpeed, animated);
speedSlider.setSpeed(currentPlaybackSpeed, animated);
updateColors();
boolean isFinal = !slidingSpeed;
slidingSpeed = false;
for (int a = 0; a < speedItems.length; a++) {
if (equals(currentPlaybackSpeed, speeds[a])) {
if (isFinal && equals(currentPlaybackSpeed, speeds[a])) {
speedItems[a].setColors(getThemedColor(Theme.key_featuredStickers_addButtonPressed), getThemedColor(Theme.key_featuredStickers_addButtonPressed));
} else {
speedItems[a].setColors(getThemedColor(Theme.key_actionBarDefaultSubmenuItem), getThemedColor(Theme.key_actionBarDefaultSubmenuItem));
@ -1392,9 +1439,11 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
if (playbackSpeedButton != null) {
float currentPlaybackSpeed = MediaController.getInstance().getPlaybackSpeed(true);
final int color = getThemedColor(!equals(currentPlaybackSpeed, 1.0f) ? Theme.key_featuredStickers_addButtonPressed : Theme.key_inappPlayerClose);
playbackSpeedButton.setIconColor(color);
if (speedIcon != null) {
speedIcon.setColor(color);
}
if (Build.VERSION.SDK_INT >= 21) {
playbackSpeedButton.setBackgroundDrawable(Theme.createSelectorDrawable(color & 0x19ffffff, 1, AndroidUtilities.dp(14)));
playbackSpeedButton.setBackground(Theme.createSelectorDrawable(color & 0x19ffffff, 1, AndroidUtilities.dp(14)));
}
}
}
@ -2262,7 +2311,7 @@ public class AudioPlayerAlert extends BottomSheet implements NotificationCenter.
optionsButton.redrawPopup(getThemedColor(Theme.key_actionBarDefaultSubmenuBackground));
};
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_player_actionBar));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_dialogBackground));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, delegate, Theme.key_player_actionBarTitle));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_player_actionBarTitle));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBTITLECOLOR, null, null, null, null, Theme.key_player_actionBarTitle));

View file

@ -72,7 +72,7 @@ public class AutoDeletePopupWrapper {
callback.setAutoDeleteHistory(0, UndoView.ACTION_AUTO_DELETE_OFF);
});
if (type != TYPE_GROUP_CREATE) {
disableItem.setColors(Theme.getColor(Theme.key_dialogTextRed2), Theme.getColor(Theme.key_dialogTextRed2));
disableItem.setColors(Theme.getColor(Theme.key_dialogTextRed), Theme.getColor(Theme.key_dialogTextRed));
}
if (type != TYPE_GROUP_CREATE) {

View file

@ -0,0 +1,192 @@
package org.telegram.ui.Components;
import static org.telegram.messenger.AndroidUtilities.dp;
import static org.telegram.messenger.AndroidUtilities.dpf2;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class BatteryDrawable extends Drawable {
private Paint paintReference;
private Paint strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint connectorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private Paint fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private float scale = 1f, translateY = 0;
private float fillValue = 1f;
private RectF rectTmp = new RectF();
public BatteryDrawable() {
strokePaint.setStyle(Paint.Style.STROKE);
}
public BatteryDrawable(float value) {
this();
setFillValue(value, false);
}
public BatteryDrawable(float value, int color) {
this();
setFillValue(value, false);
setColor(color);
}
public BatteryDrawable(float value, int color, int fillColor) {
this();
setFillValue(value, false);
setColor(color, fillColor);
}
public BatteryDrawable(float value, int color, int fillColor, float scale) {
this();
setFillValue(value, false);
setColor(color, fillColor);
setScale(scale);
}
public void setScale(float scale) {
this.scale = scale;
invalidateSelf();
}
public void setColor(int color) {
setColor(color, color);
}
public void setColor(int color, int fillColor) {
strokePaint.setColor(color);
connectorPaint.setColor(color);
fillPaint.setColor(fillColor);
}
private ValueAnimator fillValueAnimator;
public void setFillValue(float newValue, boolean animated) {
final float value = Math.max(Math.min(newValue, 1), 0);
if (fillValueAnimator != null) {
fillValueAnimator.cancel();
fillValueAnimator = null;
}
if (!animated) {
fillValue = value;
invalidateSelf();
} else {
fillValueAnimator = ValueAnimator.ofFloat(fillValue, value);
fillValueAnimator.addUpdateListener(anm -> {
fillValue = (float) anm.getAnimatedValue();
invalidateSelf();
});
fillValueAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
fillValue = value;
invalidateSelf();
}
});
fillValueAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT_QUINT);
fillValueAnimator.setDuration(200);
fillValueAnimator.start();
}
}
public void colorFromPaint(Paint paintReference) {
this.paintReference = paintReference;
}
@Override
public void draw(@NonNull Canvas canvas) {
if (getBounds() == null) {
return;
}
final int x = getBounds().left, y = getBounds().top + (int) translateY;
final int w = getBounds().width(), h = getBounds().height();
final int cx = getBounds().centerX(), cy = getBounds().centerY() + (int) translateY;
if (paintReference != null) {
setColor(paintReference.getColor());
}
if (scale != 1) {
canvas.save();
canvas.scale(scale, scale, cx, cy);
}
strokePaint.setStrokeWidth(dpf2(1.1f));
rectTmp.set(
x + (w - dpf2(16.33f)) / 2f - dpf2(1.33f),
y + (h - dpf2(10.33f)) / 2f,
x + (w + dpf2(16.33f)) / 2f - dpf2(1.33f),
y + (h + dpf2(10.33f)) / 2f
);
canvas.drawRoundRect(rectTmp, dpf2(2.33f), dpf2(2.33f), strokePaint);
rectTmp.set(
x + (w - dpf2(13f)) / 2f - dpf2(1.66f),
y + (h - dpf2(7.33f)) / 2f,
x + (w - dpf2(13f)) / 2f - dpf2(1.66f) + Math.max(dpf2(1.1f), fillValue * dpf2(13)),
y + (h + dpf2(7.33f)) / 2f
);
canvas.drawRoundRect(rectTmp, dpf2(0.83f), dpf2(0.83f), fillPaint);
rectTmp.set(
x + (w + dpf2(17.5f) - dpf2(4.66f)) / 2f,
cy - dpf2(2.65f),
x + (w + dpf2(17.5f) + dpf2(4.66f)) / 2f,
cy + dpf2(2.65f)
);
canvas.drawArc(rectTmp, -90, 180, false, connectorPaint);
if (scale != 1) {
canvas.restore();
}
}
public void setTranslationY(float translateY) {
this.translateY = translateY;
}
@Override
public void setAlpha(int alpha) {
strokePaint.setAlpha(alpha);
connectorPaint.setAlpha(alpha);
fillPaint.setAlpha(alpha);
}
@Override
public void setColorFilter(@Nullable ColorFilter colorFilter) {
strokePaint.setColorFilter(colorFilter);
connectorPaint.setColorFilter(colorFilter);
fillPaint.setColorFilter(colorFilter);
}
@Override
public int getOpacity() {
return PixelFormat.TRANSPARENT;
}
@Override
public int getIntrinsicWidth() {
return dp(24 * scale);
}
@Override
public int getIntrinsicHeight() {
return dp(24 * scale);
}
}

View file

@ -59,7 +59,13 @@ public class BlobDrawable {
private final Matrix m = new Matrix();
private final int liteFlag;
public BlobDrawable(int n) {
this(n, LiteMode.FLAG_CALLS_ANIMATIONS);
}
public BlobDrawable(int n, int liteFlag) {
N = n;
L = (float) ((4.0 / 3.0) * Math.tan(Math.PI / (2 * N)));
radius = new float[n];
@ -75,6 +81,8 @@ public class BlobDrawable {
generateBlob(radiusNext, angleNext, i);
progress[i] = 0;
}
this.liteFlag = liteFlag;
}
private void generateBlob(float[] radius, float[] angle, int i) {
@ -86,7 +94,7 @@ public class BlobDrawable {
}
public void update(float amplitude, float speedScale) {
if (!LiteMode.isEnabled(LiteMode.FLAG_CALLS_ANIMATIONS)) {
if (!LiteMode.isEnabled(liteFlag)) {
return;
}
for (int i = 0; i < N; i++) {
@ -101,7 +109,7 @@ public class BlobDrawable {
}
public void draw(float cX, float cY, Canvas canvas, Paint paint) {
if (!LiteMode.isEnabled(LiteMode.FLAG_CALLS_ANIMATIONS)) {
if (!LiteMode.isEnabled(liteFlag)) {
return;
}
path.reset();
@ -172,7 +180,7 @@ public class BlobDrawable {
public void setValue(float value, boolean isBig) {
animateToAmplitude = value;
if (!LiteMode.isEnabled(LiteMode.FLAG_CALLS_ANIMATIONS)) {
if (!LiteMode.isEnabled(liteFlag)) {
return;
}
if (isBig) {

View file

@ -939,6 +939,21 @@ public class BotWebViewContainer extends FrameLayout implements NotificationCent
delegate.onCloseRequested(null);
break;
}
case "web_app_switch_inline_query": {
try {
JSONObject jsonObject = new JSONObject(eventData);
List<String> types = new ArrayList<>();
JSONArray arr = jsonObject.getJSONArray("chat_types");
for (int i = 0; i < arr.length(); i++) {
types.add(arr.getString(i));
}
delegate.onWebAppSwitchInlineQuery(botUser, jsonObject.getString("query"), types);
} catch (JSONException e) {
FileLog.e(e);
}
break;
}
case "web_app_read_text_from_clipboard": {
try {
JSONObject jsonObject = new JSONObject(eventData);
@ -1489,6 +1504,15 @@ public class BotWebViewContainer extends FrameLayout implements NotificationCent
*/
void onWebAppExpand();
/**
* Called when web apps requests to switch to inline mode picker
*
* @param botUser Bot user
* @param query Inline query
* @param chatTypes Chat types
*/
void onWebAppSwitchInlineQuery(TLRPC.User botUser, String query, List<String> chatTypes);
/**
* Called when web app attempts to open invoice
*

View file

@ -8,6 +8,7 @@ import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.view.Gravity;
import android.view.MotionEvent;
@ -24,12 +25,14 @@ import androidx.recyclerview.widget.ChatListItemAnimator;
import org.json.JSONObject;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessageObject;
import org.telegram.messenger.MessagesController;
import org.telegram.messenger.NotificationCenter;
import org.telegram.messenger.R;
import org.telegram.messenger.UserObject;
import org.telegram.tgnet.ConnectionsManager;
import org.telegram.tgnet.TLObject;
import org.telegram.tgnet.TLRPC;
@ -38,10 +41,13 @@ import org.telegram.ui.ActionBar.ActionBarMenu;
import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.INavigationLayout;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.DialogsActivity;
import org.telegram.ui.PaymentFormActivity;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
@ -197,6 +203,45 @@ public class BotWebViewMenuContainer extends FrameLayout implements Notification
swipeContainer.stickTo(-swipeContainer.getOffsetY() + swipeContainer.getTopActionBarOffsetY());
}
@Override
public void onWebAppSwitchInlineQuery(TLRPC.User botUser, String query, List<String> chatTypes) {
if (chatTypes.isEmpty()) {
parentEnterView.setFieldText("@" + UserObject.getPublicUsername(botUser) + " " + query);
dismiss();
} else {
Bundle args = new Bundle();
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_START_ATTACH_BOT);
args.putBoolean("onlySelect", true);
args.putBoolean("allowGroups", chatTypes.contains("groups"));
args.putBoolean("allowUsers", chatTypes.contains("users"));
args.putBoolean("allowChannels", chatTypes.contains("channels"));
args.putBoolean("allowBots", chatTypes.contains("bots"));
DialogsActivity dialogsActivity = new DialogsActivity(args);
dialogsActivity.setDelegate((fragment, dids, message1, param, topicsFragment) -> {
long did = dids.get(0).dialogId;
Bundle args1 = new Bundle();
args1.putBoolean("scrollToTopOnResume", true);
if (DialogObject.isEncryptedDialog(did)) {
args1.putInt("enc_id", DialogObject.getEncryptedChatId(did));
} else if (DialogObject.isUserDialog(did)) {
args1.putLong("user_id", did);
} else {
args1.putLong("chat_id", -did);
}
args1.putString("inline_query_input", "@" + UserObject.getPublicUsername(botUser) + " " + query);
if (MessagesController.getInstance(currentAccount).checkCanOpenChat(args1, fragment)) {
fragment.presentFragment(new INavigationLayout.NavigationParams(new ChatActivity(args1)).setRemoveLast(true));
}
return true;
});
parentEnterView.getParentFragment().presentFragment(dialogsActivity);
}
}
@Override
public void onWebAppOpenInvoice(String slug, TLObject response) {
ChatActivity parentFragment = parentEnterView.getParentFragment();

View file

@ -14,6 +14,7 @@ import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.MotionEvent;
@ -34,6 +35,7 @@ import androidx.dynamicanimation.animation.SpringForce;
import org.json.JSONObject;
import org.telegram.messenger.AndroidUtilities;
import org.telegram.messenger.ContactsController;
import org.telegram.messenger.DialogObject;
import org.telegram.messenger.FileLog;
import org.telegram.messenger.LocaleController;
import org.telegram.messenger.MessagesController;
@ -50,23 +52,29 @@ import org.telegram.ui.ActionBar.ActionBarMenuItem;
import org.telegram.ui.ActionBar.ActionBarMenuSubItem;
import org.telegram.ui.ActionBar.AlertDialog;
import org.telegram.ui.ActionBar.BaseFragment;
import org.telegram.ui.ActionBar.INavigationLayout;
import org.telegram.ui.ActionBar.Theme;
import org.telegram.ui.ChatActivity;
import org.telegram.ui.DialogsActivity;
import org.telegram.ui.LaunchActivity;
import org.telegram.ui.PaymentFormActivity;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import java.util.Locale;
public class BotWebViewSheet extends Dialog implements NotificationCenter.NotificationCenterDelegate {
public final static int TYPE_WEB_VIEW_BUTTON = 0, TYPE_SIMPLE_WEB_VIEW_BUTTON = 1, TYPE_BOT_MENU_BUTTON = 2;
public final static int TYPE_WEB_VIEW_BUTTON = 0, TYPE_SIMPLE_WEB_VIEW_BUTTON = 1, TYPE_BOT_MENU_BUTTON = 2, TYPE_WEB_VIEW_BOT_APP = 3;
public final static int FLAG_FROM_INLINE_SWITCH = 1;
@Retention(RetentionPolicy.SOURCE)
@IntDef(value = {
TYPE_WEB_VIEW_BUTTON,
TYPE_SIMPLE_WEB_VIEW_BUTTON,
TYPE_BOT_MENU_BUTTON
TYPE_BOT_MENU_BUTTON,
TYPE_WEB_VIEW_BOT_APP
})
public @interface WebViewType {}
@ -298,6 +306,66 @@ public class BotWebViewSheet extends Dialog implements NotificationCenter.Notifi
swipeContainer.stickTo(-swipeContainer.getOffsetY() + swipeContainer.getTopActionBarOffsetY());
}
@Override
public void onWebAppSwitchInlineQuery(TLRPC.User botUser, String query, List<String> chatTypes) {
if (chatTypes.isEmpty()) {
if (parentActivity instanceof LaunchActivity) {
BaseFragment lastFragment = ((LaunchActivity) parentActivity).getActionBarLayout().getLastFragment();
if (lastFragment instanceof ChatActivity) {
((ChatActivity) lastFragment).getChatActivityEnterView().setFieldText("@" + UserObject.getPublicUsername(botUser) + " " + query);
dismiss();
}
}
} else {
Bundle args = new Bundle();
args.putInt("dialogsType", DialogsActivity.DIALOGS_TYPE_START_ATTACH_BOT);
args.putBoolean("onlySelect", true);
args.putBoolean("allowGroups", chatTypes.contains("groups"));
args.putBoolean("allowUsers", chatTypes.contains("users"));
args.putBoolean("allowChannels", chatTypes.contains("channels"));
args.putBoolean("allowBots", chatTypes.contains("bots"));
DialogsActivity dialogsActivity = new DialogsActivity(args);
AndroidUtilities.hideKeyboard(frameLayout);
OverlayActionBarLayoutDialog overlayActionBarLayoutDialog = new OverlayActionBarLayoutDialog(context, resourcesProvider);
dialogsActivity.setDelegate((fragment, dids, message1, param, topicsFragment) -> {
long did = dids.get(0).dialogId;
Bundle args1 = new Bundle();
args1.putBoolean("scrollToTopOnResume", true);
if (DialogObject.isEncryptedDialog(did)) {
args1.putInt("enc_id", DialogObject.getEncryptedChatId(did));
} else if (DialogObject.isUserDialog(did)) {
args1.putLong("user_id", did);
} else {
args1.putLong("chat_id", -did);
}
args1.putString("inline_query_input", "@" + UserObject.getPublicUsername(botUser) + " " + query);
if (parentActivity instanceof LaunchActivity) {
BaseFragment lastFragment = ((LaunchActivity) parentActivity).getActionBarLayout().getLastFragment();
if (MessagesController.getInstance(currentAccount).checkCanOpenChat(args1, lastFragment)) {
overlayActionBarLayoutDialog.dismiss();
dismissed = true;
AndroidUtilities.cancelRunOnUIThread(pollRunnable);
webViewContainer.destroyWebView();
NotificationCenter.getInstance(currentAccount).removeObserver(BotWebViewSheet.this, NotificationCenter.webViewResultSent);
NotificationCenter.getGlobalInstance().removeObserver(BotWebViewSheet.this, NotificationCenter.didSetNewTheme);
BotWebViewSheet.super.dismiss();
lastFragment.presentFragment(new INavigationLayout.NavigationParams(new ChatActivity(args1)).setRemoveLast(true));
}
}
return true;
});
overlayActionBarLayoutDialog.show();
overlayActionBarLayoutDialog.addFragment(dialogsActivity);
}
}
@Override
public void onSetupMainButton(boolean isVisible, boolean isActive, String text, int color, int textColor, boolean isProgressVisible) {
mainButton.setClickable(isActive);
@ -674,7 +742,19 @@ public class BotWebViewSheet extends Dialog implements NotificationCenter.Notifi
}
}
public void requestWebView(int currentAccount, long peerId, long botId, String buttonText, String buttonUrl, @WebViewType int type, int replyToMsgId, boolean silent, int flags) {
requestWebView(currentAccount, peerId, botId, buttonText, buttonUrl, type, replyToMsgId, silent, null, null, false, null, null, flags);
}
public void requestWebView(int currentAccount, long peerId, long botId, String buttonText, String buttonUrl, @WebViewType int type, int replyToMsgId, boolean silent) {
requestWebView(currentAccount, peerId, botId, buttonText, buttonUrl, type, replyToMsgId, silent, null, null, false, null, null, 0);
}
public void requestWebView(int currentAccount, long peerId, long botId, String buttonText, String buttonUrl, @WebViewType int type, int replyToMsgId, boolean silent, BaseFragment lastFragment, TLRPC.BotApp app, boolean allowWrite, String startParam, TLRPC.User botUser) {
requestWebView(currentAccount, peerId, botId, buttonText, buttonUrl, type, replyToMsgId, silent, lastFragment, app, allowWrite, startParam, botUser, 0);
}
public void requestWebView(int currentAccount, long peerId, long botId, String buttonText, String buttonUrl, @WebViewType int type, int replyToMsgId, boolean silent, BaseFragment lastFragment, TLRPC.BotApp app, boolean allowWrite, String startParam, TLRPC.User botUser, int flags) {
this.currentAccount = currentAccount;
this.peerId = peerId;
this.botId = botId;
@ -773,6 +853,7 @@ public class BotWebViewSheet extends Dialog implements NotificationCenter.Notifi
}
case TYPE_SIMPLE_WEB_VIEW_BUTTON: {
TLRPC.TL_messages_requestSimpleWebView req = new TLRPC.TL_messages_requestSimpleWebView();
req.from_switch_webview = (flags & FLAG_FROM_INLINE_SWITCH) != 0;
req.bot = MessagesController.getInstance(currentAccount).getInputUser(botId);
req.platform = "android";
if (hasThemeParams) {
@ -826,6 +907,40 @@ public class BotWebViewSheet extends Dialog implements NotificationCenter.Notifi
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.webViewResultSent);
break;
}
case TYPE_WEB_VIEW_BOT_APP: {
TLRPC.TL_messages_requestAppWebView req = new TLRPC.TL_messages_requestAppWebView();
TLRPC.TL_inputBotAppID botApp = new TLRPC.TL_inputBotAppID();
botApp.id = app.id;
botApp.access_hash = app.access_hash;
req.app = botApp;
req.write_allowed = allowWrite;
req.platform = "android";
req.peer = lastFragment instanceof ChatActivity ? ((ChatActivity) lastFragment).getCurrentUser() != null ? MessagesController.getInputPeer(((ChatActivity) lastFragment).getCurrentUser()) : MessagesController.getInputPeer(((ChatActivity) lastFragment).getCurrentChat())
: MessagesController.getInputPeer(botUser);
if (!TextUtils.isEmpty(startParam)) {
req.start_param = startParam;
req.flags |= 2;
}
if (hasThemeParams) {
req.theme_params = new TLRPC.TL_dataJSON();
req.theme_params.data = themeParams;
req.flags |= 4;
}
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response2, error2) -> AndroidUtilities.runOnUIThread(() -> {
if (error2 == null) {
TLRPC.TL_appWebViewResultUrl result = (TLRPC.TL_appWebViewResultUrl) response2;
queryId = 0;
webViewContainer.loadUrl(currentAccount, result.url);
swipeContainer.setWebView(webViewContainer.getWebView());
AndroidUtilities.runOnUIThread(pollRunnable, POLL_PERIOD);
}
}), ConnectionsManager.RequestFlagInvokeAfter | ConnectionsManager.RequestFlagFailOnServerErrors);
}
}
}

View file

@ -181,8 +181,9 @@ public class Bulletin {
}
}
public void setDuration(int duration) {
public Bulletin setDuration(int duration) {
this.duration = duration;
return this;
}
public Bulletin show() {
@ -1111,6 +1112,7 @@ public class Bulletin {
public final BackupImageView imageView;
public final TextView titleTextView;
public final TextView subtitleTextView;
private final LinearLayout linearLayout;
public TwoLineLayout(@NonNull Context context, Theme.ResourcesProvider resourcesProvider) {
super(context, resourcesProvider);
@ -1119,7 +1121,7 @@ public class Bulletin {
addView(imageView = new BackupImageView(context), LayoutHelper.createFrameRelatively(29, 29, Gravity.START | Gravity.CENTER_VERTICAL, 12, 12, 12, 12));
final LinearLayout linearLayout = new LinearLayout(context);
linearLayout = new LinearLayout(context);
linearLayout.setOrientation(LinearLayout.VERTICAL);
addView(linearLayout, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 54, 8, 12, 8));
@ -1143,6 +1145,11 @@ public class Bulletin {
public CharSequence getAccessibilityText() {
return titleTextView.getText() + ".\n" + subtitleTextView.getText();
}
public void hideImage() {
imageView.setVisibility(GONE);
((MarginLayoutParams) linearLayout.getLayoutParams()).setMarginStart(AndroidUtilities.dp(12));
}
}
public static class TwoLineLottieLayout extends ButtonLayout {
@ -1150,6 +1157,7 @@ public class Bulletin {
public final RLottieImageView imageView;
public final LinkSpanDrawable.LinksTextView titleTextView;
public final LinkSpanDrawable.LinksTextView subtitleTextView;
private final LinearLayout linearLayout;
private final int textColor;
@ -1165,7 +1173,7 @@ public class Bulletin {
final int undoInfoColor = getThemedColor(Theme.key_undo_infoColor);
final int undoLinkColor = getThemedColor(Theme.key_undo_cancelColor);
final LinearLayout linearLayout = new LinearLayout(context);
linearLayout = new LinearLayout(context);
linearLayout.setOrientation(LinearLayout.VERTICAL);
addView(linearLayout, LayoutHelper.createFrameRelatively(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 52, 8, 8, 8));
@ -1206,6 +1214,11 @@ public class Bulletin {
public CharSequence getAccessibilityText() {
return titleTextView.getText() + ".\n" + subtitleTextView.getText();
}
public void hideImage() {
imageView.setVisibility(GONE);
((MarginLayoutParams) linearLayout.getLayoutParams()).setMarginStart(AndroidUtilities.dp(10));
}
}
public static class LottieLayout extends ButtonLayout {
@ -1690,7 +1703,11 @@ public class Bulletin {
@Override
public void removeView(View child) {
super.removeView(child);
BulletinWindow.this.dismiss();
try {
BulletinWindow.this.dismiss();
} catch (Exception ignore) {
}
removeDelegate(container);
}
},

Some files were not shown because too many files have changed in this diff Show more