은 (@azizbekian 응답) 변환 된 자바 코드입니다. 변환 된 자바 코드를 복사 한 다음 도구 -> Kotlin-> 쇼 코 틀린 바이트 코드는 디 컴파일 버튼을 누르면, 안드로이드 스튜디오에서 열기 코 틀린 파일 -
public final class MyRecyclerView extends RecyclerView {
private boolean isValid;
private int x;
private int y;
private final int delta;
public boolean onTouchEvent(@Nullable MotionEvent e) {
boolean onTouchEvent = super.onTouchEvent(e);
Integer var3 = e != null?Integer.valueOf(e.getAction()):null;
boolean var4 = false;
if(var3 != null) {
if(var3.intValue() == 0) {
this.x = (int)e.getRawX();
this.y = (int)e.getRawY();
this.isValid = true;
return onTouchEvent;
}
}
byte var5 = 2;
if(var3 != null) {
if(var3.intValue() == var5) {
if(Math.abs(e.getRawX() - (float)this.x) > (float)this.delta || Math.abs(e.getRawY() - (float)this.y) > (float)this.delta) {
this.isValid = false;
}
return onTouchEvent;
}
}
var5 = 1;
if(var3 != null) {
if(var3.intValue() == var5 && this.isValid && Math.abs(e.getRawX() - (float)this.x) < (float)this.delta && Math.abs(e.getRawY() - (float)this.y) < (float)this.delta && this.isInRightArea(e)) {
this.performClick();
}
}
return onTouchEvent;
}
private final boolean isInRightArea(MotionEvent e) {
Rect r = new Rect();
this.getGlobalVisibleRect(r);
r.left = this.getPaddingLeft();
r.top += this.getPaddingTop();
return !r.contains((int)e.getRawX(), (int)e.getRawY());
}
@JvmOverloads
public MyRecyclerView(@NotNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
Intrinsics.checkParameterIsNotNull(context, "context");
super(context, attrs, defStyleAttr);
ViewConfiguration var10001 = ViewConfiguration.get(this.getContext());
Intrinsics.checkExpressionValueIsNotNull(var10001, "ViewConfiguration.get(getContext())");
this.delta = var10001.getScaledTouchSlop();
}
// $FF: synthetic method
@JvmOverloads
public MyRecyclerView(Context var1, AttributeSet var2, int var3, int var4, DefaultConstructorMarker var5) {
if((var4 & 2) != 0) {
var2 = (AttributeSet)null;
}
if((var4 & 4) != 0) {
var3 = 0;
}
this(var1, var2, var3);
}
@JvmOverloads
public MyRecyclerView(@NotNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0, 4, (DefaultConstructorMarker)null);
}
@JvmOverloads
public MyRecyclerView(@NotNull Context context) {
this(context, (AttributeSet)null, 0, 6, (DefaultConstructorMarker)null);
}
}
이것은 자바에 코 틀린 코드를 변환 할 수있는 방법이다.
코드를 보여주세요. – HassanUsman
어떤 코드를보고 싶습니까? –
ur recyclerview 어댑터에는 글로벌 클릭 수신기와 아이템 클릭 수신기가 있어야합니다. 자세한 내용은 우편 번호 –