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;
}
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 {
}
}