mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Lint - Custom Widgets extend Appcompat Widgets.
This commit is contained in:
parent
9445555d66
commit
88dac70087
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user