diff options
| author | Selim Cinek <cinek@google.com> | 2016-01-26 18:26:19 -0800 |
|---|---|---|
| committer | Selim Cinek <cinek@google.com> | 2016-01-28 19:02:20 -0800 |
| commit | 6ecc810ca203dfe3d00f76c28a89dfb68cef9ef2 (patch) | |
| tree | 6ab52de6b241aee508a59e4cb45a5148789d5c28 /core/java/android/view/NotificationHeaderView.java | |
| parent | d61c302bf8471f81ef641eb822af9baea843c9d9 (diff) | |
Fixed a bug with the media notication template
The image could overlap with the buttons due to
the specced way. This is now fixed.
Change-Id: I346467d48b5f8337d09af4b20e5cdfcd41e12b81
Diffstat (limited to 'core/java/android/view/NotificationHeaderView.java')
| -rw-r--r-- | core/java/android/view/NotificationHeaderView.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index 1c0ea0f9120b..b3d16763d0d7 100644 --- a/core/java/android/view/NotificationHeaderView.java +++ b/core/java/android/view/NotificationHeaderView.java @@ -25,8 +25,6 @@ import android.widget.LinearLayout; import android.widget.RemoteViews; import android.widget.TextView; -import com.android.internal.R; - import java.util.ArrayList; /** @@ -39,6 +37,7 @@ public class NotificationHeaderView extends LinearLayout { public static final int NO_COLOR = -1; private final int mHeaderMinWidth; private final int mExpandTopPadding; + private final int mContentEndMargin; private View mAppName; private View mSubTextView; private OnClickListener mExpandClickListener; @@ -51,6 +50,7 @@ public class NotificationHeaderView extends LinearLayout { private int mOriginalNotificationColor; private boolean mGroupHeader; private boolean mExpanded; + private boolean mShowWorkBadgeAtEnd; public NotificationHeaderView(Context context) { this(context, null); @@ -68,6 +68,8 @@ public class NotificationHeaderView extends LinearLayout { super(context, attrs, defStyleAttr, defStyleRes); mHeaderMinWidth = getResources().getDimensionPixelSize( com.android.internal.R.dimen.notification_header_shrink_min_width); + mContentEndMargin = getResources().getDimensionPixelSize( + com.android.internal.R.dimen.notification_content_margin_end); mExpandTopPadding = (int) (1 * getResources().getDisplayMetrics().density); } @@ -135,6 +137,9 @@ public class NotificationHeaderView extends LinearLayout { super.onLayout(changed, l, t, r, b); if (mProfileBadge.getVisibility() != View.GONE) { int paddingEnd = getPaddingEnd(); + if (mShowWorkBadgeAtEnd) { + paddingEnd = mContentEndMargin; + } if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) { mProfileBadge.layout(paddingEnd, mProfileBadge.getTop(), @@ -225,6 +230,13 @@ public class NotificationHeaderView extends LinearLayout { mExpandButton.setPadding(0, paddingTop, 0, 0); } + public void setShowWorkBadgeAtEnd(boolean showWorkBadgeAtEnd) { + if (showWorkBadgeAtEnd != mShowWorkBadgeAtEnd) { + setClipToPadding(!showWorkBadgeAtEnd); + mShowWorkBadgeAtEnd = showWorkBadgeAtEnd; + } + } + public class HeaderTouchListener implements View.OnTouchListener { private final ArrayList<Rect> mTouchRects = new ArrayList<>(); |
