diff --git a/src/org/thoughtcrime/securesms/components/CircleColorImageView.java b/src/org/thoughtcrime/securesms/components/CircleColorImageView.java index 179c80aec4..1bb04a48bf 100644 --- a/src/org/thoughtcrime/securesms/components/CircleColorImageView.java +++ b/src/org/thoughtcrime/securesms/components/CircleColorImageView.java @@ -3,15 +3,14 @@ package org.thoughtcrime.securesms.components; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; -import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; +import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; -import android.widget.ImageView; import org.thoughtcrime.securesms.R; -public class CircleColorImageView extends ImageView { +public class CircleColorImageView extends AppCompatImageView { public CircleColorImageView(Context context) { this(context, null); diff --git a/src/org/thoughtcrime/securesms/components/ImageDivet.java b/src/org/thoughtcrime/securesms/components/ImageDivet.java index 770226b835..51f615989f 100644 --- a/src/org/thoughtcrime/securesms/components/ImageDivet.java +++ b/src/org/thoughtcrime/securesms/components/ImageDivet.java @@ -4,12 +4,12 @@ import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.drawable.Drawable; +import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; -import android.widget.ImageView; import org.thoughtcrime.securesms.R; -public class ImageDivet extends ImageView { +public class ImageDivet extends AppCompatImageView { private static final float CORNER_OFFSET = 12F; private static final String[] POSITIONS = new String[] {"bottom_right"}; @@ -84,10 +84,6 @@ public class ImageDivet extends ImageView { return CORNER_OFFSET * density; } - public ImageView asImageView() { - return this; - } - public float getFarOffset() { return getCloseOffset() + drawableIntrinsicHeight; } diff --git a/src/org/thoughtcrime/securesms/components/RepeatableImageKey.java b/src/org/thoughtcrime/securesms/components/RepeatableImageKey.java index 602db3d9f9..5cf63cfe73 100644 --- a/src/org/thoughtcrime/securesms/components/RepeatableImageKey.java +++ b/src/org/thoughtcrime/securesms/components/RepeatableImageKey.java @@ -1,19 +1,14 @@ package org.thoughtcrime.securesms.components; -import android.annotation.TargetApi; import android.content.Context; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; +import android.support.v7.widget.AppCompatImageButton; import android.util.AttributeSet; import android.view.HapticFeedbackConstants; -import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; -import android.widget.EditText; -import android.widget.ImageButton; -public class RepeatableImageKey extends ImageButton { +public class RepeatableImageKey extends AppCompatImageButton { private KeyEventListener listener; @@ -32,14 +27,6 @@ public class RepeatableImageKey extends ImageButton { init(); } - @TargetApi(VERSION_CODES.LOLLIPOP) - public RepeatableImageKey(Context context, AttributeSet attrs, int defStyleAttr, - int defStyleRes) - { - super(context, attrs, defStyleAttr, defStyleRes); - init(); - } - private void init() { setOnClickListener(new RepeaterClickListener()); setOnTouchListener(new RepeaterTouchListener()); @@ -60,31 +47,25 @@ public class RepeatableImageKey extends ImageButton { } private class Repeater implements Runnable { - @TargetApi(VERSION_CODES.HONEYCOMB_MR1) @Override public void run() { notifyListener(); - postDelayed(this, VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB_MR1 - ? ViewConfiguration.getKeyRepeatDelay() - : 50); + postDelayed(this, ViewConfiguration.getKeyRepeatDelay()); } } private class RepeaterTouchListener implements OnTouchListener { - private Repeater repeater; + private final Repeater repeater; - public RepeaterTouchListener() { + RepeaterTouchListener() { this.repeater = new Repeater(); } - @TargetApi(VERSION_CODES.HONEYCOMB_MR1) @Override public boolean onTouch(View view, MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_DOWN: - view.postDelayed(repeater, VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB_MR1 - ? ViewConfiguration.getKeyRepeatTimeout() - : ViewConfiguration.getLongPressTimeout()); + view.postDelayed(repeater, ViewConfiguration.getKeyRepeatTimeout()); performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); return false; case MotionEvent.ACTION_CANCEL: diff --git a/src/org/thoughtcrime/securesms/components/SendButton.java b/src/org/thoughtcrime/securesms/components/SendButton.java index 7d15791899..476b99fa59 100644 --- a/src/org/thoughtcrime/securesms/components/SendButton.java +++ b/src/org/thoughtcrime/securesms/components/SendButton.java @@ -2,9 +2,9 @@ package org.thoughtcrime.securesms.components; import android.content.Context; import android.support.annotation.NonNull; +import android.support.v7.widget.AppCompatImageButton; import android.util.AttributeSet; import android.view.View; -import android.widget.ImageButton; import org.thoughtcrime.securesms.TransportOption; import org.thoughtcrime.securesms.TransportOptions; @@ -13,7 +13,7 @@ import org.thoughtcrime.securesms.TransportOptionsPopup; import org.thoughtcrime.securesms.util.ViewUtil; import org.whispersystems.libsignal.util.guava.Optional; -public class SendButton extends ImageButton +public class SendButton extends AppCompatImageButton implements TransportOptions.OnTransportChangedListener, TransportOptionsPopup.SelectedListener, View.OnLongClickListener diff --git a/src/org/thoughtcrime/securesms/components/SquareImageView.java b/src/org/thoughtcrime/securesms/components/SquareImageView.java index 57ba997203..997349d699 100644 --- a/src/org/thoughtcrime/securesms/components/SquareImageView.java +++ b/src/org/thoughtcrime/securesms/components/SquareImageView.java @@ -1,12 +1,10 @@ package org.thoughtcrime.securesms.components; -import android.annotation.TargetApi; import android.content.Context; -import android.os.Build; +import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; -import android.widget.ImageView; -public class SquareImageView extends ImageView { +public class SquareImageView extends AppCompatImageView { public SquareImageView(Context context) { super(context); } @@ -19,13 +17,9 @@ public class SquareImageView extends ImageView { super(context, attrs, defStyleAttr); } - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public SquareImageView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + //noinspection SuspiciousNameCombination super.onMeasure(widthMeasureSpec, widthMeasureSpec); } } diff --git a/src/org/thoughtcrime/securesms/components/emoji/EmojiToggle.java b/src/org/thoughtcrime/securesms/components/emoji/EmojiToggle.java index 5ffeb9b8ac..d0db467a39 100644 --- a/src/org/thoughtcrime/securesms/components/emoji/EmojiToggle.java +++ b/src/org/thoughtcrime/securesms/components/emoji/EmojiToggle.java @@ -1,16 +1,15 @@ package org.thoughtcrime.securesms.components.emoji; - import android.content.Context; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; +import android.support.v7.widget.AppCompatImageButton; import android.util.AttributeSet; -import android.widget.ImageButton; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.components.emoji.EmojiDrawer.EmojiDrawerListener; -public class EmojiToggle extends ImageButton implements EmojiDrawerListener { +public class EmojiToggle extends AppCompatImageButton implements EmojiDrawerListener { private Drawable emojiToggle; private Drawable imeToggle; diff --git a/src/org/thoughtcrime/securesms/giph/ui/AspectRatioImageView.java b/src/org/thoughtcrime/securesms/giph/ui/AspectRatioImageView.java index a1ce36e23d..3a7c746821 100644 --- a/src/org/thoughtcrime/securesms/giph/ui/AspectRatioImageView.java +++ b/src/org/thoughtcrime/securesms/giph/ui/AspectRatioImageView.java @@ -18,15 +18,14 @@ package org.thoughtcrime.securesms.giph.ui; import android.content.Context; +import android.support.v7.widget.AppCompatImageView; import android.util.AttributeSet; -import android.widget.ImageView; - /** * AspectRatioImageView maintains an aspect ratio by adjusting the width or height dimension. The * aspect ratio (width to height ratio) and adjustment dimension can be configured. */ -public class AspectRatioImageView extends ImageView { +public class AspectRatioImageView extends AppCompatImageView { private static final float DEFAULT_ASPECT_RATIO = 1.0f; private static final int DEFAULT_ADJUST_DIMENSION = 0;