得物.apk(点击下载) / ImageEditGuideDelegate.java


package com.shizhuang.duapp.media.editimage.helper;

import a.f;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import cf.a;
import co.c;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.libs.duimageloaderview.options.DuRequestOptions;
import com.shizhuang.duapp.media.publish.view.PublishBottomEditImageView;
import com.shizhuang.duapp.media.publish.view.PublishBottomView;
import fd.i;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/* compiled from: ImageEditGuideDelegate.kt */
public final class ImageEditGuideDelegate {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: a  reason: collision with root package name */
    public View f9860a;
    public cf.a b;

    /* renamed from: c  reason: collision with root package name */
    public int f9861c;
    public int d = -1;
    @Nullable
    public OnImageGuideClickListener e;
    @NotNull
    public final Context f;

    @Metadata(bv = {1, 0, 3}, d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0000\bf\u0018\u00002\u00020\u0001J\u0010\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0005H&¨\u0006\u0006"}, d2 = {"Lcom/shizhuang/duapp/media/editimage/helper/ImageEditGuideDelegate$OnImageGuideClickListener;", "", "onClickListener", "", "guideType", "", "du_media_release"}, k = 1, mv = {1, 4, 2})
    /* compiled from: ImageEditGuideDelegate.kt */
    public interface OnImageGuideClickListener {
        void onClickListener(int i);
    }

    /* compiled from: ImageEditGuideDelegate.kt */
    public static final class a {
        public static ChangeQuickRedirect changeQuickRedirect;
        @Nullable

        /* renamed from: a  reason: collision with root package name */
        public String f9862a;
        @Nullable
        public final String b;

        public a(@Nullable String str, @Nullable String str2) {
            this.f9862a = str;
            this.b = str2;
        }

        @Nullable
        public final String a() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43000, new Class[0], String.class);
            return proxy.isSupported ? (String) proxy.result : this.f9862a;
        }

