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

Commit 9c76a9ce authored by Sunny Goyal's avatar Sunny Goyal Committed by android-build-merger
Browse files

Announcing the final action when the drag-drop completes

am: 3f886406

Change-Id: Iba49c7ba1d1c2d1f4c279970bbcc3ff96af5ccc0
parents fd8eaee2 3f886406
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2743,6 +2743,9 @@ public class Workspace extends PagedView
            }
            parent.onDropChild(cell);
        }
        if (d.stateAnnouncer != null) {
            d.stateAnnouncer.completeAction(R.string.item_moved);
        }
    }

    /**
+8 −0
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;

import com.android.launcher3.Launcher;

/**
 * Periodically sends accessibility events to announce ongoing state changed. Based on the
 * implementation in ProgressBar.
@@ -50,6 +52,12 @@ public class DragViewStateAnnouncer implements Runnable {
        mTargetView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
    }

    public void completeAction(int announceResId) {
        cancel();
        Launcher launcher = Launcher.getLauncher(mTargetView.getContext());
        launcher.getDragLayer().announceForAccessibility(launcher.getText(announceResId));
    }

    public static DragViewStateAnnouncer createFor(View v) {
        if (((AccessibilityManager) v.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE))
                .isEnabled()) {
+4 −0
Original line number Diff line number Diff line
@@ -1370,6 +1370,10 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC
            // The animation has already been shown while opening the folder.
            mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, true, mLauncher);
        }

        if (d.stateAnnouncer != null) {
            d.stateAnnouncer.completeAction(R.string.item_moved);
        }
    }

    // This is used so the item doesn't immediately appear in the folder when added. In one case