use of com.yydcdut.noteplugin.bean.TreeFile in project PhotoNoter by yydcdut.
the class FilePhotoAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(FilePhotoViewHolder holder, int position) {
TreeFile treeFile = mCurrentNode.getChildren().get(position);
if (treeFile.getChildren() == null) {
//文件
holder.mFileLayout.setVisibility(View.VISIBLE);
holder.mDirNameTextView.setVisibility(View.GONE);
holder.mFileNameTextView.setText(treeFile.getFileName());
holder.mFileInfoTextView.setText(treeFile.getFileName());
} else {
//目录
holder.mFileLayout.setVisibility(View.GONE);
holder.mDirNameTextView.setVisibility(View.VISIBLE);
holder.mDirNameTextView.setText(treeFile.getFileName());
}
}
use of com.yydcdut.noteplugin.bean.TreeFile in project PhotoNoter by yydcdut.
the class FilePhotoFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
TreeFile root = PhotoModel.getInstance().findByPath();
if (root != null) {
mRecyclerView.setAdapter(new FilePhotoAdapter(root));
} else {
YLog.i("yuyidong", "root == null");
}
}
use of com.yydcdut.noteplugin.bean.TreeFile 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.TreeFile 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 {
}
}
Aggregations