mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 852955 - Disable dynamic toolbar when accessibility features are enabled. r=kats
The dynamic toolbar is just not a useful feature when it comes to accessibility.
This commit is contained in:
parent
06f324d3da
commit
69442ae71f
@ -104,6 +104,8 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
|
|
||||||
private FindInPageBar mFindInPageBar;
|
private FindInPageBar mFindInPageBar;
|
||||||
|
|
||||||
|
private boolean mAccessibilityEnabled = false;
|
||||||
|
|
||||||
// We'll ask for feedback after the user launches the app this many times.
|
// We'll ask for feedback after the user launches the app this many times.
|
||||||
private static final int FEEDBACK_LAUNCH_COUNT = 15;
|
private static final int FEEDBACK_LAUNCH_COUNT = 15;
|
||||||
|
|
||||||
@ -154,7 +156,7 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
if ("about:home".equals(tab.getURL())) {
|
if ("about:home".equals(tab.getURL())) {
|
||||||
showAboutHome();
|
showAboutHome();
|
||||||
|
|
||||||
if (mDynamicToolbarEnabled) {
|
if (isDynamicToolbarEnabled()) {
|
||||||
// Show the toolbar.
|
// Show the toolbar.
|
||||||
mBrowserToolbar.animateVisibility(true);
|
mBrowserToolbar.animateVisibility(true);
|
||||||
}
|
}
|
||||||
@ -183,7 +185,7 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
if (Tabs.getInstance().isSelectedTab(tab)) {
|
if (Tabs.getInstance().isSelectedTab(tab)) {
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
|
|
||||||
if (mDynamicToolbarEnabled) {
|
if (isDynamicToolbarEnabled()) {
|
||||||
// Show the toolbar.
|
// Show the toolbar.
|
||||||
mBrowserToolbar.animateVisibility(true);
|
mBrowserToolbar.animateVisibility(true);
|
||||||
}
|
}
|
||||||
@ -220,7 +222,7 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
||||||
if (!mDynamicToolbarEnabled || mToolbarPinned) {
|
if (!isDynamicToolbarEnabled() || mToolbarPinned) {
|
||||||
return super.onInterceptTouchEvent(view, event);
|
return super.onInterceptTouchEvent(view, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +362,7 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
case KeyEvent.KEYCODE_BUTTON_Y:
|
case KeyEvent.KEYCODE_BUTTON_Y:
|
||||||
// Toggle/focus the address bar on gamepad-y button.
|
// Toggle/focus the address bar on gamepad-y button.
|
||||||
if (mBrowserToolbar.isVisible()) {
|
if (mBrowserToolbar.isVisible()) {
|
||||||
if (mDynamicToolbarEnabled &&
|
if (isDynamicToolbarEnabled() &&
|
||||||
Boolean.FALSE.equals(mAboutHomeShowing)) {
|
Boolean.FALSE.equals(mAboutHomeShowing)) {
|
||||||
mBrowserToolbar.animateVisibility(false);
|
mBrowserToolbar.animateVisibility(false);
|
||||||
mLayerView.requestFocus();
|
mLayerView.requestFocus();
|
||||||
@ -548,21 +550,11 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
ThreadUtils.postToUiThread(new Runnable() {
|
ThreadUtils.postToUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mDynamicToolbarEnabled) {
|
// If accessibility is enabled, the dynamic toolbar is
|
||||||
setToolbarMargin(0);
|
// forced to be off.
|
||||||
} else {
|
if (!mAccessibilityEnabled) {
|
||||||
// Immediately show the toolbar when disabling the dynamic
|
setDynamicToolbarEnabled(mDynamicToolbarEnabled);
|
||||||
// toolbar.
|
|
||||||
if (mAboutHomeContent != null) {
|
|
||||||
mAboutHomeContent.setPadding(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
mBrowserToolbar.cancelVisibilityAnimation();
|
|
||||||
mBrowserToolbar.getLayout().scrollTo(0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the margins to reset the padding on the spacer and
|
|
||||||
// make sure that Gecko is in sync.
|
|
||||||
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -576,6 +568,42 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setDynamicToolbarEnabled(boolean enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
setToolbarMargin(0);
|
||||||
|
} else {
|
||||||
|
// Immediately show the toolbar when disabling the dynamic
|
||||||
|
// toolbar.
|
||||||
|
if (mAboutHomeContent != null) {
|
||||||
|
mAboutHomeContent.setPadding(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
mBrowserToolbar.cancelVisibilityAnimation();
|
||||||
|
mBrowserToolbar.getLayout().scrollTo(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Refresh the margins to reset the padding on the spacer and
|
||||||
|
// make sure that Gecko is in sync.
|
||||||
|
((BrowserToolbarLayout)mBrowserToolbar.getLayout()).refreshMargins();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isDynamicToolbarEnabled() {
|
||||||
|
return mDynamicToolbarEnabled && !mAccessibilityEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAccessibilityEnabled(boolean enabled) {
|
||||||
|
if (mAccessibilityEnabled == enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable the dynamic toolbar when accessibility features are enabled,
|
||||||
|
// and re-read the preference when they're disabled.
|
||||||
|
mAccessibilityEnabled = enabled;
|
||||||
|
if (mDynamicToolbarEnabled) {
|
||||||
|
setDynamicToolbarEnabled(!enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
if (mPrefObserverId != null) {
|
if (mPrefObserverId != null) {
|
||||||
@ -670,11 +698,11 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setToolbarHeight(int aHeight, int aVisibleHeight) {
|
public void setToolbarHeight(int aHeight, int aVisibleHeight) {
|
||||||
if (!mDynamicToolbarEnabled || Boolean.TRUE.equals(mAboutHomeShowing)) {
|
if (!isDynamicToolbarEnabled() || Boolean.TRUE.equals(mAboutHomeShowing)) {
|
||||||
// Use aVisibleHeight here so that when the dynamic toolbar is
|
// Use aVisibleHeight here so that when the dynamic toolbar is
|
||||||
// enabled, the padding will animate with the toolbar becoming
|
// enabled, the padding will animate with the toolbar becoming
|
||||||
// visible.
|
// visible.
|
||||||
if (mDynamicToolbarEnabled) {
|
if (isDynamicToolbarEnabled()) {
|
||||||
// When the dynamic toolbar is enabled, set the padding on the
|
// When the dynamic toolbar is enabled, set the padding on the
|
||||||
// about:home widget directly - this is to avoid resizing the
|
// about:home widget directly - this is to avoid resizing the
|
||||||
// LayerView, which can cause visible artifacts.
|
// LayerView, which can cause visible artifacts.
|
||||||
@ -1457,7 +1485,7 @@ abstract public class BrowserApp extends GeckoApp
|
|||||||
if (!mBrowserToolbar.openOptionsMenu())
|
if (!mBrowserToolbar.openOptionsMenu())
|
||||||
super.openOptionsMenu();
|
super.openOptionsMenu();
|
||||||
|
|
||||||
if (mDynamicToolbarEnabled)
|
if (isDynamicToolbarEnabled())
|
||||||
mBrowserToolbar.animateVisibility(true);
|
mBrowserToolbar.animateVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +67,10 @@ public class GeckoAccessibility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable the dynamic toolbar when enabling accessibility.
|
||||||
|
// These features tend not to interact well.
|
||||||
|
GeckoApp.mAppContext.setAccessibilityEnabled(sEnabled);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ret.put("enabled", sEnabled);
|
ret.put("enabled", sEnabled);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@ -2391,6 +2391,9 @@ abstract public class GeckoApp
|
|||||||
mLayerView.setTouchIntercepter(this);
|
mLayerView.setTouchIntercepter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAccessibilityEnabled(boolean enabled) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user