Skip to content

Commit

Permalink
更新工具类
Browse files Browse the repository at this point in the history
  • Loading branch information
秋逸 committed Jul 2, 2018
1 parent e54b6cd commit 94a1c31
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions RxKit/src/main/java/com/vondear/rxtool/RxConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
*/

public class RxConstants {

public final static int FAST_CLICK_TIME = 100;

public final static int VIBRATE_TIME = 100;

//----------------------------------------------------常用链接- start ------------------------------------------------------------

/**
Expand Down
12 changes: 12 additions & 0 deletions RxKit/src/main/java/com/vondear/rxtool/RxTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import android.widget.ListView;
import android.widget.TextView;

import com.vondear.rxtool.interfaces.OnDoListener;
import com.vondear.rxtool.interfaces.OnSimpleListener;
import com.vondear.rxtool.view.RxToast;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
Expand Down Expand Up @@ -350,4 +352,14 @@ public static Handler getBackgroundHandler() {
thread.start();
return new Handler(thread.getLooper());
}

public static void initFastClickAndVibrate(Context mContext, OnDoListener onRxSimple) {
if (RxTool.isFastClick(RxConstants.FAST_CLICK_TIME)) {
RxToast.normal("请不要重复点击");
return;
} else {
RxVibrateTool.vibrateOnce(mContext, RxConstants.VIBRATE_TIME);
onRxSimple.doSomething();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.vondear.rxtool.interfaces;

/**
* @author Vondear
* @date 2018/7/2
*/
public interface OnDoListener {

void doSomething();

}

0 comments on commit 94a1c31

Please sign in to comment.