Search in sources :

Example 1 with ProfileActivity

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

the class BackButtonMenu method getStackedHistoryDialogs.

public static ArrayList<PulledDialog> getStackedHistoryDialogs(BaseFragment thisFragment, long ignoreDialogId) {
    ArrayList<PulledDialog> dialogs = new ArrayList<>();
    if (thisFragment == null)
        return dialogs;
    final ActionBarLayout parentLayout = thisFragment.getParentLayout();
    if (parentLayout == null)
        return dialogs;
    ArrayList<BaseFragment> fragmentsStack = parentLayout.fragmentsStack;
    ArrayList<PulledDialog> pulledDialogs = parentLayout.pulledDialogs;
    if (fragmentsStack != null) {
        final int count = fragmentsStack.size();
        for (int i = 0; i < count; ++i) {
            BaseFragment fragment = fragmentsStack.get(i);
            Class activity;
            TLRPC.Chat chat;
            TLRPC.User user = null;
            long dialogId;
            int folderId, filterId;
            if (fragment instanceof ChatActivity) {
                activity = ChatActivity.class;
                ChatActivity chatActivity = (ChatActivity) fragment;
                if (chatActivity.getChatMode() != 0 || chatActivity.isReport()) {
                    continue;
                }
                chat = chatActivity.getCurrentChat();
                user = chatActivity.getCurrentUser();
                dialogId = chatActivity.getDialogId();
                folderId = chatActivity.getDialogFolderId();
                filterId = chatActivity.getDialogFilterId();
            } else if (fragment instanceof ProfileActivity) {
                activity = ProfileActivity.class;
                ProfileActivity profileActivity = (ProfileActivity) fragment;
                chat = profileActivity.getCurrentChat();
                try {
                    user = profileActivity.getUserInfo().user;
                } catch (Exception ignore) {
                }
                dialogId = profileActivity.getDialogId();
                folderId = 0;
                filterId = 0;
            } else {
                continue;
            }
            if (dialogId != ignoreDialogId && !(ignoreDialogId == 0 && UserObject.isUserSelf(user))) {
                boolean alreadyAddedDialog = false;
                for (int d = 0; d < dialogs.size(); ++d) {
                    if (dialogs.get(d).dialogId == dialogId) {
                        alreadyAddedDialog = true;
                        break;
                    }
                }
                if (!alreadyAddedDialog) {
                    PulledDialog pDialog = new PulledDialog();
                    pDialog.activity = activity;
                    pDialog.stackIndex = i;
                    pDialog.chat = chat;
                    pDialog.user = user;
                    pDialog.dialogId = dialogId;
                    pDialog.folderId = folderId;
                    pDialog.filterId = filterId;
                    if (pDialog.chat != null || pDialog.user != null) {
                        dialogs.add(pDialog);
                    }
                }
            }
        }
    }
    if (pulledDialogs != null) {
        for (PulledDialog pulledDialog : pulledDialogs) {
            if (pulledDialog.dialogId == ignoreDialogId) {
                continue;
            }
            boolean alreadyAddedDialog = false;
            for (int d = 0; d < dialogs.size(); ++d) {
                if (dialogs.get(d).dialogId == pulledDialog.dialogId) {
                    alreadyAddedDialog = true;
                    break;
                }
            }
            if (!alreadyAddedDialog) {
                dialogs.add(pulledDialog);
            }
        }
    }
    Collections.sort(dialogs, (d1, d2) -> d2.stackIndex - d1.stackIndex);
    return dialogs;
}
Also used : ProfileActivity(org.telegram.ui.ProfileActivity) ChatActivity(org.telegram.ui.ChatActivity) ArrayList(java.util.ArrayList) ActionBarLayout(org.telegram.ui.ActionBar.ActionBarLayout) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) TLRPC(org.telegram.tgnet.TLRPC)

Example 2 with ProfileActivity

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

the class BackButtonMenu method show.

