OSDN Git Service

Fixed the inbox line padding with an image
authorSelim Cinek <cinek@google.com>
Fri, 20 Nov 2015 23:57:26 +0000 (15:57 -0800)
committerSelim Cinek <cinek@google.com>
Tue, 1 Dec 2015 01:45:15 +0000 (17:45 -0800)
If an image was present, the first line of the
Inbox style could run into the image. This Is fixed
now.

Change-Id: I60ee22166a2dc1d2de2f1fe311effc419a95748d

core/java/android/app/Notification.java

index 375404a..f49c77d 100644 (file)
@@ -4066,11 +4066,24 @@ public class Notification implements Parcelable
                 }
                 i++;
             }
-
             mBuilder.addProfileBadge(contentView, R.id.profile_badge_large_template);
 
+            handleInboxImageMargin(contentView, rowIds[0]);
+
             return contentView;
         }
+
+        private void handleInboxImageMargin(RemoteViews contentView, int id) {
+            final int max = mBuilder.mN.extras.getInt(EXTRA_PROGRESS_MAX, 0);
+            final boolean ind = mBuilder.mN.extras.getBoolean(EXTRA_PROGRESS_INDETERMINATE);
+            boolean hasProgress = max != 0 || ind;
+            int endMargin = 0;
+            if (mTexts.size() > 0 && mBuilder.mN.mLargeIcon != null && !hasProgress) {
+                endMargin = mBuilder.mContext.getResources().getDimensionPixelSize(
+                        R.dimen.notification_content_picture_margin);
+            }
+            contentView.setViewLayoutMarginEnd(id, endMargin);
+        }
     }
 
     /**