Skip to content
Snippets Groups Projects
Commit dc331544 authored by Julia Tuttle's avatar Julia Tuttle Committed by Android (Google) Code Review
Browse files

Merge changes from topic "cherrypicker-L63500030002772203:N60600030045907686" into 24D1-dev

* changes:
  CallStyle: don't reglue icon+label if never glued
  CallStyle: Also handle null label to glue
  CallStyle: Handle null icon to glue
parents f2d695e6 8633a0d8
No related branches found
No related tags found
No related merge requests found
......@@ -229,7 +229,8 @@ public class EmphasizedNotificationButton extends Button {
+ "gluedLayoutDirection = " + mGluedLayoutDirection);
}
if (layoutDirection != mGluedLayoutDirection) {
final boolean alreadyGlued = mGluedLayoutDirection != LAYOUT_DIRECTION_UNDEFINED;
if (alreadyGlued && layoutDirection != mGluedLayoutDirection) {
if (DEBUG_NEW_ACTION_LAYOUT) {
Log.d(TAG, "onRtlPropertiesChanged: layout direction changed; regluing");
}
......@@ -249,14 +250,6 @@ public class EmphasizedNotificationButton extends Button {
return;
}
if (mIconToGlue == null && mLabelToGlue == null) {
if (DEBUG_NEW_ACTION_LAYOUT) {
Log.v(TAG, "glueIconAndLabelIfNeeded: no icon or label to glue; doing nothing");
}
mGluePending = false;
return;
}
if (!evenlyDividedCallStyleActionLayout()) {
Log.e(TAG, "glueIconAndLabelIfNeeded: new action layout disabled; doing nothing");
return;
......@@ -272,22 +265,6 @@ public class EmphasizedNotificationButton extends Button {
return;
}
// Ready to glue but don't have an icon *and* a label:
//
// (Note that this will *not* happen while the button is being initialized, since we won't
// be ready to glue. This can only happen if the button is initialized and displayed and
// *then* someone calls glueIcon or glueLabel.
if (mIconToGlue == null) {
Log.w(TAG, "glueIconAndLabelIfNeeded: label glued without icon; doing nothing");
return;
}
if (mLabelToGlue == null) {
Log.w(TAG, "glueIconAndLabelIfNeeded: icon glued without label; doing nothing");
return;
}
// Can't glue:
final int layoutDirection = getLayoutDirection();
......@@ -318,6 +295,28 @@ public class EmphasizedNotificationButton extends Button {
private static final String POP_DIRECTIONAL_ISOLATE = "\u2069";
private void glueIconAndLabel(int layoutDirection) {
if (mIconToGlue == null && mLabelToGlue == null) {
if (DEBUG_NEW_ACTION_LAYOUT) {
Log.d(TAG, "glueIconAndLabel: null icon and label, setting text to empty string");
}
setText("");
return;
} else if (mIconToGlue == null) {
if (DEBUG_NEW_ACTION_LAYOUT) {
Log.d(TAG, "glueIconAndLabel: null icon, setting text to label");
}
setText(mLabelToGlue);
return;
} else if (mLabelToGlue == null) {
if (DEBUG_NEW_ACTION_LAYOUT) {
Log.d(TAG, "glueIconAndLabel: null label, setting text to ImageSpan with icon");
}
final SpannableStringBuilder builder = new SpannableStringBuilder();
appendSpan(builder, IMAGE_SPAN_TEXT, new ImageSpan(mIconToGlue, ALIGN_CENTER));
setText(builder);
return;
}
final boolean rtlLayout = layoutDirection == LAYOUT_DIRECTION_RTL;
if (DEBUG_NEW_ACTION_LAYOUT) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment