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

Commit f982b0dc authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[a11y] fix the issue where launcher announces item added to homescreen...

Merge "[a11y] fix the issue where launcher announces item added to homescreen before it does" into ub-launcher3-master
parents a9e94440 c9074277
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ import android.view.animation.OvershootInterpolator;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.annotation.VisibleForTesting;

import com.android.launcher3.DropTarget.DragObject;
@@ -692,6 +693,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        switch (requestCode) {
            case REQUEST_CREATE_SHORTCUT:
                completeAddShortcut(intent, info.container, screenId, info.cellX, info.cellY, info);
                announceForAccessibility(R.string.item_added_to_workspace);
                break;
            case REQUEST_CREATE_APPWIDGET:
                completeAddAppWidget(appWidgetId, info, null, null);
@@ -716,7 +718,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
                break;
            }
        }

        return screenId;
    }

@@ -1322,6 +1323,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        hostView.setVisibility(View.VISIBLE);
        prepareAppWidget(hostView, launcherInfo);
        mWorkspace.addInScreen(hostView, launcherInfo);
        announceForAccessibility(R.string.item_added_to_workspace);
    }

    private void prepareAppWidget(AppWidgetHostView hostView, LauncherAppWidgetInfo item) {
@@ -2411,6 +2413,10 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
        return bounceAnim;
    }

    private void announceForAccessibility(@StringRes int stringResId) {
        getDragLayer().announceForAccessibility(getString(stringResId));
    }

    /**
     * Add the icons for all apps.
     *
+1 −1
Original line number Diff line number Diff line
@@ -191,6 +191,7 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
                        ArrayList<ItemInfo> itemList = new ArrayList<>();
                        itemList.add(info);
                        mLauncher.bindItems(itemList, true);
                        announceConfirmation(R.string.item_added_to_workspace);
                    } else if (item instanceof PendingAddItemInfo) {
                        PendingAddItemInfo info = (PendingAddItemInfo) item;
                        Workspace workspace = mLauncher.getWorkspace();
@@ -198,7 +199,6 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
                        mLauncher.addPendingItem(info, Favorites.CONTAINER_DESKTOP,
                                screenId, coordinates, info.spanX, info.spanY);
                    }
                    announceConfirmation(R.string.item_added_to_workspace);
                }
            });
            return true;