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

Commit db8320ef 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

Change-Id: Ibf9820002dc7e3fe402a6448f1422a2302776079
parents 70121518 d1c84532
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();