package mn; import android.annotation.SuppressLint; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.RecyclerView; import com.drakeet.multitype.MultiTypeAdapter; import com.google.android.gms.common.GoogleApiAvailabilityLight; import com.xingin.alpha.R$id; import com.xingin.alpha.R$layout; import com.xingin.alpha.util.CenterLayoutManager; import com.xingin.foundation.framework.v2.recyclerview.KotlinViewHolder; import java.util.Collection; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Objects; import kotlin.Metadata; import kotlin.Pair; import kotlin.Unit; import kotlin.collections.CollectionsKt___CollectionsKt; import kotlin.jvm.JvmOverloads; import kotlin.jvm.functions.Function2; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import ln.q2; import lx.m; import org.cybergarage.upnp.std.av.server.object.item.ItemNode; import sy.v0; import un.c; import y7.f; @Metadata(bv = {}, d1 = {"\u0000P\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0007\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u00002\u00020\u0001:\u00010B'\b\u0007\u0012\u0006\u0010*\u001a\u00020)\u0012\n\b\u0002\u0010,\u001a\u0004\u0018\u00010+\u0012\b\b\u0002\u0010-\u001a\u00020\u001e¢\u0006\u0004\b.\u0010/J\u0014\u0010\u0004\u001a\u000e\u0012\u0004\u0012\u00020\u0003\u0012\u0004\u0012\u00020\u00030\u0002H\u0002J\u0006\u0010\u0006\u001a\u00020\u0005J\u0006\u0010\u0007\u001a\u00020\u0005J\u0006\u0010\b\u001a\u00020\u0005J\u0006\u0010\t\u001a\u00020\u0005J\u000e\u0010\u000b\u001a\u00020\u00052\u0006\u0010\n\u001a\u00020\u0003J\u000e\u0010\u000e\u001a\u00020\u00052\u0006\u0010\r\u001a\u00020\fJ\b\u0010\u000f\u001a\u00020\u0005H\u0003J\b\u0010\u0011\u001a\u00020\u0010H\u0002J\u0018\u0010\u0013\u001a\u00020\u00052\u0006\u0010\u0012\u001a\u00020\u00102\u0006\u0010\r\u001a\u00020\fH\u0002J\u0018\u0010\u0015\u001a\u00020\u00052\u0006\u0010\n\u001a\u00020\u00032\u0006\u0010\u0014\u001a\u00020\u0003H\u0002R$\u0010\u0017\u001a\u0004\u0018\u00010\u00168\u0006@\u0006X\u000e¢\u0006\u0012\n\u0004\b\u0017\u0010\u0018\u001a\u0004\b\u0019\u0010\u001a\"\u0004\b\u001b\u0010\u001cRT\u0010#\u001a4\u0012\u0013\u0012\u00110\u001e¢\u0006\f\b\u001f\u0012\b\b \u0012\u0004\b\b(!\u0012\u0013\u0012\u00110\u0003¢\u0006\f\b\u001f\u0012\b\b \u0012\u0004\b\b(\"\u0012\u0004\u0012\u00020\u0005\u0018\u00010\u001d8\u0006@\u0006X\u000e¢\u0006\u0012\n\u0004\b#\u0010$\u001a\u0004\b%\u0010&\"\u0004\b'\u0010(¨\u00061"}, d2 = {"Lmn/h;", "Landroid/widget/LinearLayout;", "Lkotlin/Pair;", "", "getCurrentSelectedProgress", "", "l", "j", "g", "k", "progress", "i", "", "selected", GoogleApiAvailabilityLight.TRACKING_SOURCE_NOTIFICATION, z60.h.f160753a, "Llx/m;", f.f156778k, ItemNode.NAME, "m", "recommendValue", "o", "Lln/q2;", "iFilterSeekBar", "Lln/q2;", "getIFilterSeekBar", "()Lln/q2;", "setIFilterSeekBar", "(Lln/q2;)V", "Lkotlin/Function2;", "", "Lkotlin/ParameterName;", "name", "beautyType", "strength", "beautyParamsChangeCallback", "Lkotlin/jvm/functions/Function2;", "getBeautyParamsChangeCallback", "()Lkotlin/jvm/functions/Function2;", "setBeautyParamsChangeCallback", "(Lkotlin/jvm/functions/Function2;)V", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "a", "alpha_library_release"}, k = 1, mv = {1, 6, 0}) /* compiled from: BeautySettingViewV2.kt */ public final class h extends LinearLayout { /* renamed from: h reason: collision with root package name */ public static final a f106833h = new a(null); /* renamed from: a reason: collision with root package name */ public List<? extends m> f106834a; /* renamed from: b reason: collision with root package name */ public q2 f106835b; /* renamed from: c reason: collision with root package name */ public final MultiTypeAdapter f106836c; /* renamed from: d reason: collision with root package name */ public m f106837d; /* renamed from: e reason: collision with root package name */ public m f106838e; /* renamed from: f reason: collision with root package name */ public Function2<? super Integer, ? super Float, Unit> f106839f; /* renamed from: g reason: collision with root package name */ public Map<Integer, View> f106840g; @Metadata(bv = {}, d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\b\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0006\u0010\u0007R\u0014\u0010\u0003\u001a\u00020\u00028\u0002XT¢\u0006\u0006\n\u0004\b\u0003\u0010\u0004R\u0014\u0010\u0005\u001a\u00020\u00028\u0002XT¢\u0006\u0006\n\u0004\b\u0005\u0010\u0004¨\u0006\b"}, d2 = {"Lmn/h$a;", "", "", "DEFAULT_ITEM_ICON", "Ljava/lang/String;", "TAG", "<init>", "()V", "alpha_library_release"}, k = 1, mv = {1, 6, 0}) /* compiled from: BeautySettingViewV2.kt */ public static final class a { public a() { } public /* synthetic */ a(DefaultConstructorMarker defaultConstructorMarker) { this(); } } @Metadata(bv = {}, d1 = {"\u0000\u0013\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00030\u0001¨\u0006\u0004"}, d2 = {"mn/h$b", "Lmn/g;", "Llx/m;", "Lcom/xingin/foundation/framework/v2/recyclerview/KotlinViewHolder;", "alpha_library_release"}, k = 1, mv = {1, 6, 0}) /* compiled from: BeautySettingViewV2.kt */ public static final class b extends g<m, KotlinViewHolder> { /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public b(Context context, c cVar) { super(context, cVar); Intrinsics.checkNotNullExpressionValue(context, "context"); } } @Metadata(bv = {}, d1 = {"\u0000\u001d\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0004*\u0001\u0000\b\n\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0004\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u0002H\u0016J\u0018\u0010\b\u001a\u00020\u00062\u0006\u0010\u0004\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u0002H\u0016J\u0018\u0010\t\u001a\u00020\u00062\u0006\u0010\u0004\u001a\u00020\u00032\u0006\u0010\u0005\u001a\u00020\u0002H\u0016¨\u0006\n"}, d2 = {"mn/h$c", "Lun/c$b;", "Llx/m;", "", "index", ItemNode.NAME, "", "e", f.f156778k, "d", "alpha_library_release"}, k = 1, mv = {1, 6, 0}) /* compiled from: BeautySettingViewV2.kt */ public static final class c implements c.b<m> { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ h f106841a; public c(h hVar) { this.f106841a = hVar; } /* renamed from: d */ public void b(int i10, m mVar) { Intrinsics.checkNotNullParameter(mVar, ItemNode.NAME); c.b.a.a(this, i10, mVar); mVar.e(false); } /* renamed from: e */ public void c(int i10, m mVar) { Intrinsics.checkNotNullParameter(mVar, ItemNode.NAME); if (i10 == 0) { this.f106841a.j(); return; } if (mVar.g() >= 0) { this.f106841a.n(false); h hVar = this.f106841a; hVar.m(hVar.f106838e, false); this.f106841a.f106838e = mVar; h hVar2 = this.f106841a; hVar2.m(hVar2.f106838e, true); this.f106841a.k(); this.f106841a.o(mVar.i(), mVar.f()); } else { q2 iFilterSeekBar = this.f106841a.getIFilterSeekBar(); if (iFilterSeekBar != null) { iFilterSeekBar.a(true); } } v0 v0Var = v0.f131783a; v0Var.c("BeautySettingViewV2", null, "item click -- " + mVar); } /* renamed from: f */ public void a(int i10, m mVar) { Intrinsics.checkNotNullParameter(mVar, ItemNode.NAME); c.b.a.b(this, i10, mVar); mVar.e(true); } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ @JvmOverloads public h(Context context, AttributeSet attributeSet, int i10) { super(context, attributeSet, i10); Intrinsics.checkNotNullParameter(context, "context"); this.f106840g = new LinkedHashMap(); this.f106834a = f.f106828a.d(); this.f106836c = new MultiTypeAdapter(null, 0, null, 7, null); m f14 = f(); this.f106837d = f14; this.f106838e = f14; LayoutInflater.from(context).inflate(R$layout.f39962alpha_beautify_settings_layout, (ViewGroup) this, true); h(); } private final Pair<Float, Float> getCurrentSelectedProgress() { if (this.f106836c.d().contains(this.f106838e)) { return new Pair<>(Float.valueOf(((m) this.f106836c.d().get(this.f106836c.d().indexOf(this.f106838e))).i()), Float.valueOf(((m) this.f106836c.d().get(this.f106836c.d().indexOf(this.f106838e))).f())); } return new Pair<>(Float.valueOf(0.0f), Float.valueOf(0.0f)); } public View a(int i10) { Map<Integer, View> map = this.f106840g; View view = map.get(Integer.valueOf(i10)); if (view != null) { return view; } View findViewById = findViewById(i10); if (findViewById == null) { return null; } map.put(Integer.valueOf(i10), findViewById); return findViewById; } public final m f() { m mVar = new m(); mVar.k(-1); mVar.m(f.f106828a.f()); mVar.d("https://picasso-static.xiaohongshu.com/fe-platform/29540798e6fe01b1db29b568a086bc068a6c4ab0/alpha_no_beauty_icon.png"); mVar.l("无"); return mVar; } public final void g() { Pair<Float, Float> currentSelectedProgress = getCurrentSelectedProgress(); q2 q2Var = this.f106835b; if (q2Var != null) { q2Var.b(currentSelectedProgress.getFirst().floatValue(), currentSelectedProgress.getSecond().floatValue()); } k(); } /* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function2<? super java.lang.Integer, ? super java.lang.Float, kotlin.Unit>, kotlin.jvm.functions.Function2<java.lang.Integer, java.lang.Float, kotlin.Unit> */ public final Function2<Integer, Float, Unit> getBeautyParamsChangeCallback() { return this.f106839f; } public final q2 getIFilterSeekBar() { return this.f106835b; } @SuppressLint({"NotifyDataSetChanged"}) public final void h() { ((RecyclerView) a(R$id.f39752beautyEditRecyclerView)).setHasFixedSize(true); for (T t14 : this.f106834a) { t14.m(false); t14.e(false); for (m mVar : t14.a()) { mVar.m(false); } } if (!f.f106828a.f()) { m mVar2 = (m) CollectionsKt___CollectionsKt.firstOrNull((List) this.f106834a); if (mVar2 != null) { mVar2.m(true); } if (!this.f106834a.isEmpty()) { this.f106838e = (m) this.f106834a.get(0); } } int i10 = R$id.f39752beautyEditRecyclerView; ((RecyclerView) a(i10)).setAdapter(this.f106836c); Context context = getContext(); Intrinsics.checkNotNullExpressionValue(context, "context"); ((RecyclerView) a(i10)).setLayoutManager(new CenterLayoutManager(context, 0, false)); RecyclerView.ItemAnimator itemAnimator = ((RecyclerView) a(i10)).getItemAnimator(); Objects.requireNonNull(itemAnimator, "null cannot be cast to non-null type androidx.recyclerview.widget.DefaultItemAnimator"); ((DefaultItemAnimator) itemAnimator).setSupportsChangeAnimations(false); this.f106836c.notifyDataSetChanged(); List<? extends Object> list = CollectionsKt___CollectionsKt.toMutableList((Collection) this.f106834a); list.add(0, this.f106837d); this.f106836c.o(list); this.f106836c.j(m.class, new b(getContext(), new c(this))); } public final void i(float f14) { if (this.f106838e.g() >= 0) { v0 v0Var = v0.f131783a; v0Var.c("BeautySettingViewV2", null, "processBeautySettingChanged -- " + this.f106838e + " -- " + f14); f.f106828a.g(this.f106838e.g(), f14); Function2<? super Integer, ? super Float, Unit> function2 = this.f106839f; if (function2 != null) { function2.invoke(Integer.valueOf(this.f106838e.g()), Float.valueOf(f14)); } } } public final void j() { n(true); k(); m(this.f106838e, false); m(this.f106837d, true); this.f106838e = this.f106837d; Function2<? super Integer, ? super Float, Unit> function2 = this.f106839f; if (function2 != null) { function2.invoke(-1, Float.valueOf(0.0f)); } } public final void k() { if (f.f106828a.f()) { q2 q2Var = this.f106835b; if (q2Var != null) { q2Var.a(true); return; } return; } q2 q2Var2 = this.f106835b; if (q2Var2 != null) { q2Var2.e(true); } } public final void l() { this.f106834a = f.f106828a.d(); } public final void m(m mVar, boolean z14) { for (T t14 : this.f106836c.d()) { if (t14.g() == mVar.g()) { t14.m(z14); } else if (!t14.a().isEmpty()) { for (m mVar2 : t14.a()) { if (mVar2.g() == mVar.g()) { mVar2.m(z14); } } } } l(); this.f106836c.notifyDataSetChanged(); } public final void n(boolean z14) { f.f106828a.h(z14); } public final void o(float f14, float f15) { if (f14 < 0.0f) { q2 q2Var = this.f106835b; if (q2Var != null) { q2Var.b(f15, f15); } } else { q2 q2Var2 = this.f106835b; if (q2Var2 != null) { q2Var2.b(f14, f15); } } n(false); } public final void setBeautyParamsChangeCallback(Function2<? super Integer, ? super Float, Unit> function2) { this.f106839f = function2; } public final void setIFilterSeekBar(q2 q2Var) { this.f106835b = q2Var; } /* JADX INFO: this call moved to the top of the method (can break code semantics) */ public /* synthetic */ h(Context context, AttributeSet attributeSet, int i10, int i14, DefaultConstructorMarker defaultConstructorMarker) { this(context, (i14 & 2) != 0 ? null : attributeSet, (i14 & 4) != 0 ? 0 : i10); } }