Skip to content

Commit

Permalink
修改
Browse files Browse the repository at this point in the history
  • Loading branch information
zhujiang521 committed May 9, 2019
1 parent 25ee286 commit 6b56834
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
2 changes: 0 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'com.hujiang.android-aspectjx'

android {
compileSdkVersion 28
Expand All @@ -30,7 +29,6 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'

implementation 'org.aspectj:aspectjrt:1.8.14'
//安卓Utils
implementation 'com.blankj:utilcode:1.23.6'

Expand Down
1 change: 1 addition & 0 deletions singclick/src/main/java/com/zj/singclick/SingleClick.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.lang.annotation.Target;

/**
* 实现防止按钮连续点击
* @author jiang zhu on 2019/4/19
*/
@Retention(RetentionPolicy.RUNTIME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.lang.reflect.Method;

/**
* 实现防止按钮连续点击
* @author jiang zhu on 2019/4/19
*/
@Aspect
Expand All @@ -22,7 +23,7 @@ public class SingleClickAspect {
* 注意:这里me.baron.test.annotation.SingleClick需要替换成
* 你自己项目中SingleClick这个类的全路径哦
*/
@Pointcut("execution(@zj.it.bhne.androidaop.SingleClick * *(..))")
@Pointcut("execution(@com.zj.singclick.SingleClick * *(..))")
public void methodAnnotated() {}

/**
Expand All @@ -48,6 +49,7 @@ public void aroundJoinPoint(ProceedingJoinPoint joinPoint) throws Throwable {
return;
}
SingleClick singleClick = method.getAnnotation(SingleClick.class);

// 判断是否快速点击
if (!XClickUtil.isFastDoubleClick(view, singleClick.value())) {
// 不是快速点击,执行原方法
Expand Down
4 changes: 2 additions & 2 deletions singclick/src/main/java/com/zj/singclick/XClickUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* @author jiang zhu on 2019/4/19
*/
public final class XClickUtil {
final class XClickUtil {

/**
* 最近一次点击的时间
Expand All @@ -23,7 +23,7 @@ public final class XClickUtil {
* @param intervalMillis 时间间期(毫秒)
* @return true:是,false:不是
*/
public static boolean isFastDoubleClick(View v, long intervalMillis) {
static boolean isFastDoubleClick(View v, long intervalMillis) {
int viewId = v.getId();
long time = System.currentTimeMillis();
long timeInterval = Math.abs(time - mLastClickTime);
Expand Down

0 comments on commit 6b56834

Please sign in to comment.