This commit is contained in:
zhongchao
2022-11-10 16:54:26 +08:00
parent 5322d03ec1
commit 2156d2cd18
148 changed files with 147 additions and 19811 deletions

View File

@@ -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 );
}

View File

@@ -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;
}
}