2021-08-03 07:33:18 +00:00
package com.discord.widgets.guilds.invite ;
import android.view.ViewGroup ;
import android.widget.TextView ;
import androidx.recyclerview.widget.RecyclerView ;
import com.airbnb.lottie.parser.AnimatableValueParser ;
2021-08-09 22:51:56 +00:00
import com.discord.R ;
2021-08-03 07:33:18 +00:00
import com.discord.databinding.WidgetGuildInviteShareItemBinding ;
import com.discord.utilities.icon.IconUtils ;
2021-08-19 06:48:32 +00:00
import com.discord.utilities.images.MGImages ;
2021-08-03 07:33:18 +00:00
import com.discord.utilities.mg_recycler.MGRecyclerAdapterSimple ;
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder ;
import com.discord.widgets.guilds.invite.InviteSuggestionItem ;
import com.facebook.drawee.view.SimpleDraweeView ;
import com.google.android.material.button.MaterialButton ;
import d0.z.d.m ;
import kotlin.Unit ;
import kotlin.jvm.functions.Function1 ;
/* compiled from: PrivateChannelAdapter.kt */
public final class PrivateChannelAdapter extends MGRecyclerAdapterSimple < InviteSuggestionItem > {
private Function1 < ? super InviteSuggestionItem , Unit > onClick = PrivateChannelAdapter$onClick$1 . INSTANCE ;
/* compiled from: PrivateChannelAdapter.kt */
public static final class Item extends MGRecyclerViewHolder < PrivateChannelAdapter , InviteSuggestionItem > {
private final WidgetGuildInviteShareItemBinding binding ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public Item ( PrivateChannelAdapter privateChannelAdapter ) {
2021-08-09 22:51:56 +00:00
super ( ( int ) R . layout . widget_guild_invite_share_item , privateChannelAdapter ) ;
2021-08-03 07:33:18 +00:00
m . checkNotNullParameter ( privateChannelAdapter , " adapter " ) ;
WidgetGuildInviteShareItemBinding a = WidgetGuildInviteShareItemBinding . a ( this . itemView ) ;
m . checkNotNullExpressionValue ( a , " WidgetGuildInviteShareItemBinding.bind(itemView) " ) ;
this . binding = a ;
}
public static final /* synthetic */ PrivateChannelAdapter access$getAdapter$p ( Item item ) {
return ( PrivateChannelAdapter ) item . adapter ;
}
public void onConfigure ( int i , InviteSuggestionItem inviteSuggestionItem ) {
m . checkNotNullParameter ( inviteSuggestionItem , " data " ) ;
super . onConfigure ( i , ( int ) inviteSuggestionItem ) ;
boolean z2 = inviteSuggestionItem instanceof InviteSuggestionItem . ChannelItem ;
if ( z2 ) {
InviteSuggestionItem . ChannelItem channelItem = ( InviteSuggestionItem . ChannelItem ) inviteSuggestionItem ;
if ( channelItem . getChannel ( ) . A ( ) ! = 1 ) {
SimpleDraweeView simpleDraweeView = this . binding . b ;
m . checkNotNullExpressionValue ( simpleDraweeView , " binding.itemIconIv " ) ;
2021-08-19 06:48:32 +00:00
IconUtils . setIcon$default ( simpleDraweeView , channelItem . getChannel ( ) , 0 , ( MGImages . ChangeDetector ) null , 12 , ( Object ) null ) ;
2021-08-03 07:33:18 +00:00
} else {
SimpleDraweeView simpleDraweeView2 = this . binding . b ;
m . checkNotNullExpressionValue ( simpleDraweeView2 , " binding.itemIconIv " ) ;
IconUtils . setIcon$default ( simpleDraweeView2 , AnimatableValueParser . v0 ( channelItem . getChannel ( ) ) , 0 , null , null , null , 60 , null ) ;
}
TextView textView = this . binding . d ;
m . checkNotNullExpressionValue ( textView , " binding.itemNameTv " ) ;
textView . setText ( AnimatableValueParser . y0 ( channelItem . getChannel ( ) ) ) ;
} else if ( inviteSuggestionItem instanceof InviteSuggestionItem . UserItem ) {
SimpleDraweeView simpleDraweeView3 = this . binding . b ;
m . checkNotNullExpressionValue ( simpleDraweeView3 , " binding.itemIconIv " ) ;
InviteSuggestionItem . UserItem userItem = ( InviteSuggestionItem . UserItem ) inviteSuggestionItem ;
IconUtils . setIcon$default ( simpleDraweeView3 , userItem . getUser ( ) , 0 , null , null , null , 60 , null ) ;
TextView textView2 = this . binding . d ;
m . checkNotNullExpressionValue ( textView2 , " binding.itemNameTv " ) ;
textView2 . setText ( userItem . getUser ( ) . getUsername ( ) ) ;
}
if ( z2 | | ( inviteSuggestionItem instanceof InviteSuggestionItem . UserItem ) ) {
MaterialButton materialButton = this . binding . e ;
m . checkNotNullExpressionValue ( materialButton , " binding.itemSent " ) ;
int i2 = 0 ;
materialButton . setVisibility ( inviteSuggestionItem . hasSentInvite ( ) ? 0 : 8 ) ;
2021-09-09 06:47:34 +00:00
MaterialButton materialButton2 = this . binding . f1856c ;
2021-08-03 07:33:18 +00:00
m . checkNotNullExpressionValue ( materialButton2 , " binding.itemInviteBtn " ) ;
if ( ! ( ! inviteSuggestionItem . hasSentInvite ( ) ) ) {
i2 = 8 ;
}
materialButton2 . setVisibility ( i2 ) ;
2021-09-09 06:47:34 +00:00
this . binding . f1856c . setOnClickListener ( new PrivateChannelAdapter$Item$onConfigure$1 ( this , inviteSuggestionItem ) ) ;
2021-08-03 07:33:18 +00:00
}
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public PrivateChannelAdapter ( RecyclerView recyclerView ) {
super ( recyclerView , false , 2 , null ) ;
m . checkNotNullParameter ( recyclerView , " recycler " ) ;
}
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super com.discord.widgets.guilds.invite.InviteSuggestionItem, kotlin.Unit>, kotlin.jvm.functions.Function1<com.discord.widgets.guilds.invite.InviteSuggestionItem, kotlin.Unit> */
public final Function1 < InviteSuggestionItem , Unit > getOnClick ( ) {
return this . onClick ;
}
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
public Item onCreateViewHolder ( ViewGroup viewGroup , int i ) {
m . checkNotNullParameter ( viewGroup , " parent " ) ;
return new Item ( this ) ;
}
public final void setOnClick ( Function1 < ? super InviteSuggestionItem , Unit > function1 ) {
m . checkNotNullParameter ( function1 , " <set-?> " ) ;
this . onClick = function1 ;
}
}