package com.discord.widgets.channels.list; import android.content.Context; import android.graphics.Rect; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.TextView; import androidx.annotation.LayoutRes; import androidx.recyclerview.widget.RecyclerView; import com.discord.databinding.WidgetCollapsedVoiceUserListItemBinding; import com.discord.utilities.icon.IconUtils; import com.discord.utilities.images.MGImages; import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple; import com.discord.utilities.mg_recycler.MGRecyclerViewHolder; import com.discord.utilities.view.extensions.ViewExtensions; import com.discord.widgets.channels.list.items.CollapsedUser; import com.facebook.drawee.view.SimpleDraweeView; import d0.z.d.m; import java.util.Objects; /* compiled from: WidgetCollapsedUsersListAdapter.kt */ public final class WidgetCollapsedUsersListAdapter extends MGRecyclerAdapterSimple { /* compiled from: WidgetCollapsedUsersListAdapter.kt */ public static final class OverlapDecoration extends RecyclerView.ItemDecoration { private final int offset; public OverlapDecoration(int i) { this.offset = i; } @Override // androidx.recyclerview.widget.RecyclerView.ItemDecoration public void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, RecyclerView.State state) { m.checkNotNullParameter(rect, "outRect"); m.checkNotNullParameter(view, "view"); m.checkNotNullParameter(recyclerView, "parent"); m.checkNotNullParameter(state, "state"); ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type androidx.recyclerview.widget.RecyclerView.LayoutParams"); rect.set(((RecyclerView.LayoutParams) layoutParams).getViewAdapterPosition() != 0 ? this.offset : 0, 0, 0, 0); } } /* compiled from: WidgetCollapsedUsersListAdapter.kt */ public static final class WidgetCollapsedUserListItem extends MGRecyclerViewHolder { private final WidgetCollapsedVoiceUserListItemBinding binding; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public WidgetCollapsedUserListItem(@LayoutRes int i, WidgetCollapsedUsersListAdapter widgetCollapsedUsersListAdapter) { super(i, widgetCollapsedUsersListAdapter); m.checkNotNullParameter(widgetCollapsedUsersListAdapter, "adapter"); View view = this.itemView; int i2 = 2131365750; TextView textView = (TextView) view.findViewById(2131365750); if (textView != null) { i2 = 2131365751; SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(2131365751); if (simpleDraweeView != null) { WidgetCollapsedVoiceUserListItemBinding widgetCollapsedVoiceUserListItemBinding = new WidgetCollapsedVoiceUserListItemBinding((FrameLayout) view, textView, simpleDraweeView); m.checkNotNullExpressionValue(widgetCollapsedVoiceUserListItemBinding, "WidgetCollapsedVoiceUser…temBinding.bind(itemView)"); this.binding = widgetCollapsedVoiceUserListItemBinding; return; } } throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i2))); } /* JADX DEBUG: TODO: convert one arg to string using `String.valueOf()`, args: [('+' char), (wrap: int : 0x0023: INVOKE (r11v1 int) = (r11v0 com.discord.widgets.channels.list.items.CollapsedUser) type: VIRTUAL call: com.discord.widgets.channels.list.items.CollapsedUser.getExtraCount():int)] */ public void onConfigure(int i, CollapsedUser collapsedUser) { m.checkNotNullParameter(collapsedUser, "data"); super.onConfigure(i, (int) collapsedUser); if (collapsedUser.getExtraCount() > 0) { TextView textView = this.binding.b; m.checkNotNullExpressionValue(textView, "binding.widgetCollapsedUserCount"); StringBuilder sb = new StringBuilder(); sb.append('+'); sb.append(collapsedUser.getExtraCount()); ViewExtensions.setTextAndVisibilityBy(textView, sb.toString()); MGImages mGImages = MGImages.INSTANCE; SimpleDraweeView simpleDraweeView = this.binding.f1764c; m.checkNotNullExpressionValue(simpleDraweeView, "binding.widgetCollapsedUserImageview"); MGImages.setImage$default(mGImages, simpleDraweeView, 2131231135, (MGImages.ChangeDetector) null, 4, (Object) null); } else if (!collapsedUser.getEmptySlot()) { TextView textView2 = this.binding.b; m.checkNotNullExpressionValue(textView2, "binding.widgetCollapsedUserCount"); textView2.setVisibility(8); SimpleDraweeView simpleDraweeView2 = this.binding.f1764c; m.checkNotNullExpressionValue(simpleDraweeView2, "binding.widgetCollapsedUserImageview"); IconUtils.setIcon$default(simpleDraweeView2, collapsedUser.getUser(), 2131165290, null, null, null, 56, null); } } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public WidgetCollapsedUsersListAdapter(RecyclerView recyclerView) { super(recyclerView, false, 2, null); m.checkNotNullParameter(recyclerView, "recycler"); Context context = recyclerView.getContext(); m.checkNotNullExpressionValue(context, "recycler.context"); recyclerView.addItemDecoration(new OverlapDecoration(-context.getResources().getDimensionPixelSize(2131165284))); } @Override // androidx.recyclerview.widget.RecyclerView.Adapter public MGRecyclerViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { m.checkNotNullParameter(viewGroup, "parent"); return new WidgetCollapsedUserListItem(2131558988, this); } }