diff --git a/README-cn.md b/README-cn.md index 38463c2..a3d31f6 100644 --- a/README-cn.md +++ b/README-cn.md @@ -14,7 +14,7 @@ Demo 项目移到了这里: https://github.com/liaohuqiu/android-cube-app #### 依赖源 -最新版版本号: `1.0.44.17-SNAPSHOT`, 发布到了: `https://oss.sonatype.org/content/repositories/snapshots` +最新版版本号: `1.0.44`, 发布到了: `https://oss.sonatype.org/content/repositories/snapshots` * 在gradle中: @@ -61,7 +61,7 @@ mavenCentral() aar - 1.0.44.17-SNAPSHOT + 1.0.44 ``` @@ -81,7 +81,7 @@ mavenCentral() * gradle / Android Studio, 最新版 ``` -compile 'in.srain.cube:cube-sdk:1.0.44.17-SNAPSHOT@aar' +compile 'in.srain.cube:cube-sdk:1.0.44@aar' ``` * gradle / Android Studio, 稳定版 diff --git a/README.md b/README.md index be981dc..1e11c15 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ http://cube-sdk.liaohuqiu.net #### Repository -The latest version: `1.0.44.17-SNAPSHOT`, has been published to: https://oss.sonatype.org/content/repositories/snapshots, in gradle: +The latest version: `1.0.44`, has been published to: https://oss.sonatype.org/content/repositories/snapshots, in gradle: * gradle @@ -62,7 +62,7 @@ The stable version: `1.0.42`, https://oss.sonatype.org/content/repositories/rele aar - 1.0.44.17-SNAPSHOT + 1.0.44 ``` @@ -82,7 +82,7 @@ The stable version: `1.0.42`, https://oss.sonatype.org/content/repositories/rele * gradle, latest version: ``` -compile 'in.srain.cube:cube-sdk:1.0.44.17-SNAPSHOT@aar' +compile 'in.srain.cube:cube-sdk:1.0.44@aar' ``` * gradle, stable version: diff --git a/core/gradle.properties b/core/gradle.properties index d6c5438..4042a98 100644 --- a/core/gradle.properties +++ b/core/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1.0.44.17-SNAPSHOT +VERSION_NAME=1.0.44 ANDROID_BUILD_MIN_SDK_VERSION=8 ANDROID_BUILD_TARGET_SDK_VERSION=16 diff --git a/core/pom.xml b/core/pom.xml index 3c8c2cb..ea9a907 100755 --- a/core/pom.xml +++ b/core/pom.xml @@ -13,7 +13,7 @@ cube-sdk aar Cube SDK - 1.0.44.17-SNAPSHOT + 1.0.44 diff --git a/core/src/in/srain/cube/image/CubeImageView.java b/core/src/in/srain/cube/image/CubeImageView.java index 7b342d5..5616626 100755 --- a/core/src/in/srain/cube/image/CubeImageView.java +++ b/core/src/in/srain/cube/image/CubeImageView.java @@ -182,6 +182,8 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto private void tryLoadImage() { if (TextUtils.isEmpty(mUrl)) { + setImageDrawable(null); + mImageTask = null; return; } diff --git a/core/src/in/srain/cube/request/JsonData.java b/core/src/in/srain/cube/request/JsonData.java index eb4ce0e..bf3a011 100755 --- a/core/src/in/srain/cube/request/JsonData.java +++ b/core/src/in/srain/cube/request/JsonData.java @@ -12,6 +12,8 @@ public final class JsonData { private Object mJson; private static final String EMPTY_STRING = ""; + private static final JSONArray EMPTY_JSON_ARRAY = new JSONArray(); + private static final JSONObject EMPTY_JSON_OBJECT = new JSONObject(); public static JsonData newMap() { return create(new HashMap()); @@ -145,7 +147,7 @@ public JSONObject optMapOrNew() { if (mJson instanceof JSONObject) { return (JSONObject) mJson; } - return new JSONObject(); + return EMPTY_JSON_OBJECT; } private Object valueForPut(Object value) { @@ -234,7 +236,7 @@ public JSONArray optArrayOrNew() { if (mJson instanceof JSONArray) { return (JSONArray) mJson; } - return new JSONArray(); + return EMPTY_JSON_ARRAY; } public int length() { diff --git a/core/src/in/srain/cube/views/list/ListPageInfo.java b/core/src/in/srain/cube/views/list/ListPageInfo.java index 6e5a9e4..b8f684e 100755 --- a/core/src/in/srain/cube/views/list/ListPageInfo.java +++ b/core/src/in/srain/cube/views/list/ListPageInfo.java @@ -23,6 +23,9 @@ public void updateListInfo(List dataList, int total) { } private void addMore(List dataList) { + if (dataList == null) { + return; + } if (mStart == 0 || mDataList == null) { mDataList = new ArrayList(); } @@ -79,6 +82,11 @@ public boolean isEmpty() { return mDataList == null || mDataList.size() == 0; } + /** + * try to move to next page + * + * @return + */ public boolean nextPage() { if (hasMore()) { mStart += mNumPerPage; @@ -98,6 +106,30 @@ public int getListLength() { return mDataList.size(); } + /** + * the first item in list + * + * @return + */ + public T firstItem() { + if (mDataList == null || mDataList.size() == 0) { + return null; + } + return mDataList.get(0); + } + + /** + * the last item in list + * + * @return + */ + public T lastItem() { + if (mDataList == null || mDataList.size() == 0) { + return null; + } + return mDataList.get(mDataList.size() - 1); + } + public boolean hasMore() { return mDataList == null || mHasMore; } diff --git a/update-project.py b/update-project.py index c95ec92..d542678 100644 --- a/update-project.py +++ b/update-project.py @@ -1,6 +1,6 @@ import os vars = { - 'cube_sdk_version': '1.0.44.17-SNAPSHOT', + 'cube_sdk_version': '1.0.44', 'cube_sdk_stable_version': '1.0.42' }