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

Commit 3025e008 authored by Zemiao Zhu's avatar Zemiao Zhu Committed by Automerger Merge Worker
Browse files

Merge "Fix talkback. Announce Files appname by explicitly call...

Merge "Fix talkback. Announce Files appname by explicitly call View.announceForAccessibility. To prevent announcing twice, only do this when first launch." into rvc-dev am: 68392ec4 am: d1c84532 am: db8320ef

Change-Id: I42d1108b8cb0705dd9b14973b3df0fe33999064f
parents f611c111 db8320ef
Loading
Loading
Loading
Loading
+9 −18
Original line number Diff line number Diff line
@@ -348,19 +348,6 @@ public abstract class BaseActivity
        mRootsMonitor.start();
    }

    @Override
    protected void onStart() {
        super.onStart();
        if (mState.stack.getTitle() == null) {
            // First launch.
            setTitle("");
            return;
        }

        // Append app name for TalkBack when app enters foreground.
        setTitle(String.format("%s. %s", getString(R.string.files_label), mState.stack.getTitle()));
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        boolean showMenu = super.onCreateOptionsMenu(menu);
@@ -623,13 +610,17 @@ public abstract class BaseActivity
            roots.onCurrentRootChanged();
        }

        // Causes talkback to announce the activity's new title
        String appName = getString(R.string.files_label);
        if (getTitle() == null || getTitle().toString().isEmpty()) {
        String currentTitle = getTitle() != null ? getTitle().toString() : "";
        if (currentTitle.equals(appName)) {
            // First launch, TalkBack announces app name.
            setTitle(String.format("%s. %s", appName, mState.stack.getTitle()));
        } else if (mState.stack.getTitle() != null) {
            setTitle(mState.stack.getTitle());
            getWindow().getDecorView().announceForAccessibility(appName);
        }

        String newTitle = mState.stack.getTitle();
        if (newTitle != null) {
            // Causes talkback to announce the activity's new title
            setTitle(newTitle);
        }

        invalidateOptionsMenu();