public static ActionBarPopupWindow show(BaseFragment thisFragment, View backButton, long currentDialogId) {
    if (thisFragment == null) {
        return null;
    }
    final ActionBarLayout parentLayout = thisFragment.getParentLayout();
    final Context context = thisFragment.getParentActivity();
    final View fragmentView = thisFragment.getFragmentView();
    if (parentLayout == null || context == null || fragmentView == null) {
        return null;
    }
    ArrayList<PulledDialog> dialogs = getStackedHistoryDialogs(thisFragment, currentDialogId);
    if (dialogs.size() <= 0) {
        return null;
    }
    ActionBarPopupWindow.ActionBarPopupWindowLayout layout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(context);
    android.graphics.Rect backgroundPaddings = new Rect();
    Drawable shadowDrawable = thisFragment.getParentActivity().getResources().getDrawable(R.drawable.popup_fixed_alert).mutate();
    shadowDrawable.getPadding(backgroundPaddings);
    layout.setBackgroundColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuBackground));
    AtomicReference<ActionBarPopupWindow> scrimPopupWindowRef = new AtomicReference<>();
    for (int i = 0; i < dialogs.size(); ++i) {
        final PulledDialog pDialog = dialogs.get(i);
        final TLRPC.Chat chat = pDialog.chat;
        final TLRPC.User user = pDialog.user;
        FrameLayout cell = new FrameLayout(context);
        cell.setMinimumWidth(AndroidUtilities.dp(200));
        BackupImageView imageView = new BackupImageView(context);
        imageView.setRoundRadius(AndroidUtilities.dp(32));
        cell.addView(imageView, LayoutHelper.createFrameRelatively(32, 32, Gravity.START | Gravity.CENTER_VERTICAL, 13, 0, 0, 0));
        TextView titleView = new TextView(context);
        titleView.setLines(1);
        titleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        titleView.setTextColor(Theme.getColor(Theme.key_actionBarDefaultSubmenuItem));
        titleView.setEllipsize(TextUtils.TruncateAt.END);
        cell.addView(titleView, LayoutHelper.createFrameRelatively(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.START | Gravity.CENTER_VERTICAL, 59, 0, 12, 0));
        AvatarDrawable avatarDrawable = new AvatarDrawable();
        avatarDrawable.setSmallSize(true);
        if (chat != null) {
            avatarDrawable.setInfo(chat);
            imageView.setImage(ImageLocation.getForChat(chat, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, chat);
            titleView.setText(chat.title);
        } else if (user != null) {
            String name;
            if (pDialog.activity == ChatActivity.class && UserObject.isUserSelf(user)) {
                name = LocaleController.getString("SavedMessages", R.string.SavedMessages);
                avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED);
                imageView.setImageDrawable(avatarDrawable);
            } else if (UserObject.isReplyUser(user)) {
                name = LocaleController.getString("RepliesTitle", R.string.RepliesTitle);
                avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_REPLIES);
                imageView.setImageDrawable(avatarDrawable);
            } else if (UserObject.isDeleted(user)) {
                name = LocaleController.getString("HiddenName", R.string.HiddenName);
                avatarDrawable.setInfo(user);
                imageView.setImage(ImageLocation.getForUser(user, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, user);
            } else {
                name = UserObject.getUserName(user);
                avatarDrawable.setInfo(user);
                imageView.setImage(ImageLocation.getForUser(user, ImageLocation.TYPE_SMALL), "50_50", avatarDrawable, user);
            }
            titleView.setText(name);
        }
        cell.setBackground(Theme.getSelectorDrawable(Theme.getColor(Theme.key_listSelector), false));
        cell.setOnClickListener(e2 -> {
            if (scrimPopupWindowRef.get() != null) {
                scrimPopupWindowRef.getAndSet(null).dismiss();
            }
            if (pDialog.stackIndex >= 0) {
                Long nextFragmentDialogId = null;
                if (parentLayout == null || parentLayout.fragmentsStack == null || pDialog.stackIndex >= parentLayout.fragmentsStack.size()) {
                    nextFragmentDialogId = null;
                } else {
                    BaseFragment nextFragment = parentLayout.fragmentsStack.get(pDialog.stackIndex);
                    if (nextFragment instanceof ChatActivity) {
                        nextFragmentDialogId = ((ChatActivity) nextFragment).getDialogId();
                    } else if (nextFragment instanceof ProfileActivity) {
                        nextFragmentDialogId = ((ProfileActivity) nextFragment).getDialogId();
                    }
                }
                if (nextFragmentDialogId != null && nextFragmentDialogId != pDialog.dialogId) {
                    for (int j = parentLayout.fragmentsStack.size() - 2; j > pDialog.stackIndex; --j) {
                        parentLayout.removeFragmentFromStack(j);
                    }
                } else {
                    if (parentLayout != null && parentLayout.fragmentsStack != null) {
                        for (int j = parentLayout.fragmentsStack.size() - 2; j > pDialog.stackIndex; --j) {
                            if (j >= 0 && j < parentLayout.fragmentsStack.size()) {
                                parentLayout.removeFragmentFromStack(j);
                            }
                        }
                        if (pDialog.stackIndex < parentLayout.fragmentsStack.size()) {
                            parentLayout.showFragment(pDialog.stackIndex);
                            parentLayout.closeLastFragment(true);
                            return;
                        }
                    }
                }
            }
            goToPulledDialog(thisFragment, pDialog);
        });
        layout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
    }
    ActionBarPopupWindow scrimPopupWindow = new ActionBarPopupWindow(layout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);
    scrimPopupWindowRef.set(scrimPopupWindow);
    scrimPopupWindow.setPauseNotifications(true);
    scrimPopupWindow.setDismissAnimationDuration(220);
    scrimPopupWindow.setOutsideTouchable(true);
    scrimPopupWindow.setClippingEnabled(true);
    scrimPopupWindow.setAnimationStyle(R.style.PopupContextAnimation);
    scrimPopupWindow.setFocusable(true);
    layout.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);
    layout.setFitItems(true);
    int popupX = AndroidUtilities.dp(8) - backgroundPaddings.left;
    if (AndroidUtilities.isTablet()) {
        int[] location = new int[2];
        fragmentView.getLocationInWindow(location);
        popupX += location[0];
    }
    int popupY = (int) (backButton.getBottom() - backgroundPaddings.top - AndroidUtilities.dp(8));
    scrimPopupWindow.showAtLocation(fragmentView, Gravity.LEFT | Gravity.TOP, popupX, popupY);
    try {
        fragmentView.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
    } catch (Exception ignore) {
    }
    return scrimPopupWindow;
}
Also used : Rect(android.graphics.Rect) ChatActivity(org.telegram.ui.ChatActivity) ActionBarLayout(org.telegram.ui.ActionBar.ActionBarLayout) TLRPC(org.telegram.tgnet.TLRPC) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) ActionBarPopupWindow(org.telegram.ui.ActionBar.ActionBarPopupWindow) TextView(android.widget.TextView) Context(android.content.Context) Rect(android.graphics.Rect) ProfileActivity(org.telegram.ui.ProfileActivity) Drawable(android.graphics.drawable.Drawable) AtomicReference(java.util.concurrent.atomic.AtomicReference) View(android.view.View) TextView(android.widget.TextView) FrameLayout(android.widget.FrameLayout)

