Use AppCompat classes as base classes

This commit is contained in:
serso 2017-07-11 12:20:35 +02:00
parent 0f81111543
commit fe6e543fb7
4 changed files with 4 additions and 29 deletions

View File

@ -26,11 +26,6 @@ public class DirectionDragButton extends DragButton implements DirectionDragView
init(attrs); init(attrs);
} }
public DirectionDragButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(attrs);
}
private void init(@Nullable AttributeSet attrs) { private void init(@Nullable AttributeSet attrs) {
textView.init(this, attrs); textView.init(this, attrs);
} }

View File

@ -26,11 +26,6 @@ public class DirectionDragImageButton extends DragImageButton implements Directi
init(attrs); init(attrs);
} }
public DirectionDragImageButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init(attrs);
}
private void init(@Nullable AttributeSet attrs) { private void init(@Nullable AttributeSet attrs) {
final TextView view = new TextView(getContext(), attrs); final TextView view = new TextView(getContext(), attrs);
textView.init(this, attrs, view.getPaint()); textView.init(this, attrs, view.getPaint());

View File

@ -1,15 +1,13 @@
package org.solovyev.android.views.dragbutton; package org.solovyev.android.views.dragbutton;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatButton;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.widget.Button;
public abstract class DragButton extends Button implements DragView { public abstract class DragButton extends AppCompatButton implements DragView {
@NonNull @NonNull
private final DragGestureDetector dragDetector = new DragGestureDetector(this); private final DragGestureDetector dragDetector = new DragGestureDetector(this);
@ -25,11 +23,6 @@ public abstract class DragButton extends Button implements DragView {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public DragButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
if (dragDetector.onTouchEvent(event)) { if (dragDetector.onTouchEvent(event)) {

View File

@ -1,15 +1,13 @@
package org.solovyev.android.views.dragbutton; package org.solovyev.android.views.dragbutton;
import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatImageButton;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.widget.ImageButton;
public abstract class DragImageButton extends ImageButton implements DragView { public abstract class DragImageButton extends AppCompatImageButton implements DragView {
@NonNull @NonNull
private final DragGestureDetector dragDetector = new DragGestureDetector(this); private final DragGestureDetector dragDetector = new DragGestureDetector(this);
@ -25,12 +23,6 @@ public abstract class DragImageButton extends ImageButton implements DragView {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
} }
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public DragImageButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
if (dragDetector.onTouchEvent(event)) { if (dragDetector.onTouchEvent(event)) {