WeChat.apk(点击下载) / a.java


package fu2;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.tencent.mm.R;
import com.tencent.mm.autogen.mmdata.rpt.SnsChoosePostBussinessReportStruct;
import com.tencent.mm.modelcontrol.VideoTransPara;
import com.tencent.mm.plugin.mmsight.SightParams;
import com.tencent.mm.plugin.mmsight.segment.SliderSeekBar;
import com.tencent.mm.plugin.recordvideo.background.provider.WeSeeProvider;
import com.tencent.mm.plugin.recordvideo.jumper.RecordConfigProvider;
import com.tencent.mm.plugin.recordvideo.plugin.cropvideo.EditVideoSeekBarView;
import com.tencent.mm.sdk.platformtools.Log;
import com.tencent.mm.sdk.platformtools.MMApplicationContext;
import com.tencent.mm.sdk.platformtools.Util;
import com.tencent.mm.sdk.platformtools.WeChatBrands;
import com.tencent.mm.ui.h5;
import com.tencent.mm.ui.l5;
import com.tencent.mm.ui.x4;
import com.tencent.mm.vfs.h0;
import com.tencent.mm.vfs.n2;
import com.tencent.mm.vfs.o2;
import cs.b;
import d60.z;
import du2.j0;
import ie1.h;
import java.util.ArrayList;
import java.util.Arrays;
import lh4.a0;
import lh4.m;
import nf0.e6;
import nu2.f;
import p64.n;
import sv2.t;
import sv2.y;
import t32.e2;
import wg4.b0;
import yz3.j;

public final class a implements View.OnClickListener, com.tencent.mm.plugin.mmsight.segment.c, j0 {

    /* renamed from: d  reason: collision with root package name */
    public ViewGroup f217676d;

    /* renamed from: e  reason: collision with root package name */
    public nu2.f f217677e;

    /* renamed from: f  reason: collision with root package name */
    public final ImageView f217678f;

    /* renamed from: g  reason: collision with root package name */
    public final EditVideoSeekBarView f217679g;

    /* renamed from: h  reason: collision with root package name */
    public final ViewGroup f217680h = ((ViewGroup) this.f217676d.findViewById(R.id.pqx));

    /* renamed from: i  reason: collision with root package name */
    public final ImageView f217681i = ((ImageView) this.f217676d.findViewById(R.id.hl5));

    /* renamed from: j  reason: collision with root package name */
    public final ImageView f217682j = ((ImageView) this.f217676d.findViewById(R.id.hoi));

    /* renamed from: n  reason: collision with root package name */
    public final TextView f217683n = ((TextView) this.f217676d.findViewById(R.id.omg));

    /* renamed from: o  reason: collision with root package name */
    public jb0.b f217684o;

    /* renamed from: p  reason: collision with root package name */
    public RecordConfigProvider f217685p;

    /* renamed from: q  reason: collision with root package name */
    public p64.g f217686q;

    /* renamed from: r  reason: collision with root package name */
    public p64.g f217687r;

    /* renamed from: s  reason: collision with root package name */
    public boolean f217688s;

    /* renamed from: t  reason: collision with root package name */
    public float f217689t;

    /* renamed from: u  reason: collision with root package name */
    public float f217690u = 1.0f;

    /* renamed from: v  reason: collision with root package name */
    public String f217691v = "";

    /* renamed from: w  reason: collision with root package name */
    public boolean f217692w;

    /* renamed from: x  reason: collision with root package name */
    public boolean f217693x;

    /* renamed from: y  reason: collision with root package name */
    public boolean f217694y;

    /* renamed from: z  reason: collision with root package name */
    public int f217695z;

    /* renamed from: fu2.a$a  reason: collision with other inner class name */
    public static final class C2669a extends AnimatorListenerAdapter {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ a f217696d;

        public C2669a(a aVar) {
            this.f217696d = aVar;
        }

        public void onAnimationEnd(Animator animator) {
            m.g(animator, "animation");
            this.f217696d.f217679g.setVisibility(8);
            this.f217696d.f217679g.setAlpha(1.0f);
        }
    }

    public static final class b extends AnimatorListenerAdapter {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ a f217697d;

        public b(a aVar) {
            this.f217697d = aVar;
        }

        public void onAnimationEnd(Animator animator) {
            m.g(animator, "animation");
            this.f217697d.f217679g.setVisibility(8);
            this.f217697d.f217679g.setAlpha(1.0f);
        }
    }

    public static final class c extends AnimatorListenerAdapter {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ a f217698d;

        public c(a aVar) {
            this.f217698d = aVar;
        }

        public void onAnimationEnd(Animator animator) {
            m.g(animator, "animation");
            this.f217698d.f217679g.setVisibility(8);
            this.f217698d.f217679g.setAlpha(1.0f);
        }
    }

    public static final class d implements DialogInterface.OnClickListener {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ a f217699d;

        /* renamed from: e  reason: collision with root package name */
        public final /* synthetic */ boolean f217700e;

        public d(a aVar, boolean z15) {
            this.f217699d = aVar;
            this.f217700e = z15;
        }

        public final void onClick(DialogInterface dialogInterface, int i15) {
            p64.g gVar = this.f217699d.f217687r;
            if (gVar != null) {
                m.e(gVar, "null cannot be cast to non-null type android.app.Dialog");
                if (gVar.isShowing()) {
                    p64.g gVar2 = this.f217699d.f217687r;
                    if (gVar2 != null) {
                        gVar2.dismiss();
                    }
                    Log.i("MicroMsg.EditCropVideoPlugin", "click ok dismiss dialog");
                }
            }
            Log.i("MicroMsg.EditCropVideoPlugin", "dialog ok isInstall:" + this.f217700e);
            a aVar = this.f217699d;
            jb0.b bVar = aVar.f217684o;
            String str = null;
            if ((bVar != null ? bVar.f238612a : null) != null) {
                if (bVar != null) {
                    str = bVar.f238612a;
                }
            } else if (bVar != null) {
                str = bVar.f238617f;
            }
            if (this.f217700e) {
                t tVar = t.f307987a;
                m.d(str);
                int Xj0 = ((h) j.c(h.class)).Xj0(h.c.f232355sq, 30);
                Log.i("MicroMsg.SecondCutConfig", "ShareVideoDuration: " + Xj0);
                RecordConfigProvider recordConfigProvider = this.f217699d.f217685p;
                m.d(recordConfigProvider);
                VideoTransPara videoTransPara = recordConfigProvider.f139932n;
                int i16 = 0;
                int i17 = videoTransPara != null ? videoTransPara.f78867g : 0;
                RecordConfigProvider recordConfigProvider2 = this.f217699d.f217685p;
                m.d(recordConfigProvider2);
                VideoTransPara videoTransPara2 = recordConfigProvider2.f139932n;
                int i18 = videoTransPara2 != null ? videoTransPara2.f78864d : 0;
                RecordConfigProvider recordConfigProvider3 = this.f217699d.f217685p;
                m.d(recordConfigProvider3);
                VideoTransPara videoTransPara3 = recordConfigProvider3.f139932n;
                if (videoTransPara3 != null) {
                    i16 = videoTransPara3.f78865e;
                }
                Log.i("MicroMsg.SecondCutUtil", "getSecondCutEditIntent >>>videoPath: " + str + " >>>width: " + i18 + " >>>height: " + i16 + " >>>duration: " + Xj0 + " >>> videoBitrate: " + i17);
                byte[] bytes = str.getBytes(ek4.c.f208058a);
                m.f(bytes, "this as java.lang.String).getBytes(charset)");
                String encodeToString = Base64.encodeToString(bytes, 10);
                Intent intent = new Intent();
                intent.setData(Uri.parse("miaojian://createvideo?scene=" + "moments" + "&assetPaths=" + encodeToString + "&maxDuration=" + Xj0 + "&bitrate=" + i17 + "&resolution=" + i18 + ',' + i16 + "&from=2" + ""));
                intent.setPackage("com.tencent.phoenix");
                intent.setAction("android.intent.action.VIEW");
                intent.setFlags(268435456);
                Context context = this.f217699d.f217676d.getContext();
                m.f(context, "parent.context");
                tVar.d(context, intent);
                Intent intent2 = new Intent();
                Context context2 = this.f217699d.f217676d.getContext();
                m.e(context2, "null cannot be cast to non-null type android.app.Activity");
                ((Activity) context2).setResult(-2, intent2);
                Context context3 = this.f217699d.f217676d.getContext();
                m.e(context3, "null cannot be cast to non-null type android.app.Activity");
                ((Activity) context3).finish();
                return;
            }
            sv2.b bVar2 = sv2.b.f307927a;
            Context context4 = aVar.f217676d.getContext();
            m.f(context4, "parent.context");
            StringBuilder sb5 = new StringBuilder();
            String pi5 = ((h) j.c(h.class)).pi(h.c.f232391tq, "https://miaojian.weixin.qq.com/download/apps?channel=");
            Log.i("MicroMsg.SecondCutConfig", "SecondCutDownloadUrl: " + pi5);
            m.f(pi5, "url");
            sb5.append(pi5);
            sb5.append("1102");
            bVar2.c(context4, sb5.toString());
        }
    }

    public static final class e implements DialogInterface.OnClickListener {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ a f217701d;

        public e(a aVar) {
            this.f217701d = aVar;
        }

        public final void onClick(DialogInterface dialogInterface, int i15) {
            Log.i("MicroMsg.EditCropVideoPlugin", "dialog cancel");
            p64.g gVar = this.f217701d.f217687r;
            if (gVar != null) {
                m.e(gVar, "null cannot be cast to non-null type android.app.Dialog");
                if (gVar.isShowing()) {
                    p64.g gVar2 = this.f217701d.f217687r;
                    if (gVar2 != null) {
                        gVar2.dismiss();
                    }
                    Log.i("MicroMsg.EditCropVideoPlugin", "click no dismiss dialog");
                }
            }
        }
    }

    public static final class f implements DialogInterface.OnClickListener {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ a f217702d;

        /* renamed from: e  reason: collision with root package name */
        public final /* synthetic */ boolean f217703e;

        public f(a aVar, boolean z15) {
            this.f217702d = aVar;
            this.f217703e = z15;
        }

