iLOOK v1.4.0版本的 MD5 值为:510186eccd64772a217d6b415c411c73

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


package com.iLOOK.player;

import android.content.SharedPreferences;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import cn.trinea.android.common.util.HttpUtils;
import com.iLOOK.player.b.i;
import com.iLOOK.player.b.k;
import com.iLOOK.player.b.l;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import tv.danmaku.ijk.media.player.R;
public class b extends Thread {
    public static com.iLOOK.player.a.a a = null;
    private e b;
    private ArrayList<com.iLOOK.player.h.d> c = null;
    private com.iLOOK.player.h.d d = null;
    private ArrayList<i> e = null;
    private i f = null;
    private boolean g = true;
    private boolean h = true;
    private boolean i = false;
    private boolean j = true;
    private boolean k = true;
    private boolean l = false;
    private boolean m = true;
    private ArrayList<com.iLOOK.player.h.a> n = null;
    private com.iLOOK.player.h.a o = null;
    private int p = 0;
    private boolean q = true;
    private long r = 0;
    private long s = 0;
    private ArrayList<com.iLOOK.player.h.a> t = null;
    private boolean u = false;
    private boolean v = false;

    public b(e eVar) {
        this.b = null;
        this.b = eVar;
        eVar.setSplashStart(true);
    }

    private com.iLOOK.player.h.d a(int i, String str) {
        String str2;
        com.iLOOK.player.h.d dVar = new com.iLOOK.player.h.d();
        dVar.a = i;
        dVar.c = "playlist" + i;
        dVar.e = "UTF8";
        String string = MainActivity.b.getString(R.string.playlist_format_value_m3u);
        if (str != null) {
            String[] split = str.split(";", -1);
            str2 = split.length > 0 ? split[0] : null;
            if (split.length > 1) {
                string = split[1];
            }
            r1 = split.length > 2 ? split[2] : null;
            if (split.length > 3) {
                dVar.g = "1".equals(split[3]);
            }
        } else {
            str2 = null;
        }
        dVar.f = MainActivity.b.getString(R.string.playlist_format_value_xspf).equals(string) ? 2 : 1;
        if (!TextUtils.isEmpty(str2)) {
            dVar.d = str2;
        }
        if (!TextUtils.isEmpty(r1)) {
            dVar.b = r1;
        }
        return dVar;
    }

