Search in sources :

Example 1 with MemberRequestCell

use of org.telegram.ui.Cells.MemberRequestCell 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)

Aggregations

Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 ValueAnimator (android.animation.ValueAnimator)1 SuppressLint (android.annotation.SuppressLint)1 Dialog (android.app.Dialog)1 Context (android.content.Context)1 Bitmap (android.graphics.Bitmap)1 Canvas (android.graphics.Canvas)1 Color (android.graphics.Color)1 Path (android.graphics.Path)1 PorterDuff (android.graphics.PorterDuff)1 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)1 RectF (android.graphics.RectF)1 BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Drawable (android.graphics.drawable.Drawable)1 Build (android.os.Build)1 Bundle (android.os.Bundle)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 Spanned (android.text.Spanned)1 TextUtils (android.text.TextUtils)1