Example 3 with ProfileActivity

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

the class MemberRequestsDelegate method onItemClick.

public void onItemClick(View view, int position) {
    if (view instanceof MemberRequestCell) {
        if (isSearchExpanded) {
            AndroidUtilities.hideKeyboard(fragment.getParentActivity().getCurrentFocus());
        }
        MemberRequestCell cell = (MemberRequestCell) view;
        AndroidUtilities.runOnUIThread(() -> {
            importer = cell.getImporter();
            TLRPC.User user = users.get(importer.user_id);
            if (user == null) {
                return;
            }
            fragment.getMessagesController().putUser(user, false);
            boolean isLandscape = AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y;
            boolean showProfile = user.photo == null || isLandscape;
            if (showProfile) {
                isNeedRestoreList = true;
                fragment.dismissCurrentDialog();
                Bundle args = new Bundle();
                ProfileActivity profileActivity = new ProfileActivity(args);
                args.putLong("user_id", user.id);
                args.putBoolean("removeFragmentOnChatOpen", false);
                fragment.presentFragment(profileActivity);
            } else if (previewDialog == null) {
                RecyclerListView parentListView = (RecyclerListView) cell.getParent();
                previewDialog = new PreviewDialog(fragment.getParentActivity(), parentListView, fragment.getResourceProvider(), isChannel);
                previewDialog.setImporter(importer, cell.getAvatarImageView());
                previewDialog.setOnDismissListener(dialog -> previewDialog = null);
                previewDialog.show();
            }
        }, isSearchExpanded ? 100 : 0);
    }
}
Also used : Bundle(android.os.Bundle) INVISIBLE(android.view.View.INVISIBLE) ProfileActivity(org.telegram.ui.ProfileActivity) NonNull(androidx.annotation.NonNull) WindowManager(android.view.WindowManager) FrameLayout(android.widget.FrameLayout) MemberRequestsActivity(org.telegram.ui.MemberRequestsActivity) AndroidUtilities(org.telegram.messenger.AndroidUtilities) CubicBezierInterpolator(org.telegram.ui.Components.CubicBezierInterpolator) Animator(android.animation.Animator) Drawable(android.graphics.drawable.Drawable) TypefaceSpan(org.telegram.ui.Components.TypefaceSpan) Bulletin(org.telegram.ui.Components.Bulletin) AvatarDrawable(org.telegram.ui.Components.AvatarDrawable) ActionBarMenuSubItem(org.telegram.ui.ActionBar.ActionBarMenuSubItem) MemberRequestCell(org.telegram.ui.Cells.MemberRequestCell) ProfileGalleryView(org.telegram.ui.Components.ProfileGalleryView) VISIBLE(android.view.View.VISIBLE) View(android.view.View) Canvas(android.graphics.Canvas) RecyclerView(androidx.recyclerview.widget.RecyclerView) RectF(android.graphics.RectF) Utilities(org.telegram.messenger.Utilities) BaseFragment(org.telegram.ui.ActionBar.BaseFragment) BitmapDrawable(android.graphics.drawable.BitmapDrawable) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) PorterDuff(android.graphics.PorterDuff) ConnectionsManager(org.telegram.tgnet.ConnectionsManager) MathUtils(androidx.core.math.MathUtils) ViewGroup(android.view.ViewGroup) MemberRequestsController(org.telegram.messenger.MemberRequestsController) List(java.util.List) TextView(android.widget.TextView) GONE(android.view.View.GONE) LaunchActivity(org.telegram.ui.LaunchActivity) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) LongSparseArray(android.util.LongSparseArray) StickerEmptyView(org.telegram.ui.Components.StickerEmptyView) ActionBarPopupWindow(org.telegram.ui.ActionBar.ActionBarPopupWindow) ChatActivity(org.telegram.ui.ChatActivity) Context(android.content.Context) Path(android.graphics.Path) GestureDetector(android.view.GestureDetector) Spanned(android.text.Spanned) Theme(org.telegram.ui.ActionBar.Theme) Dialog(android.app.Dialog) LocaleController(org.telegram.messenger.LocaleController) AlertsCreator(org.telegram.ui.Components.AlertsCreator) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint) SpannableStringBuilder(android.text.SpannableStringBuilder) MotionEvent(android.view.MotionEvent) TLRPC(org.telegram.tgnet.TLRPC) Build(android.os.Build) AvatarPreviewPagerIndicator(org.telegram.ui.AvatarPreviewPagerIndicator) ActionBarMenu(org.telegram.ui.ActionBar.ActionBarMenu) R(org.telegram.messenger.R) MATCH_PARENT(android.view.ViewGroup.LayoutParams.MATCH_PARENT) BackupImageView(org.telegram.ui.Components.BackupImageView) TextUtils(android.text.TextUtils) LayoutHelper(org.telegram.ui.Components.LayoutHelper) FlickerLoadingView(org.telegram.ui.Components.FlickerLoadingView) MessagesController(org.telegram.messenger.MessagesController) Color(android.graphics.Color) Gravity(android.view.Gravity) UserObject(org.telegram.messenger.UserObject) Bitmap(android.graphics.Bitmap) ColorUtils(androidx.core.graphics.ColorUtils) ChatObject(org.telegram.messenger.ChatObject) Collections(java.util.Collections) RecyclerListView(org.telegram.ui.Components.RecyclerListView) ValueAnimator(android.animation.ValueAnimator) ProfileActivity(org.telegram.ui.ProfileActivity) MemberRequestCell(org.telegram.ui.Cells.MemberRequestCell) Bundle(android.os.Bundle) RecyclerListView(org.telegram.ui.Components.RecyclerListView) TLRPC(org.telegram.tgnet.TLRPC)

