Add implementation of homepage swipe to dismiss.
- Only enable swipe for slice full/half card. - Add isPendingDismiss in ContextualCard to determine if we should show dismissal view. - Take out long press feature. Bug: 126214056 Test: robotests Change-Id: Ib03e605347b2f50d3c62fcd4f95875a21cc9ef1c
This commit is contained in:
@@ -71,6 +71,7 @@ public class ContextualCard {
|
||||
private final Drawable mIconDrawable;
|
||||
@LayoutRes
|
||||
private final int mViewType;
|
||||
private final boolean mIsPendingDismiss;
|
||||
|
||||
public String getName() {
|
||||
return mName;
|
||||
@@ -156,6 +157,10 @@ public class ContextualCard {
|
||||
return mViewType;
|
||||
}
|
||||
|
||||
public boolean isPendingDismiss() {
|
||||
return mIsPendingDismiss;
|
||||
}
|
||||
|
||||
public Builder mutate() {
|
||||
return mBuilder;
|
||||
}
|
||||
@@ -181,6 +186,7 @@ public class ContextualCard {
|
||||
mIconDrawable = builder.mIconDrawable;
|
||||
mIsLargeCard = builder.mIsLargeCard;
|
||||
mViewType = builder.mViewType;
|
||||
mIsPendingDismiss = builder.mIsPendingDismiss;
|
||||
}
|
||||
|
||||
ContextualCard(Cursor c) {
|
||||
@@ -226,6 +232,8 @@ public class ContextualCard {
|
||||
mBuilder.setIconDrawable(mIconDrawable);
|
||||
mViewType = getViewTypeByCardType(mCardType);
|
||||
mBuilder.setViewType(mViewType);
|
||||
mIsPendingDismiss = false;
|
||||
mBuilder.setIsPendingDismiss(mIsPendingDismiss);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,6 +285,7 @@ public class ContextualCard {
|
||||
private boolean mIsLargeCard;
|
||||
@LayoutRes
|
||||
private int mViewType;
|
||||
private boolean mIsPendingDismiss;
|
||||
|
||||
public Builder setName(String name) {
|
||||
mName = name;
|
||||
@@ -373,6 +382,11 @@ public class ContextualCard {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setIsPendingDismiss(boolean isPendingDismiss) {
|
||||
mIsPendingDismiss = isPendingDismiss;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContextualCard build() {
|
||||
return new ContextualCard(this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user