From 954cc230ed827d5b0a22fce2775cff4db2375d78 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 20 May 2016 13:29:23 -0700 Subject: [PATCH] Fixed a bug where the text directionality was inconsistent The title would not be fully right aligned because it wasn't layouted with match_parent because there could be a second visible text when there is a progressbar. Change-Id: I73d97d9a8addaec0e3b849349f220c764fa45db0 Fixes: 27893267 --- core/java/android/app/Notification.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index d747005a1fd23..05a6a7013fef0 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -58,6 +58,7 @@ import android.util.SparseArray; import android.view.Gravity; import android.view.NotificationHeaderView; import android.view.View; +import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.RemoteViews; @@ -3194,11 +3195,14 @@ public class Notification implements Parcelable bindNotificationHeader(contentView); bindLargeIcon(contentView); + boolean showProgress = handleProgressBar(hasProgress, contentView, ex); if (title != null) { contentView.setViewVisibility(R.id.title, View.VISIBLE); contentView.setTextViewText(R.id.title, title); + contentView.setViewLayoutWidth(R.id.title, showProgress + ? ViewGroup.LayoutParams.WRAP_CONTENT + : ViewGroup.LayoutParams.MATCH_PARENT); } - boolean showProgress = handleProgressBar(hasProgress, contentView, ex); if (text != null) { int textId = showProgress ? com.android.internal.R.id.text_line_1 : com.android.internal.R.id.text;