Search in sources :

Example 6 with ProfileSearchCell

use of org.telegram.ui.Cells.ProfileSearchCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class ContactsActivity method getThemeDescriptions.

@Override
public ArrayList<ThemeDescription> getThemeDescriptions() {
    ArrayList<ThemeDescription> themeDescriptions = new ArrayList<>();
    ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
        if (listView != null) {
            int count = listView.getChildCount();
            for (int a = 0; a < count; a++) {
                View child = listView.getChildAt(a);
                if (child instanceof UserCell) {
                    ((UserCell) child).update(0);
                } else if (child instanceof ProfileSearchCell) {
                    ((ProfileSearchCell) child).update(0);
                }
            }
        }
    };
    themeDescriptions.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
    themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
    themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
    themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
    themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
    themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch));
    themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_SECTIONS, new Class[] { LetterSectionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayText4));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { View.class }, Theme.dividerPaint, null, null, Theme.key_divider));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_FASTSCROLL, null, null, null, null, Theme.key_fastScrollActive));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_FASTSCROLL, null, null, null, null, Theme.key_fastScrollInactive));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_FASTSCROLL, null, null, null, null, Theme.key_fastScrollText));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "statusColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "statusOnlineColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
    themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed));
    themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange));
    themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet));
    themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen));
    themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan));
    themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
    themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText2));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { TextCell.class }, new String[] { "imageView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon));
    themeDescriptions.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionIcon));
    themeDescriptions.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chats_actionBackground));
    themeDescriptions.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chats_actionPressedBackground));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { GraySectionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_graySectionText));
    themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[] { GraySectionCell.class }, null, null, null, Theme.key_graySection));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_groupDrawable, Theme.dialogs_broadcastDrawable, Theme.dialogs_botDrawable }, null, Theme.key_chats_nameIcon));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_verifiedCheckDrawable }, null, Theme.key_chats_verifiedCheck));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_verifiedDrawable }, null, Theme.key_chats_verifiedBackground));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, Theme.dialogs_offlinePaint, null, null, Theme.key_windowBackgroundWhiteGrayText3));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, Theme.dialogs_onlinePaint, null, null, Theme.key_windowBackgroundWhiteBlueText3));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Paint[] { Theme.dialogs_namePaint[0], Theme.dialogs_namePaint[1], Theme.dialogs_searchNamePaint }, null, null, Theme.key_chats_name));
    themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Paint[] { Theme.dialogs_nameEncryptedPaint[0], Theme.dialogs_nameEncryptedPaint[1], Theme.dialogs_searchNameEncryptedPaint }, null, null, Theme.key_chats_secretName));
    return themeDescriptions;
}
Also used : GraySectionCell(org.telegram.ui.Cells.GraySectionCell) ArrayList(java.util.ArrayList) Drawable(android.graphics.drawable.Drawable) CombinedDrawable(org.telegram.ui.Components.CombinedDrawable) Paint(android.graphics.Paint) ThemeDescription(org.telegram.ui.ActionBar.ThemeDescription) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) RLottieImageView(org.telegram.ui.Components.RLottieImageView) StickerEmptyView(org.telegram.ui.Components.StickerEmptyView) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) TextCell(org.telegram.ui.Cells.TextCell) ProfileSearchCell(org.telegram.ui.Cells.ProfileSearchCell) LetterSectionCell(org.telegram.ui.Cells.LetterSectionCell) UserCell(org.telegram.ui.Cells.UserCell)

Example 7 with ProfileSearchCell