Example 4 with ProfileActivity

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

the class MessagesController method openChatOrProfileWith.

public static void openChatOrProfileWith(TLRPC.User user, TLRPC.Chat chat, BaseFragment fragment, int type, boolean closeLast) {
    if (user == null && chat == null || fragment == null) {
        return;
    }
    String reason;
    if (chat != null) {
        reason = getRestrictionReason(chat.restriction_reason);
    } else {
        reason = getRestrictionReason(user.restriction_reason);
        if (type != 3 && user.bot) {
            type = 1;
            closeLast = true;
        }
    }
    if (reason != null) {
        showCantOpenAlert(fragment, reason);
    } else {
        Bundle args = new Bundle();
        if (chat != null) {
            args.putLong("chat_id", chat.id);
        } else {
            args.putLong("user_id", user.id);
        }
        if (type == 0) {
            fragment.presentFragment(new ProfileActivity(args));
        } else if (type == 2) {
            fragment.presentFragment(new ChatActivity(args), true, true);
        } else {
            fragment.presentFragment(new ChatActivity(args), closeLast);
        }
    }
}
Also used : ProfileActivity(org.telegram.ui.ProfileActivity) ChatActivity(org.telegram.ui.ChatActivity) Bundle(android.os.Bundle)

Example 5 with ProfileActivity

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

