package epson.print.storage; import android.content.Context; import java.io.File; import java.util.Comparator; import epson.common.ExternalFileUtils; public class StorageItem { static final int LOGGERINFO_MYPOCKET_FILE = 2; static final int LOGGERINFO_MYPOCKET_PHOTO = 1; private static final int LOGGERINFO_NO_INFO = 0; int mLoggerInfo = 0; public String name; public String path; public ItemType type; public Object userInfo; public enum ItemType { DIRECTORY, FILE, PHOTO, LOADMORE } public static boolean endsWith(String str, String str2) { if (str2.length() > str.length()) { return false; } return str.regionMatches(true, str.length() - str2.length(), str2, 0, str2.length()); } public StorageItem() { } public StorageItem(String str) { name = str; } public StorageItem(String str, String str2, ItemType itemType) { name = str; path = str2; type = itemType; } public StorageItem(String str, String str2, ItemType itemType, Object obj) { name = str; path = str2; type = itemType; userInfo = obj; } private String getDownloadLocalPath(Context context) { File file = new File(ExternalFileUtils.getInstance(context).getDownloadDir()); if (!file.exists()) { file.mkdirs(); } return new File(file.getAbsolutePath(), name).getPath(); } public static class NameComparator implements Comparator { public int compare(StorageItem storageItem, StorageItem storageItem2) { if (storageItem.name == null || storageItem2.name == null) { return -1; } int compareToIgnoreCase = storageItem.name.compareToIgnoreCase(storageItem2.name); if (compareToIgnoreCase != 0) { return compareToIgnoreCase; } if (storageItem.type == null || storageItem2.name == null) { return -1; } return storageItem.type.compareTo(storageItem2.type); } } }