use of org.telegram.ui.Adapters.FiltersView in project Telegram-FOSS by Telegram-FOSS-Team.
the class DialogsActivity method getThemeDescriptions.
@Override
public ArrayList<ThemeDescription> getThemeDescriptions() {
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
for (int b = 0; b < 3; b++) {
RecyclerListView list;
if (b == 2) {
if (searchViewPager == null) {
continue;
}
list = searchViewPager.searchListView;
} else if (viewPages != null) {
list = b < viewPages.length ? viewPages[b].listView : null;
} else {
continue;
}
if (list == null) {
continue;
}
int count = list.getChildCount();
for (int a = 0; a < count; a++) {
View child = list.getChildAt(a);
if (child instanceof ProfileSearchCell) {
((ProfileSearchCell) child).update(0);
} else if (child instanceof DialogCell) {
((DialogCell) child).update(0);
} else if (child instanceof UserCell) {
((UserCell) child).update(0);
}
}
}
if (searchViewPager != null && searchViewPager.dialogsSearchAdapter != null) {
RecyclerListView recyclerListView = searchViewPager.dialogsSearchAdapter.getInnerListView();
if (recyclerListView != null) {
int count = recyclerListView.getChildCount();
for (int a = 0; a < count; a++) {
View child = recyclerListView.getChildAt(a);
if (child instanceof HintDialogCell) {
((HintDialogCell) child).update();
}
}
}
}
if (sideMenu != null) {
View child = sideMenu.getChildAt(0);
if (child instanceof DrawerProfileCell) {
DrawerProfileCell profileCell = (DrawerProfileCell) child;
profileCell.applyBackground(true);
profileCell.updateColors();
}
}
if (viewPages != null) {
for (int a = 0; a < viewPages.length; a++) {
if (viewPages[a].pullForegroundDrawable == null) {
continue;
}
viewPages[a].pullForegroundDrawable.updateColors();
}
}
if (actionBar != null) {
actionBar.setPopupBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground), true);
actionBar.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), false, true);
actionBar.setPopupItemsColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon), true, true);
actionBar.setPopupItemsSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector), true);
}
if (scrimPopupWindowItems != null) {
for (int a = 0; a < scrimPopupWindowItems.length; a++) {
scrimPopupWindowItems[a].setColors(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem), Theme.getColor(Theme.key_actionBarDefaultSubmenuItemIcon));
scrimPopupWindowItems[a].setSelectorColor(Theme.getColor(Theme.key_dialogButtonSelector));
}
}
if (scrimPopupWindow != null) {
final View contentView = scrimPopupWindow.getContentView();
contentView.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
contentView.invalidate();
}
if (doneItem != null) {
doneItem.setIconColor(Theme.getColor(Theme.key_actionBarDefaultIcon));
}
if (commentView != null) {
commentView.updateColors();
}
if (filtersView != null) {
filtersView.updateColors();
}
if (searchViewPager != null) {
searchViewPager.updateColors();
}
if (searchTabsView != null) {
searchTabsView.updateColors();
}
if (searchItem != null) {
EditTextBoldCursor editText = searchItem.getSearchField();
if (whiteActionBar) {
editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
editText.setHintTextColor(Theme.getColor(Theme.key_player_time));
editText.setCursorColor(Theme.getColor(Theme.key_chat_messagePanelCursor));
} else {
editText.setCursorColor(Theme.getColor(Theme.key_actionBarDefaultSearch));
editText.setHintTextColor(Theme.getColor(Theme.key_actionBarDefaultSearchPlaceholder));
editText.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSearch));
}
searchItem.updateColor();
}
setSearchAnimationProgress(searchAnimationProgress);
};
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
if (movingView != null) {
arrayList.add(new ThemeDescription(movingView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
}
if (doneItem != null) {
arrayList.add(new ThemeDescription(doneItem, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_actionBarDefaultSelector));
}
if (folderId == 0) {
if (onlySelect) {
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
}
arrayList.add(new ThemeDescription(fragmentView, 0, null, actionBarDefaultPaint, null, null, Theme.key_actionBarDefault));
if (searchViewPager != null) {
arrayList.add(new ThemeDescription(searchViewPager.searchListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
}
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, cellDelegate, Theme.key_actionBarDefaultIcon));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, new Drawable[] { Theme.dialogs_holidayDrawable }, null, Theme.key_actionBarDefaultTitle));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder));
} else {
arrayList.add(new ThemeDescription(fragmentView, 0, null, actionBarDefaultPaint, null, null, Theme.key_actionBarDefaultArchived));
if (searchViewPager != null) {
arrayList.add(new ThemeDescription(searchViewPager.searchListView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
}
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchivedIcon));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, new Drawable[] { Theme.dialogs_holidayDrawable }, null, Theme.key_actionBarDefaultArchivedTitle));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchivedSelector));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultArchivedSearch));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultArchivedSearchPlaceholder));
}
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultIcon));
// arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_BACKGROUND, null, null, null, null, Theme.key_actionBarActionModeDefault));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_TOPBACKGROUND, null, null, null, null, Theme.key_actionBarActionModeDefaultTop));
arrayList.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_AM_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultSelector));
arrayList.add(new ThemeDescription(selectedDialogsCountTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_actionBarActionModeDefaultIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuItem));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarDefaultSubmenuItemIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_dialogButtonSelector));
if (filterTabsView != null) {
if (actionBar.isActionModeShowed()) {
arrayList.add(new ThemeDescription(filterTabsView, 0, new Class[] { FilterTabsView.class }, new String[] { "selectorDrawable" }, null, null, null, Theme.key_profile_tabSelectedLine));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_profile_tabSelectedText));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_profile_tabText));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_profile_tabSelector));
} else {
arrayList.add(new ThemeDescription(filterTabsView, 0, new Class[] { FilterTabsView.class }, new String[] { "selectorDrawable" }, null, null, null, Theme.key_actionBarTabLine));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_actionBarTabActiveText));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_actionBarTabUnactiveText));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_actionBarTabSelector));
}
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), 0, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_chats_tabUnreadActiveBackground));
arrayList.add(new ThemeDescription(filterTabsView.getTabsContainer(), 0, new Class[] { FilterTabsView.TabView.class }, null, null, null, Theme.key_chats_tabUnreadUnactiveBackground));
}
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionIcon));
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chats_actionBackground));
arrayList.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chats_actionPressedBackground));
for (int a = 0; a < 3; a++) {
RecyclerListView list;
if (a == 2) {
if (searchViewPager == null) {
continue;
}
list = searchViewPager.searchListView;
} else if (viewPages != null) {
list = a < viewPages.length ? viewPages[a].listView : null;
} else {
continue;
}
if (list == null) {
continue;
}
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
arrayList.add(new ThemeDescription(list, 0, new Class[] { View.class }, Theme.dividerPaint, null, null, Theme.key_divider));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_countGrayPaint, null, null, Theme.key_chats_unreadCounterMuted));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_countTextPaint, null, null, Theme.key_chats_unreadCounterText));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_lockDrawable }, null, Theme.key_chats_secretIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_groupDrawable, Theme.dialogs_broadcastDrawable, Theme.dialogs_botDrawable }, null, Theme.key_chats_nameIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_scamDrawable, Theme.dialogs_fakeDrawable }, null, Theme.key_chats_draft));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_pinnedDrawable, Theme.dialogs_reorderDrawable }, null, Theme.key_chats_pinnedIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Paint[] { Theme.dialogs_namePaint[0], Theme.dialogs_namePaint[1], Theme.dialogs_searchNamePaint }, null, null, Theme.key_chats_name));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Paint[] { Theme.dialogs_nameEncryptedPaint[0], Theme.dialogs_nameEncryptedPaint[1], Theme.dialogs_searchNameEncryptedPaint }, null, null, Theme.key_chats_secretName));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_messagePaint[1], null, null, Theme.key_chats_message_threeLines));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_messagePaint[0], null, null, Theme.key_chats_message));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_messageNamePaint, null, null, Theme.key_chats_nameMessage_threeLines));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_chats_draft));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, Theme.dialogs_messagePrintingPaint, null, null, Theme.key_chats_actionMessage));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_timePaint, null, null, Theme.key_chats_date));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_pinnedPaint, null, null, Theme.key_chats_pinnedOverlay));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_tabletSeletedPaint, null, null, Theme.key_chats_tabletSelectedOverlay));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_checkDrawable }, null, Theme.key_chats_sentCheck));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_checkReadDrawable, Theme.dialogs_halfCheckDrawable }, null, Theme.key_chats_sentReadCheck));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_clockDrawable }, null, Theme.key_chats_sentClock));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, Theme.dialogs_errorPaint, null, null, Theme.key_chats_sentError));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_errorDrawable }, null, Theme.key_chats_sentErrorIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_verifiedCheckDrawable }, null, Theme.key_chats_verifiedCheck));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class, ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_verifiedDrawable }, null, Theme.key_chats_verifiedBackground));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_muteDrawable }, null, Theme.key_chats_muteIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, new Drawable[] { Theme.dialogs_mentionDrawable }, null, Theme.key_chats_mentionIcon));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_chats_archivePinBackground));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_chats_onlineCircle));
arrayList.add(new ThemeDescription(list, 0, new Class[] { DialogCell.class }, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_CHECKBOX, new Class[] { DialogCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[] { DialogCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_checkboxCheck));
arrayList.add(new ThemeDescription(list, 0, new Class[] { LoadingCell.class }, new String[] { "progressBar" }, null, null, null, Theme.key_progressCircle));
arrayList.add(new ThemeDescription(list, 0, new Class[] { ProfileSearchCell.class }, Theme.dialogs_offlinePaint, null, null, Theme.key_windowBackgroundWhiteGrayText3));
arrayList.add(new ThemeDescription(list, 0, new Class[] { ProfileSearchCell.class }, Theme.dialogs_onlinePaint, null, null, Theme.key_windowBackgroundWhiteBlueText3));
GraySectionCell.createThemeDescriptions(arrayList, list);
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { HashtagSearchCell.class }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[] { ShadowSectionCell.class }, null, null, null, Theme.key_windowBackgroundGrayShadow));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[] { ShadowSectionCell.class }, null, null, null, Theme.key_windowBackgroundGray));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[] { TextInfoPrivacyCell.class }, null, null, null, Theme.key_windowBackgroundGrayShadow));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[] { TextInfoPrivacyCell.class }, null, null, null, Theme.key_windowBackgroundGray));
arrayList.add(new ThemeDescription(list, 0, new Class[] { TextInfoPrivacyCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayText4));
arrayList.add(new ThemeDescription(list, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText2));
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundSaved));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchived));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundArchivedHidden));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessage));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_draft));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_attachMessage));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameArchived));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessageArchived));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_nameMessageArchived_threeLines));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_messageArchived));
if (viewPages != null) {
for (int a = 0; a < viewPages.length; a++) {
if (folderId == 0) {
arrayList.add(new ThemeDescription(viewPages[a].listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
} else {
arrayList.add(new ThemeDescription(viewPages[a].listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
}
arrayList.add(new ThemeDescription(viewPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DialogsEmptyCell.class }, new String[] { "emptyTextView1" }, null, null, null, Theme.key_chats_nameMessage_threeLines));
arrayList.add(new ThemeDescription(viewPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DialogsEmptyCell.class }, new String[] { "emptyTextView2" }, null, null, null, Theme.key_chats_message));
if (SharedConfig.archiveHidden) {
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Arrow1", Theme.key_avatar_backgroundArchivedHidden));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Arrow2", Theme.key_avatar_backgroundArchivedHidden));
} else {
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Arrow1", Theme.key_avatar_backgroundArchived));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Arrow2", Theme.key_avatar_backgroundArchived));
}
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Box2", Theme.key_avatar_text));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveAvatarDrawable }, "Box1", Theme.key_avatar_text));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_pinArchiveDrawable }, "Arrow", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_pinArchiveDrawable }, "Line", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unpinArchiveDrawable }, "Arrow", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unpinArchiveDrawable }, "Line", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveDrawable }, "Arrow", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveDrawable }, "Box2", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_archiveDrawable }, "Box1", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Line 1", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Line 2", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Line 3", Theme.key_chats_archiveBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Cup Red", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_hidePsaDrawable }, "Box", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unarchiveDrawable }, "Arrow1", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unarchiveDrawable }, "Arrow2", Theme.key_chats_archivePinBackground));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unarchiveDrawable }, "Box2", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { DialogCell.class }, new RLottieDrawable[] { Theme.dialogs_unarchiveDrawable }, "Box1", Theme.key_chats_archiveIcon));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "statusColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "statusOnlineColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(viewPages[a].listView, 0, new Class[] { TextCell.class }, new String[] { "imageView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
arrayList.add(new ThemeDescription(viewPages[a].progressView, ThemeDescription.FLAG_PROGRESSBAR, null, null, null, null, Theme.key_progressCircle));
ViewPager pager = viewPages[a].dialogsAdapter.getArchiveHintCellPager();
arrayList.add(new ThemeDescription(pager, 0, new Class[] { ArchiveHintInnerCell.class }, new String[] { "imageView" }, null, null, null, Theme.key_chats_nameMessage_threeLines));
arrayList.add(new ThemeDescription(pager, 0, new Class[] { ArchiveHintInnerCell.class }, new String[] { "imageView2" }, null, null, null, Theme.key_chats_unreadCounter));
arrayList.add(new ThemeDescription(pager, 0, new Class[] { ArchiveHintInnerCell.class }, new String[] { "headerTextView" }, null, null, null, Theme.key_chats_nameMessage_threeLines));
arrayList.add(new ThemeDescription(pager, 0, new Class[] { ArchiveHintInnerCell.class }, new String[] { "messageTextView" }, null, null, null, Theme.key_chats_message));
arrayList.add(new ThemeDescription(pager, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefaultArchived));
}
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_archivePullDownBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chats_archivePullDownBackgroundActive));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_chats_menuBackground));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuName));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuPhone));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuPhoneCats));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuCloudBackgroundCats));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chat_serviceBackground));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuTopShadow));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerProfileCell.class }, null, null, null, Theme.key_chats_menuTopShadowCats));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { DrawerProfileCell.class }, new String[] { "darkThemeView" }, null, null, null, Theme.key_chats_menuName));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { DrawerProfileCell.class }, null, null, cellDelegate, Theme.key_chats_menuTopBackgroundCats));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { DrawerProfileCell.class }, null, null, cellDelegate, Theme.key_chats_menuTopBackground));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { DrawerActionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemIcon));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerActionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemText));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerUserCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemText));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DrawerUserCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_chats_unreadCounterText));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DrawerUserCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_chats_unreadCounter));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { DrawerUserCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_chats_menuBackground));
arrayList.add(new ThemeDescription(sideMenu, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { DrawerAddCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemIcon));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DrawerAddCell.class }, new String[] { "textView" }, null, null, null, Theme.key_chats_menuItemText));
arrayList.add(new ThemeDescription(sideMenu, 0, new Class[] { DividerCell.class }, Theme.dividerPaint, null, null, Theme.key_divider));
if (searchViewPager != null) {
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, Theme.dialogs_countPaint, null, null, Theme.key_chats_unreadCounter));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, Theme.dialogs_countGrayPaint, null, null, Theme.key_chats_unreadCounterMuted));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, Theme.dialogs_countTextPaint, null, null, Theme.key_chats_unreadCounterText));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, Theme.dialogs_archiveTextPaint, null, null, Theme.key_chats_archiveText));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(searchViewPager.dialogsSearchAdapter != null ? searchViewPager.dialogsSearchAdapter.getInnerListView() : null, 0, new Class[] { HintDialogCell.class }, null, null, null, Theme.key_chats_onlineCircle));
}
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "frameLayout" }, null, null, null, Theme.key_inappPlayerBackground));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { FragmentContextView.class }, new String[] { "playButton" }, null, null, null, Theme.key_inappPlayerPlayPause));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_inappPlayerTitle));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_FASTSCROLL, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_inappPlayerPerformer));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { FragmentContextView.class }, new String[] { "closeButton" }, null, null, null, Theme.key_inappPlayerClose));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "frameLayout" }, null, null, null, Theme.key_returnToCallBackground));
arrayList.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_returnToCallText));
for (int a = 0; a < undoView.length; a++) {
arrayList.add(new ThemeDescription(undoView[a], ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_undo_background));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "undoImageView" }, null, null, null, Theme.key_undo_cancelColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "undoTextView" }, null, null, null, Theme.key_undo_cancelColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "infoTextView" }, null, null, null, Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "subinfoTextView" }, null, null, null, Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "textPaint" }, null, null, null, Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "progressPaint" }, null, null, null, Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "info1", Theme.key_undo_background));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "info2", Theme.key_undo_background));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc12", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc11", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc10", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc9", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc8", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc7", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc6", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc5", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc4", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc3", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc2", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "luc1", Theme.key_undo_infoColor));
arrayList.add(new ThemeDescription(undoView[a], 0, new Class[] { UndoView.class }, new String[] { "leftImageView" }, "Oval", Theme.key_undo_infoColor));
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBackgroundGray));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlack));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextLink));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLinkSelection));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue3));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextBlue4));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextRed));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextRed2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray3));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextGray4));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRedIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogTextHint));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogInputField));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogInputFieldActivated));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareCheck));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareUnchecked));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogCheckboxSquareDisabled));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRadioBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRadioBackgroundChecked));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogProgressCircle));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogButton));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogButtonSelector));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogScrollGlow));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRoundCheckBox));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogRoundCheckBoxCheck));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBadgeBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogBadgeText));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLineProgress));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogLineProgressBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogGrayLine));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialog_inlineProgressBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialog_inlineProgress));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchHint));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogSearchText));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogFloatingButton));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogFloatingIcon));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_dialogShadowLine));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_sheet_scrollUp));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_sheet_other));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBar));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarSelector));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarTitle));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarTop));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarSubtitle));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_actionBarItems));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_background));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_time));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progressBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progressCachedBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_progress));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_button));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_player_buttonActive));
if (commentView != null) {
arrayList.add(new ThemeDescription(commentView, 0, null, Theme.chat_composeBackgroundPaint, null, null, Theme.key_chat_messagePanelBackground));
arrayList.add(new ThemeDescription(commentView, 0, null, null, new Drawable[] { Theme.chat_composeShadowDrawable }, null, Theme.key_chat_messagePanelShadow));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { ChatActivityEnterView.class }, new String[] { "messageEditText" }, null, null, null, Theme.key_chat_messagePanelText));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_CURSORCOLOR, new Class[] { ChatActivityEnterView.class }, new String[] { "messageEditText" }, null, null, null, Theme.key_chat_messagePanelCursor));
arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_HINTTEXTCOLOR, new Class[] { ChatActivityEnterView.class }, new String[] { "messageEditText" }, null, null, null, Theme.key_chat_messagePanelHint));
// arrayList.add(new ThemeDescription(commentView, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{ChatActivityEnterView.class}, new String[]{"sendButton"}, null, null, null, Theme.key_chat_messagePanelSend));
}
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_actionBarTipBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_player_time));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_chat_messagePanelCursor));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_actionBarIconBlue));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_groupcreate_spanBackground));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayGreen1));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayGreen2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayBlue1));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayBlue2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelGreen1));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelGreen2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelBlue1));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelBlue2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_topPanelGray));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertGradientMuted));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertGradientMuted2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertGradientUnmuted));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertGradientUnmuted2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_mutedByAdminGradient));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_mutedByAdminGradient2));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_mutedByAdminGradient3));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertMutedByAdmin));
arrayList.add(new ThemeDescription(null, 0, null, null, null, null, Theme.key_voipgroup_overlayAlertMutedByAdmin2));
if (filtersView != null) {
arrayList.addAll(filtersView.getThemeDescriptions());
filtersView.updateColors();
}
if (searchViewPager != null) {
searchViewPager.getThemeDescriptors(arrayList);
}
return arrayList;
}
use of org.telegram.ui.Adapters.FiltersView in project Telegram-FOSS by Telegram-FOSS-Team.
the class DialogsActivity method showSearch.
private void showSearch(boolean show, boolean animated) {
if (initialDialogsType != 0 && initialDialogsType != 3) {
animated = false;
}
if (searchAnimator != null) {
searchAnimator.cancel();
searchAnimator = null;
}
if (tabsAlphaAnimator != null) {
tabsAlphaAnimator.cancel();
tabsAlphaAnimator = null;
}
searchIsShowed = show;
if (show) {
boolean onlyDialogsAdapter;
if (searchFiltersWasShowed) {
onlyDialogsAdapter = false;
} else {
onlyDialogsAdapter = onlyDialogsAdapter();
}
searchViewPager.showOnlyDialogsAdapter(onlyDialogsAdapter);
whiteActionBar = !onlyDialogsAdapter;
if (whiteActionBar) {
searchFiltersWasShowed = true;
}
ContentView contentView = (ContentView) fragmentView;
if (searchTabsView == null && !onlyDialogsAdapter) {
searchTabsView = searchViewPager.createTabsView();
int filtersViewPosition = -1;
if (filtersView != null) {
for (int i = 0; i < contentView.getChildCount(); i++) {
if (contentView.getChildAt(i) == filtersView) {
filtersViewPosition = i;
break;
}
}
}
if (filtersViewPosition > 0) {
contentView.addView(searchTabsView, filtersViewPosition, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 44));
} else {
contentView.addView(searchTabsView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 44));
}
} else if (searchTabsView != null && onlyDialogsAdapter) {
ViewParent parent = searchTabsView.getParent();
if (parent instanceof ViewGroup) {
((ViewGroup) parent).removeView(searchTabsView);
}
searchTabsView = null;
}
EditTextBoldCursor editText = searchItem.getSearchField();
if (whiteActionBar) {
editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
editText.setHintTextColor(Theme.getColor(Theme.key_player_time));
editText.setCursorColor(Theme.getColor(Theme.key_chat_messagePanelCursor));
} else {
editText.setCursorColor(Theme.getColor(Theme.key_actionBarDefaultSearch));
editText.setHintTextColor(Theme.getColor(Theme.key_actionBarDefaultSearchPlaceholder));
editText.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSearch));
}
searchViewPager.setKeyboardHeight(((ContentView) fragmentView).getKeyboardHeight());
parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(true);
searchViewPager.clear();
if (folderId != 0) {
FiltersView.MediaFilterData filterData = new FiltersView.MediaFilterData(R.drawable.chats_archive, R.drawable.chats_archive, LocaleController.getString("ArchiveSearchFilter", R.string.ArchiveSearchFilter), null, FiltersView.FILTER_TYPE_ARCHIVE);
addSearchFilter(filterData);
}
} else {
if (filterTabsView != null && parentLayout != null) {
parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(viewPages[0].selectedType == filterTabsView.getFirstTabId() || SharedConfig.getChatSwipeAction(currentAccount) != SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS);
}
}
if (animated && searchViewPager.dialogsSearchAdapter.hasRecentSearch()) {
AndroidUtilities.setAdjustResizeToNothing(getParentActivity(), classGuid);
} else {
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
}
if (!show && filterTabsView != null && canShowFilterTabsView) {
filterTabsView.setVisibility(View.VISIBLE);
}
if (animated) {
if (show) {
searchViewPager.setVisibility(View.VISIBLE);
searchViewPager.reset();
updateFiltersView(true, null, null, false, false);
if (searchTabsView != null) {
searchTabsView.hide(false, false);
searchTabsView.setVisibility(View.VISIBLE);
}
} else {
viewPages[0].listView.setVisibility(View.VISIBLE);
viewPages[0].setVisibility(View.VISIBLE);
}
setDialogsListFrozen(true);
viewPages[0].listView.setVerticalScrollBarEnabled(false);
searchViewPager.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
searchAnimator = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofFloat(viewPages[0], View.ALPHA, show ? 0.0f : 1.0f));
animators.add(ObjectAnimator.ofFloat(viewPages[0], View.SCALE_X, show ? 0.9f : 1.0f));
animators.add(ObjectAnimator.ofFloat(viewPages[0], View.SCALE_Y, show ? 0.9f : 1.0f));
animators.add(ObjectAnimator.ofFloat(searchViewPager, View.ALPHA, show ? 1.0f : 0.0f));
animators.add(ObjectAnimator.ofFloat(searchViewPager, View.SCALE_X, show ? 1.0f : 1.05f));
animators.add(ObjectAnimator.ofFloat(searchViewPager, View.SCALE_Y, show ? 1.0f : 1.05f));
if (passcodeItem != null) {
animators.add(ObjectAnimator.ofFloat(passcodeItem.getIconView(), View.ALPHA, show ? 0 : 1f));
}
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE) {
tabsAlphaAnimator = ObjectAnimator.ofFloat(filterTabsView.getTabsContainer(), View.ALPHA, show ? 0.0f : 1.0f).setDuration(100);
tabsAlphaAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
tabsAlphaAnimator = null;
}
});
}
ValueAnimator valueAnimator = ValueAnimator.ofFloat(searchAnimationProgress, show ? 1f : 0);
valueAnimator.addUpdateListener(valueAnimator1 -> setSearchAnimationProgress((float) valueAnimator1.getAnimatedValue()));
animators.add(valueAnimator);
searchAnimator.playTogether(animators);
searchAnimator.setDuration(show ? 200 : 180);
searchAnimator.setInterpolator(CubicBezierInterpolator.EASE_OUT);
if (filterTabsViewIsVisible) {
int backgroundColor1 = Theme.getColor(folderId == 0 ? Theme.key_actionBarDefault : Theme.key_actionBarDefaultArchived);
int backgroundColor2 = Theme.getColor(Theme.key_windowBackgroundWhite);
int sum = Math.abs(Color.red(backgroundColor1) - Color.red(backgroundColor2)) + Math.abs(Color.green(backgroundColor1) - Color.green(backgroundColor2)) + Math.abs(Color.blue(backgroundColor1) - Color.blue(backgroundColor2));
searchAnimationTabsDelayedCrossfade = sum / 255f > 0.3f;
} else {
searchAnimationTabsDelayedCrossfade = true;
}
if (!show) {
searchAnimator.setStartDelay(20);
if (tabsAlphaAnimator != null) {
if (searchAnimationTabsDelayedCrossfade) {
tabsAlphaAnimator.setStartDelay(80);
tabsAlphaAnimator.setDuration(100);
} else {
tabsAlphaAnimator.setDuration(show ? 200 : 180);
}
}
}
searchAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
getNotificationCenter().onAnimationFinish(animationIndex);
if (searchAnimator != animation) {
return;
}
setDialogsListFrozen(false);
if (show) {
viewPages[0].listView.hide();
if (filterTabsView != null) {
filterTabsView.setVisibility(View.GONE);
}
searchWasFullyShowed = true;
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
searchItem.setVisibility(View.GONE);
} else {
searchItem.collapseSearchFilters();
whiteActionBar = false;
searchViewPager.setVisibility(View.GONE);
if (searchTabsView != null) {
searchTabsView.setVisibility(View.GONE);
}
searchItem.clearSearchFilters();
searchViewPager.clear();
filtersView.setVisibility(View.GONE);
viewPages[0].listView.show();
if (!onlySelect) {
hideFloatingButton(false);
}
searchWasFullyShowed = false;
}
if (fragmentView != null) {
fragmentView.requestLayout();
}
setSearchAnimationProgress(show ? 1f : 0);
viewPages[0].listView.setVerticalScrollBarEnabled(true);
searchViewPager.setBackground(null);
searchAnimator = null;
}
@Override
public void onAnimationCancel(Animator animation) {
getNotificationCenter().onAnimationFinish(animationIndex);
if (searchAnimator == animation) {
if (show) {
viewPages[0].listView.hide();
} else {
viewPages[0].listView.show();
}
searchAnimator = null;
}
}
});
animationIndex = getNotificationCenter().setAnimationInProgress(animationIndex, null);
searchAnimator.start();
if (tabsAlphaAnimator != null) {
tabsAlphaAnimator.start();
}
} else {
setDialogsListFrozen(false);
if (show) {
viewPages[0].listView.hide();
} else {
viewPages[0].listView.show();
}
viewPages[0].setAlpha(show ? 0.0f : 1.0f);
viewPages[0].setScaleX(show ? 0.9f : 1.0f);
viewPages[0].setScaleY(show ? 0.9f : 1.0f);
searchViewPager.setAlpha(show ? 1.0f : 0.0f);
filtersView.setAlpha(show ? 1.0f : 0.0f);
searchViewPager.setScaleX(show ? 1.0f : 1.1f);
searchViewPager.setScaleY(show ? 1.0f : 1.1f);
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE) {
filterTabsView.setTranslationY(show ? -AndroidUtilities.dp(44) : 0);
filterTabsView.getTabsContainer().setAlpha(show ? 0.0f : 1.0f);
}
if (filterTabsView != null) {
if (canShowFilterTabsView && !show) {
filterTabsView.setVisibility(View.VISIBLE);
} else {
filterTabsView.setVisibility(View.GONE);
}
}
searchViewPager.setVisibility(show ? View.VISIBLE : View.GONE);
setSearchAnimationProgress(show ? 1f : 0);
fragmentView.invalidate();
}
if (initialSearchType >= 0) {
searchViewPager.setPosition(initialSearchType);
}
if (!show) {
initialSearchType = -1;
}
}
use of org.telegram.ui.Adapters.FiltersView in project Telegram-FOSS by Telegram-FOSS-Team.
the class DialogsActivity method createView.
@Override
public View createView(final Context context) {
searching = false;
searchWas = false;
pacmanAnimation = null;
selectedDialogs.clear();
maximumVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
AndroidUtilities.runOnUIThread(() -> Theme.createChatResources(context, false));
ActionBarMenu menu = actionBar.createMenu();
if (!onlySelect && searchString == null && folderId == 0) {
doneItem = new ActionBarMenuItem(context, null, Theme.getColor(Theme.key_actionBarDefaultSelector), Theme.getColor(Theme.key_actionBarDefaultIcon), true);
doneItem.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
actionBar.addView(doneItem, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT, 0, 0, 10, 0));
doneItem.setOnClickListener(v -> {
filterTabsView.setIsEditing(false);
showDoneItem(false);
});
doneItem.setAlpha(0.0f);
doneItem.setVisibility(View.GONE);
proxyDrawable = new ProxyDrawable(context);
proxyItem = menu.addItem(2, proxyDrawable);
proxyItem.setContentDescription(LocaleController.getString("ProxySettings", R.string.ProxySettings));
passcodeDrawable = new RLottieDrawable(R.raw.passcode_lock_close, "passcode_lock_close", AndroidUtilities.dp(28), AndroidUtilities.dp(28), true, null);
passcodeItem = menu.addItem(1, passcodeDrawable);
passcodeItem.setContentDescription(LocaleController.getString("AccDescrPasscodeLock", R.string.AccDescrPasscodeLock));
updatePasscodeButton();
updateProxyButton(false);
}
searchItem = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true, true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
@Override
public void onSearchExpand() {
searching = true;
if (switchItem != null) {
switchItem.setVisibility(View.GONE);
}
if (proxyItem != null && proxyItemVisible) {
proxyItem.setVisibility(View.GONE);
}
if (viewPages[0] != null) {
if (searchString != null) {
viewPages[0].listView.hide();
if (searchViewPager != null) {
searchViewPager.searchListView.show();
}
}
if (!onlySelect) {
floatingButtonContainer.setVisibility(View.GONE);
}
}
setScrollY(0);
updatePasscodeButton();
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrGoBack", R.string.AccDescrGoBack));
}
@Override
public boolean canCollapseSearch() {
if (switchItem != null) {
switchItem.setVisibility(View.VISIBLE);
}
if (proxyItem != null && proxyItemVisible) {
proxyItem.setVisibility(View.VISIBLE);
}
if (searchString != null) {
finishFragment();
return false;
}
return true;
}
@Override
public void onSearchCollapse() {
searching = false;
searchWas = false;
if (viewPages[0] != null) {
viewPages[0].listView.setEmptyView(folderId == 0 ? viewPages[0].progressView : null);
if (!onlySelect) {
floatingButtonContainer.setVisibility(View.VISIBLE);
floatingHidden = true;
floatingButtonTranslation = AndroidUtilities.dp(100);
floatingButtonHideProgress = 1f;
updateFloatingButtonOffset();
}
showSearch(false, true);
}
updatePasscodeButton();
if (menuDrawable != null) {
if (actionBar.getBackButton().getDrawable() != menuDrawable) {
actionBar.setBackButtonDrawable(menuDrawable);
menuDrawable.setRotation(0, true);
}
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrOpenMenu", R.string.AccDescrOpenMenu));
}
}
@Override
public void onTextChanged(EditText editText) {
String text = editText.getText().toString();
if (text.length() != 0 || (searchViewPager.dialogsSearchAdapter != null && searchViewPager.dialogsSearchAdapter.hasRecentSearch()) || searchFiltersWasShowed) {
searchWas = true;
if (!searchIsShowed) {
showSearch(true, true);
}
}
searchViewPager.onTextChanged(text);
}
@Override
public void onSearchFilterCleared(FiltersView.MediaFilterData filterData) {
if (!searchIsShowed) {
return;
}
searchViewPager.removeSearchFilter(filterData);
searchViewPager.onTextChanged(searchItem.getSearchField().getText().toString());
updateFiltersView(true, null, null, false, true);
}
@Override
public boolean canToggleSearch() {
return !actionBar.isActionModeShowed() && databaseMigrationHint == null;
}
});
searchItem.setSearchFieldHint(LocaleController.getString("Search", R.string.Search));
searchItem.setContentDescription(LocaleController.getString("Search", R.string.Search));
if (onlySelect) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
if (initialDialogsType == 3 && selectAlertString == null) {
actionBar.setTitle(LocaleController.getString("ForwardTo", R.string.ForwardTo));
} else if (initialDialogsType == 10) {
actionBar.setTitle(LocaleController.getString("SelectChats", R.string.SelectChats));
} else {
actionBar.setTitle(LocaleController.getString("SelectChat", R.string.SelectChat));
}
actionBar.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefault));
} else {
if (searchString != null || folderId != 0) {
actionBar.setBackButtonDrawable(backDrawable = new BackDrawable(false));
} else {
actionBar.setBackButtonDrawable(menuDrawable = new MenuDrawable());
actionBar.setBackButtonContentDescription(LocaleController.getString("AccDescrOpenMenu", R.string.AccDescrOpenMenu));
}
if (folderId != 0) {
actionBar.setTitle(LocaleController.getString("ArchivedChats", R.string.ArchivedChats));
} else {
if (BuildVars.DEBUG_VERSION) {
actionBar.setTitle("Telegram Beta");
} else {
actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));
}
}
if (folderId == 0) {
actionBar.setSupportsHolidayImage(true);
}
}
if (!onlySelect) {
actionBar.setAddToContainer(false);
actionBar.setCastShadows(false);
actionBar.setClipContent(true);
}
actionBar.setTitleActionRunnable(() -> {
if (initialDialogsType != 10) {
hideFloatingButton(false);
}
scrollToTop();
});
if (initialDialogsType == 0 && folderId == 0 && !onlySelect && TextUtils.isEmpty(searchString)) {
scrimPaint = new Paint() {
@Override
public void setAlpha(int a) {
super.setAlpha(a);
if (fragmentView != null) {
fragmentView.invalidate();
}
}
};
filterTabsView = new FilterTabsView(context) {
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
getParent().requestDisallowInterceptTouchEvent(true);
maybeStartTracking = false;
return super.onInterceptTouchEvent(ev);
}
@Override
public void setTranslationY(float translationY) {
if (getTranslationY() != translationY) {
super.setTranslationY(translationY);
updateContextViewPosition();
if (fragmentView != null) {
fragmentView.invalidate();
}
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
if (scrimView != null) {
scrimView.getLocationInWindow(scrimViewLocation);
fragmentView.invalidate();
}
}
};
filterTabsView.setVisibility(View.GONE);
canShowFilterTabsView = false;
filterTabsView.setDelegate(new FilterTabsView.FilterTabsViewDelegate() {
private void showDeleteAlert(MessagesController.DialogFilter dialogFilter) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("FilterDelete", R.string.FilterDelete));
builder.setMessage(LocaleController.getString("FilterDeleteAlert", R.string.FilterDeleteAlert));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialog2, which2) -> {
TLRPC.TL_messages_updateDialogFilter req = new TLRPC.TL_messages_updateDialogFilter();
req.id = dialogFilter.id;
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
}));
// if (getMessagesController().dialogFilters.size() > 1) {
// filterTabsView.beginCrossfade();
// }
getMessagesController().removeFilter(dialogFilter);
getMessagesStorage().deleteDialogFilter(dialogFilter);
// filterTabsView.commitCrossfade();
});
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
}
@Override
public void onSamePageSelected() {
scrollToTop();
}
@Override
public void onPageReorder(int fromId, int toId) {
for (int a = 0; a < viewPages.length; a++) {
if (viewPages[a].selectedType == fromId) {
viewPages[a].selectedType = toId;
} else if (viewPages[a].selectedType == toId) {
viewPages[a].selectedType = fromId;
}
}
}
@Override
public void onPageSelected(int id, boolean forward) {
if (viewPages[0].selectedType == id) {
return;
}
ArrayList<MessagesController.DialogFilter> dialogFilters = getMessagesController().dialogFilters;
if (id != Integer.MAX_VALUE && (id < 0 || id >= dialogFilters.size())) {
return;
}
if (parentLayout != null) {
parentLayout.getDrawerLayoutContainer().setAllowOpenDrawerBySwipe(id == filterTabsView.getFirstTabId() || SharedConfig.getChatSwipeAction(currentAccount) != SwipeGestureSettingsView.SWIPE_GESTURE_FOLDERS);
}
viewPages[1].selectedType = id;
viewPages[1].setVisibility(View.VISIBLE);
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth());
showScrollbars(false);
switchToCurrentSelectedMode(true);
animatingForward = forward;
}
@Override
public boolean canPerformActions() {
return !searching;
}
@Override
public void onPageScrolled(float progress) {
if (progress == 1 && viewPages[1].getVisibility() != View.VISIBLE && !searching) {
return;
}
if (animatingForward) {
viewPages[0].setTranslationX(-progress * viewPages[0].getMeasuredWidth());
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth() - progress * viewPages[0].getMeasuredWidth());
} else {
viewPages[0].setTranslationX(progress * viewPages[0].getMeasuredWidth());
viewPages[1].setTranslationX(progress * viewPages[0].getMeasuredWidth() - viewPages[0].getMeasuredWidth());
}
if (progress == 1) {
ViewPage tempPage = viewPages[0];
viewPages[0] = viewPages[1];
viewPages[1] = tempPage;
viewPages[1].setVisibility(View.GONE);
showScrollbars(true);
updateCounters(false);
checkListLoad(viewPages[0]);
viewPages[0].dialogsAdapter.resume();
viewPages[1].dialogsAdapter.pause();
}
}
@Override
public int getTabCounter(int tabId) {
if (tabId == Integer.MAX_VALUE) {
return getMessagesStorage().getMainUnreadCount();
}
ArrayList<MessagesController.DialogFilter> dialogFilters = getMessagesController().dialogFilters;
if (tabId < 0 || tabId >= dialogFilters.size()) {
return 0;
}
return getMessagesController().dialogFilters.get(tabId).unreadCount;
}
@Override
public boolean didSelectTab(FilterTabsView.TabView tabView, boolean selected) {
if (actionBar.isActionModeShowed()) {
return false;
}
if (scrimPopupWindow != null) {
scrimPopupWindow.dismiss();
scrimPopupWindow = null;
scrimPopupWindowItems = null;
return false;
}
Rect rect = new Rect();
MessagesController.DialogFilter dialogFilter;
if (tabView.getId() == Integer.MAX_VALUE) {
dialogFilter = null;
} else {
dialogFilter = getMessagesController().dialogFilters.get(tabView.getId());
}
ActionBarPopupWindow.ActionBarPopupWindowLayout popupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity());
popupLayout.setOnTouchListener(new View.OnTouchListener() {
private int[] pos = new int[2];
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
if (scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
View contentView = scrimPopupWindow.getContentView();
contentView.getLocationInWindow(pos);
rect.set(pos[0], pos[1], pos[0] + contentView.getMeasuredWidth(), pos[1] + contentView.getMeasuredHeight());
if (!rect.contains((int) event.getX(), (int) event.getY())) {
scrimPopupWindow.dismiss();
}
}
} else if (event.getActionMasked() == MotionEvent.ACTION_OUTSIDE) {
if (scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
scrimPopupWindow.dismiss();
}
}
return false;
}
});
popupLayout.setDispatchKeyEventListener(keyEvent -> {
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && keyEvent.getRepeatCount() == 0 && scrimPopupWindow != null && scrimPopupWindow.isShowing()) {
scrimPopupWindow.dismiss();
}
});
Rect backgroundPaddings = new Rect();
Drawable shadowDrawable = getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate();
shadowDrawable.getPadding(backgroundPaddings);
popupLayout.setBackgroundDrawable(shadowDrawable);
popupLayout.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
LinearLayout linearLayout = new LinearLayout(getParentActivity());
ScrollView scrollView;
if (Build.VERSION.SDK_INT >= 21) {
scrollView = new ScrollView(getParentActivity(), null, 0, R.style.scrollbarShapeStyle) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(linearLayout.getMeasuredWidth(), getMeasuredHeight());
}
};
} else {
scrollView = new ScrollView(getParentActivity());
}
scrollView.setClipToPadding(false);
popupLayout.addView(scrollView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
linearLayout.setMinimumWidth(AndroidUtilities.dp(200));
linearLayout.setOrientation(LinearLayout.VERTICAL);
scrimPopupWindowItems = new ActionBarMenuSubItem[3];
for (int a = 0, N = (tabView.getId() == Integer.MAX_VALUE ? 2 : 3); a < N; a++) {
ActionBarMenuSubItem cell = new ActionBarMenuSubItem(getParentActivity(), a == 0, a == N - 1);
if (a == 0) {
if (getMessagesController().dialogFilters.size() <= 1) {
continue;
}
cell.setTextAndIcon(LocaleController.getString("FilterReorder", R.string.FilterReorder), R.drawable.tabs_reorder);
} else if (a == 1) {
if (N == 2) {
cell.setTextAndIcon(LocaleController.getString("FilterEditAll", R.string.FilterEditAll), R.drawable.msg_edit);
} else {
cell.setTextAndIcon(LocaleController.getString("FilterEdit", R.string.FilterEdit), R.drawable.msg_edit);
}
} else {
cell.setTextAndIcon(LocaleController.getString("FilterDeleteItem", R.string.FilterDeleteItem), R.drawable.msg_delete);
}
scrimPopupWindowItems[a] = cell;
linearLayout.addView(cell);
final int i = a;
cell.setOnClickListener(v1 -> {
if (i == 0) {
resetScroll();
filterTabsView.setIsEditing(true);
showDoneItem(true);
} else if (i == 1) {
if (N == 2) {
presentFragment(new FiltersSetupActivity());
} else {
presentFragment(new FilterCreateActivity(dialogFilter));
}
} else if (i == 2) {
showDeleteAlert(dialogFilter);
}
if (scrimPopupWindow != null) {
scrimPopupWindow.dismiss();
}
});
}
scrollView.addView(linearLayout, LayoutHelper.createScroll(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP));
scrimPopupWindow = new ActionBarPopupWindow(popupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT) {
@Override
public void dismiss() {
super.dismiss();
if (scrimPopupWindow != this) {
return;
}
scrimPopupWindow = null;
scrimPopupWindowItems = null;
if (scrimAnimatorSet != null) {
scrimAnimatorSet.cancel();
scrimAnimatorSet = null;
}
scrimAnimatorSet = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofInt(scrimPaint, AnimationProperties.PAINT_ALPHA, 0));
scrimAnimatorSet.playTogether(animators);
scrimAnimatorSet.setDuration(220);
scrimAnimatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (scrimView != null) {
scrimView.setBackground(null);
scrimView = null;
}
if (fragmentView != null) {
fragmentView.invalidate();
}
}
});
scrimAnimatorSet.start();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getParentActivity().getWindow().getDecorView().setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
}
}
};
tabView.setBackground(Theme.createRoundRectDrawable(AndroidUtilities.dp(6), Theme.getColor(Theme.key_actionBarDefault)));
scrimPopupWindow.setDismissAnimationDuration(220);
scrimPopupWindow.setOutsideTouchable(true);
scrimPopupWindow.setClippingEnabled(true);
scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
scrimPopupWindow.setFocusable(true);
popupLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST));
scrimPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
scrimPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
scrimPopupWindow.getContentView().setFocusableInTouchMode(true);
tabView.getLocationInWindow(scrimViewLocation);
int popupX = scrimViewLocation[0] + backgroundPaddings.left - AndroidUtilities.dp(16);
if (popupX < AndroidUtilities.dp(6)) {
popupX = AndroidUtilities.dp(6);
} else if (popupX > fragmentView.getMeasuredWidth() - AndroidUtilities.dp(6) - popupLayout.getMeasuredWidth()) {
popupX = fragmentView.getMeasuredWidth() - AndroidUtilities.dp(6) - popupLayout.getMeasuredWidth();
}
int popupY = scrimViewLocation[1] + tabView.getMeasuredHeight() - AndroidUtilities.dp(12);
scrimPopupWindow.showAtLocation(fragmentView, Gravity.LEFT | Gravity.TOP, popupX, popupY);
scrimView = tabView;
scrimViewSelected = selected;
fragmentView.invalidate();
if (scrimAnimatorSet != null) {
scrimAnimatorSet.cancel();
}
scrimAnimatorSet = new AnimatorSet();
ArrayList<Animator> animators = new ArrayList<>();
animators.add(ObjectAnimator.ofInt(scrimPaint, AnimationProperties.PAINT_ALPHA, 0, 50));
scrimAnimatorSet.playTogether(animators);
scrimAnimatorSet.setDuration(150);
scrimAnimatorSet.start();
return true;
}
@Override
public boolean isTabMenuVisible() {
return scrimPopupWindow != null && scrimPopupWindow.isShowing();
}
@Override
public void onDeletePressed(int id) {
showDeleteAlert(getMessagesController().dialogFilters.get(id));
}
});
}
if (allowSwitchAccount && UserConfig.getActivatedAccountsCount() > 1) {
switchItem = menu.addItemWithWidth(1, 0, AndroidUtilities.dp(56));
AvatarDrawable avatarDrawable = new AvatarDrawable();
avatarDrawable.setTextSize(AndroidUtilities.dp(12));
BackupImageView imageView = new BackupImageView(context);
imageView.setRoundRadius(AndroidUtilities.dp(18));
switchItem.addView(imageView, LayoutHelper.createFrame(36, 36, Gravity.CENTER));
TLRPC.User user = getUserConfig().getCurrentUser();
avatarDrawable.setInfo(user);
imageView.getImageReceiver().setCurrentAccount(currentAccount);
imageView.setImage(ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_SMALL), "50_50", ImageLocation.getForUserOrChat(user, ImageLocation.TYPE_STRIPPED), "50_50", avatarDrawable, user);
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
TLRPC.User u = AccountInstance.getInstance(a).getUserConfig().getCurrentUser();
if (u != null) {
AccountSelectCell cell = new AccountSelectCell(context, false);
cell.setAccount(a, true);
switchItem.addSubItem(10 + a, cell, AndroidUtilities.dp(230), AndroidUtilities.dp(48));
}
}
}
actionBar.setAllowOverlayTitle(true);
if (sideMenu != null) {
sideMenu.setBackgroundColor(Theme.getColor(Theme.key_chats_menuBackground));
sideMenu.setGlowColor(Theme.getColor(Theme.key_chats_menuBackground));
sideMenu.getAdapter().notifyDataSetChanged();
}
createActionMode(null);
ContentView contentView = new ContentView(context);
fragmentView = contentView;
int pagesCount = folderId == 0 && initialDialogsType == 0 && !onlySelect ? 2 : 1;
viewPages = new ViewPage[pagesCount];
for (int a = 0; a < pagesCount; a++) {
final ViewPage viewPage = new ViewPage(context) {
@Override
public void setTranslationX(float translationX) {
super.setTranslationX(translationX);
if (tabsAnimationInProgress) {
if (viewPages[0] == this) {
float scrollProgress = Math.abs(viewPages[0].getTranslationX()) / (float) viewPages[0].getMeasuredWidth();
filterTabsView.selectTabWithId(viewPages[1].selectedType, scrollProgress);
}
}
}
};
contentView.addView(viewPage, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
viewPage.dialogsType = initialDialogsType;
viewPages[a] = viewPage;
viewPage.progressView = new FlickerLoadingView(context);
viewPage.progressView.setViewType(FlickerLoadingView.DIALOG_CELL_TYPE);
viewPage.progressView.setVisibility(View.GONE);
viewPage.addView(viewPage.progressView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
viewPage.listView = new DialogsRecyclerView(context, viewPage);
viewPage.listView.setAccessibilityEnabled(false);
viewPage.listView.setAnimateEmptyView(true, 0);
viewPage.listView.setClipToPadding(false);
viewPage.listView.setPivotY(0);
viewPage.dialogsItemAnimator = new DialogsItemAnimator(viewPage.listView) {
@Override
public void onRemoveStarting(RecyclerView.ViewHolder item) {
super.onRemoveStarting(item);
if (viewPage.layoutManager.findFirstVisibleItemPosition() == 0) {
View v = viewPage.layoutManager.findViewByPosition(0);
if (v != null) {
v.invalidate();
}
if (viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
viewPage.archivePullViewState = ARCHIVE_ITEM_STATE_SHOWED;
}
if (viewPage.pullForegroundDrawable != null) {
viewPage.pullForegroundDrawable.doNotShow();
}
}
}
@Override
public void onRemoveFinished(RecyclerView.ViewHolder item) {
if (dialogRemoveFinished == 2) {
dialogRemoveFinished = 1;
}
}
@Override
public void onAddFinished(RecyclerView.ViewHolder item) {
if (dialogInsertFinished == 2) {
dialogInsertFinished = 1;
}
}
@Override
public void onChangeFinished(RecyclerView.ViewHolder item, boolean oldItem) {
if (dialogChangeFinished == 2) {
dialogChangeFinished = 1;
}
}
@Override
protected void onAllAnimationsDone() {
if (dialogRemoveFinished == 1 || dialogInsertFinished == 1 || dialogChangeFinished == 1) {
onDialogAnimationFinished();
}
}
};
// viewPage.listView.setItemAnimator(viewPage.dialogsItemAnimator);
viewPage.listView.setVerticalScrollBarEnabled(true);
viewPage.listView.setInstantClick(true);
viewPage.layoutManager = new LinearLayoutManager(context) {
private boolean fixOffset;
@Override
public void scrollToPositionWithOffset(int position, int offset) {
if (fixOffset) {
offset -= viewPage.listView.getPaddingTop();
}
super.scrollToPositionWithOffset(position, offset);
}
@Override
public void prepareForDrop(@NonNull View view, @NonNull View target, int x, int y) {
fixOffset = true;
super.prepareForDrop(view, target, x, y);
fixOffset = false;
}
@Override
public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
if (hasHiddenArchive() && position == 1) {
super.smoothScrollToPosition(recyclerView, state, position);
} else {
LinearSmoothScrollerCustom linearSmoothScroller = new LinearSmoothScrollerCustom(recyclerView.getContext(), LinearSmoothScrollerCustom.POSITION_MIDDLE);
linearSmoothScroller.setTargetPosition(position);
startSmoothScroll(linearSmoothScroller);
}
}
@Override
public int scrollVerticallyBy(int dy, RecyclerView.Recycler recycler, RecyclerView.State state) {
if (viewPage.listView.fastScrollAnimationRunning) {
return 0;
}
boolean isDragging = viewPage.listView.getScrollState() == RecyclerView.SCROLL_STATE_DRAGGING;
int measuredDy = dy;
int pTop = viewPage.listView.getPaddingTop();
if (viewPage.dialogsType == 0 && !onlySelect && folderId == 0 && dy < 0 && getMessagesController().hasHiddenArchive() && viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
viewPage.listView.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
int currentPosition = viewPage.layoutManager.findFirstVisibleItemPosition();
if (currentPosition == 0) {
View view = viewPage.layoutManager.findViewByPosition(currentPosition);
if (view != null && (view.getBottom() - pTop) <= AndroidUtilities.dp(1)) {
currentPosition = 1;
}
}
if (!isDragging) {
View view = viewPage.layoutManager.findViewByPosition(currentPosition);
if (view != null) {
int dialogHeight = AndroidUtilities.dp(SharedConfig.useThreeLinesLayout ? 78 : 72) + 1;
int canScrollDy = -(view.getTop() - pTop) + (currentPosition - 1) * dialogHeight;
int positiveDy = Math.abs(dy);
if (canScrollDy < positiveDy) {
measuredDy = -canScrollDy;
}
}
} else if (currentPosition == 0) {
View v = viewPage.layoutManager.findViewByPosition(currentPosition);
float k = 1f + ((v.getTop() - pTop) / (float) v.getMeasuredHeight());
if (k > 1f) {
k = 1f;
}
viewPage.listView.setOverScrollMode(View.OVER_SCROLL_NEVER);
measuredDy *= PullForegroundDrawable.startPullParallax - PullForegroundDrawable.endPullParallax * k;
if (measuredDy > -1) {
measuredDy = -1;
}
if (undoView[0].getVisibility() == View.VISIBLE) {
undoView[0].hide(true, 1);
}
}
}
if (viewPage.dialogsType == 0 && viewPage.listView.getViewOffset() != 0 && dy > 0 && isDragging) {
float ty = (int) viewPage.listView.getViewOffset();
ty -= dy;
if (ty < 0) {
measuredDy = (int) ty;
ty = 0;
} else {
measuredDy = 0;
}
viewPage.listView.setViewsOffset(ty);
}
if (viewPage.dialogsType == 0 && viewPage.archivePullViewState != ARCHIVE_ITEM_STATE_PINNED && hasHiddenArchive()) {
int usedDy = super.scrollVerticallyBy(measuredDy, recycler, state);
if (viewPage.pullForegroundDrawable != null) {
viewPage.pullForegroundDrawable.scrollDy = usedDy;
}
int currentPosition = viewPage.layoutManager.findFirstVisibleItemPosition();
View firstView = null;
if (currentPosition == 0) {
firstView = viewPage.layoutManager.findViewByPosition(currentPosition);
}
if (currentPosition == 0 && firstView != null && (firstView.getBottom() - pTop) >= AndroidUtilities.dp(4)) {
if (startArchivePullingTime == 0) {
startArchivePullingTime = System.currentTimeMillis();
}
if (viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
if (viewPage.pullForegroundDrawable != null) {
viewPage.pullForegroundDrawable.showHidden();
}
}
float k = 1f + ((firstView.getTop() - pTop) / (float) firstView.getMeasuredHeight());
if (k > 1f) {
k = 1f;
}
long pullingTime = System.currentTimeMillis() - startArchivePullingTime;
boolean canShowInternal = k > PullForegroundDrawable.SNAP_HEIGHT && pullingTime > PullForegroundDrawable.minPullingTime + 20;
if (canShowHiddenArchive != canShowInternal) {
canShowHiddenArchive = canShowInternal;
if (viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN) {
viewPage.listView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
if (viewPage.pullForegroundDrawable != null) {
viewPage.pullForegroundDrawable.colorize(canShowInternal);
}
}
}
if (viewPage.archivePullViewState == ARCHIVE_ITEM_STATE_HIDDEN && measuredDy - usedDy != 0 && dy < 0 && isDragging) {
float ty;
float tk = (viewPage.listView.getViewOffset() / PullForegroundDrawable.getMaxOverscroll());
tk = 1f - tk;
ty = (viewPage.listView.getViewOffset() - dy * PullForegroundDrawable.startPullOverScroll * tk);
viewPage.listView.setViewsOffset(ty);
}
if (viewPage.pullForegroundDrawable != null) {
viewPage.pullForegroundDrawable.pullProgress = k;
viewPage.pullForegroundDrawable.setListView(viewPage.listView);
}
} else {
startArchivePullingTime = 0;
canShowHiddenArchive = false;
viewPage.archivePullViewState = ARCHIVE_ITEM_STATE_HIDDEN;
if (viewPage.pullForegroundDrawable != null) {
viewPage.pullForegroundDrawable.resetText();
viewPage.pullForegroundDrawable.pullProgress = 0f;
viewPage.pullForegroundDrawable.setListView(viewPage.listView);
}
}
if (firstView != null) {
firstView.invalidate();
}
return usedDy;
}
return super.scrollVerticallyBy(measuredDy, recycler, state);
}
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
if (BuildVars.DEBUG_PRIVATE_VERSION) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
throw new RuntimeException("Inconsistency detected. " + "dialogsListIsFrozen=" + dialogsListFrozen + " lastUpdateAction=" + debugLastUpdateAction);
}
} else {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
FileLog.e(e);
AndroidUtilities.runOnUIThread(() -> viewPage.dialogsAdapter.notifyDataSetChanged());
}
}
}
};
viewPage.layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
viewPage.listView.setLayoutManager(viewPage.layoutManager);
viewPage.listView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
viewPage.addView(viewPage.listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
viewPage.listView.setOnItemClickListener((view, position) -> {
if (initialDialogsType == 10) {
onItemLongClick(view, position, 0, 0, viewPage.dialogsType, viewPage.dialogsAdapter);
return;
} else if ((initialDialogsType == 11 || initialDialogsType == 13) && position == 1) {
Bundle args = new Bundle();
args.putBoolean("forImport", true);
long[] array = new long[] { getUserConfig().getClientUserId() };
args.putLongArray("result", array);
args.putInt("chatType", ChatObject.CHAT_TYPE_MEGAGROUP);
String title = arguments.getString("importTitle");
if (title != null) {
args.putString("title", title);
}
GroupCreateFinalActivity activity = new GroupCreateFinalActivity(args);
activity.setDelegate(new GroupCreateFinalActivity.GroupCreateFinalActivityDelegate() {
@Override
public void didStartChatCreation() {
}
@Override
public void didFinishChatCreation(GroupCreateFinalActivity fragment, long chatId) {
ArrayList<Long> arrayList = new ArrayList<>();
arrayList.add(-chatId);
DialogsActivityDelegate dialogsActivityDelegate = delegate;
removeSelfFromStack();
dialogsActivityDelegate.didSelectDialogs(DialogsActivity.this, arrayList, null, true);
}
@Override
public void didFailChatCreation() {
}
});
presentFragment(activity);
return;
}
onItemClick(view, position, viewPage.dialogsAdapter);
});
viewPage.listView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListenerExtended() {
@Override
public boolean onItemClick(View view, int position, float x, float y) {
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && filterTabsView.isEditing()) {
return false;
}
return onItemLongClick(view, position, x, y, viewPage.dialogsType, viewPage.dialogsAdapter);
}
@Override
public void onLongClickRelease() {
finishPreviewFragment();
}
@Override
public void onMove(float dx, float dy) {
movePreviewFragment(dy);
}
});
viewPage.swipeController = new SwipeController(viewPage);
viewPage.recyclerItemsEnterAnimator = new RecyclerItemsEnterAnimator(viewPage.listView, false);
viewPage.itemTouchhelper = new ItemTouchHelper(viewPage.swipeController);
viewPage.itemTouchhelper.attachToRecyclerView(viewPage.listView);
viewPage.listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
private boolean wasManualScroll;
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
wasManualScroll = true;
scrollingManually = true;
} else {
scrollingManually = false;
}
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
wasManualScroll = false;
disableActionBarScrolling = false;
if (waitingForScrollFinished) {
waitingForScrollFinished = false;
if (updatePullAfterScroll) {
viewPage.listView.updatePullState();
updatePullAfterScroll = false;
}
viewPage.dialogsAdapter.notifyDataSetChanged();
}
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && viewPages[0].listView == recyclerView) {
int scrollY = (int) -actionBar.getTranslationY();
int actionBarHeight = ActionBar.getCurrentActionBarHeight();
if (scrollY != 0 && scrollY != actionBarHeight) {
if (scrollY < actionBarHeight / 2) {
recyclerView.smoothScrollBy(0, -scrollY);
} else if (viewPages[0].listView.canScrollVertically(1)) {
recyclerView.smoothScrollBy(0, actionBarHeight - scrollY);
}
}
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
viewPage.dialogsItemAnimator.onListScroll(-dy);
checkListLoad(viewPage);
if (initialDialogsType != 10 && wasManualScroll && floatingButtonContainer.getVisibility() != View.GONE && recyclerView.getChildCount() > 0) {
int firstVisibleItem = viewPage.layoutManager.findFirstVisibleItemPosition();
if (firstVisibleItem != RecyclerView.NO_POSITION) {
RecyclerView.ViewHolder holder = recyclerView.findViewHolderForAdapterPosition(firstVisibleItem);
if (!hasHiddenArchive() || holder != null && holder.getAdapterPosition() != 0) {
int firstViewTop = 0;
if (holder != null) {
firstViewTop = holder.itemView.getTop();
}
boolean goingDown;
boolean changed = true;
if (prevPosition == firstVisibleItem) {
final int topDelta = prevTop - firstViewTop;
goingDown = firstViewTop < prevTop;
changed = Math.abs(topDelta) > 1;
} else {
goingDown = firstVisibleItem > prevPosition;
}
if (changed && scrollUpdated && (goingDown || scrollingManually)) {
hideFloatingButton(goingDown);
}
prevPosition = firstVisibleItem;
prevTop = firstViewTop;
scrollUpdated = true;
}
}
}
if (filterTabsView != null && filterTabsView.getVisibility() == View.VISIBLE && recyclerView == viewPages[0].listView && !searching && !actionBar.isActionModeShowed() && !disableActionBarScrolling && filterTabsViewIsVisible) {
if (dy > 0 && hasHiddenArchive() && viewPages[0].dialogsType == 0) {
View child = recyclerView.getChildAt(0);
if (child != null) {
RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(child);
if (holder.getAdapterPosition() == 0) {
int visiblePartAfterScroll = child.getMeasuredHeight() + (child.getTop() - recyclerView.getPaddingTop());
if (visiblePartAfterScroll + dy > 0) {
if (visiblePartAfterScroll < 0) {
dy = -visiblePartAfterScroll;
} else {
return;
}
}
}
}
}
float currentTranslation = actionBar.getTranslationY();
float newTranslation = currentTranslation - dy;
if (newTranslation < -ActionBar.getCurrentActionBarHeight()) {
newTranslation = -ActionBar.getCurrentActionBarHeight();
} else if (newTranslation > 0) {
newTranslation = 0;
}
if (newTranslation != currentTranslation) {
setScrollY(newTranslation);
}
}
}
});
viewPage.archivePullViewState = SharedConfig.archiveHidden ? ARCHIVE_ITEM_STATE_HIDDEN : ARCHIVE_ITEM_STATE_PINNED;
if (viewPage.pullForegroundDrawable == null && folderId == 0) {
viewPage.pullForegroundDrawable = new PullForegroundDrawable(LocaleController.getString("AccSwipeForArchive", R.string.AccSwipeForArchive), LocaleController.getString("AccReleaseForArchive", R.string.AccReleaseForArchive)) {
@Override
protected float getViewOffset() {
return viewPage.listView.getViewOffset();
}
};
if (hasHiddenArchive()) {
viewPage.pullForegroundDrawable.showHidden();
} else {
viewPage.pullForegroundDrawable.doNotShow();
}
viewPage.pullForegroundDrawable.setWillDraw(viewPage.archivePullViewState != ARCHIVE_ITEM_STATE_PINNED);
}
viewPage.dialogsAdapter = new DialogsAdapter(this, context, viewPage.dialogsType, folderId, onlySelect, selectedDialogs, currentAccount) {
@Override
public void notifyDataSetChanged() {
viewPage.lastItemsCount = getItemCount();
try {
super.notifyDataSetChanged();
} catch (Exception e) {
FileLog.e(e);
}
}
};
viewPage.dialogsAdapter.setForceShowEmptyCell(afterSignup);
if (AndroidUtilities.isTablet() && openedDialogId != 0) {
viewPage.dialogsAdapter.setOpenedDialogId(openedDialogId);
}
viewPage.dialogsAdapter.setArchivedPullDrawable(viewPage.pullForegroundDrawable);
viewPage.listView.setAdapter(viewPage.dialogsAdapter);
viewPage.listView.setEmptyView(folderId == 0 ? viewPage.progressView : null);
viewPage.scrollHelper = new RecyclerAnimationScrollHelper(viewPage.listView, viewPage.layoutManager);
if (a != 0) {
viewPages[a].setVisibility(View.GONE);
}
}
int type = 0;
if (searchString != null) {
type = 2;
} else if (!onlySelect) {
type = 1;
}
searchViewPager = new SearchViewPager(context, this, type, initialDialogsType, folderId, new SearchViewPager.ChatPreviewDelegate() {
@Override
public void startChatPreview(DialogCell cell) {
showChatPreview(cell);
}
@Override
public void move(float dy) {
movePreviewFragment(dy);
}
@Override
public void finish() {
finishPreviewFragment();
}
});
contentView.addView(searchViewPager);
searchViewPager.dialogsSearchAdapter.setDelegate(new DialogsSearchAdapter.DialogsSearchAdapterDelegate() {
@Override
public void searchStateChanged(boolean search, boolean animated) {
if (searchViewPager.emptyView.getVisibility() == View.VISIBLE) {
animated = true;
}
if (searching && searchWas && searchViewPager.emptyView != null) {
if (search || searchViewPager.dialogsSearchAdapter.getItemCount() != 0) {
searchViewPager.emptyView.showProgress(true, animated);
} else {
searchViewPager.emptyView.showProgress(false, animated);
}
}
if (search && searchViewPager.dialogsSearchAdapter.getItemCount() == 0) {
searchViewPager.cancelEnterAnimation();
}
}
@Override
public void didPressedOnSubDialog(long did) {
if (onlySelect) {
if (!validateSlowModeDialog(did)) {
return;
}
if (!selectedDialogs.isEmpty()) {
boolean checked = addOrRemoveSelectedDialog(did, null);
findAndUpdateCheckBox(did, checked);
updateSelectedCount();
actionBar.closeSearchField();
} else {
didSelectResult(did, true, false);
}
} else {
Bundle args = new Bundle();
if (DialogObject.isUserDialog(did)) {
args.putLong("user_id", did);
} else {
args.putLong("chat_id", -did);
}
closeSearch();
if (AndroidUtilities.isTablet() && viewPages != null) {
for (int a = 0; a < viewPages.length; a++) {
viewPages[a].dialogsAdapter.setOpenedDialogId(openedDialogId = did);
}
updateVisibleRows(MessagesController.UPDATE_MASK_SELECT_DIALOG);
}
if (searchString != null) {
if (getMessagesController().checkCanOpenChat(args, DialogsActivity.this)) {
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
presentFragment(new ChatActivity(args));
}
} else {
if (getMessagesController().checkCanOpenChat(args, DialogsActivity.this)) {
presentFragment(new ChatActivity(args));
}
}
}
}
@Override
public void needRemoveHint(long did) {
if (getParentActivity() == null) {
return;
}
TLRPC.User user = getMessagesController().getUser(did);
if (user == null) {
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("ChatHintsDeleteAlertTitle", R.string.ChatHintsDeleteAlertTitle));
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("ChatHintsDeleteAlert", R.string.ChatHintsDeleteAlert, ContactsController.formatName(user.first_name, user.last_name))));
builder.setPositiveButton(LocaleController.getString("StickersRemove", R.string.StickersRemove), (dialogInterface, i) -> getMediaDataController().removePeer(did));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog dialog = builder.create();
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
}
@Override
public void needClearList() {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("ClearSearchAlertTitle", R.string.ClearSearchAlertTitle));
builder.setMessage(LocaleController.getString("ClearSearchAlert", R.string.ClearSearchAlert));
builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton).toUpperCase(), (dialogInterface, i) -> {
if (searchViewPager.dialogsSearchAdapter.isRecentSearchDisplayed()) {
searchViewPager.dialogsSearchAdapter.clearRecentSearch();
} else {
searchViewPager.dialogsSearchAdapter.clearRecentHashtags();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog dialog = builder.create();
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
}
@Override
public void runResultsEnterAnimation() {
if (searchViewPager != null) {
searchViewPager.runResultsEnterAnimation();
}
}
@Override
public boolean isSelected(long dialogId) {
return selectedDialogs.contains(dialogId);
}
});
searchViewPager.searchListView.setOnItemClickListener((view, position) -> {
if (initialDialogsType == 10) {
onItemLongClick(view, position, 0, 0, -1, searchViewPager.dialogsSearchAdapter);
return;
}
onItemClick(view, position, searchViewPager.dialogsSearchAdapter);
});
searchViewPager.searchListView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListenerExtended() {
@Override
public boolean onItemClick(View view, int position, float x, float y) {
return onItemLongClick(view, position, x, y, -1, searchViewPager.dialogsSearchAdapter);
}
@Override
public void onLongClickRelease() {
finishPreviewFragment();
}
@Override
public void onMove(float dx, float dy) {
movePreviewFragment(dy);
}
});
searchViewPager.setFilteredSearchViewDelegate((showMediaFilters, users, dates, archive) -> DialogsActivity.this.updateFiltersView(showMediaFilters, users, dates, archive, true));
searchViewPager.setVisibility(View.GONE);
filtersView = new FiltersView(getParentActivity(), null);
filtersView.setOnItemClickListener((view, position) -> {
filtersView.cancelClickRunnables(true);
addSearchFilter(filtersView.getFilterAt(position));
});
contentView.addView(filtersView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP));
filtersView.setVisibility(View.GONE);
floatingButtonContainer = new FrameLayout(context);
floatingButtonContainer.setVisibility(onlySelect && initialDialogsType != 10 || folderId != 0 ? View.GONE : View.VISIBLE);
contentView.addView(floatingButtonContainer, LayoutHelper.createFrame((Build.VERSION.SDK_INT >= 21 ? 56 : 60) + 20, (Build.VERSION.SDK_INT >= 21 ? 56 : 60) + 20, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, LocaleController.isRTL ? 4 : 0, 0, LocaleController.isRTL ? 0 : 4, 0));
floatingButtonContainer.setOnClickListener(v -> {
if (initialDialogsType == 10) {
if (delegate == null || selectedDialogs.isEmpty()) {
return;
}
delegate.didSelectDialogs(DialogsActivity.this, selectedDialogs, null, false);
} else {
Bundle args = new Bundle();
args.putBoolean("destroyAfterSelect", true);
presentFragment(new ContactsActivity(args));
}
});
floatingButton = new RLottieImageView(context);
floatingButton.setScaleType(ImageView.ScaleType.CENTER);
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_chats_actionBackground), Theme.getColor(Theme.key_chats_actionPressedBackground));
if (Build.VERSION.SDK_INT < 21) {
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
drawable = combinedDrawable;
}
floatingButton.setBackgroundDrawable(drawable);
floatingButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
if (initialDialogsType == 10) {
floatingButton.setImageResource(R.drawable.floating_check);
floatingButtonContainer.setContentDescription(LocaleController.getString("Done", R.string.Done));
} else {
floatingButton.setAnimation(R.raw.write_contacts_fab_icon, 52, 52);
floatingButtonContainer.setContentDescription(LocaleController.getString("NewMessageTitle", R.string.NewMessageTitle));
}
if (Build.VERSION.SDK_INT >= 21) {
StateListAnimator animator = new StateListAnimator();
animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator.ofFloat(floatingButton, View.TRANSLATION_Z, AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200));
animator.addState(new int[] {}, ObjectAnimator.ofFloat(floatingButton, View.TRANSLATION_Z, AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200));
floatingButton.setStateListAnimator(animator);
floatingButton.setOutlineProvider(new ViewOutlineProvider() {
@SuppressLint("NewApi")
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
}
});
}
floatingButtonContainer.addView(floatingButton, LayoutHelper.createFrame((Build.VERSION.SDK_INT >= 21 ? 56 : 60), (Build.VERSION.SDK_INT >= 21 ? 56 : 60), Gravity.LEFT | Gravity.TOP, 10, 6, 10, 0));
searchTabsView = null;
if (!onlySelect && initialDialogsType == 0) {
fragmentLocationContextView = new FragmentContextView(context, this, true);
fragmentLocationContextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
contentView.addView(fragmentLocationContextView);
fragmentContextView = new FragmentContextView(context, this, false) {
@Override
protected void playbackSpeedChanged(float value) {
if (Math.abs(value - 1.0f) > 0.001f || Math.abs(value - 1.8f) > 0.001f) {
getUndoView().showWithAction(0, Math.abs(value - 1.0f) > 0.001f ? UndoView.ACTION_PLAYBACK_SPEED_ENABLED : UndoView.ACTION_PLAYBACK_SPEED_DISABLED, value, null, null);
}
}
};
fragmentContextView.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 38, Gravity.TOP | Gravity.LEFT, 0, -36, 0, 0));
contentView.addView(fragmentContextView);
fragmentContextView.setAdditionalContextView(fragmentLocationContextView);
fragmentLocationContextView.setAdditionalContextView(fragmentContextView);
} else if (initialDialogsType == 3) {
if (commentView != null) {
commentView.onDestroy();
}
commentView = new ChatActivityEnterView(getParentActivity(), contentView, null, false) {
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
}
return super.dispatchTouchEvent(ev);
}
};
commentView.setAllowStickersAndGifs(false, false);
commentView.setForceShowSendButton(true, false);
commentView.setVisibility(View.GONE);
commentView.getSendButton().setAlpha(0);
contentView.addView(commentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.BOTTOM));
commentView.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() {
@Override
public void onMessageSend(CharSequence message, boolean notify, int scheduleDate) {
if (delegate == null || selectedDialogs.isEmpty()) {
return;
}
delegate.didSelectDialogs(DialogsActivity.this, selectedDialogs, message, false);
}
@Override
public void onSwitchRecordMode(boolean video) {
}
@Override
public void onTextSelectionChanged(int start, int end) {
}
@Override
public void onStickersExpandedChange() {
}
@Override
public void onPreAudioVideoRecord() {
}
@Override
public void onTextChanged(final CharSequence text, boolean bigChange) {
}
@Override
public void onTextSpansChanged(CharSequence text) {
}
@Override
public void needSendTyping() {
}
@Override
public void onAttachButtonHidden() {
}
@Override
public void onAttachButtonShow() {
}
@Override
public void onMessageEditEnd(boolean loading) {
}
@Override
public void onWindowSizeChanged(int size) {
}
@Override
public void onStickersTab(boolean opened) {
}
@Override
public void didPressAttachButton() {
}
@Override
public void needStartRecordVideo(int state, boolean notify, int scheduleDate) {
}
@Override
public void needChangeVideoPreviewState(int state, float seekProgress) {
}
@Override
public void needStartRecordAudio(int state) {
}
@Override
public void needShowMediaBanHint() {
}
@Override
public void onUpdateSlowModeButton(View button, boolean show, CharSequence time) {
}
@Override
public void onSendLongClick() {
}
@Override
public void onAudioVideoInterfaceUpdated() {
}
});
writeButtonContainer = new FrameLayout(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setText(LocaleController.formatPluralString("AccDescrShareInChats", selectedDialogs.size()));
info.setClassName(Button.class.getName());
info.setLongClickable(true);
info.setClickable(true);
}
};
writeButtonContainer.setFocusable(true);
writeButtonContainer.setFocusableInTouchMode(true);
writeButtonContainer.setVisibility(View.INVISIBLE);
writeButtonContainer.setScaleX(0.2f);
writeButtonContainer.setScaleY(0.2f);
writeButtonContainer.setAlpha(0.0f);
contentView.addView(writeButtonContainer, LayoutHelper.createFrame(60, 60, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, 6, 10));
textPaint.setTextSize(AndroidUtilities.dp(12));
textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
selectedCountView = new View(context) {
@Override
protected void onDraw(Canvas canvas) {
String text = String.format("%d", Math.max(1, selectedDialogs.size()));
int textSize = (int) Math.ceil(textPaint.measureText(text));
int size = Math.max(AndroidUtilities.dp(16) + textSize, AndroidUtilities.dp(24));
int cx = getMeasuredWidth() / 2;
int cy = getMeasuredHeight() / 2;
textPaint.setColor(getThemedColor(Theme.key_dialogRoundCheckBoxCheck));
paint.setColor(getThemedColor(Theme.isCurrentThemeDark() ? Theme.key_voipgroup_inviteMembersBackground : Theme.key_dialogBackground));
rect.set(cx - size / 2, 0, cx + size / 2, getMeasuredHeight());
canvas.drawRoundRect(rect, AndroidUtilities.dp(12), AndroidUtilities.dp(12), paint);
paint.setColor(getThemedColor(Theme.key_dialogRoundCheckBox));
rect.set(cx - size / 2 + AndroidUtilities.dp(2), AndroidUtilities.dp(2), cx + size / 2 - AndroidUtilities.dp(2), getMeasuredHeight() - AndroidUtilities.dp(2));
canvas.drawRoundRect(rect, AndroidUtilities.dp(10), AndroidUtilities.dp(10), paint);
canvas.drawText(text, cx - textSize / 2, AndroidUtilities.dp(16.2f), textPaint);
}
};
selectedCountView.setAlpha(0.0f);
selectedCountView.setScaleX(0.2f);
selectedCountView.setScaleY(0.2f);
contentView.addView(selectedCountView, LayoutHelper.createFrame(42, 24, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, -8, 9));
FrameLayout writeButtonBackground = new FrameLayout(context);
Drawable writeButtonDrawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), getThemedColor(Theme.key_dialogFloatingButton), getThemedColor(Build.VERSION.SDK_INT >= 21 ? Theme.key_dialogFloatingButtonPressed : Theme.key_dialogFloatingButton));
if (Build.VERSION.SDK_INT < 21) {
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
writeButtonDrawable = combinedDrawable;
}
writeButtonBackground.setBackgroundDrawable(writeButtonDrawable);
writeButtonBackground.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
writeButtonBackground.setOutlineProvider(new ViewOutlineProvider() {
@SuppressLint("NewApi")
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
}
});
}
writeButtonBackground.setOnClickListener(v -> {
if (delegate == null || selectedDialogs.isEmpty()) {
return;
}
delegate.didSelectDialogs(DialogsActivity.this, selectedDialogs, commentView.getFieldText(), false);
});
writeButtonBackground.setOnLongClickListener(v -> {
if (isNextButton) {
return false;
}
onSendLongClick(writeButtonBackground);
return true;
});
writeButton = new ImageView[2];
for (int a = 0; a < 2; ++a) {
writeButton[a] = new ImageView(context);
writeButton[a].setImageResource(a == 1 ? R.drawable.actionbtn_next : R.drawable.attach_send);
writeButton[a].setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_dialogFloatingIcon), PorterDuff.Mode.MULTIPLY));
writeButton[a].setScaleType(ImageView.ScaleType.CENTER);
writeButtonBackground.addView(writeButton[a], LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.CENTER));
}
AndroidUtilities.updateViewVisibilityAnimated(writeButton[0], true, 0.5f, false);
AndroidUtilities.updateViewVisibilityAnimated(writeButton[1], false, 0.5f, false);
writeButtonContainer.addView(writeButtonBackground, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.LEFT | Gravity.TOP, Build.VERSION.SDK_INT >= 21 ? 2 : 0, 0, 0, 0));
}
if (filterTabsView != null) {
contentView.addView(filterTabsView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 44));
}
if (!onlySelect) {
final FrameLayout.LayoutParams layoutParams = LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT);
if (inPreviewMode && Build.VERSION.SDK_INT >= 21) {
layoutParams.topMargin = AndroidUtilities.statusBarHeight;
}
contentView.addView(actionBar, layoutParams);
}
if (searchString == null && initialDialogsType == 0) {
updateLayout = new FrameLayout(context) {
private Paint paint = new Paint();
private Matrix matrix = new Matrix();
private LinearGradient updateGradient;
private int lastGradientWidth;
@Override
public void draw(Canvas canvas) {
if (updateGradient != null) {
paint.setColor(0xffffffff);
paint.setShader(updateGradient);
updateGradient.setLocalMatrix(matrix);
canvas.drawRect(0, 0, getMeasuredWidth(), getMeasuredHeight(), paint);
updateLayoutIcon.setBackgroundGradientDrawable(updateGradient);
updateLayoutIcon.draw(canvas);
}
super.draw(canvas);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = MeasureSpec.getSize(widthMeasureSpec);
if (lastGradientWidth != width) {
updateGradient = new LinearGradient(0, 0, width, 0, new int[] { 0xff69BF72, 0xff53B3AD }, new float[] { 0.0f, 1.0f }, Shader.TileMode.CLAMP);
lastGradientWidth = width;
}
int x = (getMeasuredWidth() - updateTextView.getMeasuredWidth()) / 2;
updateLayoutIcon.setProgressRect(x, AndroidUtilities.dp(13), x + AndroidUtilities.dp(22), AndroidUtilities.dp(13 + 22));
}
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
additionalFloatingTranslation2 = AndroidUtilities.dp(48) - translationY;
if (additionalFloatingTranslation2 < 0) {
additionalFloatingTranslation2 = 0;
}
if (!floatingHidden) {
updateFloatingButtonOffset();
}
}
};
updateLayout.setWillNotDraw(false);
updateLayout.setVisibility(View.INVISIBLE);
updateLayout.setTranslationY(AndroidUtilities.dp(48));
if (Build.VERSION.SDK_INT >= 21) {
updateLayout.setBackground(Theme.getSelectorDrawable(0x40ffffff, false));
}
contentView.addView(updateLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM));
updateLayout.setOnClickListener(v -> {
if (!SharedConfig.isAppUpdateAvailable()) {
return;
}
AndroidUtilities.openForView(SharedConfig.pendingAppUpdate.document, true, getParentActivity());
});
updateLayoutIcon = new RadialProgress2(updateLayout);
updateLayoutIcon.setColors(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
updateLayoutIcon.setCircleRadius(AndroidUtilities.dp(11));
updateLayoutIcon.setAsMini();
updateLayoutIcon.setIcon(MediaActionDrawable.ICON_UPDATE, true, false);
updateTextView = new TextView(context);
updateTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
updateTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
updateTextView.setText(LocaleController.getString("AppUpdateNow", R.string.AppUpdateNow).toUpperCase());
updateTextView.setTextColor(0xffffffff);
updateTextView.setPadding(AndroidUtilities.dp(30), 0, 0, 0);
updateLayout.addView(updateTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 0, 0, 0, 0));
}
for (int a = 0; a < 2; a++) {
undoView[a] = new UndoView(context) {
@Override
public void setTranslationY(float translationY) {
super.setTranslationY(translationY);
if (this == undoView[0] && undoView[1].getVisibility() != VISIBLE) {
additionalFloatingTranslation = getMeasuredHeight() + AndroidUtilities.dp(8) - translationY;
if (additionalFloatingTranslation < 0) {
additionalFloatingTranslation = 0;
}
if (!floatingHidden) {
updateFloatingButtonOffset();
}
}
}
@Override
protected boolean canUndo() {
for (int a = 0; a < viewPages.length; a++) {
if (viewPages[a].dialogsItemAnimator.isRunning()) {
return false;
}
}
return true;
}
@Override
protected void onRemoveDialogAction(long currentDialogId, int action) {
if (action == UndoView.ACTION_DELETE || action == UndoView.ACTION_DELETE_FEW) {
debugLastUpdateAction = 1;
setDialogsListFrozen(true);
if (frozenDialogsList != null) {
int selectedIndex = -1;
for (int i = 0; i < frozenDialogsList.size(); i++) {
if (frozenDialogsList.get(i).id == currentDialogId) {
selectedIndex = i;
break;
}
}
if (selectedIndex >= 0) {
TLRPC.Dialog dialog = frozenDialogsList.remove(selectedIndex);
viewPages[0].dialogsAdapter.notifyDataSetChanged();
int finalSelectedIndex = selectedIndex;
AndroidUtilities.runOnUIThread(() -> {
if (frozenDialogsList != null) {
frozenDialogsList.add(finalSelectedIndex, dialog);
viewPages[0].dialogsAdapter.notifyItemInserted(finalSelectedIndex);
dialogInsertFinished = 2;
}
});
} else {
setDialogsListFrozen(false);
}
}
}
}
};
contentView.addView(undoView[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
}
if (folderId != 0) {
viewPages[0].listView.setGlowColor(Theme.getColor(Theme.key_actionBarDefaultArchived));
actionBar.setTitleColor(Theme.getColor(Theme.key_actionBarDefaultArchivedTitle));
actionBar.setItemsColor(Theme.getColor(Theme.key_actionBarDefaultArchivedIcon), false);
actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultArchivedSelector), false);
actionBar.setSearchTextColor(Theme.getColor(Theme.key_actionBarDefaultArchivedSearch), false);
actionBar.setSearchTextColor(Theme.getColor(Theme.key_actionBarDefaultArchivedSearchPlaceholder), true);
}
if (!onlySelect && initialDialogsType == 0) {
blurredView = new View(context) {
@Override
public void setAlpha(float alpha) {
super.setAlpha(alpha);
if (fragmentView != null) {
fragmentView.invalidate();
}
}
};
blurredView.setVisibility(View.GONE);
contentView.addView(blurredView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
}
actionBarDefaultPaint.setColor(Theme.getColor(folderId == 0 ? Theme.key_actionBarDefault : Theme.key_actionBarDefaultArchived));
if (inPreviewMode) {
final TLRPC.User currentUser = getUserConfig().getCurrentUser();
avatarContainer = new ChatAvatarContainer(actionBar.getContext(), null, false);
avatarContainer.setTitle(UserObject.getUserName(currentUser));
avatarContainer.setSubtitle(LocaleController.formatUserStatus(currentAccount, currentUser));
avatarContainer.setUserAvatar(currentUser, true);
avatarContainer.setOccupyStatusBar(false);
avatarContainer.setLeftPadding(AndroidUtilities.dp(10));
actionBar.addView(avatarContainer, 0, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 40, 0));
floatingButton.setVisibility(View.INVISIBLE);
actionBar.setOccupyStatusBar(false);
actionBar.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefault));
if (fragmentContextView != null) {
contentView.removeView(fragmentContextView);
}
if (fragmentLocationContextView != null) {
contentView.removeView(fragmentLocationContextView);
}
}
searchIsShowed = false;
updateFilterTabs(false, false);
if (searchString != null) {
showSearch(true, false);
actionBar.openSearchField(searchString, false);
} else if (initialSearchString != null) {
showSearch(true, false);
actionBar.openSearchField(initialSearchString, false);
initialSearchString = null;
if (filterTabsView != null) {
filterTabsView.setTranslationY(-AndroidUtilities.dp(44));
}
} else {
showSearch(false, false);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
FilesMigrationService.checkBottomSheet(this);
}
updateMenuButton(false);
return fragmentView;
}
Aggregations