Search in sources :

Example 11 with TLObject

use of org.telegram.tgnet.TLObject in project Telegram-FOSS by Telegram-FOSS-Team.

the class MentionsAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    int type = holder.getItemViewType();
    if (type == 4) {
        StickerCell stickerCell = (StickerCell) holder.itemView;
        StickerResult result = stickers.get(position);
        stickerCell.setSticker(result.sticker, result.parent);
        stickerCell.setClearsInputField(true);
    } else if (type == 3) {
        TextView textView = (TextView) holder.itemView;
        TLRPC.Chat chat = parentFragment.getCurrentChat();
        if (chat != null) {
            if (!ChatObject.hasAdminRights(chat) && chat.default_banned_rights != null && chat.default_banned_rights.send_inline) {
                textView.setText(LocaleController.getString("GlobalAttachInlineRestricted", R.string.GlobalAttachInlineRestricted));
            } else if (AndroidUtilities.isBannedForever(chat.banned_rights)) {
                textView.setText(LocaleController.getString("AttachInlineRestrictedForever", R.string.AttachInlineRestrictedForever));
            } else {
                textView.setText(LocaleController.formatString("AttachInlineRestricted", R.string.AttachInlineRestricted, LocaleController.formatDateForBan(chat.banned_rights.until_date)));
            }
        }
    } else if (searchResultBotContext != null) {
        boolean hasTop = searchResultBotContextSwitch != null;
        if (holder.getItemViewType() == 2) {
            if (hasTop) {
                ((BotSwitchCell) holder.itemView).setText(searchResultBotContextSwitch.text);
            }
        } else {
            if (hasTop) {
                position--;
            }
            ((ContextLinkCell) holder.itemView).setLink(searchResultBotContext.get(position), foundContextBot, contextMedia, position != searchResultBotContext.size() - 1, hasTop && position == 0, "gif".equals(searchingContextUsername));
        }
    } else {
        if (searchResultUsernames != null) {
            TLObject object = searchResultUsernames.get(position);
            if (object instanceof TLRPC.User) {
                ((MentionCell) holder.itemView).setUser((TLRPC.User) object);
            } else if (object instanceof TLRPC.Chat) {
                ((MentionCell) holder.itemView).setChat((TLRPC.Chat) object);
            }
        } else if (searchResultHashtags != null) {
            ((MentionCell) holder.itemView).setText(searchResultHashtags.get(position));
        } else if (searchResultSuggestions != null) {
            ((MentionCell) holder.itemView).setEmojiSuggestion(searchResultSuggestions.get(position));
        } else if (searchResultCommands != null) {
            ((MentionCell) holder.itemView).setBotCommand(searchResultCommands.get(position), searchResultCommandsHelp.get(position), searchResultCommandsUsers != null ? searchResultCommandsUsers.get(position) : null);
        }
    }
}
Also used : ContextLinkCell(org.telegram.ui.Cells.ContextLinkCell) TLRPC(org.telegram.tgnet.TLRPC) StickerCell(org.telegram.ui.Cells.StickerCell) MentionCell(org.telegram.ui.Cells.MentionCell) TLObject(org.telegram.tgnet.TLObject) TextView(android.widget.TextView) BotSwitchCell(org.telegram.ui.Cells.BotSwitchCell)

Example 12 with TLObject

use of org.telegram.tgnet.TLObject in project Telegram-FOSS by Telegram-FOSS-Team.

the class MentionsAdapter method searchForContextBot.