use of org.telegram.ui.Cells.ProfileSearchCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class DialogsSearchAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch(holder.getItemViewType()) {
        case 0:
            {
                ProfileSearchCell cell = (ProfileSearchCell) holder.itemView;
                long oldDialogId = cell.getDialogId();
                TLRPC.User user = null;
                TLRPC.Chat chat = null;
                TLRPC.EncryptedChat encryptedChat = null;
                CharSequence username = null;
                CharSequence name = null;
                boolean isRecent = false;
                String un = null;
                Object obj = getItem(position);
                if (obj instanceof TLRPC.User) {
                    user = (TLRPC.User) obj;
                    un = user.username;
                } else if (obj instanceof TLRPC.Chat) {
                    chat = MessagesController.getInstance(currentAccount).getChat(((TLRPC.Chat) obj).id);
                    if (chat == null) {
                        chat = (TLRPC.Chat) obj;
                    }
                    un = chat.username;
                } else if (obj instanceof TLRPC.EncryptedChat) {
                    encryptedChat = MessagesController.getInstance(currentAccount).getEncryptedChat(((TLRPC.EncryptedChat) obj).id);
                    user = MessagesController.getInstance(currentAccount).getUser(encryptedChat.user_id);
                }
                if (isRecentSearchDisplayed()) {
                    isRecent = true;
                    cell.useSeparator = position != getItemCount() - 1;
                } else {
                    ArrayList<TLObject> globalSearch = searchAdapterHelper.getGlobalSearch();
                    ArrayList<Object> phoneSearch = searchAdapterHelper.getPhoneSearch();
                    int localCount = searchResult.size();
                    int localServerCount = searchAdapterHelper.getLocalServerSearch().size();
                    int phoneCount = phoneSearch.size();
                    if (phoneCount > 3 && phoneCollapsed) {
                        phoneCount = 3;
                    }
                    int phoneCount2 = phoneCount;
                    if (phoneCount > 0 && phoneSearch.get(phoneCount - 1) instanceof String) {
                        phoneCount2 -= 2;
                    }
                    int globalCount = globalSearch.isEmpty() ? 0 : globalSearch.size() + 1;
                    if (globalCount > 4 && globalSearchCollapsed) {
                        globalCount = 4;
                    }
                    cell.useSeparator = (position != getItemCount() - 1 && position != localCount + phoneCount2 + localServerCount - 1 && position != localCount + globalCount + phoneCount + localServerCount - 1);
                    if (position < searchResult.size()) {
                        name = searchResultNames.get(position);
                        if (name != null && user != null && user.username != null && user.username.length() > 0) {
                            if (name.toString().startsWith("@" + user.username)) {
                                username = name;
                                name = null;
                            }
                        }
                    } else {
                        String foundUserName = searchAdapterHelper.getLastFoundUsername();
                        if (!TextUtils.isEmpty(foundUserName)) {
                            String nameSearch = null;
                            int index;
                            if (user != null) {
                                nameSearch = ContactsController.formatName(user.first_name, user.last_name);
                            } else if (chat != null) {
                                nameSearch = chat.title;
                            }
                            if (nameSearch != null && (index = AndroidUtilities.indexOfIgnoreCase(nameSearch, foundUserName)) != -1) {
                                SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(nameSearch);
                                spannableStringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_windowBackgroundWhiteBlueText4), index, index + foundUserName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                                name = spannableStringBuilder;
                            } else if (un != null) {
                                if (foundUserName.startsWith("@")) {
                                    foundUserName = foundUserName.substring(1);
                                }
                                try {
                                    SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                                    spannableStringBuilder.append("@");
                                    spannableStringBuilder.append(un);
                                    if ((index = AndroidUtilities.indexOfIgnoreCase(un, foundUserName)) != -1) {
                                        int len = foundUserName.length();
                                        if (index == 0) {
                                            len++;
                                        } else {
                                            index++;
                                        }
                                        spannableStringBuilder.setSpan(new ForegroundColorSpanThemable(Theme.key_windowBackgroundWhiteBlueText4), index, index + len, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                                    }
                                    username = spannableStringBuilder;
                                } catch (Exception e) {
                                    username = un;
                                    FileLog.e(e);
                                }
                            }
                        }
                    }
                    cell.setChecked(false, false);
                }
                boolean savedMessages = false;
                if (user != null && user.id == selfUserId) {
                    name = LocaleController.getString("SavedMessages", R.string.SavedMessages);
                    username = null;
                    savedMessages = true;
                }
                if (chat != null && chat.participants_count != 0) {
                    String membersString;
                    if (ChatObject.isChannel(chat) && !chat.megagroup) {
                        membersString = LocaleController.formatPluralString("Subscribers", chat.participants_count);
                    } else {
                        membersString = LocaleController.formatPluralString("Members", chat.participants_count);
                    }
                    if (username instanceof SpannableStringBuilder) {
                        ((SpannableStringBuilder) username).append(", ").append(membersString);
                    } else if (!TextUtils.isEmpty(username)) {
                        username = TextUtils.concat(username, ", ", membersString);
                    } else {
                        username = membersString;
                    }
                }
                cell.setData(user != null ? user : chat, encryptedChat, name, username, isRecent, savedMessages);
                cell.setChecked(delegate.isSelected(cell.getDialogId()), oldDialogId == cell.getDialogId());
                break;
            }
        case 1:
            {
                GraySectionCell cell = (GraySectionCell) holder.itemView;
                if (isRecentSearchDisplayed()) {
                    int offset = (!MediaDataController.getInstance(currentAccount).hints.isEmpty() ? 1 : 0);
                    if (position < offset) {
                        cell.setText(LocaleController.getString("ChatHints", R.string.ChatHints));
                    } else {
                        cell.setText(LocaleController.getString("Recent", R.string.Recent), LocaleController.getString("ClearButton", R.string.ClearButton), v -> {
                            if (delegate != null) {
                                delegate.needClearList();
                            }
                        });
                    }
                } else if (!searchResultHashtags.isEmpty()) {
                    cell.setText(LocaleController.getString("Hashtags", R.string.Hashtags), LocaleController.getString("ClearButton", R.string.ClearButton), v -> {
                        if (delegate != null) {
                            delegate.needClearList();
                        }
                    });
                } else {
                    ArrayList<TLObject> globalSearch = searchAdapterHelper.getGlobalSearch();
                    int localCount = searchResult.size();
                    int localServerCount = searchAdapterHelper.getLocalServerSearch().size();
                    int phoneCount = searchAdapterHelper.getPhoneSearch().size();
                    if (phoneCount > 3 && phoneCollapsed) {
                        phoneCount = 3;
                    }
                    int globalCount = globalSearch.isEmpty() ? 0 : globalSearch.size() + 1;
                    if (globalCount > 4 && globalSearchCollapsed) {
                        globalCount = 4;
                    }
                    int messagesCount = searchResultMessages.isEmpty() ? 0 : searchResultMessages.size() + 1;
                    position -= localCount + localServerCount;
                    String title;
                    boolean showMore = false;
                    Runnable onClick = null;
                    if (position >= 0 && position < phoneCount) {
                        title = LocaleController.getString("PhoneNumberSearch", R.string.PhoneNumberSearch);
                        if (searchAdapterHelper.getPhoneSearch().size() > 3) {
                            showMore = phoneCollapsed;
                            onClick = () -> {
                                phoneCollapsed = !phoneCollapsed;
                                notifyDataSetChanged();
                            };
                        }
                    } else {
                        position -= phoneCount;
                        if (position >= 0 && position < globalCount) {
                            title = LocaleController.getString("GlobalSearch", R.string.GlobalSearch);
                            if (searchAdapterHelper.getGlobalSearch().size() > 3) {
                                showMore = globalSearchCollapsed;
                                onClick = () -> {
                                    globalSearchCollapsed = !globalSearchCollapsed;
                                    notifyDataSetChanged();
                                };
                            }
                        } else {
                            title = LocaleController.getString("SearchMessages", R.string.SearchMessages);
                        }
                    }
                    if (onClick == null) {
                        cell.setText(title);
                    } else {
                        final Runnable finalOnClick = onClick;
                        cell.setText(title, showMore ? LocaleController.getString("ShowMore", R.string.ShowMore) : LocaleController.getString("ShowLess", R.string.ShowLess), e -> finalOnClick.run());
                    }
                }
                break;
            }
        case 2:
            {
                DialogCell cell = (DialogCell) holder.itemView;
                cell.useSeparator = (position != getItemCount() - 1);
                MessageObject messageObject = (MessageObject) getItem(position);
                cell.setDialog(messageObject.getDialogId(), messageObject, messageObject.messageOwner.date, false);
                break;
            }
        case 4:
            {
                HashtagSearchCell cell = (HashtagSearchCell) holder.itemView;
                cell.setText(searchResultHashtags.get(position - 1));
                cell.setNeedDivider(position != searchResultHashtags.size());
                break;
            }
        case 5:
            {
                RecyclerListView recyclerListView = (RecyclerListView) holder.itemView;
                ((CategoryAdapterRecycler) recyclerListView.getAdapter()).setIndex(position / 2);
                break;
            }
        case 6:
            {
                String str = (String) getItem(position);
                TextCell cell = (TextCell) holder.itemView;
                cell.setColors(null, Theme.key_windowBackgroundWhiteBlueText2);
                cell.setText(LocaleController.formatString("AddContactByPhone", R.string.AddContactByPhone, PhoneFormat.getInstance().format("+" + str)), false);
                break;
            }
    }
}
Also used : Context(android.content.Context) ForegroundColorSpanThemable(org.telegram.ui.Components.ForegroundColorSpanThemable) Spanned(android.text.Spanned) Theme(org.telegram.ui.ActionBar.Theme) AndroidUtilities(org.telegram.messenger.AndroidUtilities) LocaleController(org.telegram.messenger.LocaleController) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SpannableStringBuilder(android.text.SpannableStringBuilder) TextCell(org.telegram.ui.Cells.TextCell) MotionEvent(android.view.MotionEvent) TLRPC(org.telegram.tgnet.TLRPC) PhoneFormat(org.telegram.PhoneFormat.PhoneFormat) TLObject(org.telegram.tgnet.TLObject) HintDialogCell(org.telegram.ui.Cells.HintDialogCell) View(android.view.View) MessageObject(org.telegram.messenger.MessageObject) MediaDataController(org.telegram.messenger.MediaDataController) RecyclerView(androidx.recyclerview.widget.RecyclerView) DialogCell(org.telegram.ui.Cells.DialogCell) ProfileSearchCell(org.telegram.ui.Cells.ProfileSearchCell) Utilities(org.telegram.messenger.Utilities) LongSparseArray(androidx.collection.LongSparseArray) DialogObject(org.telegram.messenger.DialogObject) FilteredSearchView(org.telegram.ui.FilteredSearchView) R(org.telegram.messenger.R) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) TextUtils(android.text.TextUtils) SQLitePreparedStatement(org.telegram.SQLite.SQLitePreparedStatement) FileLog(org.telegram.messenger.FileLog) ConnectionsManager(org.telegram.tgnet.ConnectionsManager) ViewGroup(android.view.ViewGroup) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) MessagesController(org.telegram.messenger.MessagesController) UserConfig(org.telegram.messenger.UserConfig) UserObject(org.telegram.messenger.UserObject) ContactsController(org.telegram.messenger.ContactsController) MessagesStorage(org.telegram.messenger.MessagesStorage) GraySectionCell(org.telegram.ui.Cells.GraySectionCell) HashtagSearchCell(org.telegram.ui.Cells.HashtagSearchCell) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) SQLiteCursor(org.telegram.SQLite.SQLiteCursor) ChatObject(org.telegram.messenger.ChatObject) Collections(java.util.Collections) RecyclerListView(org.telegram.ui.Components.RecyclerListView) GraySectionCell(org.telegram.ui.Cells.GraySectionCell) ArrayList(java.util.ArrayList) RecyclerListView(org.telegram.ui.Components.RecyclerListView) TLRPC(org.telegram.tgnet.TLRPC) TextCell(org.telegram.ui.Cells.TextCell) HintDialogCell(org.telegram.ui.Cells.HintDialogCell) DialogCell(org.telegram.ui.Cells.DialogCell) ForegroundColorSpanThemable(org.telegram.ui.Components.ForegroundColorSpanThemable) HashtagSearchCell(org.telegram.ui.Cells.HashtagSearchCell) ProfileSearchCell(org.telegram.ui.Cells.ProfileSearchCell) TLObject(org.telegram.tgnet.TLObject) TLObject(org.telegram.tgnet.TLObject) MessageObject(org.telegram.messenger.MessageObject) DialogObject(org.telegram.messenger.DialogObject) UserObject(org.telegram.messenger.UserObject) ChatObject(org.telegram.messenger.ChatObject) MessageObject(org.telegram.messenger.MessageObject) SpannableStringBuilder(android.text.SpannableStringBuilder)

