Life Simulator: Game Dev v0.6版本的 MD5 值为:ecca8c682c00d3b861fbed7f58e41c8d

以下内容为反编译后的 i.java 源代码,内容仅作参考


package com.appodeal.ads.d;

import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Build;
import android.support.annotation.NonNull;
import android.util.DisplayMetrics;
import com.amazon.device.ads.WebRequest;
import com.appodeal.ads.Appodeal;
import com.appodeal.ads.AppodealSettings;
import com.appodeal.ads.Native;
import com.appodeal.ads.ah;
import com.appodeal.ads.ak;
import com.appodeal.ads.an;
import com.appodeal.ads.ao;
import com.mopub.common.AdType;
import com.mopub.common.GpsHelper;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import org.json.JSONException;
import org.json.JSONObject;
import org.nexage.sourcekit.vast.model.VASTModel;

public class i extends AsyncTask<Void, Object, com.appodeal.ads.d.a> {
    private h a;
    private String b;
    private int c;
    private int d;
    private Context e;
    private g f;
    private List<c> g;
    private com.appodeal.ads.d.a h;
    private a i;
    private Double j;
    private List<Thread> k;
    private int l;
    private int m;

    public interface a {
        void a(int i, com.appodeal.ads.d.a aVar, h hVar);

        void a(c cVar);

        void a(f fVar);
    }

