mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
put directories and files in the same list + permission handling
This commit is contained in:
@ -0,0 +1,45 @@
|
||||
package com.simplemobiletools.filemanager.models;
|
||||
|
||||
public class FileDirItem implements Comparable {
|
||||
private final String mPath;
|
||||
private final String mName;
|
||||
private final boolean mIsDirectory;
|
||||
|
||||
public FileDirItem(String path, String name, boolean isDirectory) {
|
||||
mPath = path;
|
||||
mName = name;
|
||||
mIsDirectory = isDirectory;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return mPath;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public boolean getIsDirectory() {
|
||||
return mIsDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object object) {
|
||||
final FileDirItem item = (FileDirItem) object;
|
||||
if (mIsDirectory && !item.getIsDirectory()) {
|
||||
return -1;
|
||||
} else if (!mIsDirectory && item.getIsDirectory()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return mName.compareToIgnoreCase(item.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FileDirItem {" +
|
||||
"name=" + getName() +
|
||||
", isDirectory=" + getIsDirectory() +
|
||||
", path=" + getPath() + "}";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user