private void searchForContextBot(final String username, final String query) {
    if (foundContextBot != null && foundContextBot.username != null && foundContextBot.username.equals(username) && searchingContextQuery != null && searchingContextQuery.equals(query)) {
        return;
    }
    searchResultBotContext = null;
    searchResultBotContextSwitch = null;
    notifyDataSetChanged();
    if (foundContextBot != null) {
        if (!inlineMediaEnabled && username != null && query != null) {
            return;
        }
        delegate.needChangePanelVisibility(false);
    }
    if (contextQueryRunnable != null) {
        AndroidUtilities.cancelRunOnUIThread(contextQueryRunnable);
        contextQueryRunnable = null;
    }
    if (TextUtils.isEmpty(username) || searchingContextUsername != null && !searchingContextUsername.equals(username)) {
        if (contextUsernameReqid != 0) {
            ConnectionsManager.getInstance(currentAccount).cancelRequest(contextUsernameReqid, true);
            contextUsernameReqid = 0;
        }
        if (contextQueryReqid != 0) {
            ConnectionsManager.getInstance(currentAccount).cancelRequest(contextQueryReqid, true);
            contextQueryReqid = 0;
        }
        foundContextBot = null;
        inlineMediaEnabled = true;
        searchingContextUsername = null;
        searchingContextQuery = null;
        locationProvider.stop();
        noUserName = false;
        if (delegate != null) {
            delegate.onContextSearch(false);
        }
        if (username == null || username.length() == 0) {
            return;
        }
    }
    if (query == null) {
        if (contextQueryReqid != 0) {
            ConnectionsManager.getInstance(currentAccount).cancelRequest(contextQueryReqid, true);
            contextQueryReqid = 0;
        }
        searchingContextQuery = null;
        if (delegate != null) {
            delegate.onContextSearch(false);
        }
        return;
    }
    if (delegate != null) {
        if (foundContextBot != null) {
            delegate.onContextSearch(true);
        } else if (username.equals("gif")) {
            searchingContextUsername = "gif";
            delegate.onContextSearch(false);
        }
    }
    final MessagesController messagesController = MessagesController.getInstance(currentAccount);
    final MessagesStorage messagesStorage = MessagesStorage.getInstance(currentAccount);
    searchingContextQuery = query;
    contextQueryRunnable = new Runnable() {

        @Override
        public void run() {
            if (contextQueryRunnable != this) {
                return;
            }
            contextQueryRunnable = null;
            if (foundContextBot != null || noUserName) {
                if (noUserName) {
                    return;
                }
                searchForContextBotResults(true, foundContextBot, query, "");
            } else {
                searchingContextUsername = username;
                TLObject object = messagesController.getUserOrChat(searchingContextUsername);
                if (object instanceof TLRPC.User) {
                    processFoundUser((TLRPC.User) object);
                } else {
                    TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
                    req.username = searchingContextUsername;
                    contextUsernameReqid = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
                        if (searchingContextUsername == null || !searchingContextUsername.equals(username)) {
                            return;
                        }
                        TLRPC.User user = null;
                        if (error == null) {
                            TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
                            if (!res.users.isEmpty()) {
                                user = res.users.get(0);
                                messagesController.putUser(user, false);
                                messagesStorage.putUsersAndChats(res.users, null, true, true);
                            }
                        }
                        processFoundUser(user);
                    }));
                }
            }
        }
    };
    AndroidUtilities.runOnUIThread(contextQueryRunnable, 400);
}
Also used : MessagesStorage(org.telegram.messenger.MessagesStorage) TLObject(org.telegram.tgnet.TLObject) MessagesController(org.telegram.messenger.MessagesController) TLRPC(org.telegram.tgnet.TLRPC)

Example 13 with TLObject

use of org.telegram.tgnet.TLObject in project Telegram-FOSS by Telegram-FOSS-Team.

