/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  javax.microedition.io.file.FileSystemRegistry
 */
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
import javax.microedition.io.file.FileSystemRegistry;

public final class ct
implements Runnable,
fw {
    private final int d;
    private static Vector e = new Vector();
    private int f;
    private le g;
    private w h = jj.a(false);
    private w i = jj.d(false);
    public pj a;
    public Vector b = new Vector();
    public boolean c = false;

    static {
        e.addElement(".jpg");
        e.addElement(".jpeg");
        e.addElement(".JPG");
        e.addElement(".JPEG");
    }

    public final void g() {
        this.b = new Vector();
    }

    public final int c() {
        return this.h().b();
    }

    private static String c(String string) {
        if (!string.equals("store/home/user/pictures/")) {
            if (!string.equals("SDCard/BlackBerry/pictures/")) {
                return lh.d(244);
            }
            return lh.d(245);
        }
        return lh.d(246);
    }

    private static String k() {
        Enumeration enumeration = FileSystemRegistry.listRoots();
        if (enumeration.hasMoreElements()) {
            return (String)enumeration.nextElement();
        }
        return null;
    }

    public static boolean b() {
        return !ct.j().isEmpty() || ct.k() != null;
    }

    public final boolean d() {
        return this.f == 0;
    }

    public final boolean e() {
        return this.f == 1;
    }

    public final boolean f() {
        return this.f == 2;
    }

    /*
     * Enabled aggressive block sorting
     */
    public final int a(Object object, Object object2) {
        pj pj2 = (pj)object;
        pj pj3 = (pj)object2;
        if (pj2.f() == pj3.f()) {
            if (pj2.f() && pj3.f()) {
                return pj2.j().toLowerCase().compareTo(pj3.j().toLowerCase());
            }
            if (pj2.o > pj3.o) return -1;
            return 1;
        }
        if (pj2.f()) return -1;
        return 1;
    }

    public final le h() {
        lc lc2;
        if (this.g == null && (lc2 = ps.a().c()) instanceof gu) {
            this.g = ((gu)lc2).d('\ued49');
        }
        return this.g;
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    public final boolean a(String string) {
        if (string.startsWith(".")) return false;
        if (string.endsWith("/")) return this.f();
        if (e == null) return true;
        int n = string.lastIndexOf(46);
        if (n == -1) return false;
        return e.contains(string.substring(n).toLowerCase());
    }

    private static Vector j() {
        Vector<String> vector = new Vector<String>();
        String string = System.getProperty("fileconn.dir.photos");
        if (!ed.b(string)) {
            if (string.startsWith("file:///")) {
                string = string.substring("file:///".length());
            }
            vector.addElement(string);
        }
        return vector;
    }

    public ct(int n) {
        this.d = n;
        this.a();
    }

    public final void a(pj pj2) {
        this.a = pj2;
        this.b = new Vector();
        this.c = true;
        if (!ed.b(this.a.k())) {
            if (this.d() || this.e()) {
                this.b.addElement(dz.a(this.d, this.a.c(), this.h, 8));
            }
            this.b.addElement(dz.a(this.d, this.a.k(), this.i, 8));
        }
        new Thread(this).start();
    }

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    public final void run() {
        int n;
        Vector vector;
        pj pj2 = this.a;
        try {
            vector = pj2.m();
            if (vector == null) {
                return;
            }
            if (!vector.isEmpty()) {
                a.a(vector, this);
                for (n = 0; n < vector.size(); ++n) {
                    this.b.addElement(vector.elementAt(n));
                }
            } else {
                this.b.addElement(dz.a(this.d, lh.d(235)));
            }
        }
        catch (IOException iOException) {
            me.a("FileBrowser", iOException);
            return;
        }
        for (n = 0; n < vector.size() && this.a == pj2; ++n) {
            try {
                ((pj)vector.elementAt(n)).n();
                continue;
            }
            catch (SecurityException securityException) {}
            return;
        }
    }

    public final void a() {
        block7: {
            block6: {
                block4: {
                    Vector vector;
                    block5: {
                        int n;
                        vector = ct.j();
                        if (vector.isEmpty()) break block4;
                        if (vector.size() == 1) break block5;
                        this.f = 1;
                        pj[] pjArray = new pj[vector.size()];
                        for (n = 0; n < vector.size(); ++n) {
                            String string = (String)vector.elementAt(n);
                            pjArray[n] = new pj(this.d, this, null, string, ct.c(string), this.h);
                        }
                        this.a = null;
                        this.b = new Vector();
                        this.c = true;
                        for (n = 0; n < pjArray.length; ++n) {
                            this.b.addElement(pjArray[n]);
                        }
                        break block6;
                    }
                    String string = (String)vector.elementAt(0);
                    this.f = 0;
                    this.a(new pj(this.d, this, null, string, ct.c(string), this.h));
                    return;
                }
                this.f = 2;
                String string = ct.k();
                if (string == null) break block7;
                this.a(new pj(this.d, this, null, string, ct.c(string), this.h));
            }
            return;
        }
        this.b.addElement(dz.a(this.d, lh.d(235)));
    }
}

