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

Commit 5bd3f582 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

Change-Id: I44e840d4e10e36c85878a0f5fb02b202fb7efe45
parents ad167bf7 68392ec4
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();