зеркало из https://github.com/mozilla/gecko-dev.git
Bug 924480 - Part 2: Disable TalkBack access to Gecko with HomePager displayed. r=eeejay,lucasr
This commit is contained in:
Родитель
8819c2b7f6
Коммит
a7216e6474
|
@ -166,6 +166,12 @@ abstract public class BrowserApp extends GeckoApp
|
|||
|
||||
private BrowserHealthReporter mBrowserHealthReporter;
|
||||
|
||||
// The animator used to toggle HomePager visibility has a race where if the HomePager is shown
|
||||
// (starting the animation), the HomePager is hidden, and the HomePager animation completes,
|
||||
// both the web content and the HomePager will be hidden. This flag is used to prevent the
|
||||
// race by determining if the web content should be hidden at the animation's end.
|
||||
private boolean mHideWebContentOnAnimationEnd = false;
|
||||
|
||||
private SiteIdentityPopup mSiteIdentityPopup;
|
||||
|
||||
public SiteIdentityPopup getSiteIdentityPopup() {
|
||||
|
@ -1573,7 +1579,38 @@ abstract public class BrowserApp extends GeckoApp
|
|||
final ViewStub homePagerStub = (ViewStub) findViewById(R.id.home_pager_stub);
|
||||
mHomePager = (HomePager) homePagerStub.inflate();
|
||||
}
|
||||
|
||||
mHomePager.show(getSupportFragmentManager(), page, animator);
|
||||
|
||||
// Hide the web content so it cannot be focused by screen readers.
|
||||
hideWebContentOnPropertyAnimationEnd(animator);
|
||||
}
|
||||
|
||||
private void hideWebContentOnPropertyAnimationEnd(final PropertyAnimator animator) {
|
||||
if (animator == null) {
|
||||
hideWebContent();
|
||||
return;
|
||||
}
|
||||
|
||||
animator.addPropertyAnimationListener(new PropertyAnimator.PropertyAnimationListener() {
|
||||
@Override
|
||||
public void onPropertyAnimationStart() {
|
||||
mHideWebContentOnAnimationEnd = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPropertyAnimationEnd() {
|
||||
if (mHideWebContentOnAnimationEnd) {
|
||||
hideWebContent();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void hideWebContent() {
|
||||
// The view is set to INVISIBLE, rather than GONE, to avoid
|
||||
// the additional requestLayout() call.
|
||||
mLayerView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
private void hideHomePager() {
|
||||
|
@ -1586,6 +1623,12 @@ abstract public class BrowserApp extends GeckoApp
|
|||
return;
|
||||
}
|
||||
|
||||
// Prevent race in hiding web content - see declaration for more info.
|
||||
mHideWebContentOnAnimationEnd = false;
|
||||
|
||||
// Display the previously hidden web content (which prevented screen reader access).
|
||||
mLayerView.setVisibility(View.VISIBLE);
|
||||
|
||||
if (mHomePager != null) {
|
||||
mHomePager.hide();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче