Mark Editors as deleted when entire KindSectionViews are removed.
Regression was introduce by ag/721564
Bug 22345338
Change-Id: I21ef3e94cc20c8cc10f06084ce350b626710bbfc
diff --git a/src/com/android/contacts/editor/Editor.java b/src/com/android/contacts/editor/Editor.java
index 73b950a..d5c8589 100644
--- a/src/com/android/contacts/editor/Editor.java
+++ b/src/com/android/contacts/editor/Editor.java
@@ -81,7 +81,13 @@
public void onFieldChanged(String column, String value);
/**
- * Performs the delete operation for this {@link Editor}.
+ * Marks the underlying ValuesDelta as deleted, but does not update the view.
+ */
+ public void markDeleted();
+
+ /**
+ * Performs the delete operation for this {@link Editor}, which involves both
+ * marking the underlying ValuesDelta as deleted and updating the view.
*/
public void deleteEditor();
diff --git a/src/com/android/contacts/editor/KindSectionView.java b/src/com/android/contacts/editor/KindSectionView.java
index 5837ab1..26ef058 100644
--- a/src/com/android/contacts/editor/KindSectionView.java
+++ b/src/com/android/contacts/editor/KindSectionView.java
@@ -133,6 +133,7 @@
// If there is a listener, let it decide whether to delete the Editor or the entire
// KindSectionView so that there is no jank from both animations happening in succession.
if (mListener != null) {
+ editor.markDeleted();
mListener.onDeleteRequested(editor);
} else {
editor.deleteEditor();
@@ -140,10 +141,21 @@
}
}
+ /**
+ * Calling this signifies that this entire section view is intended to be removed from the
+ * layout. Note, calling this does not change the deleted state of any underlying
+ * {@link Editor}, i.e. {@link com.android.contacts.common.model.ValuesDelta#markDeleted()}
+ * is not invoked on any editor in this section. It is purely marked for higher level UI
+ * layers to manipulate the layout w/o introducing jank.
+ * See b/22228718 for context.
+ */
public void markForRemoval() {
mMarkedForRemoval = true;
}
+ /**
+ * Whether the entire section view is intended to be removed from the layout.
+ */
public boolean isMarkedForRemoval() {
return mMarkedForRemoval;
}
diff --git a/src/com/android/contacts/editor/LabeledEditorView.java b/src/com/android/contacts/editor/LabeledEditorView.java
index fe7ae0a..931d7cf 100644
--- a/src/com/android/contacts/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/editor/LabeledEditorView.java
@@ -185,9 +185,14 @@
}
@Override
- public void deleteEditor() {
+ public void markDeleted() {
// Keep around in model, but mark as deleted
mEntry.markDeleted();
+ }
+
+ @Override
+ public void deleteEditor() {
+ markDeleted();
// Remove the view
EditorAnimator.getInstance().removeEditorView(this);
diff --git a/src/com/android/contacts/editor/PhotoEditorView.java b/src/com/android/contacts/editor/PhotoEditorView.java
index 40f4f82..f69c935 100644
--- a/src/com/android/contacts/editor/PhotoEditorView.java
+++ b/src/com/android/contacts/editor/PhotoEditorView.java
@@ -252,6 +252,11 @@
}
@Override
+ public void markDeleted() {
+ // Photo is not deletable
+ }
+
+ @Override
public void deleteEditor() {
// Photo is not deletable
}