the class SearchAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch(holder.getItemViewType()) {
        case 0:
            {
                TLObject object = (TLObject) getItem(position);
                if (object != null) {
                    long id = 0;
                    String un = null;
                    boolean self = false;
                    if (object instanceof TLRPC.User) {
                        un = ((TLRPC.User) object).username;
                        id = ((TLRPC.User) object).id;
                        self = ((TLRPC.User) object).self;
                    } else if (object instanceof TLRPC.Chat) {
                        un = ((TLRPC.Chat) object).username;
                        id = ((TLRPC.Chat) object).id;
                    }
                    CharSequence username = null;
                    CharSequence name = null;
                    if (position < searchResult.size()) {
                        name = searchResultNames.get(position);
                        if (name != null && un != null && un.length() > 0) {
                            if (name.toString().startsWith("@" + un)) {
                                username = name;
                                name = null;
                            }
                        }
                    } else if (position > searchResult.size() && un != null) {
                        String foundUserName = searchAdapterHelper.getLastFoundUsername();
                        if (foundUserName != null && foundUserName.startsWith("@")) {
                            foundUserName = foundUserName.substring(1);
                        }
                        try {
                            int index;
                            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                            spannableStringBuilder.append("@");
                            spannableStringBuilder.append(un);
                            if (foundUserName != null && (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);
                        }
                    }
                    if (useUserCell) {
                        UserCell userCell = (UserCell) holder.itemView;
                        userCell.setData(object, name, username, 0);
                        if (checkedMap != null) {
                            userCell.setChecked(checkedMap.indexOfKey(id) >= 0, false);
                        }
                    } else {
                        ProfileSearchCell profileSearchCell = (ProfileSearchCell) holder.itemView;
                        if (self) {
                            name = LocaleController.getString("SavedMessages", R.string.SavedMessages);
                        }
                        profileSearchCell.setData(object, null, name, username, false, self);
                        profileSearchCell.useSeparator = (position != getItemCount() - 1 && position != searchResult.size() - 1);
                    /*if (ignoreUsers != null) {
                            if (ignoreUsers.containsKey(id)) {
                                profileSearchCell.drawAlpha = 0.5f;
                            } else {
                                profileSearchCell.drawAlpha = 1.0f;
                            }
                        }*/
                    }
                }
                break;
            }
        case 1:
            {
                GraySectionCell cell = (GraySectionCell) holder.itemView;
                if (getItem(position) == null) {
                    cell.setText(LocaleController.getString("GlobalSearch", R.string.GlobalSearch));
                } else {
                    cell.setText(LocaleController.getString("PhoneNumberSearch", R.string.PhoneNumberSearch));
                }
                break;
            }
        case 2:
            {
                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 : GraySectionCell(org.telegram.ui.Cells.GraySectionCell) TLRPC(org.telegram.tgnet.TLRPC) TextCell(org.telegram.ui.Cells.TextCell) ProfileSearchCell(org.telegram.ui.Cells.ProfileSearchCell) TLObject(org.telegram.tgnet.TLObject) UserCell(org.telegram.ui.Cells.UserCell) SpannableStringBuilder(android.text.SpannableStringBuilder) ForegroundColorSpanThemable(org.telegram.ui.Components.ForegroundColorSpanThemable)

Example 14 with TLObject

use of org.telegram.tgnet.TLObject in project Telegram-FOSS by Telegram-FOSS-Team.

the class MediaActivity method createView.

@Override
public View createView(Context context) {
    actionBar.setBackButtonDrawable(new BackDrawable(false));
    actionBar.setCastShadows(false);
    actionBar.setAddToContainer(false);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {

        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });
    FrameLayout avatarContainer = new FrameLayout(context);
    FrameLayout fragmentView = new FrameLayout(context) {

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            FrameLayout.LayoutParams lp = (LayoutParams) sharedMediaLayout.getLayoutParams();
            lp.topMargin = ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0);
            lp = (LayoutParams) avatarContainer.getLayoutParams();
            lp.topMargin = actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0;
            lp.height = ActionBar.getCurrentActionBarHeight();
            int textTop = (ActionBar.getCurrentActionBarHeight() / 2 - AndroidUtilities.dp(22)) / 2 + AndroidUtilities.dp(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 4 : 5);
            lp = (LayoutParams) nameTextView.getLayoutParams();
            lp.topMargin = textTop;
            textTop = ActionBar.getCurrentActionBarHeight() / 2 + (ActionBar.getCurrentActionBarHeight() / 2 - AndroidUtilities.dp(19)) / 2 - AndroidUtilities.dp(3);
            lp = (LayoutParams) mediaCounterTextView.getLayoutParams();
            lp.topMargin = textTop;
            lp = (LayoutParams) avatarImageView.getLayoutParams();
            lp.topMargin = (ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(42)) / 2;
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        }

        @Override
        public boolean dispatchTouchEvent(MotionEvent ev) {
            if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll()) {
                return sharedMediaLayout.dispatchFastScrollEvent(ev);
            }
            if (sharedMediaLayout != null && sharedMediaLayout.checkPinchToZoom(ev)) {
                return true;
            }
            return super.dispatchTouchEvent(ev);
        }
    };
    this.fragmentView = fragmentView;
    nameTextView = new SimpleTextView(context);
    nameTextView.setTextSize(18);
    nameTextView.setGravity(Gravity.LEFT);
    nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    nameTextView.setLeftDrawableTopPadding(-AndroidUtilities.dp(1.3f));
    nameTextView.setScrollNonFitText(true);
    nameTextView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
    avatarContainer.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 56, 0));
    avatarImageView = new ProfileActivity.AvatarImageView(context) {

        @Override
        public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
            super.onInitializeAccessibilityNodeInfo(info);
            if (getImageReceiver().hasNotThumb()) {
                info.setText(LocaleController.getString("AccDescrProfilePicture", R.string.AccDescrProfilePicture));
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                    info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, LocaleController.getString("Open", R.string.Open)));
                    info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, LocaleController.getString("AccDescrOpenInPhotoViewer", R.string.AccDescrOpenInPhotoViewer)));
                }
            } else {
                info.setVisibleToUser(false);
            }
        }
    };
    avatarImageView.getImageReceiver().setAllowDecodeSingleFrame(true);
    avatarImageView.setRoundRadius(AndroidUtilities.dp(21));
    avatarImageView.setPivotX(0);
    avatarImageView.setPivotY(0);
    AvatarDrawable avatarDrawable = new AvatarDrawable();
    avatarDrawable.setProfile(true);
    avatarImageView.setImageDrawable(avatarDrawable);
    avatarContainer.addView(avatarImageView, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.LEFT, 64, 0, 0, 0));
    mediaCounterTextView = new AudioPlayerAlert.ClippingTextViewSwitcher(context) {

        @Override
        protected TextView createTextView() {
            TextView textView = new TextView(context);
            textView.setTextColor(Theme.getColor(Theme.key_player_actionBarSubtitle));
            textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
            textView.setSingleLine(true);
            textView.setEllipsize(TextUtils.TruncateAt.END);
            textView.setGravity(Gravity.LEFT);
            return textView;
        }
    };
    avatarContainer.addView(mediaCounterTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 56, 0));
    sharedMediaLayout = new SharedMediaLayout(context, dialogId, sharedMediaPreloader, 0, null, currentChatInfo, false, this, new SharedMediaLayout.Delegate() {

        @Override
        public void scrollToSharedMedia() {
        }

        @Override
        public boolean onMemberClick(TLRPC.ChatParticipant participant, boolean b, boolean resultOnly) {
            return false;
        }

        @Override
        public TLRPC.Chat getCurrentChat() {
            return null;
        }

        @Override
        public boolean isFragmentOpened() {
            return true;
        }

        @Override
        public RecyclerListView getListView() {
            return null;
        }

        @Override
        public boolean canSearchMembers() {
            return false;
        }

        @Override
        public void updateSelectedMediaTabText() {
            updateMediaCount();
        }
    }, SharedMediaLayout.VIEW_TYPE_MEDIA_ACTIVITY) {

        @Override
        protected void onSelectedTabChanged() {
            updateMediaCount();
        }

        @Override
        protected void onSearchStateChanged(boolean expanded) {
            if (SharedConfig.smoothKeyboard) {
                AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
            }
            AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, !expanded, 0.95f, true);
        }
    };
    sharedMediaLayout.setPinnedToTop(true);
    sharedMediaLayout.getSearchItem().setTranslationY(0);
    sharedMediaLayout.photoVideoOptionsItem.setTranslationY(0);
    fragmentView.addView(sharedMediaLayout);
    fragmentView.addView(actionBar);
    fragmentView.addView(avatarContainer);
    TLObject avatarObject = null;
    if (DialogObject.isEncryptedDialog(dialogId)) {
        TLRPC.EncryptedChat encryptedChat = getMessagesController().getEncryptedChat(DialogObject.getEncryptedChatId(dialogId));
        if (encryptedChat != null) {
            TLRPC.User user = getMessagesController().getUser(encryptedChat.user_id);
            if (user != null) {
                nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
                avatarDrawable.setInfo(user);
                avatarObject = user;
            }
        }
    } else if (DialogObject.isUserDialog(dialogId)) {
        TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId);
        if (user != null) {
            if (user.self) {
                nameTextView.setText(LocaleController.getString("SavedMessages", R.string.SavedMessages));
                avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED);
                avatarDrawable.setSmallSize(true);
            } else {
                nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
                avatarDrawable.setInfo(user);
                avatarObject = user;
            }
        }
    } else {
        TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId);
        if (chat != null) {
            nameTextView.setText(chat.title);
            avatarDrawable.setInfo(chat);
            avatarObject = chat;
        }
    }
    final ImageLocation thumbLocation = ImageLocation.getForUserOrChat(avatarObject, ImageLocation.TYPE_SMALL);
    avatarImageView.setImage(thumbLocation, "50_50", avatarDrawable, avatarObject);
    if (TextUtils.isEmpty(nameTextView.getText())) {
        nameTextView.setText(LocaleController.getString("SharedContentTitle", R.string.SharedContentTitle));
    }
    if (sharedMediaLayout.isSearchItemVisible()) {
        sharedMediaLayout.getSearchItem().setVisibility(View.VISIBLE);
    }
    if (sharedMediaLayout.isCalendarItemVisible()) {
        sharedMediaLayout.photoVideoOptionsItem.setVisibility(View.VISIBLE);
    } else {
        sharedMediaLayout.photoVideoOptionsItem.setVisibility(View.INVISIBLE);
    }
    AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, true, 1, false);
    updateMediaCount();
    updateColors();
    return fragmentView;
}
Also used : BackDrawable(org.telegram.ui.ActionBar.BackDrawable) TLRPC(org.telegram.tgnet.TLRPC) ImageLocation(org.telegram.messenger.ImageLocation) SimpleTextView(org.telegram.ui.ActionBar.SimpleTextView) TextView(android.widget.TextView) ActionBar(org.telegram.ui.ActionBar.ActionBar) ProfileActivity(org.telegram.ui.ProfileActivity) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) MotionEvent(android.view.MotionEvent) TLObject(org.telegram.tgnet.TLObject) FrameLayout(android.widget.FrameLayout) SimpleTextView(org.telegram.ui.ActionBar.SimpleTextView)

