提交 4625d7e8 编写于 作者: B Blankj

see 06/20 log

上级 3bc96042
* `19/06/20` [fix] BusUtils' permission. Publish v1.24.4.
* `19/06/19` [fix] UriUtils. Publish v1.24.3. * `19/06/19` [fix] UriUtils. Publish v1.24.3.
* `19/06/18` [add] ClickUtils, ViewUtils. * `19/06/18` [add] ClickUtils, ViewUtils.
* `19/06/07` [fix] LogUtils file name contains ':'. Publish v1.24.2. * `19/06/07` [fix] LogUtils file name contains ':'. Publish v1.24.2.
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png [logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.24.3-brightgreen.svg [aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.24.4-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode [auc]: https://github.com/Blankj/AndroidUtilCode
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg [apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
...@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen ...@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png [logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.24.3-brightgreen.svg [aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.24.4-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode [auc]: https://github.com/Blankj/AndroidUtilCode
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg [apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
...@@ -8,8 +8,8 @@ gradle.ext { ...@@ -8,8 +8,8 @@ gradle.ext {
compileSdkVersion = 27 compileSdkVersion = 27
minSdkVersion = 14 minSdkVersion = 14
targetSdkVersion = 27 targetSdkVersion = 27
versionCode = 1_024_003 versionCode = 1_024_004
versionName = '1.24.3'// E.g. 1.9.72 => 1,009,072 versionName = '1.24.4'// E.g. 1.9.72 => 1,009,072
// lib version // lib version
kotlin_version = '1.3.10' kotlin_version = '1.3.10'
......
...@@ -4,7 +4,6 @@ import android.content.Context; ...@@ -4,7 +4,6 @@ import android.content.Context;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import java.util.List; import java.util.List;
...@@ -39,19 +38,8 @@ public class BaseAdapter<Cell extends BaseCell> extends RecyclerView.Adapter<Bas ...@@ -39,19 +38,8 @@ public class BaseAdapter<Cell extends BaseCell> extends RecyclerView.Adapter<Bas
@NonNull @NonNull
@Override @Override
public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { public BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if (mContext == null) { BaseViewHolder baseViewHolder = Cell.onCreateViewHolder(parent, viewType);
mContext = parent.getContext(); return baseViewHolder;
mInflater = LayoutInflater.from(mContext);
}
int layoutByType = BaseCell.getLayoutByType(viewType);
if (layoutByType != -1) {
return new BaseViewHolder(mInflater.inflate(layoutByType, parent, false));
}
View viewByType = BaseCell.getViewByType(viewType);
if (viewByType != null) {
return new BaseViewHolder(viewByType);
}
throw new RuntimeException("onCreateViewHolder: get holder from view type failed.");
} }
@Override @Override
...@@ -61,6 +49,7 @@ public class BaseAdapter<Cell extends BaseCell> extends RecyclerView.Adapter<Bas ...@@ -61,6 +49,7 @@ public class BaseAdapter<Cell extends BaseCell> extends RecyclerView.Adapter<Bas
@Override @Override
public int getItemCount() { public int getItemCount() {
if (mData == null) return 0;
return mData.size(); return mData.size();
} }
......
...@@ -3,7 +3,9 @@ package com.blankj.lib.base.rv; ...@@ -3,7 +3,9 @@ package com.blankj.lib.base.rv;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.util.SparseArray; import android.util.SparseArray;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
/** /**
* <pre> * <pre>
...@@ -42,4 +44,16 @@ public abstract class BaseCell { ...@@ -42,4 +44,16 @@ public abstract class BaseCell {
viewType = getClass().hashCode(); viewType = getClass().hashCode();
VIEW_SPARSE_ARRAY.put(viewType, view); VIEW_SPARSE_ARRAY.put(viewType, view);
} }
public static BaseViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
int layoutByType = getLayoutByType(viewType);
if (layoutByType != -1) {
return new BaseViewHolder(LayoutInflater.from(parent.getContext()).inflate(layoutByType, parent, false));
}
View viewByType = getViewByType(viewType);
if (viewByType != null) {
return new BaseViewHolder(viewByType);
}
throw new RuntimeException("onCreateViewHolder: get holder from view type failed.");
}
} }
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
Gradle: Gradle:
```groovy ```groovy
implementation 'com.blankj:utilcode:1.24.3' implementation 'com.blankj:utilcode:1.24.4'
// if u use AndroidX, use the following // if u use AndroidX, use the following
implementation 'com.blankj:utilcodex:1.24.3' implementation 'com.blankj:utilcodex:1.24.4'
``` ```
...@@ -41,11 +41,6 @@ pt2Px : pt 转 px ...@@ -41,11 +41,6 @@ pt2Px : pt 转 px
px2Pt : px 转 pt px2Pt : px 转 pt
``` ```
* ### AntiShake 相关 -> [AntiShakeUtils.java][antiShake.java]
```
isValid: 是否有效
```
* ### App 相关 -> [AppUtils.java][app.java] -> [Demo][app.demo] * ### App 相关 -> [AppUtils.java][app.java] -> [Demo][app.demo]
``` ```
registerAppStatusChangedListener : 注册 App 前后台切换监听器 registerAppStatusChangedListener : 注册 App 前后台切换监听器
...@@ -976,8 +971,6 @@ getComments : 获取压缩文件中的注释链表 ...@@ -976,8 +971,6 @@ getComments : 获取压缩文件中的注释链表
[adaptScreen.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AdaptScreenUtils.java [adaptScreen.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AdaptScreenUtils.java
[adaptScreen.demo]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/adaptScreen/AdaptScreenActivity.kt [adaptScreen.demo]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/adaptScreen/AdaptScreenActivity.kt
[antiShake.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AntiShakeUtils.java
[app.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AppUtils.java [app.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AppUtils.java
[app.demo]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/app/AppActivity.kt [app.demo]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/app/AppActivity.kt
......
...@@ -27,7 +27,7 @@ apply plugin: "com.blankj.bus" ...@@ -27,7 +27,7 @@ apply plugin: "com.blankj.bus"
给 base 模块添加 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 依赖: 给 base 模块添加 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 依赖:
```groovy ```groovy
api "com.blankj:utilcode:1.24.3" api "com.blankj:utilcode:1.24.4"
``` ```
比如 module0 中存在的 `Module0Activity.java`,我们通常都是在它内部写一个 `start` 函数来启动它,现在我们给它添加 `@BusUtils.Subscribe` 注解,并给注解的 `name` 赋唯一值,要注意,函数务必要 `public static` 哦: 比如 module0 中存在的 `Module0Activity.java`,我们通常都是在它内部写一个 `start` 函数来启动它,现在我们给它添加 `@BusUtils.Subscribe` 注解,并给注解的 `name` 赋唯一值,要注意,函数务必要 `public static` 哦:
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
Gradle: Gradle:
```groovy ```groovy
implementation 'com.blankj:utilcode:1.24.3' implementation 'com.blankj:utilcode:1.24.4'
// if u use AndroidX, use the following // if u use AndroidX, use the following
implementation 'com.blankj:utilcodex:1.24.3' implementation 'com.blankj:utilcodex:1.24.4'
``` ```
...@@ -41,11 +41,6 @@ pt2Px ...@@ -41,11 +41,6 @@ pt2Px
px2Pt px2Pt
``` ```
* ### About AntiShake -> [AntiShakeUtils.java][antiShake.java]
```
isValid
```
* ### About App -> [AppUtils.java][app.java] -> [Demo][app.demo] * ### About App -> [AppUtils.java][app.java] -> [Demo][app.demo]
``` ```
registerAppStatusChangedListener registerAppStatusChangedListener
...@@ -976,8 +971,6 @@ getComments ...@@ -976,8 +971,6 @@ getComments
[adaptScreen.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AdaptScreenUtils.java [adaptScreen.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AdaptScreenUtils.java
[adaptScreen.demo]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/adaptScreen/AdaptScreenActivity.kt [adaptScreen.demo]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/adaptScreen/AdaptScreenActivity.kt
[antiShake.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AntiShakeUtils.java
[app.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AppUtils.java [app.java]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/lib/src/main/java/com/blankj/utilcode/util/AppUtils.java
[app.demo]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/app/AppActivity.kt [app.demo]: https://github.com/Blankj/AndroidUtilCode/blob/master/utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/app/AppActivity.kt
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.blankj.utilcode"> package="com.blankj.utilcode">
<permission android:name="com.blankj.utilcode.util.bus" />
<application> <application>
<activity <activity
...@@ -23,9 +21,7 @@ ...@@ -23,9 +21,7 @@
android:resource="@xml/util_code_provider_paths" /> android:resource="@xml/util_code_provider_paths" />
</provider> </provider>
<service <service android:name="com.blankj.utilcode.util.BusUtils$ServerService">
android:name="com.blankj.utilcode.util.BusUtils$ServerService"
android:permission="com.blankj.utilcode.util.bus">
<intent-filter> <intent-filter>
<action android:name="${applicationId}.messenger" /> <action android:name="${applicationId}.messenger" />
</intent-filter> </intent-filter>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" <!--<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"-->
android:id="@+id/imageRv" <!--android:layout_width="match_parent"-->
android:layout_width="match_parent" <!--android:layout_height="match_parent">-->
android:layout_height="match_parent"
android:padding="@dimen/spacing_16" /> <!--<LinearLayout-->
\ No newline at end of file <!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="vertical">-->
<android.support.v7.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/imageRv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fadeScrollbars="false"
android:padding="@dimen/spacing_16"
android:scrollbarSize="6dp"
android:scrollbarStyle="outsideOverlay"
android:scrollbarThumbVertical="@color/light_black"
android:scrollbars="vertical"
android:translationZ="-8dp" />
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="40dp"-->
<!--android:background="@color/light_black">-->
<!--</LinearLayout>-->
<!--</LinearLayout>-->
<!--</ScrollView>-->
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册