From caf510c998add48762e27e6f0ba9ffbad38a04c7 Mon Sep 17 00:00:00 2001 From: Zhanty Date: Thu, 1 Aug 2019 20:51:16 +0800 Subject: [PATCH] optimize --- config/repository.gradle | 2 +- .../android/base/interfaces/OnItemClickListener.java | 11 ++++------- .../base/interfaces/OnItemLongClickListener.java | 9 ++------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/config/repository.gradle b/config/repository.gradle index 4e64a2d..e2eb71c 100644 --- a/config/repository.gradle +++ b/config/repository.gradle @@ -260,7 +260,7 @@ static Repository innerNewRepository() { photoView : 'com.github.chrisbanes:PhotoView:2.1.3', //https://github.com/davemorrissey/subsampling-scale-image-view subsamplingScaleImageView: 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0', - //https://github.com/vinc3m1/RoundedImageView + //https://github.com/hdodenhof/CircleImageView circleImageView : 'de.hdodenhof:circleimageview:2.1.0', //https://github.com/vinc3m1/RoundedImageView roundedImageView : 'com.makeramen:roundedimageview:2.3.0', diff --git a/lib_base/src/main/java/com/android/base/interfaces/OnItemClickListener.java b/lib_base/src/main/java/com/android/base/interfaces/OnItemClickListener.java index 1ba71b8..6bb7937 100644 --- a/lib_base/src/main/java/com/android/base/interfaces/OnItemClickListener.java +++ b/lib_base/src/main/java/com/android/base/interfaces/OnItemClickListener.java @@ -1,9 +1,8 @@ package com.android.base.interfaces; +import android.support.annotation.NonNull; import android.view.View; -import timber.log.Timber; - public abstract class OnItemClickListener implements View.OnClickListener { @@ -12,13 +11,11 @@ public abstract class OnItemClickListener implements View.OnClickListener { public final void onClick(View v) { Object tag = v.getTag(); if (tag == null) { - Timber.w("OnItemClickListener tag is null , view = " + v); - return; + throw new NullPointerException("OnItemClickListener --> no tag found"); } onClick(v, (T) tag); } - public abstract void onClick(View view, T t); - + public abstract void onClick(@NonNull View view, @NonNull T t); -} +} \ No newline at end of file diff --git a/lib_base/src/main/java/com/android/base/interfaces/OnItemLongClickListener.java b/lib_base/src/main/java/com/android/base/interfaces/OnItemLongClickListener.java index d1fb782..bc9bfea 100644 --- a/lib_base/src/main/java/com/android/base/interfaces/OnItemLongClickListener.java +++ b/lib_base/src/main/java/com/android/base/interfaces/OnItemLongClickListener.java @@ -2,9 +2,6 @@ package com.android.base.interfaces; import android.view.View; -import timber.log.Timber; - - public abstract class OnItemLongClickListener implements View.OnLongClickListener { @@ -13,13 +10,11 @@ public abstract class OnItemLongClickListener implements View.OnLongClickList public final boolean onLongClick(View v) { Object tag = v.getTag(); if (tag == null) { - Timber.w("OnItemLongClickListener tag is null , view = " + v); - return false; + throw new NullPointerException("OnItemLongClickListener --> no tag found"); } return onClick(v, (T) tag); } public abstract boolean onClick(View view, T t); - -} +} \ No newline at end of file