mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
convert myviewpager and myimageview to kotlin
This commit is contained in:
parent
856913520a
commit
4d324e491e
9 changed files with 63 additions and 69 deletions
|
@ -1,26 +0,0 @@
|
|||
package com.simplemobiletools.gallery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
public class MyImageView extends ImageView {
|
||||
|
||||
public MyImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public MyImageView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public MyImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
setMeasuredDimension(getMeasuredWidth(), getMeasuredWidth());
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
package com.simplemobiletools.gallery;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.booking.rtlviewpager.RtlViewPager;
|
||||
|
||||
public class MyViewPager extends RtlViewPager {
|
||||
|
||||
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,22 @@
|
|||
package com.simplemobiletools.gallery.views
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.widget.ImageView
|
||||
|
||||
class MyImageView : ImageView {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
|
||||
}
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||
setMeasuredDimension(measuredWidth, measuredWidth)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.simplemobiletools.gallery.views
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
|
||||
import com.booking.rtlviewpager.RtlViewPager
|
||||
|
||||
class MyViewPager : RtlViewPager {
|
||||
|
||||
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
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.simplemobiletools.gallery.MyImageView
|
||||
<com.simplemobiletools.gallery.views.MyImageView
|
||||
android:id="@+id/dir_thumbnail"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.simplemobiletools.gallery.MyImageView
|
||||
<com.simplemobiletools.gallery.views.MyImageView
|
||||
android:id="@+id/medium_thumbnail"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.simplemobiletools.gallery.MyViewPager
|
||||
<com.simplemobiletools.gallery.views.MyViewPager
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:foreground="@drawable/selector">
|
||||
|
||||
<com.simplemobiletools.gallery.MyImageView
|
||||
<com.simplemobiletools.gallery.views.MyImageView
|
||||
android:id="@+id/dir_thumbnail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:foreground="@drawable/selector">
|
||||
|
||||
<com.simplemobiletools.gallery.MyImageView
|
||||
<com.simplemobiletools.gallery.views.MyImageView
|
||||
android:id="@+id/medium_thumbnail"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
|
Loading…
Reference in a new issue