临时解决 endIndex 大于 size 的问题
This commit is contained in:
1 parent
e45db97a54
commit
566226958f
7 files changed
+46
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,7 @@
|
||||
Version 0.4.3 (2014-??-??)
|
||||
* 更丰富的错误提示
|
||||
* 禁止多次同时更新
|
||||
* 修正由于版本之间数据不同导致的阅读时崩溃
|
||||
|
||||
Version 0.4.2 (2014-04-04)
|
||||
* 添加内置存储空间或 Sd Card 检测
|
||||
|
||||
@@ -22,4 +22,27 @@ public class FileException extends Exception {
|
||||
return mErrorCode;
|
||||
}
|
||||
|
||||
|
||||
// TODO
|
||||
public String getMessage() {
|
||||
switch (mErrorCode) {
|
||||
case MKDIR_ERROR:
|
||||
return "mkdir error";
|
||||
case CREATE_FILE_ERROR:
|
||||
return "create file error";
|
||||
case NOT_DIR:
|
||||
return "it is not a dir";
|
||||
case NOT_FILE:
|
||||
return "it is not a file";
|
||||
case CANNOT_EXECUTE:
|
||||
return "can not execute";
|
||||
case CANNOT_READ:
|
||||
return "can not read";
|
||||
case CANNOT_WRITE:
|
||||
return "can not write";
|
||||
default:
|
||||
return "unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -89,15 +89,33 @@ public class ImageSet {
|
||||
// [startIndex, endIndex)
|
||||
public ImageSet(Context context, String gid, File folder, int size, int startIndex, int endIndex,
|
||||
Set<Integer> failIndexSet) {
|
||||
|
||||
if (folder == null || !folder.isDirectory())
|
||||
size = 0;
|
||||
|
||||
/*
|
||||
if (folder == null)
|
||||
throw new IllegalArgumentException("Folder is null");
|
||||
if (!folder.isDirectory())
|
||||
throw new IllegalArgumentException("Folder is not directory, path is " + folder.getPath());
|
||||
*/
|
||||
|
||||
if (size < 0)
|
||||
size = 0;
|
||||
if (endIndex > size)
|
||||
endIndex = size;
|
||||
if (startIndex < 0)
|
||||
startIndex = 0;
|
||||
if (startIndex > endIndex)
|
||||
startIndex = endIndex;
|
||||
|
||||
/*
|
||||
if (size < 0 || startIndex < 0
|
||||
|| startIndex > endIndex || endIndex > size)
|
||||
throw new IllegalArgumentException("size or index value error, size = "
|
||||
+ size + ", startIndex = " + startIndex
|
||||
+ ", endIndex = " + endIndex + ", path is " + folder.getPath());
|
||||
*/
|
||||
|
||||
mContext = context;
|
||||
mGid = gid;
|
||||
|
||||
@@ -139,6 +139,9 @@ public class Downloader implements Runnable {
|
||||
else if (mException instanceof NoSdCardException)
|
||||
return mContext.getString(R.string.em_no_sdcard);
|
||||
|
||||
else if (mException instanceof FileException)
|
||||
return ((FileException)mException).getMessage();
|
||||
|
||||
else
|
||||
return mException.getMessage();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user