convert MyViewPager to kotlin
This commit is contained in:
parent
e82c056289
commit
2d1c5985be
|
@ -1,38 +0,0 @@
|
|||
package com.simplemobiletools.calendar.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
// we are creating a custom viewpager just to fix "pointerIndex out of range" exception at onInterceptTouchEvent
|
||||
public class MyViewPager extends ViewPager {
|
||||
|
||||
public MyViewPager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MyViewPager(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
try {
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
try {
|
||||
return super.onTouchEvent(ev);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.simplemobiletools.calendar.views
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v4.view.ViewPager
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
|
||||
// we are creating a custom viewpager just to fix "pointerIndex out of range" exception at onInterceptTouchEvent
|
||||
class MyViewPager : ViewPager {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
try {
|
||||
return super.onInterceptTouchEvent(ev)
|
||||
} catch (ex: IllegalArgumentException) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onTouchEvent(ev: MotionEvent): Boolean {
|
||||
try {
|
||||
return super.onTouchEvent(ev)
|
||||
} catch (ex: IllegalArgumentException) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue