package ᕣ.K.K;

import android.content.Context;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import com.appsflyer.share.Constants;
import com.indiaholacash.holacash.R;
import com.mexico.inloancash.fragment.IndiaFourthStepAuthFragment;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import top.zibin.luban.Checker;
import ඓ.ῲ.K.C1218;
import ඓ.ῲ.K.ComponentCallbacks2C1161;

/* renamed from: ᕣ.K.K.㿎  reason: contains not printable characters */
/* compiled from: Luban */
public class C1468 implements Handler.Callback {

    /* renamed from: ʬ  reason: contains not printable characters */
    public int f5472;

    /* renamed from: ඓ  reason: contains not printable characters */
    public List<AbstractC1459> f5473;

    /* renamed from: ῲ  reason: contains not printable characters */
    public boolean f5474;

    /* renamed from: K  reason: contains not printable characters */
    public String f5475;

    /* renamed from: 㴹  reason: contains not printable characters */
    public Handler f5476 = new Handler(Looper.getMainLooper(), this);

    /* renamed from: 㸾  reason: contains not printable characters */
    public AbstractC1461 f5477;

    public /* synthetic */ C1468(C1469 k, RunnableC1467 r2) {
        this.f5475 = k.f5480;
        AbstractC1465 r22 = k.f5484;
        this.f5473 = k.f5481;
        this.f5477 = k.f5479;
        this.f5472 = k.f5478;
        AbstractC1464 k2 = k.f5483;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public static C1469 m3677(Context context) {
        return new C1469(context);
    }

    public boolean handleMessage(Message message) {
        AbstractC1461 r0 = this.f5477;
        if (r0 == null) {
            return false;
        }
        int i = message.what;
        if (i == 0) {
            IndiaFourthStepAuthFragment.C0479 r02 = (IndiaFourthStepAuthFragment.C0479) r0;
            IndiaFourthStepAuthFragment indiaFourthStepAuthFragment = IndiaFourthStepAuthFragment.this;
            indiaFourthStepAuthFragment.f2653 = (File) message.obj;
            ((C1218) ComponentCallbacks2C1161.m3106(indiaFourthStepAuthFragment.getActivity()).m3119(IndiaFourthStepAuthFragment.this.f2653).m3216((int) R.mipmap.india_gocash_picture_pic_camera)).m3290(IndiaFourthStepAuthFragment.this.mIndia_Prove);
            IndiaFourthStepAuthFragment.this.f3640.m2185();
            IndiaFourthStepAuthFragment.this.m1537();
        } else if (i == 1) {
            IndiaFourthStepAuthFragment.C0479 r03 = (IndiaFourthStepAuthFragment.C0479) r0;
        } else if (i == 2) {
            Throwable th = (Throwable) message.obj;
            IndiaFourthStepAuthFragment.this.f3640.m2185();
        }
        return false;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public final File m3678(Context context) {
        File externalCacheDir = context.getExternalCacheDir();
        if (externalCacheDir != null) {
            File file = new File(externalCacheDir, "luban_disk_cache");
            if (file.mkdirs() || (file.exists() && file.isDirectory())) {
                return file;
            }
            return null;
        } else if (!Log.isLoggable("Luban", 6)) {
            return null;
        } else {
            Log.e("Luban", "default disk cache dir is null");
            return null;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final List<File> m3680(Context context) throws IOException {
        ArrayList arrayList = new ArrayList();
        Iterator<AbstractC1459> it2 = this.f5473.iterator();
        while (it2.hasNext()) {
            arrayList.add(m3679(context, it2.next()));
            it2.remove();
        }
        return arrayList;
    }

    /* renamed from: ᕣ.K.K.㿎$K  reason: contains not printable characters */
    /* compiled from: Luban */
    public static class C1469 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public int f5478 = 100;

        /* renamed from: ඓ  reason: contains not printable characters */
        public AbstractC1461 f5479;

        /* renamed from: ῲ  reason: contains not printable characters */
        public String f5480;

        /* renamed from: ⁱ  reason: contains not printable characters */
        public List<AbstractC1459> f5481;

        /* renamed from: K  reason: contains not printable characters */
        public Context f5482;

        /* renamed from: 㴹  reason: contains not printable characters */
        public AbstractC1464 f5483;

        /* renamed from: 㸾  reason: contains not printable characters */
        public AbstractC1465 f5484;

        public C1469(Context context) {
            this.f5482 = context;
            this.f5481 = new ArrayList();
        }

        /* renamed from: K  reason: contains not printable characters */
        public List<File> m3681() throws IOException {
            return new C1468(this, null).m3680(this.f5482);
        }

        /* renamed from: K  reason: contains not printable characters */
        public <T> C1469 m3682(List<T> list) {
            for (T t : list) {
                if (t instanceof String) {
                    this.f5481.add(new C1466(this, t));
                } else if (t instanceof File) {
                    this.f5481.add(new C1460(this, t));
                } else if (t instanceof Uri) {
                    this.f5481.add(new C1463(this, t));
                } else {
                    throw new IllegalArgumentException("Incoming data type exception, it must be String, File, Uri or Bitmap");
                }
            }
            return this;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final File m3679(Context context, AbstractC1459 r7) throws IOException {
        String extSuffix = Checker.SINGLE.extSuffix(r7);
        if (TextUtils.isEmpty(this.f5475)) {
            this.f5475 = m3678(context).getAbsolutePath();
        }
        StringBuilder sb = new StringBuilder();
        sb.append(this.f5475);
        sb.append(Constants.URL_PATH_DELIMITER);
        sb.append(System.currentTimeMillis());
        sb.append((int) (Math.random() * 1000.0d));
        if (TextUtils.isEmpty(extSuffix)) {
            extSuffix = ".jpg";
        }
        sb.append(extSuffix);
        File file = new File(sb.toString());
        if (Checker.SINGLE.needCompress(this.f5472, r7.m3668())) {
            return new C1462(r7, file, this.f5474).m3672();
        }
        return new File(r7.m3668());
    }
}
