酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

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


package com.kugou.android.audioidentify.f;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import com.kugou.android.lite.R;
import com.kugou.common.utils.ag;
import com.kugou.common.utils.as;
import com.kugou.common.utils.au;
import com.kugou.common.utils.bc;
import com.kugou.common.utils.br;
import com.kugou.common.utils.bv;
import com.kugou.common.utils.g;
import com.kugou.common.utils.s;
import com.kugou.ktv.android.common.constant.c;
import com.kugou.ktv.android.common.j.o;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;

public class a {

    private static volatile a f22237a;
    private Context g;

    private C0383a f22238b = new C0383a();

    private long f22239c = -1;

    private int f22240d = 0;

    private int f22241e = 0;
    private Handler f = new Handler(Looper.getMainLooper());
    private HashMap<String, b> h = new HashMap<>(0);

    public a(Context context) {
        this.g = context;
    }

    public static a a(Context context) {
        if (f22237a == null) {
            f22237a = new a(context);
        }
        return f22237a;
    }

    public void d() {
        if (this.f22239c != -1) {
            g.a().a(1010, "http://applink.kugou.com/download/21/590");
        }
        this.f22239c = -1L;
        C0383a c0383a = this.f22238b;
        if (c0383a != null) {
            c0383a.onStop(null);
        }
    }

    public void a(String str, b bVar) {
        synchronized (this.h) {
            this.h.put(str, bVar);
        }
    }

    public void a(String str) {
        synchronized (this.h) {
            this.h.remove(str);
        }
    }

    public void e() {
        synchronized (this.h) {
            this.h.clear();
        }
    }

    public int f() {
        return this.f22240d;
    }

    public int g() {
        return this.f22241e;
    }

    public void a(String str, String str2) {
        try {
            File file = new File(str2);
            long length = file.length();
            String str3 = c.G + file.getName();
            s sVar = new s(c.G);
            if (!sVar.exists() || !sVar.isDirectory()) {
                sVar.mkdirs();
            }
            if (ag.f(str3)) {
                ag.e(str3);
            }
            ag.a(str2, str3);
            s sVar2 = new s(str3);
            if (sVar2.exists()) {
                this.f22240d = 2;
                a(str3, length);
                a(sVar2, true);
                if (file.exists()) {
                    file.delete();
                }
            }
        } catch (Exception e2) {
            as.e(e2);
            a((s) null, false);
        }
    }

    public void a(final s sVar, final boolean z) {
        this.f.post(new Runnable() {
            @Override
            public void run() {
                if (z) {
                    a.this.a(sVar);
                } else if (!bc.o(a.this.g)) {
                    bv.b(a.this.g, R.string.am3);
                }
                a.this.f.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            synchronized (a.this.h) {
                                Iterator it = a.this.h.values().iterator();
                                while (it.hasNext()) {
                                    try {
                                        ((b) it.next()).f(z);
                                    } catch (Exception e2) {
                                        as.e(e2);
                                    }
                                }
                            }
                        } catch (Exception e3) {
                            as.e(e3);
                        }
                    }
                }, 500L);
            }
        });
    }

    public void a(s sVar) {
        a((File) sVar);
    }

    public void a(File file) {
        if (file == null) {
            return;
        }
        try {
            br.d(this.g, file.getAbsolutePath());
        } catch (Exception e2) {
            as.e(e2);
        }
    }

    public void a(String str, long j) {
        o.a().b("audio_identify_app_apk_path_com.kugou.shiqutouch", str);
        o.a().b("audio_identify_app_apk_size_com.kugou.shiqutouch", j);
    }

    private class C0383a implements g.a {
        private C0383a() {
        }

        @Override
        public void onStart(String str) {
            a.this.f22240d = 1;
            a.this.f22241e = 0;
            try {
                synchronized (a.this.h) {
                    Iterator it = a.this.h.values().iterator();
                    while (it.hasNext()) {
                        try {
                            ((b) it.next()).A();
                        } catch (Exception e2) {
                            as.e(e2);
                        }
                    }
                }
            } catch (Exception e3) {
                as.e(e3);
            }
        }

        @Override
        public void onProgress(String str, int i) {
            if (i < 0) {
                i = 0;
            } else if (i > 100) {
                i = 100;
            }
            a.this.f22241e = i;
            try {
                synchronized (a.this.h) {
                    Iterator it = a.this.h.values().iterator();
                    while (it.hasNext()) {
                        try {
                            ((b) it.next()).c(a.this.f22241e);
                        } catch (Exception e2) {
                            as.e(e2);
                        }
                    }
                }
            } catch (Exception e3) {
                as.e(e3);
            }
        }

        @Override
        public void onComplete(final String str, final String str2) {
            a.this.f22239c = -1L;
            au.a().a(new Runnable() {
                @Override
                public void run() {
                    a.this.a(str, str2);
                }
            });
        }

        @Override
        public void onError(String str, int i) {
            a.this.f22240d = 3;
            a.this.f22239c = -1L;
            try {
                synchronized (a.this.h) {
                    Iterator it = a.this.h.values().iterator();
                    while (it.hasNext()) {
                        try {
                            ((b) it.next()).d(i);
                        } catch (Exception e2) {
                            as.e(e2);
                        }
                    }
                }
            } catch (Exception e3) {
                as.e(e3);
            }
            if (as.c()) {
                as.b("FufuRadarAppDownloadDelegate", "onStateChanged failed errorCode=" + i);
            }
            a.this.a((s) null, false);
        }

        @Override
        public void onStop(String str) {
            a.this.f22239c = -1L;
            if (as.c()) {
                as.b("FufuRadarAppDownloadDelegate", "onStateChanged onStop");
            }
            a.this.f22240d = 0;
            try {
                synchronized (a.this.h) {
                    Iterator it = a.this.h.values().iterator();
                    while (it.hasNext()) {
                        try {
                            ((b) it.next()).B();
                        } catch (Exception e2) {
                            as.e(e2);
                        }
                    }
                }
            } catch (Exception e3) {
                as.e(e3);
            }
        }
    }
}