Merge "Make Notification long clickable" into tm-qpr-dev am: ecbc12235e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21047384 Change-Id: I9326d26b45dfeb357d2e061f75a7109dac5c29b2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -591,6 +591,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
}
|
}
|
||||||
mShowingPublicInitialized = false;
|
mShowingPublicInitialized = false;
|
||||||
updateNotificationColor();
|
updateNotificationColor();
|
||||||
|
updateLongClickable();
|
||||||
if (mMenuRow != null) {
|
if (mMenuRow != null) {
|
||||||
mMenuRow.onNotificationUpdated(mEntry.getSbn());
|
mMenuRow.onNotificationUpdated(mEntry.getSbn());
|
||||||
mMenuRow.setAppName(mAppName);
|
mMenuRow.setAppName(mAppName);
|
||||||
@@ -1196,8 +1197,26 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
return getShowingLayout().getVisibleWrapper();
|
return getShowingLayout().getVisibleWrapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateLongClickable() {
|
||||||
|
setLongClickable(isNotificationRowLongClickable());
|
||||||
|
}
|
||||||
|
|
||||||
public void setLongPressListener(LongPressListener longPressListener) {
|
public void setLongPressListener(LongPressListener longPressListener) {
|
||||||
mLongPressListener = longPressListener;
|
mLongPressListener = longPressListener;
|
||||||
|
updateLongClickable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDragController(ExpandableNotificationRowDragController dragController) {
|
public void setDragController(ExpandableNotificationRowDragController dragController) {
|
||||||
@@ -2044,11 +2063,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
void onGutsOpened() {
|
void onGutsOpened() {
|
||||||
resetTranslation();
|
resetTranslation();
|
||||||
updateContentAccessibilityImportanceForGuts(false /* isEnabled */);
|
updateContentAccessibilityImportanceForGuts(false /* isEnabled */);
|
||||||
|
updateLongClickable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onGutsClosed() {
|
void onGutsClosed() {
|
||||||
updateContentAccessibilityImportanceForGuts(true /* isEnabled */);
|
updateContentAccessibilityImportanceForGuts(true /* isEnabled */);
|
||||||
mIsSnoozed = false;
|
mIsSnoozed = false;
|
||||||
|
updateLongClickable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2947,6 +2968,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()) {
|
||||||
|
|||||||
@@ -586,7 +586,9 @@ public class NotificationGutsManager implements NotifGutsViewManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final ExpandableNotificationRow row = (ExpandableNotificationRow) view;
|
final ExpandableNotificationRow row = (ExpandableNotificationRow) view;
|
||||||
|
if (view.isLongClickable()) {
|
||||||
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