package com.ifpdos.debugmenu.action;

import android.content.ComponentName;
import android.content.Context;
import android.hardware.Camera;
import android.text.TextUtils;
import com.ifpdos.debugmenu.R;
import com.ifpdos.debugmenu.action.base.ItemButtonAction;
import com.ifpdos.debugmenu.event.ActivityEvent;
import d.f.a.c1;
import d.f.a.r2.u2;
import d.f.a.s1.e;
import d.i.c.a;
import d.i.f.d.b;
import java.io.File;
import k.c.a.c;

/* JADX INFO: loaded from: classes.dex */
public class PlayVideoAction extends ItemButtonAction implements c1 {
    private static final String FACTORY_AGING_ACTIVITY = "com.seewo.factoryaging.MainActivity";
    private static final String FACTORY_AGING_PACKAGE = "com.seewo.factoryaging";
    private static final String FACTORY_AGING_SERVICE = "com.seewo.factoryaging.BootService";
    private static final String NEW_AGING_APP_ACTIVITY = "com.seewo.agingtest.MainActivity";
    private static final String NEW_AGING_APP_PACKAGE = "com.seewo.agingtest";
    private static final String TAG = "PlayVideoAction";
    public static final String VIDEO_PLAY_ACTION = "com.ifpdos.debugmenu.activity.agingtest.VideoPlayActivity";

    public PlayVideoAction(Context context) {
        super(context);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public void copyFileToInternalStorage(final String str, final String str2, final e eVar) {
        new Thread(new Runnable() { // from class: d.f.a.p1.v4
            @Override // java.lang.Runnable
            public final void run() {
                String str3 = str;
                String str4 = str2;
                d.f.a.s1.e eVar2 = eVar;
                k.c.a.c.c().g(new ActivityEvent.ShowProgressDialog(true));
                boolean zC = d.f.a.r2.u2.c(str3, str4);
                d.b.a.a.a.Y(false, k.c.a.c.c());
                if (zC) {
                    eVar2.call();
                }
            }
        }).start();
    }

    @Override // com.ifpdos.debugmenu.action.base.ItemButtonAction, d.f.a.j2.e.e.a
    public void onClick(Context context, d.f.a.j2.e.e eVar) {
        d.h.a.e.a(TAG).a("onPlayVideoAction");
        if (a.v(this.mContext, FACTORY_AGING_PACKAGE)) {
            c.c().g(new ActivityEvent.StartActivity(new ComponentName(FACTORY_AGING_PACKAGE, FACTORY_AGING_ACTIVITY)));
            return;
        }
        if (Camera.getNumberOfCameras() > 0 && a.v(this.mContext, NEW_AGING_APP_PACKAGE)) {
            c.c().g(new ActivityEvent.StartActivity(new ComponentName(NEW_AGING_APP_PACKAGE, NEW_AGING_APP_ACTIVITY)));
            return;
        }
        if (!TextUtils.isEmpty(u2.j())) {
            c.c().g(new ActivityEvent.StartActivityWithAction(VIDEO_PLAY_ACTION));
            return;
        }
        final String strL = u2.l();
        if (TextUtils.isEmpty(strL)) {
            d.b.a.a.a.J(R.string.video_res_error, c.c());
        } else {
            c.c().g(new ActivityEvent.ShowDebugMenuDialog(R.string.video_copy_dialog_title, R.string.video_copy_dialog_content, new e() { // from class: com.ifpdos.debugmenu.action.PlayVideoAction.1
                @Override // d.f.a.s1.e
                public void call() {
                    d.b.a.a.a.X(c.c());
                    String str = strL;
                    String strSubstring = str.substring(str.lastIndexOf("/") + 1);
                    PlayVideoAction playVideoAction = PlayVideoAction.this;
                    String str2 = strL;
                    StringBuilder sb = new StringBuilder();
                    sb.append(b.a().b().a);
                    playVideoAction.copyFileToInternalStorage(str2, d.b.a.a.a.v(sb, File.separator, strSubstring), new e() { // from class: com.ifpdos.debugmenu.action.PlayVideoAction.1.1
                        @Override // d.f.a.s1.e
                        public void call() {
                            c.c().g(new ActivityEvent.StartActivityWithAction(PlayVideoAction.VIDEO_PLAY_ACTION));
                        }
                    });
                }
            }));
        }
    }

    @Override // com.ifpdos.debugmenu.action.base.ItemButtonAction, d.f.a.j2.e.e.a
    public void onLongClick(Context context, d.f.a.j2.e.e eVar) {
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // d.f.a.c1
    public void quickAction(e eVar) {
        onClick(this.mContext, (d.f.a.j2.e.e) this.mViewModel);
        if (eVar != null) {
            eVar.call();
        }
    }
}
