Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpUtil.java +44 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,15 @@ package com.android.systemui.statusbar.policy; import android.annotation.NonNull; import android.annotation.Nullable; import android.util.Log; import android.view.View; import com.android.systemui.R; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.util.Compile; /** * A class of utility static methods for heads up notifications. Loading @@ -26,12 +32,18 @@ import com.android.systemui.R; public final class HeadsUpUtil { private static final int TAG_CLICKED_NOTIFICATION = R.id.is_clicked_heads_up_tag; private static final String LOG_TAG = "HeadsUpUtil"; private static final boolean LOG_DEBUG = Compile.IS_DEBUG && Log.isLoggable(LOG_TAG, Log.DEBUG); /** * Set the given view as clicked or not-clicked. * @param view The view to be set the flag to. * @param clicked True to set as clicked. False to not-clicked. */ public static void setNeedsHeadsUpDisappearAnimationAfterClick(View view, boolean clicked) { if (LOG_DEBUG) { logTagClickedNotificationChanged(view, clicked); } view.setTag(TAG_CLICKED_NOTIFICATION, clicked ? true : null); } Loading @@ -44,4 +56,36 @@ public final class HeadsUpUtil { Boolean clicked = (Boolean) view.getTag(TAG_CLICKED_NOTIFICATION); return clicked != null && clicked; } private static void logTagClickedNotificationChanged(@Nullable View view, boolean isClicked) { if (view == null) { return; } final boolean wasClicked = isClickedHeadsUpNotification(view); if (isClicked == wasClicked) { return; } Log.d(LOG_TAG, getViewKey(view) + ": TAG_CLICKED_NOTIFICATION set to " + isClicked); } private static @NonNull String getViewKey(@NonNull View view) { if (!(view instanceof ExpandableNotificationRow)) { return "(not a row)"; } final ExpandableNotificationRow row = (ExpandableNotificationRow) view; final NotificationEntry entry = row.getEntry(); if (entry == null) { return "(null entry)"; } final String key = entry.getKey(); if (key == null) { return "(null key)"; } return key; } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpUtil.java +44 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,15 @@ package com.android.systemui.statusbar.policy; import android.annotation.NonNull; import android.annotation.Nullable; import android.util.Log; import android.view.View; import com.android.systemui.R; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.util.Compile; /** * A class of utility static methods for heads up notifications. Loading @@ -26,12 +32,18 @@ import com.android.systemui.R; public final class HeadsUpUtil { private static final int TAG_CLICKED_NOTIFICATION = R.id.is_clicked_heads_up_tag; private static final String LOG_TAG = "HeadsUpUtil"; private static final boolean LOG_DEBUG = Compile.IS_DEBUG && Log.isLoggable(LOG_TAG, Log.DEBUG); /** * Set the given view as clicked or not-clicked. * @param view The view to be set the flag to. * @param clicked True to set as clicked. False to not-clicked. */ public static void setNeedsHeadsUpDisappearAnimationAfterClick(View view, boolean clicked) { if (LOG_DEBUG) { logTagClickedNotificationChanged(view, clicked); } view.setTag(TAG_CLICKED_NOTIFICATION, clicked ? true : null); } Loading @@ -44,4 +56,36 @@ public final class HeadsUpUtil { Boolean clicked = (Boolean) view.getTag(TAG_CLICKED_NOTIFICATION); return clicked != null && clicked; } private static void logTagClickedNotificationChanged(@Nullable View view, boolean isClicked) { if (view == null) { return; } final boolean wasClicked = isClickedHeadsUpNotification(view); if (isClicked == wasClicked) { return; } Log.d(LOG_TAG, getViewKey(view) + ": TAG_CLICKED_NOTIFICATION set to " + isClicked); } private static @NonNull String getViewKey(@NonNull View view) { if (!(view instanceof ExpandableNotificationRow)) { return "(not a row)"; } final ExpandableNotificationRow row = (ExpandableNotificationRow) view; final NotificationEntry entry = row.getEntry(); if (entry == null) { return "(null entry)"; } final String key = entry.getKey(); if (key == null) { return "(null key)"; } return key; } }