Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23a34d10 authored by Walter Jang's avatar Walter Jang
Browse files

Mark Editors as deleted when entire KindSectionViews are removed.

Regression was introduce by ag/721564

Bug 22345338

Change-Id: I21ef3e94cc20c8cc10f06084ce350b626710bbfc
parent 4ee224b7
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -81,7 +81,13 @@ public interface Editor {
    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();

+12 −0
Original line number Diff line number Diff line
@@ -133,6 +133,7 @@ public class KindSectionView extends LinearLayout implements EditorListener {
            // 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 @@ public class KindSectionView extends LinearLayout implements EditorListener {
        }
    }

    /**
     * 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;
    }
+6 −1
Original line number Diff line number Diff line
@@ -185,9 +185,14 @@ public abstract class LabeledEditorView extends LinearLayout implements Editor,
    }

    @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);
+5 −0
Original line number Diff line number Diff line
@@ -251,6 +251,11 @@ public class PhotoEditorView extends LinearLayout implements Editor {
        return !mHasSetPhoto;
    }

    @Override
    public void markDeleted() {
        // Photo is not deletable
    }

    @Override
    public void deleteEditor() {
        // Photo is not deletable