Example 8 with ProfileSearchCell

use of org.telegram.ui.Cells.ProfileSearchCell in project Telegram-FOSS by Telegram-FOSS-Team.

the class DialogsSearchAdapter method onCreateViewHolder.

@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view;
    switch(viewType) {
        case 0:
            view = new ProfileSearchCell(mContext);
            break;
        case 1:
            view = new GraySectionCell(mContext);
            break;
        case 2:
            view = new DialogCell(null, mContext, false, true);
            break;
        case 3:
            FlickerLoadingView flickerLoadingView = new FlickerLoadingView(mContext);
            flickerLoadingView.setViewType(FlickerLoadingView.DIALOG_TYPE);
            flickerLoadingView.setIsSingleCell(true);
            view = flickerLoadingView;
            break;
        case 4:
            view = new HashtagSearchCell(mContext);
            break;
        case 5:
            RecyclerListView horizontalListView = new RecyclerListView(mContext) {

                @Override
                public boolean onInterceptTouchEvent(MotionEvent e) {
                    if (getParent() != null && getParent().getParent() != null) {
                        getParent().getParent().requestDisallowInterceptTouchEvent(canScrollHorizontally(-1) || canScrollHorizontally(1));
                    }
                    return super.onInterceptTouchEvent(e);
                }
            };
            horizontalListView.setSelectorRadius(AndroidUtilities.dp(4));
            horizontalListView.setSelectorDrawableColor(Theme.getColor(Theme.key_listSelector));
            horizontalListView.setTag(9);
            horizontalListView.setItemAnimator(null);
            horizontalListView.setLayoutAnimation(null);
            LinearLayoutManager layoutManager = new LinearLayoutManager(mContext) {

                @Override
                public boolean supportsPredictiveItemAnimations() {
                    return false;
                }
            };
            layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
            horizontalListView.setLayoutManager(layoutManager);
            // horizontalListView.setDisallowInterceptTouchEvents(true);
            horizontalListView.setAdapter(new CategoryAdapterRecycler(mContext, currentAccount, false));
            horizontalListView.setOnItemClickListener((view1, position) -> {
                if (delegate != null) {
                    delegate.didPressedOnSubDialog((Long) view1.getTag());
                }
            });
            horizontalListView.setOnItemLongClickListener((view12, position) -> {
                if (delegate != null) {
                    delegate.needRemoveHint((Long) view12.getTag());
                }
                return true;
            });
            view = horizontalListView;
            innerListView = horizontalListView;
            break;
        case 6:
        default:
            view = new TextCell(mContext, 16, false);
            break;
    }
    if (viewType == 5) {
        view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, AndroidUtilities.dp(86)));
    } else {
        view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
    }
    return new RecyclerListView.Holder(view);
}
Also used : GraySectionCell(org.telegram.ui.Cells.GraySectionCell) RecyclerListView(org.telegram.ui.Components.RecyclerListView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) FilteredSearchView(org.telegram.ui.FilteredSearchView) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) HashtagSearchCell(org.telegram.ui.Cells.HashtagSearchCell) MotionEvent(android.view.MotionEvent) TextCell(org.telegram.ui.Cells.TextCell) HintDialogCell(org.telegram.ui.Cells.HintDialogCell) DialogCell(org.telegram.ui.Cells.DialogCell) ProfileSearchCell(org.telegram.ui.Cells.ProfileSearchCell) RecyclerView(androidx.recyclerview.widget.RecyclerView) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView)

Aggregations

ProfileSearchCell (org.telegram.ui.Cells.ProfileSearchCell)8 View (android.view.View)7 RecyclerView (androidx.recyclerview.widget.RecyclerView)7 FlickerLoadingView (org.telegram.ui.Components.FlickerLoadingView)6 RecyclerListView (org.telegram.ui.Components.RecyclerListView)6 ImageView (android.widget.ImageView)5 DialogCell (org.telegram.ui.Cells.DialogCell)5 GraySectionCell (org.telegram.ui.Cells.GraySectionCell)5 HintDialogCell (org.telegram.ui.Cells.HintDialogCell)5 TextCell (org.telegram.ui.Cells.TextCell)5 Paint (android.graphics.Paint)4 TextView (android.widget.TextView)4 ArrayList (java.util.ArrayList)4 UserCell (org.telegram.ui.Cells.UserCell)4 Drawable (android.graphics.drawable.Drawable)3 ScrollView (android.widget.ScrollView)3 FiltersView (org.telegram.ui.Adapters.FiltersView)3 BackupImageView (org.telegram.ui.Components.BackupImageView)3 ChatActivityEnterView (org.telegram.ui.Components.ChatActivityEnterView)3 FilterTabsView (org.telegram.ui.Components.FilterTabsView)3