    private void a(final ArrayList<com.iLOOK.player.h.a> arrayList, final boolean z, final boolean z2) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.a(arrayList, z, z2);
            }
        });
    }

    private void b(final ArrayList<com.iLOOK.player.h.a> arrayList) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.setChannelsVOD(arrayList);
            }
        });
    }

    private void b(boolean z, boolean z2) {
        String a2;
        boolean z3;
        if (this.t == null || (a2 = com.iLOOK.player.util.g.a()) == null) {
            return;
        }
        Iterator<com.iLOOK.player.h.a> it = this.t.iterator();
        while (it.hasNext()) {
            com.iLOOK.player.h.a next = it.next();
            String c = com.iLOOK.player.d.a.c(next.r);
            if (next.l != null) {
                boolean isFile = new File(a2, next.l).isFile();
                z3 = z && !TextUtils.isEmpty(com.iLOOK.player.d.a.b(next.r));
                if (isFile || next.v != null) {
                    next.n = z2;
                    if (z3) {
                        if (z2) {
                            next.m = next.l;
                        }
                        next.l = null;
                    }
                } else if (z && TextUtils.isEmpty(c)) {
                    next.l = null;
                }
            } else {
                z3 = false;
            }
            if (!z3 && !TextUtils.isEmpty(c)) {
                if (z2 && next.n) {
                    next.m = next.l;
                }
                next.l = c;
            }
        }
    }

    private void g() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.I();
            }
        });
    }

    public void a(final int i, final boolean z) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.a(i, z);
            }
        });
    }

    public void a(final com.iLOOK.player.h.a aVar) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.a(aVar);
            }
        });
    }

    public void a(final String str, final String str2, final int i, final int i2) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.a(str, str2, i, i2);
            }
        });
    }

    public synchronized void a(ArrayList<com.iLOOK.player.h.a> arrayList) {
        if (arrayList != null) {
            this.g = false;
            this.h = false;
            this.i = false;
            this.j = false;
            this.l = false;
            this.n = arrayList;
            this.o = null;
        }
    }

    public synchronized void a(boolean z) {
        this.u = true;
        this.v = z;
    }

    public void a(boolean z, boolean z2) {
        this.b.a(z, z2);
    }

    public synchronized void a(boolean z, boolean z2, boolean z3, boolean z4) {
        boolean z5;
        if (!z4) {
            if (a()) {
                this.p = (z3 ? 4 : 0) | (z2 ? 2 : 0) | 1;
            }
        }
        if (c.a()) {
            if (this.d == null) {
                this.d = new com.iLOOK.player.h.d();
                this.d.c = "playlist0";
                this.d.e = "UTF8";
            }
            if (this.f == null) {
                ArrayList<i> a2 = a.a(4);
                if (a2.size() > 0) {
                    this.f = a2.get(0);
                } else {
                    this.f = new i();
                    this.f.b = "0";
                    this.f.c = -1;
                    this.f.g = 2;
                    this.f.a = a.a(this.f);
                }
                this.f.d = "epg0";
            }
        }
        ArrayList<com.iLOOK.player.h.d> arrayList = new ArrayList<>();
        int i = 1;
        while (true) {
            String string = MainActivity.c.getString("pref_key_playlist_" + i, null);
            if (TextUtils.isEmpty(string)) {
                break;
            }
            arrayList.add(a(i, string));
            i++;
        }
        this.c = arrayList;
        this.i = z3;
        ArrayList<i> a3 = a.a(2);
        Iterator<i> it = a3.iterator();
        while (it.hasNext()) {
            i next = it.next();
            if (next.c > 0) {
                next.d = "epg" + next.c;
                if (this.e != null && !this.i) {
                    Iterator<i> it2 = this.e.iterator();
                    while (true) {
                        if (!it2.hasNext()) {
                            z5 = false;
                            break;
                        }
                        i next2 = it2.next();
                        if (next.a == next2.a) {
                            if ((next.e == null && next2.e != null) || ((next.e != null && !next.e.equals(next2.e)) || next.f != next2.f)) {
                                next.i = true;
                            }
                            z5 = true;
                        }
                    }
                    if (!z5) {
                        next.i = true;
                    }
                }
            } else {
                next.d = "epg" + (next.b == null ? "p0" : next.b.toLowerCase());
            }
        }
        this.e = a3;
        this.g = true;
        this.h = true;
        this.j = true;
        this.l = z;
        this.m = z2;
        this.n = null;
        this.o = null;
    }

    public synchronized boolean a() {
        boolean z;
        if (!this.q && !this.g && !this.h && !this.j && (this.n == null || this.n.size() <= 0)) {
            z = this.o != null;
        }
        return z;
    }

    public void b() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                if (MainActivity.b != null) {
                    MainActivity.b.a();
                }
            }
        });
    }

    public synchronized void b(com.iLOOK.player.h.a aVar) {
        if (aVar != null) {
            this.g = false;
            this.h = false;
            this.i = false;
            this.j = false;
            this.l = false;
            this.n = null;
            this.o = aVar;
        }
    }

    public void b(final boolean z) {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                if (b.this.b.w()) {
                    return;
                }
                b.this.c(z);
            }
        });
    }

    public void c() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.d();
            }
        });
    }

    public synchronized void c(boolean z) {
        this.g = true;
        this.h = true;
        this.i = z;
        this.j = true;
        this.l = true;
        this.n = null;
        this.o = null;
    }

    public void d() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.z();
            }
        });
    }

    public void e() {
        new Handler(Looper.getMainLooper()).post(new Runnable() {
            @Override
            public void run() {
                b.this.b.B();
            }
        });
    }

    public synchronized void f() {
        this.g = false;
        this.h = false;
        this.i = false;
        this.j = true;
        this.l = false;
        this.n = null;
        this.o = null;
    }

    @Override
    public void run() {
        boolean z;
        boolean z2;
        boolean z3;
        boolean z4;
        boolean z5;
        boolean z6;
        ArrayList<com.iLOOK.player.h.a> arrayList;
        com.iLOOK.player.h.a aVar;
        boolean z7;
        boolean z8;
        boolean z9;
        int i;
        boolean z10;
        int i2;
        boolean z11;
        int i3;
        String str;
        ArrayList<com.iLOOK.player.h.a> arrayList2;
        boolean z12;
        boolean z13;
        int i4;
        boolean z14;
        int i5;
        boolean z15;
        a = new com.iLOOK.player.a.a(MainActivity.a);
        a.a();
        a.b();
        com.iLOOK.player.h.e eVar = new com.iLOOK.player.h.e(this);
        com.iLOOK.player.h.f fVar = new com.iLOOK.player.h.f();
        com.iLOOK.player.b.d dVar = new com.iLOOK.player.b.d(this);
        com.iLOOK.player.b.e eVar2 = new com.iLOOK.player.b.e(this);
        l lVar = new l(this);
        com.iLOOK.player.d.b bVar = new com.iLOOK.player.d.b(this);
        c cVar = new c(this);
        com.iLOOK.player.util.g.a(MainActivity.a, 30);
        b();
        if (com.iLOOK.player.e.g.a()) {
            g();
        }
        String format = new SimpleDateFormat("dd.MM.yyyy", Locale.US).format(Long.valueOf(System.currentTimeMillis()));
        if (format != null && !format.equals(MainActivity.c.getString("pref_key_last_startup_day", null))) {
            com.iLOOK.player.util.g.a(null, "http://iLOOK.com/pp/startup.php?device_id=" + Settings.Secure.getString(MainActivity.a.getContentResolver(), "android_id") + "&provider=null", 4000, 4000);
            g.a();
            SharedPreferences.Editor edit = MainActivity.c.edit();
            edit.putString("pref_key_last_startup_day", format);
            edit.apply();
        }
        a(false, true, false, true);
        while (true) {
            boolean z16 = false;
            int i6 = 0;
            boolean z17 = false;
            this.p = 0;
            synchronized (this) {
                if (this.u) {
                    break;
                }
                z = this.g;
                z2 = this.h;
                z3 = this.i;
                z4 = this.j;
                z5 = this.l;
                z6 = this.m;
                arrayList = this.n;
                aVar = this.o;
                this.q = z || z2 || z4 || (arrayList != null && arrayList.size() > 0) || aVar != null;
            }
            if (z || z2) {
                this.r = System.currentTimeMillis();
                this.s = System.currentTimeMillis();
            } else if (!this.q && System.currentTimeMillis() - this.s > 60000) {
                this.s = System.currentTimeMillis();
                if (this.r == 0 || System.currentTimeMillis() - this.r > 21600000) {
                    if (com.iLOOK.player.util.g.a(MainActivity.a)) {
                        b(false);
                    }
                }
            }
            if (z5) {
                a(MainActivity.a.getString(R.string.text_update), MainActivity.a.getString(R.string.text_playlist_update_started), 6, 5000);
            }
            cVar.a(z, this.d != null ? this.d.a(true) : null, this.f != null ? this.f.a() : null);
            boolean z18 = c.a() && cVar.a(this.d);
            if (z18) {
                z8 = false;
                z7 = cVar.b();
            } else {
                z7 = false;
                z8 = z;
            }
            if (z8) {
                Iterator<com.iLOOK.player.h.d> it = this.c.iterator();
                while (true) {
                    z15 = z7;
                    if (!it.hasNext()) {
                        break;
                    }
                    com.iLOOK.player.h.d next = it.next();
                    next.h = false;
                    if (next.d != null && eVar.a(next)) {
                        z15 = true;
                        next.h = true;
                    }
                    z7 = z15;
                }
                z9 = z15;
            } else {
                z9 = z7;
            }
            boolean z19 = this.q && MainActivity.c.getBoolean("pref_key_epgs_assign_mode", false);
            boolean z20 = this.q && MainActivity.c.getBoolean("pref_key_logos_assign_mode", false);
            boolean z21 = this.q && MainActivity.c.getBoolean("pref_key_groups_management_mode", false);
            boolean z22 = z19 || z20 || z21;
            if (z4) {
                this.t = new ArrayList<>();
                ArrayList<com.iLOOK.player.h.a> arrayList3 = null;
                boolean z23 = false;
                fVar.a();
                if (z18) {
                    arrayList2 = null;
                    z16 = fVar.a(this.d, this.t, true, z21) == 0;
                } else {
                    Iterator<com.iLOOK.player.h.d> it2 = this.c.iterator();
                    while (it2.hasNext()) {
                        com.iLOOK.player.h.d next2 = it2.next();
                        if (next2.g && arrayList3 == null) {
                            arrayList3 = new ArrayList<>();
                        }
                        if (fVar.a(next2, next2.g ? arrayList3 : this.t, false, !next2.g && z21) == 0) {
                            z13 = true;
                            z12 = (next2.f != 2 || next2.g) ? z23 : true;
                        } else {
                            z12 = z23;
                            z13 = z16;
                        }
                        z23 = z12;
                        z16 = z13;
                    }
                    arrayList2 = arrayList3;
                }
                if (z16) {
                    i5 = this.t.size();
                    int size = arrayList2 != null ? arrayList2.size() : 0;
                    Log.i("PlaylistLoader", "Loaded " + i5 + (size > 0 ? HttpUtils.PATHS_SEPARATOR + size : "") + " channels");
                    if (!z18) {
                        String b = fVar.b();
                        if (!TextUtils.isEmpty(b) && a.a(2).size() == 0) {
                            i iVar = new i();
                            iVar.c = 1;
                            iVar.b = "1";
                            iVar.e = b;
                            iVar.f = b.toLowerCase().endsWith(".zip") ? 2 : 1;
                            a.a(iVar);
                            if (this.p == 0) {
                                this.p = 1;
                            }
                        }
                    }
                    if (i5 > 0) {
                        if (cVar.c()) {
                            cVar.a(this.t);
                        }
                        boolean z24 = MainActivity.c.getBoolean("pref_key_download_supposed_logos", true);
                        b(z24, z20);
                        if (z23 || z24) {
                            bVar.a(this.t, z24, z20);
                        }
                        if (!z22) {
                            int a2 = eVar2.a(this.t, z18, false);
                            z14 = a2 > 0;
                            i6 = size;
                            i4 = a2;
                        }
                    }
                    z14 = false;
                    i6 = size;
                    i4 = -1;
                } else {
                    i4 = -1;
                    z14 = false;
                    i5 = 0;
                }
                if (!z19) {
                    a(this.t, z6, z22);
                }
                b(arrayList2);
                i2 = i5;
                z10 = z14;
                i = i4;
            } else {
                i = -1;
                z10 = false;
                i2 = 0;
            }
            if (this.k) {
                this.k = false;
                c();
            }
            if (z2) {
                if (!z18) {
                    Iterator<i> it3 = this.e.iterator();
                    boolean z25 = false;
                    while (it3.hasNext()) {
                        i next3 = it3.next();
                        if (next3.e != null && dVar.a(next3, z3)) {
                            z25 = true;
                            if (next3.f == 2) {
                                k.a(next3, this);
                            } else {
                                lVar.a(next3);
                            }
                        }
                        z25 = z25;
                    }
                    z17 = z25;
                } else if (cVar.d()) {
                    lVar.a(this.f);
                    z17 = true;
                }
                if (z17 && !z22) {
                    ArrayList<com.iLOOK.player.h.a> arrayList4 = new ArrayList<>();
                    Iterator<com.iLOOK.player.h.a> it4 = this.t.iterator();
                    while (it4.hasNext()) {
                        arrayList4.add(new com.iLOOK.player.h.a(it4.next()));
                    }
                    i = eVar2.a(arrayList4, z18, false);
                    z10 = i > 0;
                    if (i > 0) {
                        a(arrayList4, false, false);
                    }
                }
            }
            int i7 = i;
            boolean z26 = z10;
            if (z4 && z19) {
                int a3 = eVar2.a(this.t, z18);
                boolean z27 = a3 > 0;
                a(this.t, false, true);
                i3 = a3;
                z11 = z27;
            } else {
                z11 = z26;
                i3 = i7;
            }
            if (arrayList != null && arrayList.size() > 0 && MainActivity.c.getBoolean("pref_key_download_supposed_logos", true)) {
                bVar.a(arrayList, z20);
            }
            if (aVar != null) {
                ArrayList<com.iLOOK.player.h.a> arrayList5 = new ArrayList<>(1);
                arrayList5.add(new com.iLOOK.player.h.a(aVar));
                eVar2.a(arrayList5, z18, true);
                com.iLOOK.player.h.a aVar2 = arrayList5.get(0);
                if (aVar2.E != null && aVar2.E.d != null && aVar2.E.d.size() > 0 && aVar2.E.d.get(0).b < System.currentTimeMillis()) {
                    a(aVar2);
                }
            }
            if (z5) {
                String str2 = null;
                if (z9) {
                    StringBuilder append = new StringBuilder().append(MainActivity.a.getString(R.string.text_playlist_downloaded));
                    if (z16) {
                        str = " (" + i2 + (i6 > 0 ? HttpUtils.PATHS_SEPARATOR + i6 : "") + ")";
                    } else {
                        str = "";
                    }
                    str2 = append.append(str).toString();
                } else if (z16) {
                    str2 = MainActivity.a.getString(R.string.text_playlist_loaded) + " (" + i2 + (i6 > 0 ? HttpUtils.PATHS_SEPARATOR + i6 : "") + ")";
                }
                if (str2 == null) {
                    str2 = "";
                }
                if (z17) {
                    str2 = str2 + (str2.length() > 0 ? ", " : "") + MainActivity.a.getString(R.string.text_epg_downloaded) + (z11 ? " (" + i3 + ")" : "");
                } else if (z11) {
                    str2 = str2 + (str2.length() > 0 ? ", " : "") + MainActivity.a.getString(R.string.text_epg_loaded) + " (" + i3 + ")";
                }
                if (str2 == null || str2.length() <= 0) {
                    a(MainActivity.a.getString(R.string.text_update), MainActivity.a.getString(R.string.text_nothing_updated), 6, 5000);
                } else {
                    a(MainActivity.a.getString(R.string.text_update), str2, 6, 10000);
                }
            }
            if (this.q) {
                a(0, false);
            }
            synchronized (this) {
                this.g = false;
                this.h = false;
                this.i = false;
                this.j = false;
                this.l = false;
                this.m = false;
                this.n = null;
                this.o = null;
                this.q = false;
            }
            if (this.p > 0) {
                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    @Override
                    public void run() {
                        b.this.a(true, (b.this.p & 2) != 0, (b.this.p & 4) != 0, false);
                    }
                });
            }
            sleep(500L);
        }
        a.close();
        a = null;
        if (this.v) {
            MainActivity.a.deleteDatabase("epg.db");
        }
        if (bVar != null) {
            bVar.a();
        }
        e();
        Log.i("DataUpdater", "Thread disposed");
    }
}