summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/notification/NotificationMainView.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2017-05-02 11:16:26 -0700
committerTony Wickham <twickham@google.com>2017-05-02 14:02:37 -0700
commit44410552339377f55a98b32dbadb4f7cf3aa8d83 (patch)
treefd02abe4a38ebc49a8666b74b1d60f8eacc37841 /src/com/android/launcher3/notification/NotificationMainView.java
parentf77a6f7fd75243999912d040470a543e825d6d12 (diff)
downloadandroid_packages_apps_Trebuchet-44410552339377f55a98b32dbadb4f7cf3aa8d83.tar.gz
android_packages_apps_Trebuchet-44410552339377f55a98b32dbadb4f7cf3aa8d83.tar.bz2
android_packages_apps_Trebuchet-44410552339377f55a98b32dbadb4f7cf3aa8d83.zip
Relax notification filter for badges
- Allow notifications with only title or text, not both (centered in popup) - Allow notifications without an intent (don't add onClickListener) Change-Id: I33d9bdbe0d27347d703b6fb81eda64ebdc7429d5
Diffstat (limited to 'src/com/android/launcher3/notification/NotificationMainView.java')
-rw-r--r--src/com/android/launcher3/notification/NotificationMainView.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/launcher3/notification/NotificationMainView.java b/src/com/android/launcher3/notification/NotificationMainView.java
index bb2dac0e1..d6e0272fe 100644
--- a/src/com/android/launcher3/notification/NotificationMainView.java
+++ b/src/com/android/launcher3/notification/NotificationMainView.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.RippleDrawable;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -83,11 +84,21 @@ public class NotificationMainView extends FrameLayout implements SwipeHelper.Cal
public void applyNotificationInfo(NotificationInfo mainNotification, View iconView,
boolean animate) {
mNotificationInfo = mainNotification;
- mTitleView.setText(mNotificationInfo.title);
- mTextView.setText(mNotificationInfo.text);
+ CharSequence title = mNotificationInfo.title;
+ CharSequence text = mNotificationInfo.text;
+ if (!TextUtils.isEmpty(title) && !TextUtils.isEmpty(text)) {
+ mTitleView.setText(title);
+ mTextView.setText(text);
+ } else {
+ mTitleView.setMaxLines(2);
+ mTitleView.setText(TextUtils.isEmpty(title) ? text : title);
+ mTextView.setVisibility(GONE);
+ }
iconView.setBackground(mNotificationInfo.getIconForBackground(getContext(),
mBackgroundColor));
- setOnClickListener(mNotificationInfo);
+ if (mNotificationInfo.intent != null) {
+ setOnClickListener(mNotificationInfo);
+ }
setTranslationX(0);
// Add a dummy ItemInfo so that logging populates the correct container and item types
// instead of DEFAULT_CONTAINERTYPE and DEFAULT_ITEMTYPE, respectively.