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

Commit b78cce90 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: 5bd3f582 am: 1f172b0f

Change-Id: I35b6ec405402ebb3989af89a6db7c3cd6144c420
parents 34e42727 1f172b0f
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();