Merge "Make Notification long clickable" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ae1b2e33b1
@@ -1196,6 +1196,22 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
return getShowingLayout().getVisibleWrapper();
|
return getShowingLayout().getVisibleWrapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether the notification row is long clickable or not.
|
||||||
|
*/
|
||||||
|
public boolean isNotificationRowLongClickable() {
|
||||||
|
if (mLongPressListener == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!areGutsExposed()) { // guts is not opened
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it is leave behind, it shouldn't be long clickable.
|
||||||
|
return !isGutsLeaveBehind();
|
||||||
|
}
|
||||||
|
|
||||||
public void setLongPressListener(LongPressListener longPressListener) {
|
public void setLongPressListener(LongPressListener longPressListener) {
|
||||||
mLongPressListener = longPressListener;
|
mLongPressListener = longPressListener;
|
||||||
}
|
}
|
||||||
@@ -2947,6 +2963,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
return (mGuts != null && mGuts.isExposed());
|
return (mGuts != null && mGuts.isExposed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isGutsLeaveBehind() {
|
||||||
|
return (mGuts != null && mGuts.isLeavebehind());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isContentExpandable() {
|
public boolean isContentExpandable() {
|
||||||
if (mIsSummaryWithChildren && !shouldShowPublic()) {
|
if (mIsSummaryWithChildren && !shouldShowPublic()) {
|
||||||
@@ -3394,7 +3414,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
@Override
|
@Override
|
||||||
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
|
public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
|
||||||
super.onInitializeAccessibilityNodeInfoInternal(info);
|
super.onInitializeAccessibilityNodeInfoInternal(info);
|
||||||
|
final boolean isLongClickable = isNotificationRowLongClickable();
|
||||||
|
if (isLongClickable) {
|
||||||
info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_LONG_CLICK);
|
info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_LONG_CLICK);
|
||||||
|
}
|
||||||
|
info.setLongClickable(isLongClickable);
|
||||||
|
|
||||||
if (canViewBeDismissed() && !mIsSnoozed) {
|
if (canViewBeDismissed() && !mIsSnoozed) {
|
||||||
info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS);
|
info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -586,7 +586,9 @@ public class NotificationGutsManager implements NotifGutsViewManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final ExpandableNotificationRow row = (ExpandableNotificationRow) view;
|
final ExpandableNotificationRow row = (ExpandableNotificationRow) view;
|
||||||
|
if (row.isNotificationRowLongClickable()) {
|
||||||
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
|
||||||
|
}
|
||||||
if (row.areGutsExposed()) {
|
if (row.areGutsExposed()) {
|
||||||
closeAndSaveGuts(false /* removeLeavebehind */, false /* force */,
|
closeAndSaveGuts(false /* removeLeavebehind */, false /* force */,
|
||||||
true /* removeControls */, -1 /* x */, -1 /* y */,
|
true /* removeControls */, -1 /* x */, -1 /* y */,
|
||||||
|
|||||||
Reference in New Issue
Block a user