wait
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.mogo.eagle.core.utilcode.mogo.view;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public abstract class OnPreventFastClickListener implements View.OnClickListener {
|
||||
|
||||
public static final long INTERVAL = 1_000L;
|
||||
|
||||
private final long mInterval;
|
||||
private long mLastClickTime = 0L;
|
||||
|
||||
public OnPreventFastClickListener() {
|
||||
this( INTERVAL );
|
||||
}
|
||||
|
||||
public OnPreventFastClickListener( long interval ) {
|
||||
if ( interval < 0L ) {
|
||||
interval = INTERVAL;
|
||||
}
|
||||
this.mInterval = interval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onClick( View v ) {
|
||||
if ( System.currentTimeMillis() - mLastClickTime > mInterval ) {
|
||||
onClickImpl( v );
|
||||
mLastClickTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onClickImpl( View v );
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.eagle.core.utilcode.mogo.view;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* 这是LinearLayoutManager设置Item间距的的一个辅助类
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
|
||||
private final int space;
|
||||
|
||||
public SpacesItemDecoration(int space) {
|
||||
this.space = space;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view,
|
||||
RecyclerView parent, RecyclerView.State state) {
|
||||
outRect.bottom = space;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user