From f96a5b97bc5efb1bfc1bf765c60bcd0b9b0541a8 Mon Sep 17 00:00:00 2001 From: dumchev Date: Tue, 28 Aug 2018 16:29:53 +0300 Subject: [PATCH] add null-safety; update readme --- README.md | 4 ++-- .../example/delegateadapter/delegate/BaseDelegateAdapter.java | 2 +- .../delegateadapter/delegate/CompositeDelegateAdapter.java | 2 +- .../example/delegateadapter/delegate/IDelegateAdapter.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a70955e..bed039b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This lib is inspired by Hannes Dorfmann [AdapterDelegates](https://github.com/so for java: ```groovy -compile 'com.github.liverm0r:delegateadapters:v1.11' +implementation 'com.github.liverm0r:delegateadapters:v1.11' ``` for kotlin: @@ -19,7 +19,7 @@ android { experimental = true } } -compile 'com.github.liverm0r:delegateadapters:v2.0' +implementation 'com.github.liverm0r:delegateadapters:v2.0' ``` You also have to add this in your project build.gradle diff --git a/delegateadapter/src/main/java/com/example/delegateadapter/delegate/BaseDelegateAdapter.java b/delegateadapter/src/main/java/com/example/delegateadapter/delegate/BaseDelegateAdapter.java index b57c85c..bf415b4 100644 --- a/delegateadapter/src/main/java/com/example/delegateadapter/delegate/BaseDelegateAdapter.java +++ b/delegateadapter/src/main/java/com/example/delegateadapter/delegate/BaseDelegateAdapter.java @@ -28,7 +28,7 @@ abstract protected void onBindViewHolder(@NonNull View view, abstract protected VH createViewHolder(View parent); @Override - public void onRecycled(VH holder) { + public void onRecycled(@NonNull VH holder) { } @NonNull diff --git a/delegateadapter/src/main/java/com/example/delegateadapter/delegate/CompositeDelegateAdapter.java b/delegateadapter/src/main/java/com/example/delegateadapter/delegate/CompositeDelegateAdapter.java index 78d6e5e..48aa47b 100644 --- a/delegateadapter/src/main/java/com/example/delegateadapter/delegate/CompositeDelegateAdapter.java +++ b/delegateadapter/src/main/java/com/example/delegateadapter/delegate/CompositeDelegateAdapter.java @@ -52,7 +52,7 @@ public final void onBindViewHolder(RecyclerView.ViewHolder holder, int position) } @Override - public void onViewRecycled(RecyclerView.ViewHolder holder) { + public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) { //noinspection unchecked typeToAdapterMap.get(holder.getItemViewType()).onRecycled(holder); } diff --git a/delegateadapter/src/main/java/com/example/delegateadapter/delegate/IDelegateAdapter.java b/delegateadapter/src/main/java/com/example/delegateadapter/delegate/IDelegateAdapter.java index 7c4c1e3..44e6921 100644 --- a/delegateadapter/src/main/java/com/example/delegateadapter/delegate/IDelegateAdapter.java +++ b/delegateadapter/src/main/java/com/example/delegateadapter/delegate/IDelegateAdapter.java @@ -18,7 +18,7 @@ void onBindViewHolder(@NonNull VH holder, @NonNull List items, int position); - void onRecycled(VH holder); + void onRecycled(@NonNull VH holder); boolean isForViewType(@NonNull List items, int position); }