the class ChatActivityEnterView method didPressedBotButton.

public boolean didPressedBotButton(final TLRPC.KeyboardButton button, final MessageObject replyMessageObject, final MessageObject messageObject) {
    if (button == null || messageObject == null) {
        return false;
    }
    if (button instanceof TLRPC.TL_keyboardButton) {
        SendMessagesHelper.getInstance(currentAccount).sendMessage(button.text, dialog_id, replyMessageObject, getThreadMessage(), null, false, null, null, null, true, 0, null);
    } else if (button instanceof TLRPC.TL_keyboardButtonUrl) {
        AlertsCreator.showOpenUrlAlert(parentFragment, button.url, false, true, resourcesProvider);
    } else if (button instanceof TLRPC.TL_keyboardButtonRequestPhone) {
        parentFragment.shareMyContact(2, messageObject);
    } else if (button instanceof TLRPC.TL_keyboardButtonRequestPoll) {
        parentFragment.openPollCreate((button.flags & 1) != 0 ? button.quiz : null);
        return false;
    } else if (button instanceof TLRPC.TL_keyboardButtonRequestGeoLocation) {
        AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
        builder.setTitle(LocaleController.getString("ShareYouLocationTitle", R.string.ShareYouLocationTitle));
        builder.setMessage(LocaleController.getString("ShareYouLocationInfo", R.string.ShareYouLocationInfo));
        builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), (dialogInterface, i) -> {
            if (Build.VERSION.SDK_INT >= 23 && parentActivity.checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
                parentActivity.requestPermissions(new String[] { Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION }, 2);
                pendingMessageObject = messageObject;
                pendingLocationButton = button;
                return;
            }
            SendMessagesHelper.getInstance(currentAccount).sendCurrentLocation(messageObject, button);
        });
        builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
        parentFragment.showDialog(builder.create());
    } else if (button instanceof TLRPC.TL_keyboardButtonCallback || button instanceof TLRPC.TL_keyboardButtonGame || button instanceof TLRPC.TL_keyboardButtonBuy || button instanceof TLRPC.TL_keyboardButtonUrlAuth) {
        SendMessagesHelper.getInstance(currentAccount).sendCallback(true, messageObject, button, parentFragment);
    } else if (button instanceof TLRPC.TL_keyboardButtonSwitchInline) {
        if (parentFragment.processSwitchButton((TLRPC.TL_keyboardButtonSwitchInline) button)) {
            return true;
        }
        if (button.same_peer) {
            long uid = messageObject.messageOwner.from_id.user_id;
            if (messageObject.messageOwner.via_bot_id != 0) {
                uid = messageObject.messageOwner.via_bot_id;
            }
            TLRPC.User user = accountInstance.getMessagesController().getUser(uid);
            if (user == null) {
                return true;
            }
            setFieldText("@" + user.username + " " + button.query);
        } else {
            Bundle args = new Bundle();
            args.putBoolean("onlySelect", true);
            args.putInt("dialogsType", 1);
            DialogsActivity fragment = new DialogsActivity(args);
            fragment.setDelegate((fragment1, dids, message, param) -> {
                long uid = messageObject.messageOwner.from_id.user_id;
                if (messageObject.messageOwner.via_bot_id != 0) {
                    uid = messageObject.messageOwner.via_bot_id;
                }
                TLRPC.User user = accountInstance.getMessagesController().getUser(uid);
                if (user == null) {
                    fragment1.finishFragment();
                    return;
                }
                long did = dids.get(0);
                MediaDataController.getInstance(currentAccount).saveDraft(did, 0, "@" + user.username + " " + button.query, null, null, true);
                if (did != dialog_id) {
                    if (!DialogObject.isEncryptedDialog(did)) {
                        Bundle args1 = new Bundle();
                        if (DialogObject.isUserDialog(did)) {
                            args1.putLong("user_id", did);
                        } else {
                            args1.putLong("chat_id", -did);
                        }
                        if (!accountInstance.getMessagesController().checkCanOpenChat(args1, fragment1)) {
                            return;
                        }
                        ChatActivity chatActivity = new ChatActivity(args1);
                        if (parentFragment.presentFragment(chatActivity, true)) {
                            if (!AndroidUtilities.isTablet()) {
                                parentFragment.removeSelfFromStack();
                            }
                        } else {
                            fragment1.finishFragment();
                        }
                    } else {
                        fragment1.finishFragment();
                    }
                } else {
                    fragment1.finishFragment();
                }
            });
            parentFragment.presentFragment(fragment);
        }
    } else if (button instanceof TLRPC.TL_keyboardButtonUserProfile) {
        if (MessagesController.getInstance(currentAccount).getUser(button.user_id) != null) {
            Bundle args = new Bundle();
            args.putLong("user_id", button.user_id);
            ProfileActivity fragment = new ProfileActivity(args);
            parentFragment.presentFragment(fragment);
        }
    }
    return true;
}
Also used : AlertDialog(org.telegram.ui.ActionBar.AlertDialog) ProfileActivity(org.telegram.ui.ProfileActivity) ChatActivity(org.telegram.ui.ChatActivity) Bundle(android.os.Bundle) SpannableStringBuilder(android.text.SpannableStringBuilder) DialogsActivity(org.telegram.ui.DialogsActivity) TLRPC(org.telegram.tgnet.TLRPC)

Aggregations

ProfileActivity (org.telegram.ui.ProfileActivity)8 ChatActivity (org.telegram.ui.ChatActivity)7 Bundle (android.os.Bundle)6 TLRPC (org.telegram.tgnet.TLRPC)6 Drawable (android.graphics.drawable.Drawable)4 Context (android.content.Context)3 BitmapDrawable (android.graphics.drawable.BitmapDrawable)3 SpannableStringBuilder (android.text.SpannableStringBuilder)3 View (android.view.View)3 BaseFragment (org.telegram.ui.ActionBar.BaseFragment)3 Animator (android.animation.Animator)2 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 ValueAnimator (android.animation.ValueAnimator)2 Bitmap (android.graphics.Bitmap)2 Canvas (android.graphics.Canvas)2 PorterDuff (android.graphics.PorterDuff)2 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)2 Rect (android.graphics.Rect)2 Build (android.os.Build)2 Spanned (android.text.Spanned)2