63 lines
2.5 KiB
Java
63 lines
2.5 KiB
Java
package com.discord.api.botuikit;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.google.gson.TypeAdapter;
|
|
import com.google.gson.stream.JsonReader;
|
|
import com.google.gson.stream.JsonWriter;
|
|
import d0.z.d.m;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
/* compiled from: ButtonComponent.kt */
|
|
public final class ButtonStyleTypeAdapter extends TypeAdapter<ButtonStyle> {
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
ButtonStyle.values();
|
|
int[] iArr = new int[6];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[ButtonStyle.PRIMARY.ordinal()] = 1;
|
|
iArr[ButtonStyle.SECONDARY.ordinal()] = 2;
|
|
iArr[ButtonStyle.SUCCESS.ordinal()] = 3;
|
|
iArr[ButtonStyle.DANGER.ordinal()] = 4;
|
|
iArr[ButtonStyle.LINK.ordinal()] = 5;
|
|
iArr[ButtonStyle.UNKNOWN.ordinal()] = 6;
|
|
}
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
@Override // com.google.gson.TypeAdapter
|
|
public ButtonStyle read(JsonReader jsonReader) {
|
|
m.checkNotNullParameter(jsonReader, "in");
|
|
Integer N1 = AnimatableValueParser.N1(jsonReader);
|
|
return (N1 != null && N1.intValue() == 1) ? ButtonStyle.PRIMARY : (N1 != null && N1.intValue() == 2) ? ButtonStyle.SECONDARY : (N1 != null && N1.intValue() == 3) ? ButtonStyle.SUCCESS : (N1 != null && N1.intValue() == 4) ? ButtonStyle.DANGER : (N1 != null && N1.intValue() == 5) ? ButtonStyle.LINK : ButtonStyle.UNKNOWN;
|
|
}
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [com.google.gson.stream.JsonWriter, java.lang.Object] */
|
|
@Override // com.google.gson.TypeAdapter
|
|
public void write(JsonWriter jsonWriter, ButtonStyle buttonStyle) {
|
|
int i;
|
|
ButtonStyle buttonStyle2 = buttonStyle;
|
|
m.checkNotNullParameter(jsonWriter, "out");
|
|
if (buttonStyle2 != null) {
|
|
int ordinal = buttonStyle2.ordinal();
|
|
if (ordinal == 0) {
|
|
i = null;
|
|
} else if (ordinal == 1) {
|
|
i = 1;
|
|
} else if (ordinal == 2) {
|
|
i = 2;
|
|
} else if (ordinal == 3) {
|
|
i = 3;
|
|
} else if (ordinal == 4) {
|
|
i = 4;
|
|
} else if (ordinal == 5) {
|
|
i = 5;
|
|
} else {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
jsonWriter.G(i);
|
|
}
|
|
}
|
|
}
|