        /* JADX WARNING: Removed duplicated region for block: B:20:0x005a  */
        /* JADX WARNING: Removed duplicated region for block: B:53:0x01f4  */
        public final void onClick(DialogInterface dialogInterface, int i15) {
            String str;
            boolean z15;
            char c15;
            Exception e15;
            p64.g gVar = this.f217702d.f217686q;
            if (gVar != null && gVar.isShowing()) {
                p64.g gVar2 = this.f217702d.f217686q;
                if (gVar2 != null) {
                    gVar2.dismiss();
                }
                Log.i("MicroMsg.EditCropVideoPlugin", "click ok dismiss dialog");
            }
            Log.i("MicroMsg.EditCropVideoPlugin", "dialog ok isInstallWeSee:" + this.f217703e);
            jb0.b bVar = this.f217702d.f217684o;
            if ((bVar != null ? bVar.f238612a : null) != null) {
                if (bVar != null) {
                    str = bVar.f238612a;
                    if (this.f217703e) {
                        ru2.g gVar3 = ru2.g.f297974a;
                        gVar3.l(2);
                        gVar3.i(3, 1);
                        Context context = this.f217702d.f217676d.getContext();
                        m.f(context, "parent.context");
                        m.d(str);
                        String str2 = z.b().i() + "_" + e6.c();
                        m.f(str2, "sb.append(MMKernel.accou…end(timestamp).toString()");
                        Intent intent = new Intent();
                        SightParams sightParams = (SightParams) intent.getParcelableExtra("KEY_SIGHT_PARAMS");
                        if (sightParams == null) {
                            sightParams = new SightParams(2, 0);
                        }
                        sightParams.f132991q = str2;
                        if (Util.isNullOrNil(str2)) {
                            str2 = Util.nowMilliSecond() + "_" + Util.getRandomString(5);
                        }
                        if (Util.isNullOrNil(str)) {
                            Log.e("MicroMsg.TakePhotoUtil", "path is null");
                        }
                        n2 a15 = n2.a(str);
                        String str3 = a15.f189021f;
                        if (str3 != null) {
                            String k15 = o2.k(str3, false, false);
                            if (!a15.f189021f.equals(k15)) {
                                a15 = new n2(a15.f189019d, a15.f189020e, k15, a15.f189022g, a15.f189023h);
                            }
                        }
                        h0.h l15 = h0.i.f188954a.l(a15, null);
                        if (!l15.a()) {
                            z15 = false;
                        } else {
                            z15 = l15.f188951a.D(l15.f188952b);
                        }
                        if (!z15) {
                            Log.e("MicroMsg.TakePhotoUtil", "file is not exists");
                        }
                        intent.setAction("android.intent.action.VIEW");
                        intent.setData(Uri.parse("weishi://videoEdit?videoPath=" + str + "&activity_id=WxPublisherAct&update=1"));
                        intent.setPackage("com.tencent.weishi");
                        intent.setFlags(268435456);
                        context.getSharedPreferences("opensdk_shareTicket", 0).edit().putString(intent.getPackage(), str2).apply();
                        try {
                            k30.a aVar = new k30.a();
                            aVar.c(intent);
                            c15 = 0;
                            try {
                                j30.a.d(context, aVar.b(), "com/tencent/mm/pluginsdk/ui/tools/TakePhotoUtil", "takeWeiShiSightToEdit", "(Landroid/content/Context;ILandroid/content/Intent;ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;)Z", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
                                context.startActivity((Intent) aVar.a(0));
                                j30.a.e(context, "com/tencent/mm/pluginsdk/ui/tools/TakePhotoUtil", "takeWeiShiSightToEdit", "(Landroid/content/Context;ILandroid/content/Intent;ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;)Z", "Undefined", "startActivity", "(Landroid/content/Intent;)V");
                                if (context instanceof Activity) {
                                    ((Activity) context).overridePendingTransition(R.anim.f357363e0, -1);
                                }
                            } catch (Exception e16) {
                                e15 = e16;
                                Object[] objArr = new Object[1];
                                objArr[c15] = e15.getMessage();
                                Log.w("MicroMsg.TakePhotoUtil", "takeWeishiSight Exception: %s", objArr);
                                ru2.e.f297963a.m("KEY_WESEE_DIALOG_OPERATION", 1);
                                Intent intent2 = new Intent();
                                Context context2 = this.f217702d.f217676d.getContext();
                                m.e(context2, "null cannot be cast to non-null type android.app.Activity");
                                ((Activity) context2).setResult(-2, intent2);
                                Context context3 = this.f217702d.f217676d.getContext();
                                m.e(context3, "null cannot be cast to non-null type android.app.Activity");
                                ((Activity) context3).finish();
                                return;
                            }
                        } catch (Exception e17) {
                            e15 = e17;
                            c15 = 0;
                            Object[] objArr2 = new Object[1];
                            objArr2[c15] = e15.getMessage();
                            Log.w("MicroMsg.TakePhotoUtil", "takeWeishiSight Exception: %s", objArr2);
                            ru2.e.f297963a.m("KEY_WESEE_DIALOG_OPERATION", 1);
                            Intent intent22 = new Intent();
                            Context context22 = this.f217702d.f217676d.getContext();
                            m.e(context22, "null cannot be cast to non-null type android.app.Activity");
                            ((Activity) context22).setResult(-2, intent22);
                            Context context32 = this.f217702d.f217676d.getContext();
                            m.e(context32, "null cannot be cast to non-null type android.app.Activity");
                            ((Activity) context32).finish();
                            return;
                        }
                        ru2.e.f297963a.m("KEY_WESEE_DIALOG_OPERATION", 1);
                        Intent intent222 = new Intent();
                        Context context222 = this.f217702d.f217676d.getContext();
                        m.e(context222, "null cannot be cast to non-null type android.app.Activity");
                        ((Activity) context222).setResult(-2, intent222);
                        Context context322 = this.f217702d.f217676d.getContext();
                        m.e(context322, "null cannot be cast to non-null type android.app.Activity");
                        ((Activity) context322).finish();
                        return;
                    }
                    WeSeeProvider.a aVar2 = WeSeeProvider.f139904g;
                    String str4 = "weishi://videoEdit?videoPath=" + str + "&activity_id=WxPublisherAct&update=1";
                    m.f(str4, "parseWeSeeUri(videoPath)");
                    aVar2.b(str4, System.currentTimeMillis());
                    Context context4 = this.f217702d.f217676d.getContext();
                    m.f(context4, "parent.context");
                    Intent intent3 = new Intent();
                    intent3.putExtra("rawUrl", "https://isee.weishi.qq.com/static/release/group_10/528a4494-9ce7-4ac8-a763-247d84d07dae.html?_wwv=4096&chid=205000000&attach=cp_reserves3_2230000000");
                    sv3.b.j(context4, "webview", ".ui.tools.WebViewUI", intent3, null);
                    ru2.e.f297963a.m("KEY_WESEE_DIALOG_OPERATION", 3);
                    return;
                }
            } else if (bVar != null) {
                str = bVar.f238617f;
                if (this.f217703e) {
                }
            }
            str = null;
            if (this.f217703e) {
            }
        }
    }