Example 15 with TLObject

use of org.telegram.tgnet.TLObject in project Telegram-FOSS by Telegram-FOSS-Team.

the class InviteMembersBottomSheet method setSelectedContacts.

public void setSelectedContacts(ArrayList<Long> dialogs) {
    for (int a = 0, N = dialogs.size(); a < N; a++) {
        long dialogId = dialogs.get(a);
        TLObject object;
        if (DialogObject.isChatDialog(dialogId)) {
            object = MessagesController.getInstance(currentAccount).getChat(-dialogId);
        } else {
            object = MessagesController.getInstance(currentAccount).getUser(dialogId);
        }
        GroupCreateSpan span = new GroupCreateSpan(spansContainer.getContext(), object);
        spansContainer.addSpan(span, false);
        span.setOnClickListener(spanClickListener);
    }
    spansCountChanged(false);
    int count = spansContainer.getChildCount();
    boolean isPortrait = AndroidUtilities.displaySize.x < AndroidUtilities.displaySize.y;
    if (AndroidUtilities.isTablet() || isPortrait) {
        maxSize = AndroidUtilities.dp(144);
    } else {
        maxSize = AndroidUtilities.dp(56);
    }
    int width;
    if (AndroidUtilities.isTablet()) {
        width = (int) (Math.min(AndroidUtilities.displaySize.x, AndroidUtilities.displaySize.y) * 0.8f);
    } else {
        width = isPortrait ? AndroidUtilities.displaySize.x : (int) Math.max(AndroidUtilities.displaySize.x * 0.8f, Math.min(AndroidUtilities.dp(480), AndroidUtilities.displaySize.x));
    }
    int maxWidth = width - AndroidUtilities.dp(26);
    int currentLineWidth = 0;
    int y = AndroidUtilities.dp(10);
    for (int a = 0; a < count; a++) {
        View child = spansContainer.getChildAt(a);
        if (!(child instanceof GroupCreateSpan)) {
            continue;
        }
        child.measure(View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(32), View.MeasureSpec.EXACTLY));
        if (currentLineWidth + child.getMeasuredWidth() > maxWidth) {
            y += child.getMeasuredHeight() + AndroidUtilities.dp(8);
            currentLineWidth = 0;
        }
        currentLineWidth += child.getMeasuredWidth() + AndroidUtilities.dp(9);
    }
    int animateToH = y + AndroidUtilities.dp(32 + 10);
    int newAdditionalH;
    if (dialogsDelegate != null) {
        newAdditionalH = spanEnter ? Math.min(maxSize, animateToH) : 0;
    } else {
        newAdditionalH = Math.max(0, Math.min(maxSize, animateToH) - AndroidUtilities.dp(52));
    }
    int oldSearchAdditionalH = searchAdditionalHeight;
    searchAdditionalHeight = (selectedContacts.size() > 0 ? AndroidUtilities.dp(56) : 0);
    if (newAdditionalH != additionalHeight || oldSearchAdditionalH != searchAdditionalHeight) {
        additionalHeight = newAdditionalH;
    }
}
Also used : TLObject(org.telegram.tgnet.TLObject) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) ScrollView(android.widget.ScrollView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint)

Aggregations

TLObject (org.telegram.tgnet.TLObject)85 TLRPC (org.telegram.tgnet.TLRPC)79 Paint (android.graphics.Paint)36 ArrayList (java.util.ArrayList)36 TextPaint (android.text.TextPaint)25 SuppressLint (android.annotation.SuppressLint)22 ConnectionsManager (org.telegram.tgnet.ConnectionsManager)22 File (java.io.File)21 HashMap (java.util.HashMap)20 Context (android.content.Context)19 Build (android.os.Build)19 TextUtils (android.text.TextUtils)19 MessageObject (org.telegram.messenger.MessageObject)19 Theme (org.telegram.ui.ActionBar.Theme)19 BaseFragment (org.telegram.ui.ActionBar.BaseFragment)18 LongSparseArray (androidx.collection.LongSparseArray)17 AlertDialog (org.telegram.ui.ActionBar.AlertDialog)17 Bundle (android.os.Bundle)16 SpannableStringBuilder (android.text.SpannableStringBuilder)16 ChatObject (org.telegram.messenger.ChatObject)16