diff --git a/bin/EhViewer.apk b/bin/EhViewer.apk index 116db69a9..b7e090e7f 100644 Binary files a/bin/EhViewer.apk and b/bin/EhViewer.apk differ diff --git a/bin/classes.dex b/bin/classes.dex index 548f74374..976b359d5 100644 Binary files a/bin/classes.dex and b/bin/classes.dex differ diff --git a/bin/resources.ap_ b/bin/resources.ap_ index e278bed3a..e9ff0a53c 100644 Binary files a/bin/resources.ap_ and b/bin/resources.ap_ differ diff --git a/res/raw/change_log b/res/raw/change_log index 7b2743fa3..8f85bf628 100644 --- a/res/raw/change_log +++ b/res/raw/change_log @@ -1,5 +1,7 @@ Version 0.4.3 (2014-??-??) * 更丰富的错误提示 +* 禁止多次同时更新 +* 修正由于版本之间数据不同导致的阅读时崩溃 Version 0.4.2 (2014-04-04) * 添加内置存储空间或 Sd Card 检测 diff --git a/src/com/hippo/ehviewer/exception/FileException.java b/src/com/hippo/ehviewer/exception/FileException.java index ce7b7ce70..f314f7377 100644 --- a/src/com/hippo/ehviewer/exception/FileException.java +++ b/src/com/hippo/ehviewer/exception/FileException.java @@ -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"; + } + } + } diff --git a/src/com/hippo/ehviewer/gallery/data/ImageSet.java b/src/com/hippo/ehviewer/gallery/data/ImageSet.java index b328e6e36..e8a74a976 100644 --- a/src/com/hippo/ehviewer/gallery/data/ImageSet.java +++ b/src/com/hippo/ehviewer/gallery/data/ImageSet.java @@ -89,15 +89,33 @@ public class ImageSet { // [startIndex, endIndex) public ImageSet(Context context, String gid, File folder, int size, int startIndex, int endIndex, Set 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; diff --git a/src/com/hippo/ehviewer/network/Downloader.java b/src/com/hippo/ehviewer/network/Downloader.java index 9cec66240..98ddfa488 100644 --- a/src/com/hippo/ehviewer/network/Downloader.java +++ b/src/com/hippo/ehviewer/network/Downloader.java @@ -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(); }