Fix a Talkback problem of BottomActionBar and BottomNavigationView
Problem: Talkback will navigate to BottomNavigationView when BottomActionBar is visible. Video: https://drive.google.com/a/google.com/file/d/1ednveuPqoRovWduPEKWjykeDu46EA6QA/view?usp=sharing
Fix: Hide the BottomNavigationView when BottomActionBar is visible. Video: https://drive.google.com/a/google.com/file/d/1OVjVbwQY4NlJvHYd5wwg6mtsrAFTmfmk/view?usp=sharing
Test: Manually
Bug: 151892004
Change-Id: I874dd10190d0e5b0b4e3f9d57f273c15ec28e97b
diff --git a/src/com/android/customization/picker/CustomizationPickerActivity.java b/src/com/android/customization/picker/CustomizationPickerActivity.java
index 0dde0eb..f1e9a47 100644
--- a/src/com/android/customization/picker/CustomizationPickerActivity.java
+++ b/src/com/android/customization/picker/CustomizationPickerActivity.java
@@ -25,6 +25,7 @@
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
@@ -101,6 +102,7 @@
private static final Map<Integer, CustomizationSection> mSections = new HashMap<>();
private CategoryFragment mWallpaperCategoryFragment;
+ private BottomActionBar mBottomActionBar;
private boolean mWallpaperCategoryInitialized;
@@ -137,6 +139,15 @@
? R.id.nav_wallpaper : R.id.nav_theme);
}
}
+
+ mBottomActionBar = findViewById(R.id.bottom_actionbar);
+ mBottomActionBar.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
+ // Only update the visibility of mBottomNav when mBottomActionBar visibility changes.
+ // Since the listener will be triggered by mBottomActionBar and its child views.
+ if (mBottomActionBar.getVisibility() == mBottomNav.getVisibility()) {
+ mBottomNav.setVisibility(mBottomActionBar.isVisible() ? View.GONE : View.VISIBLE);
+ }
+ });
}
@Override
@@ -413,7 +424,7 @@
@Override
public BottomActionBar getBottomActionBar() {
- return findViewById(R.id.bottom_actionbar);
+ return mBottomActionBar;
}
/**