        @Nullable
        public final String b() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43002, new Class[0], String.class);
            return proxy.isSupported ? (String) proxy.result : this.b;
        }

        public boolean equals(@Nullable Object obj) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{obj}, this, changeQuickRedirect, false, 43008, new Class[]{Object.class}, Boolean.TYPE);
            if (proxy.isSupported) {
                return ((Boolean) proxy.result).booleanValue();
            }
            if (this != obj) {
                if (obj instanceof a) {
                    a aVar = (a) obj;
                    if (!Intrinsics.areEqual(this.f9862a, aVar.f9862a) || !Intrinsics.areEqual(this.b, aVar.b)) {
                        return false;
                    }
                }
                return false;
            }
            return true;
        }

        public int hashCode() {
            int i = 0;
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43007, new Class[0], Integer.TYPE);
            if (proxy.isSupported) {
                return ((Integer) proxy.result).intValue();
            }
            String str = this.f9862a;
            int hashCode = (str != null ? str.hashCode() : 0) * 31;
            String str2 = this.b;
            if (str2 != null) {
                i = str2.hashCode();
            }
            return hashCode + i;
        }

        @NotNull
        public String toString() {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43006, new Class[0], String.class);
            if (proxy.isSupported) {
                return (String) proxy.result;
            }
            StringBuilder h12 = f.h("Guide(text=");
            h12.append(this.f9862a);
            h12.append(", url=");
            return f.g(h12, this.b, ")");
        }
    }

    /* compiled from: ImageEditGuideDelegate.kt */
    public static final class b implements Runnable {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ ImageEditGuideDelegate b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ View f9863c;

        public b(ImageEditGuideDelegate imageEditGuideDelegate, View view) {
            this.b = imageEditGuideDelegate;
            this.f9863c = view;
        }

        public final void run() {
            PublishBottomView g3;
            PublishBottomEditImageView publishBottomEditImageView;
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 43011, new Class[0], Void.TYPE).isSupported && nq.b.c(this.b.b()) && this.f9863c != null && (g3 = ku.b.f34916a.g(this.b.b())) != null && (publishBottomEditImageView = (PublishBottomEditImageView) g3.a(R.id.editImageView)) != null && publishBottomEditImageView.getAlpha() == 1.0f) {
                ImageEditGuideDelegate imageEditGuideDelegate = this.b;
                View view = this.f9863c;
                imageEditGuideDelegate.f9860a = view;
                int left = view.getLeft();
                int b2 = (fi.b.f32351a - fi.b.b((float) 170)) - fi.b.b((float) 16);
                if (left < b2) {
                    this.b.c().e(this.f9863c, fi.b.b((float) 9), 0, 48);
                    return;
                }
                int i = left - b2;
                View b5 = this.b.c().b(R.id.triangle);
                if (b5 != null) {
                    b5.setTranslationX(((float) i) + ((float) fi.b.b((float) 9)));
                }
                this.b.c().e(this.f9863c, -i, 0, 48);
            }
        }
    }

    public ImageEditGuideDelegate(@NotNull Context context) {
        this.f = context;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 42989, new Class[0], Void.TYPE).isSupported) {
            cf.a a5 = new a.C0050a(context).c(R.layout.du_media_dialog_pic_template_guide).f(fi.b.b((float) 170)).e(fi.b.b((float) 198)).b(-1).d(true).a();
            this.b = a5;
            if (a5 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("imageTemplateGuideDialog");
            }
            View b2 = a5.b(R.id.guideClose);
            if (b2 != null) {
                b2.setOnClickListener(new ImageEditGuideDelegate$createGuideDialog$1(this));
            }
        }
    }

    public final void a() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 42995, new Class[0], Void.TYPE).isSupported) {
            cf.a aVar = this.b;
            if (aVar == null) {
                Intrinsics.throwUninitializedPropertyAccessException("imageTemplateGuideDialog");
            }
            aVar.a();
        }
    }

    @NotNull
    public final Context b() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 42999, new Class[0], Context.class);
        return proxy.isSupported ? (Context) proxy.result : this.f;
    }

    @NotNull
    public final cf.a c() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 42987, new Class[0], cf.a.class);
        if (proxy.isSupported) {
            return (cf.a) proxy.result;
        }
        cf.a aVar = this.b;
        if (aVar == null) {
            Intrinsics.throwUninitializedPropertyAccessException("imageTemplateGuideDialog");
        }
        return aVar;
    }

    public final void d(View view) {
        if (!PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 42992, new Class[]{View.class}, Void.TYPE).isSupported && view != null) {
            view.postDelayed(new b(this, view), 300);
        }
    }

    public final void e(a aVar) {
        c i;
        c c5;
        PublishBottomEditImageView publishBottomEditImageView;
        if (!PatchProxy.proxy(new Object[]{aVar}, this, changeQuickRedirect, false, 42991, new Class[]{a.class}, Void.TYPE).isSupported) {
            PublishBottomView g3 = ku.b.f34916a.g(this.f);
            DuImageLoaderView duImageLoaderView = null;
            ImageView imageView = (g3 == null || (publishBottomEditImageView = (PublishBottomEditImageView) g3.a(R.id.editImageView)) == null) ? null : (ImageView) publishBottomEditImageView.findViewById(R.id.ivTemplate);
            cf.a aVar2 = this.b;
            if (aVar2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("imageTemplateGuideDialog");
            }
            View b2 = aVar2.b(R.id.guideText);
            if (!(b2 instanceof TextView)) {
                b2 = null;
            }
            TextView textView = (TextView) b2;
            if (textView != null) {
                textView.setText(aVar.a());
            }
            cf.a aVar3 = this.b;
            if (aVar3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("imageTemplateGuideDialog");
            }
            View b5 = aVar3.b(R.id.guideImg);
            if (b5 instanceof DuImageLoaderView) {
                duImageLoaderView = b5;
            }
            DuImageLoaderView duImageLoaderView2 = duImageLoaderView;
            if (!(duImageLoaderView2 == null || (i = duImageLoaderView2.i(aVar.b())) == null || (c5 = i.c(2, i)) == null)) {
                c5.x();
            }
            d(imageView);
        }
    }

    public final void f(a aVar) {
        if (!PatchProxy.proxy(new Object[]{aVar}, this, changeQuickRedirect, false, 42994, new Class[]{a.class}, Void.TYPE).isSupported) {
            String b2 = aVar.b();
            if (b2 == null) {
                b2 = "https://cdn.poizon.com/node-common/f280e45281f754f8204bb48dd29899df.webp";
            }
            ((DuRequestOptions) mn.a.f35714a.g(b2).u(new ImageEditGuideDelegate$showFaceGuide$1(this, aVar, b2))).y();
        }
    }
}