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

Commit 35cb746e authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge changes I414b9a5f,I0a08b06b

* changes:
  Fixed a bug where the notifications could get stuck animating
  Better messaging style wrapping
parents 6a7256fc 2f6272ec
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -115,6 +115,7 @@ public class ImageFloatingTextView extends TextView {
        // Lets calculate how many lines the given measurement allows us.
        // Lets calculate how many lines the given measurement allows us.
        int availableHeight = height - mPaddingTop - mPaddingBottom;
        int availableHeight = height - mPaddingTop - mPaddingBottom;
        int maxLines = availableHeight / getLineHeight();
        int maxLines = availableHeight / getLineHeight();
        maxLines = Math.max(1, maxLines);
        if (getMaxLines() > 0) {
        if (getMaxLines() > 0) {
            maxLines = Math.min(getMaxLines(), maxLines);
            maxLines = Math.min(getMaxLines(), maxLines);
        }
        }
+24 −9
Original line number Original line Diff line number Diff line
@@ -16,8 +16,6 @@


package com.android.internal.widget;
package com.android.internal.widget;


import com.android.internal.R;

import android.annotation.Nullable;
import android.annotation.Nullable;
import android.content.Context;
import android.content.Context;
import android.content.res.TypedArray;
import android.content.res.TypedArray;
@@ -28,6 +26,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup;
import android.widget.RemoteViews;
import android.widget.RemoteViews;


import com.android.internal.R;

/**
/**
 * A custom-built layout for the Notification.MessagingStyle.
 * A custom-built layout for the Notification.MessagingStyle.
 *
 *
@@ -119,23 +119,30 @@ public class MessagingLinearLayout extends ViewGroup {
                }
                }
                final View child = getChildAt(i);
                final View child = getChildAt(i);
                LayoutParams lp = (LayoutParams) getChildAt(i).getLayoutParams();
                LayoutParams lp = (LayoutParams) getChildAt(i).getLayoutParams();

                ImageFloatingTextView textChild = null;
                if (child instanceof ImageFloatingTextView) {
                if (child instanceof ImageFloatingTextView) {
                    // Pretend we need the image padding for all views, we don't know which
                    // Pretend we need the image padding for all views, we don't know which
                    // one will end up needing to do this (might end up not using all the space,
                    // one will end up needing to do this (might end up not using all the space,
                    // but calculating this exactly would be more expensive).
                    // but calculating this exactly would be more expensive).
                    ((ImageFloatingTextView) child).setNumIndentLines(
                    textChild = (ImageFloatingTextView) child;
                            mIndentLines == 2 ? 3 : mIndentLines);
                    textChild.setNumIndentLines(mIndentLines == 2 ? 3 : mIndentLines);
                }
                }


                measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
                int spacing = first ? 0 : mSpacing;
                measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, totalHeight
                        - mPaddingTop - mPaddingBottom + spacing);


                final int childHeight = child.getMeasuredHeight();
                final int childHeight = child.getMeasuredHeight();
                int newHeight = Math.max(totalHeight, totalHeight + childHeight + lp.topMargin +
                int newHeight = Math.max(totalHeight, totalHeight + childHeight + lp.topMargin +
                        lp.bottomMargin + (first ? 0 : mSpacing));
                        lp.bottomMargin + spacing);
                first = false;
                first = false;
                boolean measuredTooSmall = false;
                if (textChild != null) {
                    measuredTooSmall = childHeight < textChild.getLayout().getHeight()
                            + textChild.getPaddingTop() + textChild.getPaddingBottom();
                }


                if (newHeight <= targetHeight) {
                if (newHeight <= targetHeight && !measuredTooSmall) {
                    totalHeight = newHeight;
                    totalHeight = newHeight;
                    lp.hide = false;
                    lp.hide = false;
                } else {
                } else {
@@ -168,7 +175,15 @@ public class MessagingLinearLayout extends ViewGroup {
                }
                }
                boolean changed = textChild.setNumIndentLines(Math.max(0, imageLines));
                boolean changed = textChild.setNumIndentLines(Math.max(0, imageLines));
                if (changed || !recalculateVisibility) {
                if (changed || !recalculateVisibility) {
                    measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
                    final int childWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec,
                            mPaddingLeft + mPaddingRight + lp.leftMargin + lp.rightMargin,
                            lp.width);
                    // we want to measure it at most as high as it is currently, otherwise we'll
                    // drop later lines
                    final int childHeightMeasureSpec = getChildMeasureSpec(heightMeasureSpec,
                            targetHeight - child.getMeasuredHeight(), lp.height);

                    child.measure(childWidthMeasureSpec, childHeightMeasureSpec);;
                }
                }
                imageLines -= textChild.getLineCount();
                imageLines -= textChild.getLineCount();
            }
            }
+2 −1
Original line number Original line Diff line number Diff line
@@ -1160,7 +1160,8 @@ public class KeyguardViewMediator extends SystemUI {


            if (mOccluded != isOccluded) {
            if (mOccluded != isOccluded) {
                mOccluded = isOccluded;
                mOccluded = isOccluded;
                mStatusBarKeyguardViewManager.setOccluded(isOccluded, animate);
                mStatusBarKeyguardViewManager.setOccluded(isOccluded, animate
                        && mDeviceInteractive);
                adjustStatusBarLocked();
                adjustStatusBarLocked();
            }
            }
        }
        }