    public static final class g implements DialogInterface.OnClickListener {

        /* renamed from: d  reason: collision with root package name */
        public final /* synthetic */ boolean f217704d;

        /* renamed from: e  reason: collision with root package name */
        public final /* synthetic */ a f217705e;

        public g(boolean z15, a aVar) {
            this.f217704d = z15;
            this.f217705e = aVar;
        }

        public final void onClick(DialogInterface dialogInterface, int i15) {
            if (this.f217704d) {
                ru2.e.f297963a.m("KEY_WESEE_DIALOG_OPERATION", 2);
            } else {
                ru2.e.f297963a.m("KEY_WESEE_DIALOG_OPERATION", 4);
            }
            Log.i("MicroMsg.EditCropVideoPlugin", "dialog cancel");
            p64.g gVar = this.f217705e.f217686q;
            if (gVar != null) {
                m.e(gVar, "null cannot be cast to non-null type android.app.Dialog");
                if (gVar.isShowing()) {
                    p64.g gVar2 = this.f217705e.f217686q;
                    if (gVar2 != null) {
                        gVar2.dismiss();
                    }
                    Log.i("MicroMsg.EditCropVideoPlugin", "click no dismiss dialog");
                }
            }
        }
    }

    public a(ViewGroup viewGroup, nu2.f fVar) {
        m.g(viewGroup, "parent");
        m.g(fVar, "status");
        this.f217676d = viewGroup;
        this.f217677e = fVar;
        View findViewById = viewGroup.findViewById(R.id.f362917d81);
        m.f(findViewById, "parent.findViewById(R.id.editor_crop_video)");
        ImageView imageView = (ImageView) findViewById;
        this.f217678f = imageView;
        View findViewById2 = this.f217676d.findViewById(R.id.f362916d80);
        m.f(findViewById2, "parent.findViewById(R.id.editor_crop_bar)");
        EditVideoSeekBarView editVideoSeekBarView = (EditVideoSeekBarView) findViewById2;
        this.f217679g = editVideoSeekBarView;
        imageView.setImageDrawable(h5.d(this.f217676d.getContext(), R.raw.icons_filled_crop, -1));
        imageView.setOnClickListener(this);
        editVideoSeekBarView.setCancelButtonClickListener(this);
        editVideoSeekBarView.setFinishButtonClickListener(this);
        ViewGroup.LayoutParams layoutParams = editVideoSeekBarView.getLayoutParams();
        m.e(layoutParams, "null cannot be cast to non-null type android.widget.RelativeLayout.LayoutParams");
        RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) layoutParams;
        layoutParams2.bottomMargin += l5.c(this.f217676d.getContext());
        editVideoSeekBarView.setLayoutParams(layoutParams2);
    }

    @Override // du2.j0
    public void I(RecordConfigProvider recordConfigProvider) {
        m.g(recordConfigProvider, "configProvider");
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x0049  */
    /* JADX WARNING: Removed duplicated region for block: B:18:0x0066  */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x0080  */
    public final void a(boolean z15) {
        int i15;
        String str;
        int i16;
        int i17;
        int i18;
        int i19;
        int i25;
        int i26;
        int i27;
        ru2.e eVar = ru2.e.f297963a;
        eVar.b(13);
        jb0.b bVar = this.f217684o;
        if (bVar != null && !m.b(this.f217691v, bVar.f238612a)) {
            this.f217691v = bVar.f238612a;
            RecordConfigProvider recordConfigProvider = this.f217685p;
            if (recordConfigProvider != null) {
                if ((r7 = recordConfigProvider.f139942x) >= 0) {
                    StringBuilder sb5 = new StringBuilder();
                    sb5.append("duration:");
                    i16 = recordConfigProvider.f139941w;
                    i17 = bVar.f238616e;
                    if (i16 > i17) {
                        i16 = i17;
                    }
                    sb5.append(i16);
                    sb5.append(" minDuration:");
                    sb5.append(r7);
                    Log.i("MicroMsg.EditCropVideoPlugin", sb5.toString());
                    EditVideoSeekBarView editVideoSeekBarView = this.f217679g;
                    String str2 = bVar.f238612a;
                    i18 = recordConfigProvider.f139941w;
                    i19 = bVar.f238616e;
                    if (i18 > i19) {
                        i18 = i19;
                    }
                    editVideoSeekBarView.a(str2, i18, (int) Math.ceil((((double) r7) * 1.0d) / ((double) 1000)));
                    this.f217679g.setThumbBarSeekListener(this);
                    i25 = recordConfigProvider.f139941w;
                    i26 = bVar.f238616e;
                    if (i25 > i26) {
                        i25 = i26;
                    }
                    this.f217690u = (((float) i25) * 1.0f) / ((float) i26);
                } else {
                    StringBuilder sb52 = new StringBuilder();
                    sb52.append("duration:");
                    i16 = recordConfigProvider.f139941w;
                    i17 = bVar.f238616e;
                    if (i16 > i17) {
                    }
                    sb52.append(i16);
                    sb52.append(" minDuration:");
                    sb52.append(r7);
                    Log.i("MicroMsg.EditCropVideoPlugin", sb52.toString());
                    EditVideoSeekBarView editVideoSeekBarView2 = this.f217679g;
                    String str22 = bVar.f238612a;
                    i18 = recordConfigProvider.f139941w;
                    i19 = bVar.f238616e;
                    if (i18 > i19) {
                    }
                    editVideoSeekBarView2.a(str22, i18, (int) Math.ceil((((double) r7) * 1.0d) / ((double) 1000)));
                    this.f217679g.setThumbBarSeekListener(this);
                    i25 = recordConfigProvider.f139941w;
                    i26 = bVar.f238616e;
                    if (i25 > i26) {
                    }
                    this.f217690u = (((float) i25) * 1.0f) / ((float) i26);
                }
                int i28 = i27;
                StringBuilder sb522 = new StringBuilder();
                sb522.append("duration:");
                i16 = recordConfigProvider.f139941w;
                i17 = bVar.f238616e;
                if (i16 > i17) {
                }
                sb522.append(i16);
                sb522.append(" minDuration:");
                sb522.append(i28);
                Log.i("MicroMsg.EditCropVideoPlugin", sb522.toString());
                EditVideoSeekBarView editVideoSeekBarView22 = this.f217679g;
                String str222 = bVar.f238612a;
                i18 = recordConfigProvider.f139941w;
                i19 = bVar.f238616e;
                if (i18 > i19) {
                }
                editVideoSeekBarView22.a(str222, i18, (int) Math.ceil((((double) i28) * 1.0d) / ((double) 1000)));
                this.f217679g.setThumbBarSeekListener(this);
                i25 = recordConfigProvider.f139941w;
                i26 = bVar.f238616e;
                if (i25 > i26) {
                }
                this.f217690u = (((float) i25) * 1.0f) / ((float) i26);
            }
        }
        this.f217679g.setVisibility(0);
        Bundle bundle = new Bundle();
        if (z15) {
            RecordConfigProvider recordConfigProvider2 = this.f217685p;
            if (recordConfigProvider2 != null && recordConfigProvider2.F == 2) {
                boolean z16 = ((h) j.c(h.class)).Xj0(h.c.f232138mq, 1) == 1;
                boolean rW = ((e2) j.c(e2.class)).rW();
                boolean equals = TextUtils.equals(((h) j.c(h.class)).pi(h.c.f232433uw, "0"), "1");
                boolean z17 = MMApplicationContext.getDefaultPreference().getBoolean("wesee_switch", false);
                yz3.d c15 = j.c(cs.b.class);
                m.f(c15, "getService(IFinderPublis…atureService::class.java)");
                boolean a15 = b.a.a((cs.b) c15, false, 1, null);
                boolean Lk0 = ((h) j.c(h.class)).Lk0(h.c.f232247pq, false);
                Log.i("MicroMsg.SecondCutConfig", "EditVideoToSecondCutEntrance: " + Lk0);
                this.f217694y = Lk0;
                boolean z18 = z16 && rW && a15;
                this.f217692w = z18;
                boolean z19 = equals || z17;
                this.f217693x = z19;
                if (z18) {
                    this.f217695z++;
                }
                if (z19) {
                    this.f217695z++;
                }
                if (Lk0) {
                    this.f217695z++;
                }
                Log.i("MicroMsg.EditCropVideoPlugin", "sns2FinderEnable:" + z16 + ", showPostEntry:" + rW + ", finderServerOpen=" + a15 + "showWeseeEntry:" + equals + ", weseeCommandSwitch:" + z17 + " weseeEnable:" + this.f217693x + " secondCutEnable:" + this.f217694y + " entranceNum:" + this.f217695z);
                TextView textView = this.f217683n;
                if (textView != null) {
                    textView.setTextSize(0, (float) gy3.a.f(this.f217676d.getContext(), R.dimen.f359306j4));
                }
                if (this.f217695z >= 2) {
                    RecordConfigProvider recordConfigProvider3 = this.f217685p;
                    int i29 = (recordConfigProvider3 != null ? recordConfigProvider3.f139941w : 10000) / 1000;
                    TextView textView2 = this.f217683n;
                    if (textView2 != null) {
                        String string = this.f217676d.getContext().getResources().getString(R.string.btl);
                        m.f(string, "parent.context.resources…g.edit_post_long_content)");
                        String format = String.format(string, Arrays.copyOf(new Object[]{Integer.valueOf(i29)}, 1));
                        m.f(format, "format(format, *args)");
                        textView2.setText(format);
                    }
                    ImageView imageView = this.f217681i;
                    if (imageView != null) {
                        imageView.setVisibility(8);
                    }
                    i();
                    if (this.f217693x) {
                        bundle.putBoolean("EDIT_CROP_VIDEO_SHOW_WESEE_SWITCH_BOOLEAN", true);
                        WeSeeProvider.f139904g.a();
                        eVar.m("KEY_IS_SHOW_WESEE_BTN", 1);
                    }
                    eVar.k(3);
                } else {
                    boolean z25 = this.f217692w;
                    if (z25 || this.f217694y) {
                        TextView textView3 = this.f217683n;
                        if (textView3 != null) {
                            if (z25) {
                                str = this.f217676d.getContext().getResources().getString(R.string.btn);
                            } else {
                                String string2 = this.f217676d.getContext().getResources().getString(R.string.btr);
                                m.f(string2, "parent.context.resources…t_secondcut_post_content)");
                                int Xj0 = ((h) j.c(h.class)).Xj0(h.c.f232427uq, 30);
                                Log.i("MicroMsg.SecondCutConfig", "SecondCutWordingTime: " + Xj0);
                                str = String.format(string2, Arrays.copyOf(new Object[]{Integer.valueOf(Xj0)}, 1));
                                m.f(str, "format(format, *args)");
                            }
                            textView3.setText(str);
                        }
                        ImageView imageView2 = this.f217681i;
                        if (imageView2 != null) {
                            imageView2.setVisibility(8);
                        }
                        i();
                        eVar.m("KEY_IS_SHOW_WESEE_BTN", 2);
                        eVar.k(3);
                    } else if (this.f217693x) {
                        TextView textView4 = this.f217683n;
                        if (textView4 != null) {
                            String string3 = this.f217676d.getContext().getResources().getString(R.string.bts);
                            m.f(string3, "parent.context.resources…tring.edit_wesee_content)");
                            int Xj02 = ((h) j.c(h.class)).Xj0(h.c.f232463vq, 30);
                            Log.i("MicroMsg.SecondCutConfig", "WeSeeWordingTime: " + Xj02);
                            String format2 = String.format(string3, Arrays.copyOf(new Object[]{Integer.valueOf(Xj02)}, 1));
                            m.f(format2, "format(format, *args)");
                            textView4.setText(format2);
                        }
                        ImageView imageView3 = this.f217681i;
                        if (imageView3 != null) {
                            imageView3.setVisibility(0);
                        }
                        bundle.putBoolean("EDIT_CROP_VIDEO_SHOW_WESEE_SWITCH_BOOLEAN", true);
                        i();
                        WeSeeProvider.f139904g.a();
                        eVar.m("KEY_IS_SHOW_WESEE_BTN", 1);
                        eVar.k(2);
                    } else {
                        eVar.k(1);
                    }
                }
                y yVar = y.f308006a;
                Context context = this.f217676d.getContext();
                m.f(context, "parent.context");
                if (yVar.b(context)) {
                    eVar.m("KEY_IS_INSTALL_WESEE", 1);
                    i15 = 2;
                } else {
                    i15 = 2;
                    eVar.m("KEY_IS_INSTALL_WESEE", 2);
                }
                eVar.m("KEY_IS_CLICK_WESEE_BTN", Integer.valueOf(i15));
            }
        }
        this.f217677e.M(f.b.f272919p0, bundle);
    }

    public final String b(int i15) {
        if (this.f217676d.getContext() == null) {
            return "";
        }
        String string = this.f217676d.getContext().getString(i15);
        m.f(string, "parent.context.getString(resId)");
        return string;
    }

    public final void d(boolean z15) {
        String str;
        int i15;
        Log.i("MicroMsg.EditCropVideoPlugin", "[onClickFinder] fromBottomSheet:" + z15);
        ru2.g gVar = ru2.g.f297974a;
        gVar.l(3);
        gVar.i(3, 1);
        Intent intent = new Intent();
        ((e2) j.c(e2.class)).I7(4, 5, 44, intent);
        e2 e2Var = (e2) j.c(e2.class);
        Context context = this.f217676d.getContext();
        m.f(context, "parent.context");
        intent.putExtra("key_finder_sns_post_type", 3);
        intent.putExtra("key_finder_post_router", 6);
        intent.putExtra("key_finder_post_from", 6);
        intent.putExtra("key_finder_post_video_source", 1);
        intent.putExtra("key_form_sns", true);
        intent.putExtra("KEY_POST_DIRECTLY_FROM_SNS", true);
        jb0.b bVar = this.f217684o;
        String str2 = null;
        if (bVar != null) {
            str = bVar.f238612a;
        } else {
            str = null;
        }
        if (str != null) {
            if (bVar != null) {
                str2 = bVar.f238612a;
            }
        } else if (bVar != null) {
            str2 = bVar.f238617f;
        }
        intent.putExtra("key_finder_post_sns_video_path", str2);
        jb0.b bVar2 = this.f217684o;
        if (bVar2 != null) {
            i15 = bVar2.f238616e;
        } else {
            i15 = 0;
        }
        intent.putExtra("key_finder_post_sns_video_duration_ms", i15);
        b0 b0Var = b0.f332794a;
        e2Var.e0(context, intent);
    }

    @Override // com.tencent.mm.plugin.mmsight.segment.c
    public void e(boolean z15, float f15, float f16) {
    }

    public final void f() {
        int i15;
        sv2.b bVar = sv2.b.f307927a;
        Context context = this.f217676d.getContext();
        m.f(context, "parent.context");
        boolean b15 = bVar.b(context, "com.tencent.phoenix", "A24DC0755072F64C480DC06DCD3412BF");
        Context context2 = this.f217676d.getContext();
        if (b15) {
            i15 = R.string.f367461ub;
        } else {
            i15 = R.string.f367460ua;
        }
        this.f217687r = i14.j.A(context2, b(i15), "", b(R.string.f367559x1), b(R.string.f367394sg), new d(this, b15), new e(this));
    }

    public final void h() {
        int i15;
        y yVar = y.f308006a;
        Context context = this.f217676d.getContext();
        m.f(context, "parent.context");
        boolean b15 = yVar.b(context);
        ru2.e.f297963a.m("KEY_IS_CLICK_WESEE_BTN", 1);
        Context context2 = this.f217676d.getContext();
        if (b15) {
            i15 = R.string.f367478us;
        } else {
            i15 = R.string.f367476uq;
        }
        this.f217686q = i14.j.A(context2, b(i15), "", b(R.string.f367559x1), b(R.string.f367394sg), new f(this, b15), new g(b15, this));
    }

    public final void i() {
        Context context;
        ViewGroup.LayoutParams layoutParams;
        ViewGroup viewGroup = this.f217680h;
        if (viewGroup != null) {
            viewGroup.setVisibility(0);
        }
        ViewGroup viewGroup2 = this.f217680h;
        if (viewGroup2 != null) {
            viewGroup2.setOnClickListener(this);
        }
        ImageView imageView = this.f217681i;
        if (imageView != null) {
            imageView.setImageDrawable(h5.d(this.f217676d.getContext(), R.raw.icons_filled_wesee, -1));
        }
        ImageView imageView2 = this.f217682j;
        if (imageView2 != null) {
            imageView2.setImageDrawable(h5.d(this.f217676d.getContext(), R.raw.icons_filled_arrow, -1));
        }
        ViewGroup viewGroup3 = this.f217680h;
        Context context2 = null;
        if (viewGroup3 != null) {
            context = viewGroup3.getContext();
        } else {
            context = null;
        }
        if (x4.t(context, false)) {
            ViewGroup viewGroup4 = this.f217680h;
            if (viewGroup4 != null) {
                layoutParams = viewGroup4.getLayoutParams();
            } else {
                layoutParams = null;
            }
            m.e(layoutParams, "null cannot be cast to non-null type android.view.ViewGroup.MarginLayoutParams");
            ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
            int i15 = marginLayoutParams.topMargin;
            ViewGroup viewGroup5 = this.f217680h;
            if (viewGroup5 != null) {
                context2 = viewGroup5.getContext();
            }
            marginLayoutParams.topMargin = i15 + x4.o(context2);
            ViewGroup viewGroup6 = this.f217680h;
            if (viewGroup6 != null) {
                viewGroup6.setLayoutParams(marginLayoutParams);
            }
        }
    }

    @Override // com.tencent.mm.plugin.mmsight.segment.c
    public void j(boolean z15, float f15, float f16) {
        int i15;
        Context context = this.f217676d.getContext();
        if (z15) {
            i15 = R.string.f366981gw;
        } else {
            i15 = R.string.f366982gx;
        }
        this.f217679g.announceForAccessibility(gy3.a.q(context, i15));
        f.a.a(this.f217677e, f.b.U0, null, 2, null);
    }

    @Override // com.tencent.mm.plugin.mmsight.segment.c
    public void k(boolean z15, float f15, float f16) {
        float f17;
        this.f217689t = f15;
        this.f217690u = f16;
        l(f15, f16);
        jb0.b bVar = this.f217684o;
        if (bVar != null) {
            int i15 = bVar.f238616e - bVar.f238615d;
            Object[] objArr = new Object[1];
            if (z15) {
                f17 = (f15 * ((float) i15)) / ((float) 1000);
            } else {
                f17 = (f16 * ((float) i15)) / ((float) 1000);
            }
            objArr[0] = Float.valueOf(f17);
            String format = String.format("%.2f", Arrays.copyOf(objArr, 1));
            m.f(format, "format(format, *args)");
            String q15 = gy3.a.q(this.f217676d.getContext(), R.string.f366989h4);
            m.f(q15, "getString(parent.context…aging_time_in_crop_video)");
            String format2 = String.format(q15, Arrays.copyOf(new Object[]{format}, 1));
            m.f(format2, "format(format, *args)");
            this.f217679g.announceForAccessibility(format2);
        }
    }

    public final void l(float f15, float f16) {
        jb0.b bVar = this.f217684o;
        if (bVar != null) {
            float f17 = (float) (bVar.f238616e - bVar.f238615d);
            float f18 = (f16 - f15) * f17;
            RecordConfigProvider recordConfigProvider = this.f217685p;
            m.d(recordConfigProvider);
            int i15 = recordConfigProvider.f139941w + 250;
            jb0.b bVar2 = this.f217684o;
            m.d(bVar2);
            int i16 = bVar2.f238616e;
            if (i15 > i16) {
                i15 = i16;
            }
            float f19 = f18 - ((float) i15);
            if (f19 < 0.0f) {
                f19 = 0.0f;
            }
            int i17 = ((int) f19) / 2;
            int round = Math.round(f15 * f17) + i17;
            int round2 = Math.round(f17 * f16) - i17;
            Bundle bundle = new Bundle();
            bundle.putInt("EDIT_CROP_VIDEO_LENGTH_START_TIME_INT", round);
            bundle.putInt("EDIT_CROP_VIDEO_LENGTH_END_TIME_INT", round2);
            this.f217677e.M(f.b.f272948y0, bundle);
        }
    }

    @Override // du2.j0
    public String name() {
        return a.class.getName();
    }

    @Override // du2.j0
    public void onActivityResult(int i15, int i16, Intent intent) {
    }

    @Override // du2.j0
    public void onAttach() {
    }

    @Override // du2.j0
    public boolean onBackPress() {
        ViewGroup viewGroup = this.f217680h;
        if (viewGroup != null) {
            viewGroup.setVisibility(8);
        }
        if (this.f217679g.getVisibility() != 0) {
            return false;
        }
        f.a.a(this.f217677e, f.b.W0, null, 2, null);
        this.f217679g.animate().alpha(0.0f).setDuration(100).setListener(new C2669a(this));
        return true;
    }

    public void onClick(View view) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(view);
        Object[] array = arrayList.toArray();
        arrayList.clear();
        j30.a.b("com/tencent/mm/plugin/recordvideo/plugin/cropvideo/EditCropVideoPlugin", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V", this, array);
        Integer valueOf = view != null ? Integer.valueOf(view.getId()) : null;
        if (valueOf != null && valueOf.intValue() == R.id.d6s) {
            SliderSeekBar sliderSeekBar = this.f217679g.f139985d.f133059p;
            if (sliderSeekBar != null) {
                sliderSeekBar.d();
            }
            f.a.a(this.f217677e, f.b.W0, null, 2, null);
            this.f217679g.animate().alpha(0.0f).setDuration(100).setListener(new b(this));
            ViewGroup viewGroup = this.f217680h;
            if (viewGroup != null) {
                viewGroup.setVisibility(8);
            }
        } else if (valueOf != null && valueOf.intValue() == R.id.d6w) {
            l(this.f217689t, this.f217690u);
            f.a.a(this.f217677e, f.b.X0, null, 2, null);
            if (!this.f217688s) {
                this.f217679g.animate().alpha(0.0f).setDuration(100).setListener(new c(this));
            }
            ViewGroup viewGroup2 = this.f217680h;
            if (viewGroup2 != null) {
                viewGroup2.setVisibility(8);
            }
            jb0.b bVar = this.f217684o;
            if (bVar != null) {
                float f15 = (float) (bVar.f238616e - bVar.f238615d);
                ru2.e.f297963a.m("KEY_VIDEO_CROP_DURATION_MS_INT", Integer.valueOf((int) ((this.f217690u - this.f217689t) * f15)));
                ru2.g gVar = ru2.g.f297974a;
                long j15 = (long) (this.f217689t * f15);
                Log.i("MicroMsg.VideoWidgetReporter", "setCropVideoStartTime >> " + j15);
                ru2.g.f297975b.N = j15;
                long j16 = (long) (f15 * this.f217690u);
                Log.i("MicroMsg.VideoWidgetReporter", "setCropVideoEndTime >> " + j16);
                ru2.g.f297975b.O = j16;
            }
        } else if (valueOf != null && valueOf.intValue() == R.id.f362917d81) {
            a(false);
            ru2.e.c(ru2.e.f297963a, "KEY_CLICK_VIDEO_CROP_COUNT_INT", 0, 2, null);
        } else if (valueOf != null && valueOf.intValue() == R.id.pqx) {
            if (!WeChatBrands.Business.Entries.MomentChannels.checkAvailable(view.getContext())) {
                j30.a.g(this, "com/tencent/mm/plugin/recordvideo/plugin/cropvideo/EditCropVideoPlugin", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V");
                return;
            } else if (this.f217695z >= 2) {
                ru2.e eVar = ru2.e.f297963a;
                SnsChoosePostBussinessReportStruct snsChoosePostBussinessReportStruct = new SnsChoosePostBussinessReportStruct();
                snsChoosePostBussinessReportStruct.f69987e = 1;
                snsChoosePostBussinessReportStruct.f69986d = snsChoosePostBussinessReportStruct.b("sessionid", ru2.e.f297972j, true);
                snsChoosePostBussinessReportStruct.n();
                a0 a0Var = new a0();
                a0Var.f253280d = true;
                n nVar = new n(this.f217676d.getContext(), 1, true);
                nVar.f281245i = new b(nVar, this);
                nVar.f281259q = new c(a0Var, this, nVar);
                nVar.f281235d = new d(a0Var);
                nVar.q();
            } else if (this.f217692w) {
                d(false);
                ru2.e.f297963a.j(1);
            } else if (this.f217693x) {
                h();
            } else if (this.f217694y) {
                f();
            }
        }
        j30.a.g(this, "com/tencent/mm/plugin/recordvideo/plugin/cropvideo/EditCropVideoPlugin", "android/view/View$OnClickListener", "onClick", "(Landroid/view/View;)V");
    }

    @Override // du2.j0
    public void onDetach() {
    }

    @Override // du2.j0
    public void onPause() {
    }

    @Override // du2.j0
    public void onRequestPermissionsResult(int i15, String[] strArr, int[] iArr) {
        j0.a.b(this, i15, strArr, iArr);
    }

    @Override // du2.j0
    public void onResume() {
    }

    @Override // com.tencent.mm.plugin.mmsight.segment.c
    public void q(float f15, float f16) {
        this.f217689t = f15;
        this.f217690u = f16;
        l(f15, f16);
    }

    @Override // du2.j0
    public void release() {
        this.f217679g.b();
        p64.g gVar = this.f217686q;
        if (gVar != null) {
            m.e(gVar, "null cannot be cast to non-null type android.app.Dialog");
            if (gVar.isShowing()) {
                p64.g gVar2 = this.f217686q;
                if (gVar2 != null) {
                    gVar2.dismiss();
                }
                Log.i("MicroMsg.EditCropVideoPlugin", "release dismiss dialog");
            }
        }
    }

    @Override // du2.j0
    public void reset() {
        this.f217691v = "";
        this.f217679g.b();
    }

    @Override // du2.j0
    public void setVisibility(int i15) {
        this.f217678f.setVisibility(i15);
    }
}