    public i(@NonNull Activity activity, int i, int i2, @NonNull g gVar, a aVar, Double d, String str, String str2) {
        this.c = 0;
        this.i = aVar;
        if (gVar.e()) {
            if (aVar != null) {
                this.i.a(i2, null, null);
                return;
            }
            return;
        }
        if (d == null || d.doubleValue() > 100.0d) {
            if (aVar != null) {
                this.i.a(i2, null, null);
                return;
            }
            return;
        }
        this.e = activity;
        this.c = i;
        this.b = str;
        this.d = i2;
        this.f = gVar;
        this.g = new ArrayList();
        this.j = d;
        this.a = new h();
        this.a.g();
        this.a.d(str2);
        DisplayMetrics displayMetrics = this.e.getResources().getDisplayMetrics();
        this.l = displayMetrics.widthPixels;
        this.m = displayMetrics.heightPixels;
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (Build.VERSION.SDK_INT >= 11) {
                    i.this.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
                } else {
                    i.this.execute(new Void[0]);
                }
            }
        });
    }

    private b a() {
        try {
            String string = this.e.getSharedPreferences("appodeal", 0).getString(GpsHelper.ADVERTISING_ID_KEY, null);
            if (string == null) {
                string = an.l(this.e);
            }
            String str = string + System.currentTimeMillis();
            String packageName = this.e.getPackageName();
            String str2 = "https://play.google.com/store/apps/details?id=" + packageName;
            if (this.f.g() != null) {
                str2 = this.f.g().optString("store_url", str2);
            }
            return new b(this.e, this.j, str, string, packageName, str2, 2, this.f.b(), this.f.d(), this.f.f(), this.f.g(), true, AppodealSettings.h);
        } catch (JSONException e) {
            throw new f("bid_json_create_exception");
        } catch (Exception e2) {
            throw new f("some_exception");
        }
    }

    private String b(com.appodeal.ads.d.a aVar) {
        try {
            aVar.a(Double.valueOf(this.j.doubleValue() + 0.009999999776482582d));
            String c = aVar.c();
            if (c.isEmpty()) {
                return "";
            }
            try {
                try {
                    HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(c).openConnection();
                    httpURLConnection.setRequestProperty("Accept", WebRequest.CONTENT_TYPE_JSON);
                    httpURLConnection.setRequestProperty("Content-type", WebRequest.CONTENT_TYPE_JSON);
                    httpURLConnection.setRequestProperty("x-openrtb-version", "2.3");
                    httpURLConnection.setRequestMethod("GET");
                    switch (httpURLConnection.getResponseCode()) {
                        case VASTModel.ERROR_CODE_BAD_MODEL:
                            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
                            String str = "";
                            while (true) {
                                String readLine = bufferedReader.readLine();
                                if (readLine == null) {
                                    return str;
                                }
                                str = str + readLine;
                            }
                        default:
                            throw new f("response_code " + httpURLConnection.getResponseCode());
                    }
                } catch (IOException e) {
                    throw new f("connection_exception");
                }
            } catch (MalformedURLException e2) {
                throw new f("wrong_url");
            }
        } catch (Exception e3) {
            throw new f("some_exception");
        }
    }

    @Override
    public com.appodeal.ads.d.a doInBackground(Void... voidArr) {
        int i;
        JSONObject a2;
        int i2 = 0;
        try {
        } catch (Exception e) {
            Appodeal.a(e);
        }
        if (this.f.c() == null || this.f.c().isEmpty()) {
            return null;
        }
        try {
            b a3 = a();
            LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue();
            this.k = new ArrayList();
            for (e eVar : this.f.c()) {
                String m = eVar.m();
                switch (this.c) {
                    case 1:
                        a2 = a3.a(eVar.k(), 320, 50, false);
                        break;
                    case 2:
                        if (m == null || !m.equals(AdType.MRAID)) {
                            a2 = a3.a(ao.a() ? ao.a() : eVar.i().booleanValue(), ah.v / 1000, eVar);
                            break;
                        } else {
                            a2 = a3.a(eVar.k(), this.l, this.m, true);
                            break;
                        }
                        break;
                    case 3:
                        a2 = a3.a(eVar.k(), this.l, this.m, true);
                        break;
                    case 4:
                        if (m == null || !m.equals(AdType.MRAID)) {
                            a2 = a3.a(ao.a() ? ao.a() : eVar.i().booleanValue(), ak.w / 1000, eVar);
                            break;
                        } else {
                            a2 = a3.a(eVar.k(), this.l, this.m, true);
                            break;
                        }
                    case 5:
                        a2 = a3.a(Native.m, eVar.k(), eVar.n());
                        break;
                    case 6:
                    default:
                        throw new f("wrong_type");
                    case 7:
                        a2 = a3.a(eVar.k(), 300, 250, false);
                        break;
                }
                a3.a(eVar.a(), a2);
                Thread thread = new Thread(new d(linkedBlockingQueue, a2, eVar, this.b), "BidThread");
                thread.setDaemon(true);
                thread.start();
                this.k.add(thread);
                if (!this.a.h()) {
                    this.a.c(a2);
                }
            }
            while (!isCancelled()) {
                try {
                    Serializable serializable = (Serializable) linkedBlockingQueue.take();
                    if (serializable != null) {
                        int i3 = i2 + 1;
                        if (serializable instanceof c) {
                            this.g.add((c) serializable);
                            Iterator<j> it = ((c) serializable).b().iterator();
                            while (it.hasNext()) {
                                for (com.appodeal.ads.d.a aVar : it.next().a()) {
                                    if (this.h == null) {
                                        if (aVar.b().doubleValue() > this.j.doubleValue() * aVar.i().a().floatValue()) {
                                            this.h = aVar;
                                            this.j = Double.valueOf(this.j.doubleValue() * aVar.i().a().floatValue());
                                        } else {
                                            this.a.a(aVar);
                                        }
                                    } else if (this.h.b().doubleValue() < aVar.b().doubleValue()) {
                                        this.j = this.h.b();
                                        this.a.a(this.h);
                                        this.h = aVar;
                                    } else if (this.h.b().doubleValue() > aVar.b().doubleValue()) {
                                        this.a.a(aVar);
                                        if (this.j.doubleValue() < aVar.b().doubleValue()) {
                                            this.j = aVar.b();
                                        }
                                    } else {
                                        this.a.a(aVar);
                                    }
                                }
                            }
                        }
                        publishProgress(serializable);
                        if (i3 < this.f.c().size()) {
                            i = i3;
                        }
                    } else {
                        i = i2;
                    }
                    i2 = i;
                } catch (InterruptedException e2) {
                }
            }
            try {
                if (this.h != null) {
                    this.a.a(this.h);
                    String b = b(this.h);
                    if (b != null && !b.isEmpty() && this.h.e().isEmpty()) {
                        this.h.a(b);
                    }
                    this.h.d();
                    return this.h;
                }
            } catch (f e3) {
                publishProgress(e3);
            }
            return null;
        } catch (f e4) {
            publishProgress(e4);
            return null;
        }
    }

    @Override
    public void onPostExecute(com.appodeal.ads.d.a aVar) {
        super.onPostExecute(aVar);
        try {
            if (this.i != null) {
                if (aVar != null) {
                    this.a.a(aVar.a());
                    this.a.a(aVar.a().optString("mfr_id"));
                    this.a.b(aVar.i().c());
                    if (aVar.f() != null && aVar.f().length > 0) {
                        this.a.c(aVar.f()[0]);
                    }
                }
                if (this.g != null && this.g.size() > 0) {
                    for (c cVar : this.g) {
                        if (cVar.f().l()) {
                            if (aVar != null && cVar.f().c().equals(aVar.i().c())) {
                                cVar.a(true);
                            }
                            this.a.a(cVar);
                        }
                    }
                }
                this.a.a(this.e);
                this.f.a(this.a);
                this.i.a(this.d, aVar, this.a);
            }
        } catch (Exception e) {
            Appodeal.a(e);
            this.i.a(this.d, null, null);
        }
    }

    @Override
    protected void onCancelled() {
        super.onCancelled();
        try {
            if (this.k != null) {
                for (Thread thread : this.k) {
                    if (thread != null && thread.isAlive()) {
                        thread.interrupt();
                    }
                }
            }
        } catch (Exception e) {
            Appodeal.a(e);
        }
    }

    @Override
    protected void onProgressUpdate(Object... objArr) {
        super.onProgressUpdate(objArr);
        try {
            if (this.i != null && objArr.length > 0) {
                Object obj = objArr[0];
                if (obj instanceof c) {
                    this.i.a((c) obj);
                } else if (obj instanceof f) {
                    this.i.a((f) obj);
                }
            }
        } catch (Exception e) {
            Appodeal.a(e);
        }
    }
}