172 lines
7.8 KiB
Java
172 lines
7.8 KiB
Java
package com.discord.widgets.chat.input.emoji;
|
|
|
|
import android.view.View;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageView;
|
|
import androidx.annotation.DrawableRes;
|
|
import androidx.core.content.res.ResourcesCompat;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import com.discord.databinding.EmojiCategoryItemGuildBinding;
|
|
import com.discord.databinding.EmojiCategoryItemStandardBinding;
|
|
import com.discord.models.domain.emoji.EmojiCategory;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.color.ColorCompatKt;
|
|
import com.discord.widgets.chat.input.emoji.EmojiCategoryItem;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: EmojiCategoryViewHolder.kt */
|
|
public abstract class EmojiCategoryViewHolder extends RecyclerView.ViewHolder {
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
/* compiled from: EmojiCategoryViewHolder.kt */
|
|
public static final class Companion {
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
EmojiCategory.values();
|
|
int[] iArr = new int[11];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[EmojiCategory.FAVORITE.ordinal()] = 1;
|
|
iArr[EmojiCategory.PEOPLE.ordinal()] = 2;
|
|
iArr[EmojiCategory.NATURE.ordinal()] = 3;
|
|
iArr[EmojiCategory.FOOD.ordinal()] = 4;
|
|
iArr[EmojiCategory.ACTIVITY.ordinal()] = 5;
|
|
iArr[EmojiCategory.TRAVEL.ordinal()] = 6;
|
|
iArr[EmojiCategory.OBJECTS.ordinal()] = 7;
|
|
iArr[EmojiCategory.SYMBOLS.ordinal()] = 8;
|
|
iArr[EmojiCategory.FLAGS.ordinal()] = 9;
|
|
iArr[EmojiCategory.RECENT.ordinal()] = 10;
|
|
iArr[EmojiCategory.CUSTOM.ordinal()] = 11;
|
|
}
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
@DrawableRes
|
|
public final int getCategoryIconResId(EmojiCategory emojiCategory) {
|
|
m.checkNotNullParameter(emojiCategory, "emojiCategory");
|
|
switch (emojiCategory.ordinal()) {
|
|
case 0:
|
|
return 2131231595;
|
|
case 1:
|
|
return 2131231601;
|
|
case 2:
|
|
default:
|
|
return 2131231594;
|
|
case 3:
|
|
return 2131231600;
|
|
case 4:
|
|
return 2131231598;
|
|
case 5:
|
|
return 2131231597;
|
|
case 6:
|
|
return 2131231593;
|
|
case 7:
|
|
return 2131231603;
|
|
case 8:
|
|
return 2131231599;
|
|
case 9:
|
|
return 2131231602;
|
|
case 10:
|
|
return 2131231596;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiCategoryViewHolder.kt */
|
|
public static final class Guild extends EmojiCategoryViewHolder {
|
|
private final EmojiCategoryItemGuildBinding binding;
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public Guild(EmojiCategoryItemGuildBinding emojiCategoryItemGuildBinding) {
|
|
super(r0, null);
|
|
m.checkNotNullParameter(emojiCategoryItemGuildBinding, "binding");
|
|
FrameLayout frameLayout = emojiCategoryItemGuildBinding.a;
|
|
m.checkNotNullExpressionValue(frameLayout, "binding.root");
|
|
this.binding = emojiCategoryItemGuildBinding;
|
|
}
|
|
|
|
public final void configure(EmojiCategoryItem.GuildItem guildItem, Function1<? super EmojiCategoryItem, Unit> function1) {
|
|
m.checkNotNullParameter(guildItem, "guildCategoryItem");
|
|
m.checkNotNullParameter(function1, "onCategoryClicked");
|
|
this.binding.b.updateView(guildItem.getGuild());
|
|
View view = this.binding.f1605c.b;
|
|
m.checkNotNullExpressionValue(view, "binding.overline.express…CategorySelectionOverline");
|
|
view.setVisibility(guildItem.isSelected() ? 0 : 8);
|
|
this.itemView.setOnClickListener(new EmojiCategoryViewHolder$Guild$configure$1(function1, guildItem));
|
|
View view2 = this.itemView;
|
|
m.checkNotNullExpressionValue(view2, "itemView");
|
|
view2.setContentDescription(guildItem.getGuild().getName());
|
|
}
|
|
}
|
|
|
|
/* compiled from: EmojiCategoryViewHolder.kt */
|
|
public static final class Standard extends EmojiCategoryViewHolder {
|
|
private final EmojiCategoryItemStandardBinding binding;
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
public Standard(EmojiCategoryItemStandardBinding emojiCategoryItemStandardBinding) {
|
|
super(r0, null);
|
|
m.checkNotNullParameter(emojiCategoryItemStandardBinding, "binding");
|
|
FrameLayout frameLayout = emojiCategoryItemStandardBinding.a;
|
|
m.checkNotNullExpressionValue(frameLayout, "binding.root");
|
|
this.binding = emojiCategoryItemStandardBinding;
|
|
}
|
|
|
|
public final void configure(EmojiCategoryItem.StandardItem standardItem, Function1<? super EmojiCategoryItem, Unit> function1) {
|
|
int i;
|
|
m.checkNotNullParameter(standardItem, "standardCategoryItem");
|
|
m.checkNotNullParameter(function1, "onCategoryClicked");
|
|
EmojiCategory emojiCategory = standardItem.getEmojiCategory();
|
|
int categoryIconResId = EmojiCategoryViewHolder.Companion.getCategoryIconResId(emojiCategory);
|
|
ImageView imageView = this.binding.b;
|
|
View view = this.itemView;
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
|
imageView.setImageDrawable(ResourcesCompat.getDrawable(view.getResources(), categoryIconResId, null));
|
|
boolean isSelected = standardItem.isSelected();
|
|
ImageView imageView2 = this.binding.b;
|
|
m.checkNotNullExpressionValue(imageView2, "binding.emojiCategoryItemStandardIcon");
|
|
imageView2.setSelected(isSelected);
|
|
View view2 = this.binding.f1606c.b;
|
|
m.checkNotNullExpressionValue(view2, "binding.overline.express…CategorySelectionOverline");
|
|
view2.setVisibility(isSelected ? 0 : 8);
|
|
if (isSelected) {
|
|
ImageView imageView3 = this.binding.b;
|
|
m.checkNotNullExpressionValue(imageView3, "binding.emojiCategoryItemStandardIcon");
|
|
i = ColorCompat.getThemedColor(imageView3, 2130968946);
|
|
} else {
|
|
ImageView imageView4 = this.binding.b;
|
|
m.checkNotNullExpressionValue(imageView4, "binding.emojiCategoryItemStandardIcon");
|
|
i = ColorCompat.getThemedColor(imageView4, 2130968949);
|
|
}
|
|
ImageView imageView5 = this.binding.b;
|
|
m.checkNotNullExpressionValue(imageView5, "binding.emojiCategoryItemStandardIcon");
|
|
ColorCompatKt.tintWithColor(imageView5, i);
|
|
ImageView imageView6 = this.binding.b;
|
|
m.checkNotNullExpressionValue(imageView6, "binding.emojiCategoryItemStandardIcon");
|
|
imageView6.setAlpha(isSelected ? 1.0f : 0.5f);
|
|
this.itemView.setOnClickListener(new EmojiCategoryViewHolder$Standard$configure$1(function1, standardItem));
|
|
View view3 = this.itemView;
|
|
m.checkNotNullExpressionValue(view3, "itemView");
|
|
view3.setContentDescription(emojiCategory.name());
|
|
}
|
|
}
|
|
|
|
private EmojiCategoryViewHolder(View view) {
|
|
super(view);
|
|
}
|
|
|
|
public /* synthetic */ EmojiCategoryViewHolder(View view, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(view);
|
|
}
|
|
}
|