142 lines
7.3 KiB
Java
142 lines
7.3 KiB
Java
package com.discord.widgets.channels;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.view.View;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import androidx.core.content.ContextCompat;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.R;
|
|
import com.discord.databinding.ViewGuildRoleSubscriptionChannelItemBinding;
|
|
import com.discord.utilities.channel.GuildChannelIconUtilsKt;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.color.ColorCompatKt;
|
|
import com.discord.widgets.channels.ChannelPickerAdapterItem;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: WidgetChannelPickerAdapter.kt */
|
|
public abstract class ChannelPickerViewHolder extends RecyclerView.ViewHolder {
|
|
|
|
/* compiled from: WidgetChannelPickerAdapter.kt */
|
|
public static final class ChannelItemViewHolder extends ChannelPickerViewHolder {
|
|
private final ViewGuildRoleSubscriptionChannelItemBinding binding;
|
|
private ChannelPickerAdapterItem.ChannelItem item;
|
|
|
|
/* compiled from: WidgetChannelPickerAdapter.kt */
|
|
/* renamed from: com.discord.widgets.channels.ChannelPickerViewHolder$ChannelItemViewHolder$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 implements View.OnClickListener {
|
|
public final /* synthetic */ Function1 $onItemClickListener;
|
|
public final /* synthetic */ ChannelItemViewHolder this$0;
|
|
|
|
public AnonymousClass1(ChannelItemViewHolder channelItemViewHolder, Function1 function1) {
|
|
this.this$0 = channelItemViewHolder;
|
|
this.$onItemClickListener = function1;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
ChannelPickerAdapterItem.ChannelItem access$getItem$p = ChannelItemViewHolder.access$getItem$p(this.this$0);
|
|
if (access$getItem$p != null) {
|
|
this.$onItemClickListener.invoke(access$getItem$p);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public ChannelItemViewHolder(ViewGuildRoleSubscriptionChannelItemBinding viewGuildRoleSubscriptionChannelItemBinding, Function1<? super ChannelPickerAdapterItem.ChannelItem, Unit> function1) {
|
|
super(r0, null);
|
|
m.checkNotNullParameter(viewGuildRoleSubscriptionChannelItemBinding, "binding");
|
|
m.checkNotNullParameter(function1, "onItemClickListener");
|
|
LinearLayout linearLayout = viewGuildRoleSubscriptionChannelItemBinding.a;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.root");
|
|
this.binding = viewGuildRoleSubscriptionChannelItemBinding;
|
|
this.itemView.setOnClickListener(new AnonymousClass1(this, function1));
|
|
}
|
|
|
|
public static final /* synthetic */ ChannelPickerAdapterItem.ChannelItem access$getItem$p(ChannelItemViewHolder channelItemViewHolder) {
|
|
return channelItemViewHolder.item;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setItem$p(ChannelItemViewHolder channelItemViewHolder, ChannelPickerAdapterItem.ChannelItem channelItem) {
|
|
channelItemViewHolder.item = channelItem;
|
|
}
|
|
|
|
public final void configure(ChannelPickerAdapterItem channelPickerAdapterItem) {
|
|
m.checkNotNullParameter(channelPickerAdapterItem, "adapterItem");
|
|
ChannelPickerAdapterItem.ChannelItem channelItem = (ChannelPickerAdapterItem.ChannelItem) channelPickerAdapterItem;
|
|
this.item = channelItem;
|
|
if (channelItem != null) {
|
|
TextView textView = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView, "binding.channelItemName");
|
|
textView.setText(AnimatableValueParser.y0(channelItem.getChannel()));
|
|
this.binding.d.setImageResource(GuildChannelIconUtilsKt.guildChannelIcon(channelItem.getChannel()));
|
|
ImageView imageView = this.binding.f1666c;
|
|
m.checkNotNullExpressionValue(imageView, "binding.channelItemSelected");
|
|
imageView.setVisibility(channelItem.isSelected() ? 0 : 8);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetChannelPickerAdapter.kt */
|
|
@SuppressLint({"SetTextI18n"})
|
|
public static final class CreateChannelViewHolder extends ChannelPickerViewHolder {
|
|
|
|
/* compiled from: WidgetChannelPickerAdapter.kt */
|
|
/* renamed from: com.discord.widgets.channels.ChannelPickerViewHolder$CreateChannelViewHolder$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 implements View.OnClickListener {
|
|
public final /* synthetic */ Function0 $onItemClickListener;
|
|
|
|
public AnonymousClass1(Function0 function0) {
|
|
this.$onItemClickListener = function0;
|
|
}
|
|
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
this.$onItemClickListener.mo1invoke();
|
|
}
|
|
}
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public CreateChannelViewHolder(ViewGuildRoleSubscriptionChannelItemBinding viewGuildRoleSubscriptionChannelItemBinding, Function0<Unit> function0) {
|
|
super(r0, null);
|
|
m.checkNotNullParameter(viewGuildRoleSubscriptionChannelItemBinding, "binding");
|
|
m.checkNotNullParameter(function0, "onItemClickListener");
|
|
LinearLayout linearLayout = viewGuildRoleSubscriptionChannelItemBinding.a;
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.root");
|
|
Drawable drawable = null;
|
|
viewGuildRoleSubscriptionChannelItemBinding.b.setText(R.string.guild_role_subscription_tier_benefits_create_a_channel_label);
|
|
View view = this.itemView;
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
|
int themedColor = ColorCompat.getThemedColor(view, (int) R.attr.colorTextLink);
|
|
viewGuildRoleSubscriptionChannelItemBinding.b.setTextColor(themedColor);
|
|
View view2 = this.itemView;
|
|
m.checkNotNullExpressionValue(view2, "itemView");
|
|
Drawable drawable2 = ContextCompat.getDrawable(view2.getContext(), R.drawable.ic_add_24dp);
|
|
if (drawable2 != null) {
|
|
m.checkNotNullExpressionValue(drawable2, "drawable");
|
|
ColorCompatKt.setTint(drawable2, themedColor, false);
|
|
drawable = drawable2;
|
|
}
|
|
viewGuildRoleSubscriptionChannelItemBinding.d.setImageDrawable(drawable);
|
|
ImageView imageView = viewGuildRoleSubscriptionChannelItemBinding.f1666c;
|
|
m.checkNotNullExpressionValue(imageView, "binding.channelItemSelected");
|
|
imageView.setVisibility(8);
|
|
this.itemView.setOnClickListener(new AnonymousClass1(function0));
|
|
}
|
|
}
|
|
|
|
private ChannelPickerViewHolder(View view) {
|
|
super(view);
|
|
}
|
|
|
|
public /* synthetic */ ChannelPickerViewHolder(View view, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(view);
|
|
}
|
|
}
|