Dialer: Replace widgets with their AppCompat variants
Change-Id: I83253cf2bb691ae57ca0851bd3e6ac5535feb232
diff --git a/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java b/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java
index d84d8f7..4238815 100644
--- a/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java
+++ b/java/com/android/contacts/common/widget/LayoutSuppressingImageView.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,22 +17,25 @@
package com.android.contacts.common.widget;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
-import android.widget.ImageView;
+
+import androidx.appcompat.widget.AppCompatImageView;
/**
- * Custom {@link ImageView} that improves layouting performance.
+ * Custom {@link AppCompatImageView} that improves layouting performance.
*
* <p>This improves the performance by not passing requestLayout() to its parent, taking advantage
* of knowing that image size won't change once set.
*/
-public class LayoutSuppressingImageView extends ImageView {
+public class LayoutSuppressingImageView extends AppCompatImageView {
public LayoutSuppressingImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
+ @SuppressLint("MissingSuperCall")
@Override
public void requestLayout() {
forceLayout();
diff --git a/java/com/android/dialer/voicemail/settings/RecordButton.java b/java/com/android/dialer/voicemail/settings/RecordButton.java
index 6c9a954..6409dd4 100644
--- a/java/com/android/dialer/voicemail/settings/RecordButton.java
+++ b/java/com/android/dialer/voicemail/settings/RecordButton.java
@@ -26,15 +26,15 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
-import android.widget.Button;
+import androidx.appcompat.widget.AppCompatButton;
import androidx.core.content.ContextCompat;
import com.android.dialer.R;
import com.android.dialer.voicemail.settings.RecordVoicemailGreetingActivity.ButtonState;
/** Custom Button View for Dialer voicemail greeting recording */
-public class RecordButton extends Button {
+public class RecordButton extends AppCompatButton {
private final float trackWidth = getResources().getDimensionPixelSize(R.dimen.track_width);
private final int centerIconRadius =
diff --git a/java/com/android/dialer/widget/BidiTextView.java b/java/com/android/dialer/widget/BidiTextView.java
index ab1cdff..4d4a990 100644
--- a/java/com/android/dialer/widget/BidiTextView.java
+++ b/java/com/android/dialer/widget/BidiTextView.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +19,14 @@
import android.content.Context;
import android.util.AttributeSet;
-import android.widget.TextView;
import androidx.annotation.Nullable;
+import androidx.appcompat.widget.AppCompatTextView;
import com.android.dialer.i18n.DialerBidiFormatter;
-/** A {@link TextView} that applies bidirectional formatting to its text. */
-public final class BidiTextView extends TextView {
+/** An {@link AppCompatTextView} that applies bidirectional formatting to its text. */
+public final class BidiTextView extends AppCompatTextView {
public BidiTextView(Context context) {
super(context);
diff --git a/java/com/android/dialer/widget/ResizingTextEditText.java b/java/com/android/dialer/widget/ResizingTextEditText.java
index 16b7552..a00638d 100644
--- a/java/com/android/dialer/widget/ResizingTextEditText.java
+++ b/java/com/android/dialer/widget/ResizingTextEditText.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,11 +20,13 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
-import android.widget.EditText;
+
+import androidx.appcompat.widget.AppCompatEditText;
+
import com.android.dialer.util.ViewUtil;
/** EditText which resizes dynamically with respect to text length. */
-public class ResizingTextEditText extends EditText {
+public class ResizingTextEditText extends AppCompatEditText {
private final int originalTextSize;
private final int minTextSize;
diff --git a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
index 133e714..c6a5b71 100644
--- a/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
+++ b/java/com/android/incallui/answer/impl/affordance/SwipeButtonView.java
@@ -32,16 +32,16 @@
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.animation.Interpolator;
-import android.widget.ImageView;
import androidx.annotation.Nullable;
+import androidx.appcompat.widget.AppCompatImageView;
import com.android.dialer.R;
import com.android.incallui.answer.impl.utils.FlingAnimationUtils;
import com.android.incallui.answer.impl.utils.Interpolators;
/** Button that allows swiping to trigger */
-public class SwipeButtonView extends ImageView {
+public class SwipeButtonView extends AppCompatImageView {
private static final long CIRCLE_APPEAR_DURATION = 80;
private static final long CIRCLE_DISAPPEAR_MAX_DURATION = 200;
@@ -112,11 +112,7 @@
}
public SwipeButtonView(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public SwipeButtonView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
+ super(context, attrs, defStyleAttr);
circlePaint = new Paint();
circlePaint.setAntiAlias(true);
circleColor = 0xffffffff;
diff --git a/java/com/android/incallui/autoresizetext/AutoResizeTextView.java b/java/com/android/incallui/autoresizetext/AutoResizeTextView.java
index 1709103..7784ce6 100644
--- a/java/com/android/incallui/autoresizetext/AutoResizeTextView.java
+++ b/java/com/android/incallui/autoresizetext/AutoResizeTextView.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,9 +27,9 @@
import android.util.DisplayMetrics;
import android.util.SparseIntArray;
import android.util.TypedValue;
-import android.widget.TextView;
import androidx.annotation.Nullable;
+import androidx.appcompat.widget.AppCompatTextView;
import com.android.dialer.R;
@@ -40,7 +41,7 @@
* found yet. A known workaround is the solution provided on StackOverflow:
* http://stackoverflow.com/a/5535672
*/
-public class AutoResizeTextView extends TextView {
+public class AutoResizeTextView extends AppCompatTextView {
private static final int NO_LINE_LIMIT = -1;
private static final float DEFAULT_MIN_TEXT_SIZE = 16.0f;
private static final int DEFAULT_RESIZE_STEP_UNIT = TypedValue.COMPLEX_UNIT_PX;
@@ -69,12 +70,6 @@
initialize(context, attrs, defStyleAttr, 0);
}
- public AutoResizeTextView(
- Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- initialize(context, attrs, defStyleAttr, defStyleRes);
- }
-
private void initialize(
Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
TypedArray typedArray = context.getTheme().obtainStyledAttributes(
diff --git a/java/com/android/incallui/rtt/impl/RttCheckableButton.java b/java/com/android/incallui/rtt/impl/RttCheckableButton.java
index c0c8599..5bb8600 100644
--- a/java/com/android/incallui/rtt/impl/RttCheckableButton.java
+++ b/java/com/android/incallui/rtt/impl/RttCheckableButton.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,11 +23,12 @@
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.SoundEffectConstants;
-import android.widget.Button;
import android.widget.Checkable;
+import androidx.appcompat.widget.AppCompatButton;
+
/** Image button that maintains a checked state. */
-public class RttCheckableButton extends Button implements Checkable {
+public class RttCheckableButton extends AppCompatButton implements Checkable {
private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};
@@ -51,12 +53,7 @@
}
public RttCheckableButton(Context context, AttributeSet attrs, int defStyleAttr) {
- this(context, attrs, defStyleAttr, 0);
- }
-
- public RttCheckableButton(
- Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
+ super(context, attrs, defStyleAttr);
init(context, attrs);
}
diff --git a/java/com/android/incallui/video/impl/CheckableImageButton.java b/java/com/android/incallui/video/impl/CheckableImageButton.java
index 320f057..6be86f5 100644
--- a/java/com/android/incallui/video/impl/CheckableImageButton.java
+++ b/java/com/android/incallui/video/impl/CheckableImageButton.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 The Android Open Source Project
+ * Copyright (C) 2023 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,10 +24,11 @@
import android.util.AttributeSet;
import android.view.SoundEffectConstants;
import android.widget.Checkable;
-import android.widget.ImageButton;
+
+import androidx.appcompat.widget.AppCompatImageButton;
/** Image button that maintains a checked state. */
-public class CheckableImageButton extends ImageButton implements Checkable {
+public class CheckableImageButton extends AppCompatImageButton implements Checkable {
private static final int[] CHECKED_STATE_SET = {android.R.attr.state_checked};