Fix "Emergency Information" text overflow
At large font sizes/low DPI values, the "Emergency Information" text at
the top will overflow when tapped. This change uses the new auto-resize
API to prevent the overflow.
Change-Id: Ie6d81869155b8124f8bb6f530efb2af0199351d0
Fixes: 63331318
Test: manual
diff --git a/res/layout/emergency_dialer.xml b/res/layout/emergency_dialer.xml
index 5248c19..9bb5570 100644
--- a/res/layout/emergency_dialer.xml
+++ b/res/layout/emergency_dialer.xml
@@ -95,8 +95,10 @@
android:backgroundTint="#00000000"
style="?android:attr/buttonStyle">
<TextView
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:gravity="center"
+ android:maxLines="1"
android:id="@+id/selected_label"
android:textColor="@android:color/white"
android:textAppearance="?android:attr/textAppearanceButton" />
@@ -104,6 +106,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/launch_hint"
+ android:maxLines="1"
+ android:autoSizeTextType="uniform"
android:text="@string/emergency_action_launch_hint"
android:textColor="@android:color/white"
android:textStyle="italic" />
diff --git a/src/com/android/phone/EmergencyActionGroup.java b/src/com/android/phone/EmergencyActionGroup.java
index 524462e..54842f3 100644
--- a/src/com/android/phone/EmergencyActionGroup.java
+++ b/src/com/android/phone/EmergencyActionGroup.java
@@ -240,6 +240,9 @@
}
private void revealTheButton(View v) {
+ CharSequence buttonText = ((Button) v).getText();
+ mSelectedLabel.setText(buttonText);
+ mSelectedLabel.setAutoSizeTextTypeWithDefaults(TextView.AUTO_SIZE_TEXT_TYPE_UNIFORM);
mSelectedContainer.setVisibility(VISIBLE);
int centerX = v.getLeft() + v.getWidth() / 2;
int centerY = v.getTop() + v.getHeight() / 2;
@@ -255,7 +258,6 @@
animateHintText(mSelectedLabel, v, reveal);
animateHintText(mLaunchHint, v, reveal);
- mSelectedLabel.setText(((Button) v).getText());
mSelectedContainer.setTag(R.id.tag_intent, v.getTag(R.id.tag_intent));
mLastRevealed = v;
postDelayed(mHideRunnable, HIDE_DELAY);