Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 614da108 authored by Julia Tuttle's avatar Julia Tuttle
Browse files

CallStyle: Also handle null label to glue

Bug: 329288442
Flag: ACONFIG com.android.systemui.new_call_style_action_layout NEXTFOOD
Test: none
Change-Id: Ib8958198aa7e99b0db54834602ecf4767146c560
parent 19c7dd73
Loading
Loading
Loading
Loading
+15 −20
Original line number Diff line number Diff line
@@ -249,14 +249,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,17 +264,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 (mLabelToGlue == null) {
            Log.w(TAG, "glueIconAndLabelIfNeeded: icon glued without label; doing nothing");
            return;
        }

        // Can't glue:

        final int layoutDirection = getLayoutDirection();
@@ -313,12 +294,26 @@ public class EmphasizedNotificationButton extends Button {
    private static final String POP_DIRECTIONAL_ISOLATE = "\u2069";

    private void glueIconAndLabel(int layoutDirection) {
        if (mIconToGlue == null) {
        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;