146 lines
4.7 KiB
Java
146 lines
4.7 KiB
Java
package c.i.a.c.e2.q;
|
|
|
|
import android.graphics.Color;
|
|
import android.graphics.PointF;
|
|
import android.util.Log;
|
|
import androidx.annotation.ColorInt;
|
|
import androidx.annotation.Nullable;
|
|
import c.i.a.c.i2.f0;
|
|
import c.i.a.c.i2.p;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import java.util.Objects;
|
|
import java.util.regex.Matcher;
|
|
import java.util.regex.Pattern;
|
|
/* compiled from: SsaStyle */
|
|
public final class c {
|
|
public final String a;
|
|
public final int b;
|
|
@Nullable
|
|
@ColorInt
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final Integer f843c;
|
|
public final float d;
|
|
public final boolean e;
|
|
public final boolean f;
|
|
|
|
/* compiled from: SsaStyle */
|
|
public static final class a {
|
|
public final int a;
|
|
public final int b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final int f844c;
|
|
public final int d;
|
|
public final int e;
|
|
public final int f;
|
|
public final int g;
|
|
|
|
public a(int i, int i2, int i3, int i4, int i5, int i6, int i7) {
|
|
this.a = i;
|
|
this.b = i2;
|
|
this.f844c = i3;
|
|
this.d = i4;
|
|
this.e = i5;
|
|
this.f = i6;
|
|
this.g = i7;
|
|
}
|
|
}
|
|
|
|
/* compiled from: SsaStyle */
|
|
public static final class b {
|
|
public static final Pattern a = Pattern.compile("\\{([^}]*)\\}");
|
|
public static final Pattern b = Pattern.compile(f0.k("\\\\pos\\((%1$s),(%1$s)\\)", "\\s*\\d+(?:\\.\\d+)?\\s*"));
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public static final Pattern f845c = Pattern.compile(f0.k("\\\\move\\(%1$s,%1$s,(%1$s),(%1$s)(?:,%1$s,%1$s)?\\)", "\\s*\\d+(?:\\.\\d+)?\\s*"));
|
|
public static final Pattern d = Pattern.compile("\\\\an(\\d+)");
|
|
|
|
@Nullable
|
|
public static PointF a(String str) {
|
|
String str2;
|
|
String str3;
|
|
Matcher matcher = b.matcher(str);
|
|
Matcher matcher2 = f845c.matcher(str);
|
|
boolean find = matcher.find();
|
|
boolean find2 = matcher2.find();
|
|
if (find) {
|
|
if (find2) {
|
|
Log.i("SsaStyle.Overrides", "Override has both \\pos(x,y) and \\move(x1,y1,x2,y2); using \\pos values. override='" + str + "'");
|
|
}
|
|
str2 = matcher.group(1);
|
|
str3 = matcher.group(2);
|
|
} else if (!find2) {
|
|
return null;
|
|
} else {
|
|
str2 = matcher2.group(1);
|
|
str3 = matcher2.group(2);
|
|
}
|
|
Objects.requireNonNull(str2);
|
|
float parseFloat = Float.parseFloat(str2.trim());
|
|
Objects.requireNonNull(str3);
|
|
return new PointF(parseFloat, Float.parseFloat(str3.trim()));
|
|
}
|
|
}
|
|
|
|
public c(String str, int i, @Nullable @ColorInt Integer num, float f, boolean z2, boolean z3) {
|
|
this.a = str;
|
|
this.b = i;
|
|
this.f843c = num;
|
|
this.d = f;
|
|
this.e = z2;
|
|
this.f = z3;
|
|
}
|
|
|
|
public static int a(String str) {
|
|
boolean z2;
|
|
try {
|
|
int parseInt = Integer.parseInt(str.trim());
|
|
switch (parseInt) {
|
|
case 1:
|
|
case 2:
|
|
case 3:
|
|
case 4:
|
|
case 5:
|
|
case 6:
|
|
case 7:
|
|
case 8:
|
|
case 9:
|
|
z2 = true;
|
|
break;
|
|
default:
|
|
z2 = false;
|
|
break;
|
|
}
|
|
if (z2) {
|
|
return parseInt;
|
|
}
|
|
} catch (NumberFormatException unused) {
|
|
}
|
|
c.d.b.a.a.g0("Ignoring unknown alignment: ", str, "SsaStyle");
|
|
return -1;
|
|
}
|
|
|
|
public static boolean b(String str) {
|
|
try {
|
|
int parseInt = Integer.parseInt(str);
|
|
return parseInt == 1 || parseInt == -1;
|
|
} catch (NumberFormatException e) {
|
|
p.c("SsaStyle", "Failed to parse bold/italic: '" + str + "'", e);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@Nullable
|
|
@ColorInt
|
|
public static Integer c(String str) {
|
|
try {
|
|
long parseLong = str.startsWith("&H") ? Long.parseLong(str.substring(2), 16) : Long.parseLong(str);
|
|
AnimatableValueParser.k(parseLong <= 4294967295L);
|
|
return Integer.valueOf(Color.argb(c.i.a.f.e.o.c.t(((parseLong >> 24) & 255) ^ 255), c.i.a.f.e.o.c.t(parseLong & 255), c.i.a.f.e.o.c.t((parseLong >> 8) & 255), c.i.a.f.e.o.c.t((parseLong >> 16) & 255)));
|
|
} catch (IllegalArgumentException e) {
|
|
p.c("SsaStyle", "Failed to parse color expression: '" + str + "'", e);
|
|
return null;
|
|
}
|
|
}
|
|
}
|