Search in sources :

Example 1 with FilePhoto

use of com.yydcdut.noteplugin.bean.FilePhoto in project PhotoNoter by yydcdut.

the class PhotoModel method findByPath.

public TreeFile findByPath() {
    if (!hasSDCard()) {
        return null;
    }
    TreeFile rootTreeFile = new FilePhoto(0, Environment.getExternalStorageDirectory().getAbsolutePath(), null);
    String sdPath = Environment.getExternalStorageDirectory().getAbsolutePath();
    ergodicFiles(rootTreeFile, new File(sdPath));
    return rootTreeFile;
}
Also used : FilePhoto(com.yydcdut.noteplugin.bean.FilePhoto) TreeFile(com.yydcdut.noteplugin.bean.TreeFile) File(java.io.File) TreeFile(com.yydcdut.noteplugin.bean.TreeFile)

Example 2 with FilePhoto

use of com.yydcdut.noteplugin.bean.FilePhoto in project PhotoNoter by yydcdut.

the class PhotoModel method ergodicFiles.

private void ergodicFiles(TreeFile root, File rootFile) {
    if (rootFile.isDirectory()) {
        for (File file : rootFile.listFiles()) {
            if (file.isDirectory()) {
                TreeFile child = new FilePhoto(root.getLevel() + 1, file.getName(), root);
                root.addChild(child);
                ergodicFiles(child, file);
            } else {
                TreeFile child = new FilePhoto(root.getLevel() + 1, file.getName(), root);
                root.addChild(child);
                if (isPhoto(file)) {
                    root.addCoverPhoto(file.getName());
                }
            }
        }
    } else {
    }
}
Also used : FilePhoto(com.yydcdut.noteplugin.bean.FilePhoto) TreeFile(com.yydcdut.noteplugin.bean.TreeFile) File(java.io.File) TreeFile(com.yydcdut.noteplugin.bean.TreeFile)

Aggregations

FilePhoto (com.yydcdut.noteplugin.bean.FilePhoto)2 TreeFile (com.yydcdut.noteplugin.bean.TreeFile)2 File (java.io.File)2