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.
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()) {
// 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