зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1412872 - 5. Move GeckoAccessibility out of gecko-view; r=snorp
Move GeckoAccessibility out of gecko-view and into gecko-browser. GeckoAccessibility as-is is currently only good for Fennec and is not suitable for generic GeckoView use. MozReview-Commit-ID: Fek8fLJNC6F --HG-- rename : mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAccessibility.java => mobile/android/base/java/org/mozilla/gecko/GeckoAccessibility.java rename : mobile/android/geckoview/src/thirdparty/java/com/googlecode/eyesfree/braille/selfbraille/ISelfBrailleService.java => mobile/android/thirdparty/com/googlecode/eyesfree/braille/selfbraille/ISelfBrailleService.java rename : mobile/android/geckoview/src/thirdparty/java/com/googlecode/eyesfree/braille/selfbraille/SelfBrailleClient.java => mobile/android/thirdparty/com/googlecode/eyesfree/braille/selfbraille/SelfBrailleClient.java rename : mobile/android/geckoview/src/thirdparty/java/com/googlecode/eyesfree/braille/selfbraille/WriteData.java => mobile/android/thirdparty/com/googlecode/eyesfree/braille/selfbraille/WriteData.java
This commit is contained in:
Родитель
7496680254
Коммит
e8b3470987
|
@ -227,6 +227,13 @@ public class GeckoAccessibility {
|
|||
view.setAccessibilityDelegate(new GeckoAccessibilityDelegate());
|
||||
view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||
}
|
||||
|
||||
view.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
@Override
|
||||
public void onFocusChange(final View v, final boolean hasFocus) {
|
||||
onLayerViewFocusChanged(hasFocus);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void setAccessibilityManagerListeners(final Context context) {
|
|
@ -652,7 +652,6 @@ public abstract class GeckoApp extends GeckoActivity
|
|||
final EventCallback callback) {
|
||||
if (event.equals("Gecko:Ready")) {
|
||||
mGeckoReadyStartupTimer.stop();
|
||||
geckoConnected();
|
||||
|
||||
// This method is already running on the background thread, so we
|
||||
// know that mHealthRecorder will exist. That doesn't stop us being
|
||||
|
@ -1197,6 +1196,9 @@ public abstract class GeckoApp extends GeckoActivity
|
|||
|
||||
mLayerView.setChromeUri("chrome://browser/content/browser.xul");
|
||||
mLayerView.setContentListener(this);
|
||||
mLayerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
|
||||
GeckoAccessibility.setDelegate(mLayerView);
|
||||
|
||||
getAppEventDispatcher().registerGeckoThreadListener(this,
|
||||
"Accessibility:Event",
|
||||
|
@ -1668,10 +1670,6 @@ public abstract class GeckoApp extends GeckoActivity
|
|||
if (selectedTab != null) {
|
||||
Tabs.getInstance().notifyListeners(selectedTab, Tabs.TabEvents.SELECTED);
|
||||
}
|
||||
|
||||
if (GeckoThread.isRunning()) {
|
||||
geckoConnected();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2484,10 +2482,6 @@ public abstract class GeckoApp extends GeckoActivity
|
|||
Permissions.onRequestPermissionsResult(this, permissions, grantResults);
|
||||
}
|
||||
|
||||
private void geckoConnected() {
|
||||
mLayerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
}
|
||||
|
||||
public static class MainLayout extends RelativeLayout {
|
||||
private TouchEventInterceptor mTouchEventInterceptor;
|
||||
private MotionEventInterceptor mMotionEventInterceptor;
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.mozilla.gecko.BrowserApp;
|
|||
import org.mozilla.gecko.DoorHangerPopup;
|
||||
import org.mozilla.gecko.EventDispatcher;
|
||||
import org.mozilla.gecko.FormAssistPopup;
|
||||
import org.mozilla.gecko.GeckoAccessibility;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
import org.mozilla.gecko.GeckoViewSettings;
|
||||
|
@ -129,6 +130,8 @@ public class CustomTabsActivity extends AppCompatActivity
|
|||
mGeckoView.setProgressListener(this);
|
||||
mGeckoView.setContentListener(this);
|
||||
|
||||
GeckoAccessibility.setDelegate(mGeckoView);
|
||||
|
||||
mPromptService = new PromptService(this, mGeckoView.getEventDispatcher());
|
||||
mDoorHangerPopup = new DoorHangerPopup(this, mGeckoView.getEventDispatcher());
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.mozilla.gecko.ActivityHandlerHelper;
|
|||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.BrowserApp;
|
||||
import org.mozilla.gecko.DoorHangerPopup;
|
||||
import org.mozilla.gecko.GeckoAccessibility;
|
||||
import org.mozilla.gecko.GeckoScreenOrientation;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.GeckoView;
|
||||
|
@ -113,6 +114,8 @@ public class WebAppActivity extends AppCompatActivity
|
|||
}
|
||||
});
|
||||
|
||||
GeckoAccessibility.setDelegate(mGeckoView);
|
||||
|
||||
mPromptService = new PromptService(this, mGeckoView.getEventDispatcher());
|
||||
mDoorHangerPopup = new DoorHangerPopup(this, mGeckoView.getEventDispatcher());
|
||||
|
||||
|
|
|
@ -372,7 +372,6 @@ gvjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x
|
|||
'Clipboard.java',
|
||||
'CrashHandler.java',
|
||||
'EventDispatcher.java',
|
||||
'GeckoAccessibility.java',
|
||||
'GeckoAppShell.java',
|
||||
'GeckoBatteryManager.java',
|
||||
'GeckoEditable.java',
|
||||
|
@ -463,12 +462,6 @@ gvjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x
|
|||
'WakeLockDelegate.java',
|
||||
]]
|
||||
|
||||
gvjar.sources += [geckoview_thirdparty_source_dir + f for f in [
|
||||
'java/com/googlecode/eyesfree/braille/selfbraille/ISelfBrailleService.java',
|
||||
'java/com/googlecode/eyesfree/braille/selfbraille/SelfBrailleClient.java',
|
||||
'java/com/googlecode/eyesfree/braille/selfbraille/WriteData.java',
|
||||
]]
|
||||
|
||||
if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
|
||||
gvjar.sources += [geckoview_source_dir + 'java/org/mozilla/gecko/' + x for x in [
|
||||
'media/GeckoHlsAudioRenderer.java',
|
||||
|
@ -645,6 +638,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'firstrun/SyncPanel.java',
|
||||
'firstrun/TabQueuePanel.java',
|
||||
'FormAssistPopup.java',
|
||||
'GeckoAccessibility.java',
|
||||
'GeckoActivity.java',
|
||||
'GeckoActivityMonitor.java',
|
||||
'GeckoApp.java',
|
||||
|
@ -1018,6 +1012,11 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
|||
'widget/themed/ThemedTextView.java',
|
||||
'widget/themed/ThemedView.java',
|
||||
]]
|
||||
gbjar.sources += [thirdparty_source_dir + f for f in [
|
||||
'com/googlecode/eyesfree/braille/selfbraille/ISelfBrailleService.java',
|
||||
'com/googlecode/eyesfree/braille/selfbraille/SelfBrailleClient.java',
|
||||
'com/googlecode/eyesfree/braille/selfbraille/WriteData.java',
|
||||
]]
|
||||
# The following sources are Photon specific, Eventually they should be merged into base.
|
||||
gbjar.sources += ['../app/src/photon/java/org/mozilla/gecko/' + x for x in [
|
||||
'home/SearchEngineRow.java',
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.nio.IntBuffer;
|
|||
import org.mozilla.gecko.AndroidGamepadManager;
|
||||
import org.mozilla.gecko.annotation.RobocopTarget;
|
||||
import org.mozilla.gecko.annotation.WrapForJNI;
|
||||
import org.mozilla.gecko.GeckoAccessibility;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.GeckoThread;
|
||||
import org.mozilla.gecko.mozglue.JNIObject;
|
||||
|
@ -37,6 +36,7 @@ import android.view.TextureView;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.InputDevice;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -48,6 +48,8 @@ import java.util.List;
|
|||
public class LayerView extends FrameLayout {
|
||||
private static final String LOGTAG = "GeckoLayerView";
|
||||
|
||||
private static AccessibilityManager sAccessibilityManager;
|
||||
|
||||
private GeckoLayerClient mLayerClient;
|
||||
private PanZoomController mPanZoomController;
|
||||
private DynamicToolbarAnimator mToolbarAnimator;
|
||||
|
@ -315,8 +317,6 @@ public class LayerView extends FrameLayout {
|
|||
|
||||
setFocusable(true);
|
||||
setFocusableInTouchMode(true);
|
||||
|
||||
GeckoAccessibility.setDelegate(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -382,12 +382,21 @@ public class LayerView extends FrameLayout {
|
|||
return false;
|
||||
}
|
||||
|
||||
private boolean isAccessibilityEnabled() {
|
||||
if (sAccessibilityManager == null) {
|
||||
sAccessibilityManager = (AccessibilityManager)
|
||||
getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||
}
|
||||
return sAccessibilityManager.isEnabled() &&
|
||||
sAccessibilityManager.isTouchExplorationEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onHoverEvent(MotionEvent event) {
|
||||
// If we get a touchscreen hover event, and accessibility is not enabled,
|
||||
// don't send it to gecko.
|
||||
if (event.getSource() == InputDevice.SOURCE_TOUCHSCREEN &&
|
||||
!GeckoAccessibility.isEnabled()) {
|
||||
!isAccessibilityEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -773,26 +782,10 @@ public class LayerView extends FrameLayout {
|
|||
public void drawFinished();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverScrollMode(int overscrollMode) {
|
||||
super.setOverScrollMode(overscrollMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOverScrollMode() {
|
||||
return super.getOverScrollMode();
|
||||
}
|
||||
|
||||
public float getZoomFactor() {
|
||||
return getLayerClient().getViewportMetrics().zoomFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFocusChanged (boolean gainFocus, int direction, Rect previouslyFocusedRect) {
|
||||
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
|
||||
GeckoAccessibility.onLayerViewFocusChanged(gainFocus);
|
||||
}
|
||||
|
||||
public void setFullScreenState(FullScreenState state) {
|
||||
mFullScreenState = state;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче