From 64d82423fe9811d66e2abfa4fa420a3ae922b000 Mon Sep 17 00:00:00 2001 From: serso Date: Tue, 11 Jul 2017 12:26:41 +0200 Subject: [PATCH] Use AppCompat classes as base classes in custom views --- .../solovyev/android/views/AutoResizeTextView.java | 13 ++++++++----- .../org/solovyev/android/views/DiscreteSeekBar.java | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/solovyev/android/views/AutoResizeTextView.java b/app/src/main/java/org/solovyev/android/views/AutoResizeTextView.java index f4002d2d..3825e5bf 100644 --- a/app/src/main/java/org/solovyev/android/views/AutoResizeTextView.java +++ b/app/src/main/java/org/solovyev/android/views/AutoResizeTextView.java @@ -1,4 +1,6 @@ -package org.solovyev.android.views; /** +package org.solovyev.android.views; + +/* * DO WHAT YOU WANT TO PUBLIC LICENSE * Version 2, December 2004 *

@@ -14,8 +16,12 @@ package org.solovyev.android.views; /** * 0. You just DO WHAT YOU WANT TO. */ +import static android.util.TypedValue.COMPLEX_UNIT_SP; +import static android.util.TypedValue.applyDimension; + import android.annotation.SuppressLint; import android.content.Context; +import android.support.v7.widget.AppCompatTextView; import android.text.Layout.Alignment; import android.text.StaticLayout; import android.text.TextPaint; @@ -24,9 +30,6 @@ import android.util.TimingLogger; import android.util.TypedValue; import android.widget.TextView; -import static android.util.TypedValue.COMPLEX_UNIT_SP; -import static android.util.TypedValue.applyDimension; - /** * Text view that auto adjusts text size to fit within the view. * If the text size equals the minimum text size and still does not @@ -36,7 +39,7 @@ import static android.util.TypedValue.applyDimension; * @since Apr 4, 2011 */ @SuppressWarnings("unused") -public class AutoResizeTextView extends TextView { +public class AutoResizeTextView extends AppCompatTextView { // Minimum text size for this text view public static final float MIN_TEXT_SIZE = 20; diff --git a/app/src/main/java/org/solovyev/android/views/DiscreteSeekBar.java b/app/src/main/java/org/solovyev/android/views/DiscreteSeekBar.java index 088f309e..ed96e579 100644 --- a/app/src/main/java/org/solovyev/android/views/DiscreteSeekBar.java +++ b/app/src/main/java/org/solovyev/android/views/DiscreteSeekBar.java @@ -9,6 +9,7 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.os.Build; +import android.support.v7.widget.AppCompatSeekBar; import android.util.AttributeSet; import android.view.animation.DecelerateInterpolator; import android.widget.SeekBar; @@ -19,7 +20,7 @@ import org.solovyev.android.calculator.R; /** * SeekBar for discrete values with a label displayed underneath the active tick */ -public class DiscreteSeekBar extends SeekBar { +public class DiscreteSeekBar extends AppCompatSeekBar { // Duration of how quick the SeekBar thumb should snap to its destination value private static final int THUMB_SNAP_DURATION_TIME = 100; private final Paint mPaint = new Paint();