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

Commit 27b963fd authored by calderwoodra's avatar calderwoodra Committed by Copybara-Service
Browse files

Fixed some a11y issues in MainActivity.

 - main fragments are no longer detected by talkback while search is open.
 - FAB now has a content description

Bug: 73587831,73891132
Test: tap
PiperOrigin-RevId: 187248081
Change-Id: I5a8fe2df23542d19c935cba77d1337ec753064af
parent 0b0c2093
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -128,7 +128,9 @@ public class MainSearchController implements SearchBarListener {
      // TODO(a bug): zero suggest results aren't actually shown but this enabled the nearby
      // places promo to be shown.
      searchFragment = NewSearchFragment.newInstance(/* showZeroSuggest=*/ true);
      transaction.add(R.id.fragment_container, searchFragment, SEARCH_FRAGMENT_TAG);
      transaction.replace(R.id.fragment_container, searchFragment, SEARCH_FRAGMENT_TAG);
      transaction.addToBackStack(null);
      transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    } else if (!isSearchVisible()) {
      transaction.show(searchFragment);
    }
@@ -287,11 +289,20 @@ public class MainSearchController implements SearchBarListener {
    showBottomNav();
    toolbar.collapse(animate);
    toolbarShadow.setVisibility(View.GONE);
    mainActivity.getFragmentManager().beginTransaction().remove(getSearchFragment()).commit();
    mainActivity.getFragmentManager().popBackStack();

    // Clear the dialpad so the phone number isn't persisted between search sessions.
    if (getDialpadFragment() != null) {
      getDialpadFragment().clearDialpad();
    DialpadFragment dialpadFragment = getDialpadFragment();
    if (dialpadFragment != null) {
      // Temporarily disable accessibility when we clear the dialpad, since it should be
      // invisible and should not announce anything.
      dialpadFragment
          .getDigitsWidget()
          .setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
      dialpadFragment.clearDialpad();
      dialpadFragment
          .getDigitsWidget()
          .setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO);
    }

    notifyListenersOnSearchClose();
@@ -355,7 +366,9 @@ public class MainSearchController implements SearchBarListener {
      // TODO(a bug): zero suggest results aren't actually shown but this enabled the nearby
      // places promo to be shown.
      searchFragment = NewSearchFragment.newInstance(true);
      transaction.add(R.id.fragment_container, searchFragment, SEARCH_FRAGMENT_TAG);
      transaction.replace(R.id.fragment_container, searchFragment, SEARCH_FRAGMENT_TAG);
      transaction.addToBackStack(null);
      transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    } else if (!isSearchVisible()) {
      transaction.show(getSearchFragment());
    }
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
        android:layout_margin="16dp"
        android:layout_gravity="end|bottom"
        android:src="@drawable/quantum_ic_dialpad_white_24"
        android:contentDescription="@string/dialpad_button_content_description"
        app:backgroundTint="?android:attr/colorAccent"/>
  </android.support.design.widget.CoordinatorLayout>

+4 −0
Original line number Diff line number Diff line
@@ -40,4 +40,8 @@

  <!-- Message displayed when there is no application available to handle voice search. [CHAR LIMIT=NONE] -->
  <string name="voice_search_not_available">Voice search not available</string>

  <!-- Content description for the button that displays the dialpad
       [CHAR LIMIT=NONE] -->
  <string name="dialpad_button_content_description">key pad</string>
</resources>