AutoSize TextView (part 9) - sanitize APIs naming
This CL is no-op (cosmetics only) * renames autoSizeText type "xy" to "uniform" * renames attribute "autoSizeStepSizeSet" to "autoSizePresetSizes" * renames "AUTO_SIZE_TEXT_TYPE_XY" to "AUTO_SIZE_TEXT_TYPE_UNIFORM" * renames public TextView#getAutoSizeTextPresetSizes() to public TextView#getAutoSizeTextAvailableSizes() because this method can return either preset sizes or computed sizes (via min/max/step) Bug: 34923754 Bug: 32221168 Test: associated test renames in the same topic Change-Id: Ifacccf21ca014b6c0a07322fa02b7859ee53e387
This commit is contained in:
@@ -35,8 +35,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="20px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="110px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="1010px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="10010px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="100010px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="310px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -35,8 +35,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="15px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="60px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
android:layout_width="400dp"
|
||||
android:layout_height="600dp"
|
||||
android:text="@string/long_text"
|
||||
android:textDirection="rtl"
|
||||
android:autoSizeText="xy"
|
||||
android:autoSizeText="uniform"
|
||||
android:autoSizeMinTextSize="10px"
|
||||
android:textSize="510px"
|
||||
android:autoSizeStepGranularity="1px"/>
|
||||
|
||||
@@ -299,8 +299,8 @@ package android {
|
||||
field public static final int autoRemoveFromRecents = 16843847; // 0x1010447
|
||||
field public static final int autoSizeMaxTextSize = 16844103; // 0x1010547
|
||||
field public static final int autoSizeMinTextSize = 16844088; // 0x1010538
|
||||
field public static final int autoSizePresetSizes = 16844087; // 0x1010537
|
||||
field public static final int autoSizeStepGranularity = 16844086; // 0x1010536
|
||||
field public static final int autoSizeStepSizeSet = 16844087; // 0x1010537
|
||||
field public static final int autoSizeText = 16844085; // 0x1010535
|
||||
field public static final int autoStart = 16843445; // 0x10102b5
|
||||
field public static final deprecated int autoText = 16843114; // 0x101016a
|
||||
@@ -5503,6 +5503,7 @@ package android.app {
|
||||
public final class NotificationChannelGroup implements android.os.Parcelable {
|
||||
ctor public NotificationChannelGroup(java.lang.String, java.lang.CharSequence);
|
||||
ctor protected NotificationChannelGroup(android.os.Parcel);
|
||||
method public android.app.NotificationChannelGroup clone();
|
||||
method public int describeContents();
|
||||
method public java.util.List<android.app.NotificationChannel> getChannels();
|
||||
method public java.lang.String getId();
|
||||
@@ -50379,7 +50380,7 @@ package android.widget {
|
||||
method public int getAutoSizeMaxTextSize();
|
||||
method public int getAutoSizeMinTextSize();
|
||||
method public int getAutoSizeStepGranularity();
|
||||
method public int[] getAutoSizeTextPresetSizes();
|
||||
method public int[] getAutoSizeTextAvailableSizes();
|
||||
method public int getAutoSizeTextType();
|
||||
method public int getBreakStrategy();
|
||||
method public int getCompoundDrawablePadding();
|
||||
@@ -50587,7 +50588,7 @@ package android.widget {
|
||||
method public void setTypeface(android.graphics.Typeface);
|
||||
method public void setWidth(int);
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_NONE = 0; // 0x0
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_XY = 1; // 0x1
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM = 1; // 0x1
|
||||
}
|
||||
|
||||
public static final class TextView.BufferType extends java.lang.Enum {
|
||||
|
||||
@@ -411,8 +411,8 @@ package android {
|
||||
field public static final int autoRemoveFromRecents = 16843847; // 0x1010447
|
||||
field public static final int autoSizeMaxTextSize = 16844103; // 0x1010547
|
||||
field public static final int autoSizeMinTextSize = 16844088; // 0x1010538
|
||||
field public static final int autoSizePresetSizes = 16844087; // 0x1010537
|
||||
field public static final int autoSizeStepGranularity = 16844086; // 0x1010536
|
||||
field public static final int autoSizeStepSizeSet = 16844087; // 0x1010537
|
||||
field public static final int autoSizeText = 16844085; // 0x1010535
|
||||
field public static final int autoStart = 16843445; // 0x10102b5
|
||||
field public static final deprecated int autoText = 16843114; // 0x101016a
|
||||
@@ -5697,6 +5697,7 @@ package android.app {
|
||||
ctor public NotificationChannelGroup(java.lang.String, java.lang.CharSequence);
|
||||
ctor protected NotificationChannelGroup(android.os.Parcel);
|
||||
method public void addChannel(android.app.NotificationChannel);
|
||||
method public android.app.NotificationChannelGroup clone();
|
||||
method public int describeContents();
|
||||
method public java.util.List<android.app.NotificationChannel> getChannels();
|
||||
method public java.lang.String getId();
|
||||
@@ -54159,7 +54160,7 @@ package android.widget {
|
||||
method public int getAutoSizeMaxTextSize();
|
||||
method public int getAutoSizeMinTextSize();
|
||||
method public int getAutoSizeStepGranularity();
|
||||
method public int[] getAutoSizeTextPresetSizes();
|
||||
method public int[] getAutoSizeTextAvailableSizes();
|
||||
method public int getAutoSizeTextType();
|
||||
method public int getBreakStrategy();
|
||||
method public int getCompoundDrawablePadding();
|
||||
@@ -54367,7 +54368,7 @@ package android.widget {
|
||||
method public void setTypeface(android.graphics.Typeface);
|
||||
method public void setWidth(int);
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_NONE = 0; // 0x0
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_XY = 1; // 0x1
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM = 1; // 0x1
|
||||
}
|
||||
|
||||
public static final class TextView.BufferType extends java.lang.Enum {
|
||||
|
||||
@@ -299,8 +299,8 @@ package android {
|
||||
field public static final int autoRemoveFromRecents = 16843847; // 0x1010447
|
||||
field public static final int autoSizeMaxTextSize = 16844103; // 0x1010547
|
||||
field public static final int autoSizeMinTextSize = 16844088; // 0x1010538
|
||||
field public static final int autoSizePresetSizes = 16844087; // 0x1010537
|
||||
field public static final int autoSizeStepGranularity = 16844086; // 0x1010536
|
||||
field public static final int autoSizeStepSizeSet = 16844087; // 0x1010537
|
||||
field public static final int autoSizeText = 16844085; // 0x1010535
|
||||
field public static final int autoStart = 16843445; // 0x10102b5
|
||||
field public static final deprecated int autoText = 16843114; // 0x101016a
|
||||
@@ -5513,6 +5513,7 @@ package android.app {
|
||||
public final class NotificationChannelGroup implements android.os.Parcelable {
|
||||
ctor public NotificationChannelGroup(java.lang.String, java.lang.CharSequence);
|
||||
ctor protected NotificationChannelGroup(android.os.Parcel);
|
||||
method public android.app.NotificationChannelGroup clone();
|
||||
method public int describeContents();
|
||||
method public java.util.List<android.app.NotificationChannel> getChannels();
|
||||
method public java.lang.String getId();
|
||||
@@ -50699,7 +50700,7 @@ package android.widget {
|
||||
method public int getAutoSizeMaxTextSize();
|
||||
method public int getAutoSizeMinTextSize();
|
||||
method public int getAutoSizeStepGranularity();
|
||||
method public int[] getAutoSizeTextPresetSizes();
|
||||
method public int[] getAutoSizeTextAvailableSizes();
|
||||
method public int getAutoSizeTextType();
|
||||
method public int getBreakStrategy();
|
||||
method public int getCompoundDrawablePadding();
|
||||
@@ -50907,7 +50908,7 @@ package android.widget {
|
||||
method public void setTypeface(android.graphics.Typeface);
|
||||
method public void setWidth(int);
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_NONE = 0; // 0x0
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_XY = 1; // 0x1
|
||||
field public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM = 1; // 0x1
|
||||
}
|
||||
|
||||
public static final class TextView.BufferType extends java.lang.Enum {
|
||||
|
||||
@@ -271,7 +271,7 @@ import java.util.Locale;
|
||||
* @attr ref android.R.styleable#TextView_autoSizeMinTextSize
|
||||
* @attr ref android.R.styleable#TextView_autoSizeMaxTextSize
|
||||
* @attr ref android.R.styleable#TextView_autoSizeStepGranularity
|
||||
* @attr ref android.R.styleable#TextView_autoSizeStepSizeSet
|
||||
* @attr ref android.R.styleable#TextView_autoSizePresetSizes
|
||||
*/
|
||||
@RemoteView
|
||||
public class TextView extends View implements ViewTreeObserver.OnPreDrawListener {
|
||||
@@ -698,9 +698,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
public static final int AUTO_SIZE_TEXT_TYPE_NONE = 0;
|
||||
// The TextView performs uniform horizontal and vertical text size scaling to fit within the
|
||||
// container.
|
||||
public static final int AUTO_SIZE_TEXT_TYPE_XY = 1;
|
||||
public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM = 1;
|
||||
/** @hide */
|
||||
@IntDef({AUTO_SIZE_TEXT_TYPE_NONE, AUTO_SIZE_TEXT_TYPE_XY})
|
||||
@IntDef({AUTO_SIZE_TEXT_TYPE_NONE, AUTO_SIZE_TEXT_TYPE_UNIFORM})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface AutoSizeTextType {}
|
||||
// Default minimum size for auto-sizing text in scaled pixels. {@see #setAutoSizeMinTextSize}.
|
||||
@@ -725,7 +725,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
// Specifies whether auto-size should use the provided auto size steps set or if it should
|
||||
// build the steps set using mAutoSizeMinTextSizeInPx, mAutoSizeMaxTextSizeInPx and
|
||||
// mAutoSizeStepGranularityInPx.
|
||||
private boolean mHasPredefinedAutoSizeSet = false;
|
||||
private boolean mHasPresetAutoSizeValues = false;
|
||||
|
||||
// Watcher used to notify changes to auto-fill manager.
|
||||
private AutoFillChangeWatcher mAutoFillChangeWatcher;
|
||||
@@ -1318,12 +1318,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
mAutoSizeMaxTextSizeInPx = a.getDimensionPixelSize(attr, 0);
|
||||
break;
|
||||
|
||||
case com.android.internal.R.styleable.TextView_autoSizeStepSizeSet:
|
||||
case com.android.internal.R.styleable.TextView_autoSizePresetSizes:
|
||||
final int autoSizeStepSizeArrayResId = a.getResourceId(attr, 0);
|
||||
if (autoSizeStepSizeArrayResId > 0) {
|
||||
final TypedArray autoSizePreDefTextSizes = a.getResources()
|
||||
.obtainTypedArray(autoSizeStepSizeArrayResId);
|
||||
setupAutoSizeStepSizeSet(autoSizePreDefTextSizes);
|
||||
setupAutoSizePresetSizes(autoSizePreDefTextSizes);
|
||||
autoSizePreDefTextSizes.recycle();
|
||||
}
|
||||
break;
|
||||
@@ -1601,7 +1601,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||
}
|
||||
|
||||
setupAutoSizeTextXY();
|
||||
setupAutoSizeText();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1610,7 +1610,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
*
|
||||
* @param autoSizeTextType the type of auto-size. Must be one of
|
||||
* {@link TextView#AUTO_SIZE_TEXT_TYPE_NONE} or
|
||||
* {@link TextView#AUTO_SIZE_TEXT_TYPE_XY}
|
||||
* {@link TextView#AUTO_SIZE_TEXT_TYPE_UNIFORM}
|
||||
*
|
||||
* @attr ref android.R.styleable#TextView_autoSizeText
|
||||
*
|
||||
@@ -1630,10 +1630,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
mNeedsAutoSizeText = false;
|
||||
}
|
||||
break;
|
||||
case AUTO_SIZE_TEXT_TYPE_XY:
|
||||
if (mAutoSizeTextType != AUTO_SIZE_TEXT_TYPE_XY) {
|
||||
mAutoSizeTextType = AUTO_SIZE_TEXT_TYPE_XY;
|
||||
setupAutoSizeTextXY();
|
||||
case AUTO_SIZE_TEXT_TYPE_UNIFORM:
|
||||
if (mAutoSizeTextType != AUTO_SIZE_TEXT_TYPE_UNIFORM) {
|
||||
mAutoSizeTextType = AUTO_SIZE_TEXT_TYPE_UNIFORM;
|
||||
setupAutoSizeText();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1648,7 +1648,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
*
|
||||
* @return an {@code int} corresponding to one of the auto-size types:
|
||||
* {@link TextView#AUTO_SIZE_TEXT_TYPE_NONE} or
|
||||
* {@link TextView#AUTO_SIZE_TEXT_TYPE_XY}
|
||||
* {@link TextView#AUTO_SIZE_TEXT_TYPE_UNIFORM}
|
||||
*
|
||||
* @attr ref android.R.styleable#TextView_autoSizeText
|
||||
*
|
||||
@@ -1678,8 +1678,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
if (supportsAutoSizeText()) {
|
||||
mAutoSizeStepGranularityInPx = (int) TypedValue.applyDimension(
|
||||
unit, size, getResources().getDisplayMetrics());
|
||||
mHasPredefinedAutoSizeSet = false;
|
||||
setupAutoSizeTextXY();
|
||||
mHasPresetAutoSizeValues = false;
|
||||
setupAutoSizeText();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1711,8 +1711,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
if (supportsAutoSizeText()) {
|
||||
mAutoSizeMinTextSizeInPx = (int) TypedValue.applyDimension(
|
||||
unit, size, getResources().getDisplayMetrics());
|
||||
mHasPredefinedAutoSizeSet = false;
|
||||
setupAutoSizeTextXY();
|
||||
mHasPresetAutoSizeValues = false;
|
||||
setupAutoSizeText();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1745,8 +1745,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
if (supportsAutoSizeText()) {
|
||||
mAutoSizeMaxTextSizeInPx = (int) TypedValue.applyDimension(
|
||||
unit, size, getResources().getDisplayMetrics());
|
||||
mHasPredefinedAutoSizeSet = false;
|
||||
setupAutoSizeTextXY();
|
||||
mHasPresetAutoSizeValues = false;
|
||||
setupAutoSizeText();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1774,25 +1774,25 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
*
|
||||
* @param presetSizes an {@code int} array of sizes in pixels
|
||||
*
|
||||
* @attr ref android.R.styleable#TextView_autoSizeStepSizeSet
|
||||
* @attr ref android.R.styleable#TextView_autoSizePresetSizes
|
||||
*
|
||||
* @see #getAutoSizeTextPresetSizes()
|
||||
* @see #getAutoSizeTextAvailableSizes()
|
||||
*/
|
||||
public void setAutoSizeTextPresetSizes(@NonNull int[] presetSizes) {
|
||||
if (supportsAutoSizeText()) {
|
||||
if (presetSizes.length > 0) {
|
||||
mAutoSizeTextSizesInPx = cleanupAutoSizePredefinedSizes(presetSizes);
|
||||
mAutoSizeTextSizesInPx = cleanupAutoSizePresetSizes(presetSizes);
|
||||
final int sizesLength = mAutoSizeTextSizesInPx.length;
|
||||
mHasPredefinedAutoSizeSet = sizesLength > 0;
|
||||
if (mHasPredefinedAutoSizeSet) {
|
||||
mHasPresetAutoSizeValues = sizesLength > 0;
|
||||
if (mHasPresetAutoSizeValues) {
|
||||
mAutoSizeMinTextSizeInPx = mAutoSizeTextSizesInPx[0];
|
||||
mAutoSizeMaxTextSizeInPx = mAutoSizeTextSizesInPx[sizesLength - 1];
|
||||
mAutoSizeStepGranularityInPx = 0;
|
||||
}
|
||||
} else {
|
||||
mHasPredefinedAutoSizeSet = false;
|
||||
mHasPresetAutoSizeValues = false;
|
||||
}
|
||||
setupAutoSizeTextXY();
|
||||
setupAutoSizeText();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1804,11 +1804,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
* @see #setAutoSizeMaxTextSize(int, float)
|
||||
* @see #setAutoSizeStepGranularity(int, float)
|
||||
*/
|
||||
public int[] getAutoSizeTextPresetSizes() {
|
||||
public int[] getAutoSizeTextAvailableSizes() {
|
||||
return mAutoSizeTextSizesInPx;
|
||||
}
|
||||
|
||||
private void setupAutoSizeStepSizeSet(TypedArray textSizes) {
|
||||
private void setupAutoSizePresetSizes(TypedArray textSizes) {
|
||||
final int textSizesLength = textSizes.length();
|
||||
final int[] parsedSizes = new int[textSizesLength];
|
||||
|
||||
@@ -1816,39 +1816,39 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
|
||||
for (int i = 0; i < textSizesLength; i++) {
|
||||
parsedSizes[i] = textSizes.getDimensionPixelSize(i, -1);
|
||||
}
|
||||
mAutoSizeTextSizesInPx = cleanupAutoSizePredefinedSizes(parsedSizes);
|
||||
mHasPredefinedAutoSizeSet = mAutoSizeTextSizesInPx.length > 0;
|
||||
mAutoSizeTextSizesInPx = cleanupAutoSizePresetSizes(parsedSizes);
|
||||
mHasPresetAutoSizeValues = mAutoSizeTextSizesInPx.length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Returns distinct sorted positive values.
|
||||
private int[] cleanupAutoSizePredefinedSizes(int[] predefinedValues) {
|
||||
final int predefinedValuesLength = predefinedValues.length;
|
||||
if (predefinedValuesLength == 0) {
|
||||
return predefinedValues;
|
||||
private int[] cleanupAutoSizePresetSizes(int[] presetValues) {
|
||||
final int presetValuesLength = presetValues.length;
|
||||
if (presetValuesLength == 0) {
|
||||
return presetValues;
|
||||
}
|
||||
Arrays.sort(predefinedValues);
|
||||
Arrays.sort(presetValues);
|
||||
|
||||
final IntArray uniqueValidSizes = new IntArray();
|
||||
for (int i = 0; i < predefinedValuesLength; i++) {
|
||||
final int currentPredefinedValue = predefinedValues[i];
|
||||
for (int i = 0; i < presetValuesLength; i++) {
|
||||
final int currentPresetValue = presetValues[i];
|
||||
|
||||
if (currentPredefinedValue > 0
|
||||
&& uniqueValidSizes.binarySearch(currentPredefinedValue) < 0) {
|
||||
uniqueValidSizes.add(currentPredefinedValue);
|
||||
if (currentPresetValue > 0
|
||||
&& uniqueValidSizes.binarySearch(currentPresetValue) < 0) {
|
||||
uniqueValidSizes.add(currentPresetValue);
|
||||
}
|
||||
}
|
||||
|
||||
return predefinedValuesLength == uniqueValidSizes.size()
|
||||
? predefinedValues
|
||||
return presetValuesLength == uniqueValidSizes.size()
|
||||
? presetValues
|
||||
: uniqueValidSizes.toArray();
|
||||
}
|
||||
|
||||
private void setupAutoSizeTextXY() {
|
||||
if (supportsAutoSizeText() && mAutoSizeTextType == AUTO_SIZE_TEXT_TYPE_XY) {
|
||||
private void setupAutoSizeText() {
|
||||
if (supportsAutoSizeText() && mAutoSizeTextType == AUTO_SIZE_TEXT_TYPE_UNIFORM) {
|
||||
// Calculate the sizes set based on minimum size, maximum size and step size if we do
|
||||
// not have a predefined set of sizes or if the current sizes array is empty.
|
||||
if (!mHasPredefinedAutoSizeSet || mAutoSizeTextSizesInPx.length == 0) {
|
||||
if (!mHasPresetAutoSizeValues || mAutoSizeTextSizesInPx.length == 0) {
|
||||
// Set valid defaults.
|
||||
if (mAutoSizeMinTextSizeInPx <= 0) {
|
||||
mAutoSizeMinTextSizeInPx = (int) TypedValue.applyDimension(
|
||||
|
||||
@@ -4714,16 +4714,16 @@
|
||||
<!-- No auto-sizing (default). -->
|
||||
<enum name="none" value="0" />
|
||||
<!-- Uniform horizontal and vertical scaling. -->
|
||||
<enum name="xy" value="1" />
|
||||
<enum name="uniform" value="1" />
|
||||
</attr>
|
||||
<!-- Specify the auto-size step size if <code>autoSizeText</code> is set to
|
||||
<code>xy</code>. The default is 1px. Overwrites
|
||||
<code>autoSizeStepSizeSet</code> if set. -->
|
||||
<code>autoSizePresetSizes</code> if set. -->
|
||||
<attr name="autoSizeStepGranularity" format="dimension" />
|
||||
<!-- Array of dimensions to be used in conjunction with
|
||||
<code>autoSizeText</code> set to <code>xy</code>. Overwrites
|
||||
<code>autoSizeStepGranularity</code> if set. -->
|
||||
<attr name="autoSizeStepSizeSet"/>
|
||||
<attr name="autoSizePresetSizes"/>
|
||||
<!-- The minimum text size constraint to be used when auto-sizing text -->
|
||||
<attr name="autoSizeMinTextSize" format="dimension" />
|
||||
<!-- The maximum text size constraint to be used when auto-sizing text -->
|
||||
|
||||
@@ -2767,7 +2767,7 @@
|
||||
<public name="tooltipText" />
|
||||
<public name="autoSizeText" />
|
||||
<public name="autoSizeStepGranularity" />
|
||||
<public name="autoSizeStepSizeSet" />
|
||||
<public name="autoSizePresetSizes" />
|
||||
<public name="autoSizeMinTextSize" />
|
||||
<public name="min" />
|
||||
<public name="rotationAnimation" />
|
||||
|
||||
Reference in New Issue
Block a user