Skip to content

Commit

Permalink
TerminalView: only use accessibility features when accessibility is
Browse files Browse the repository at this point in the history
enabled when starting the view
  • Loading branch information
pvagner authored and fornwall committed Jun 29, 2018
1 parent 5652624 commit d1f0c76
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.accessibility.AccessibilityManager;
import android.view.ActionMode;
import android.view.HapticFeedbackConstants;
import android.view.InputDevice;
Expand Down Expand Up @@ -75,6 +76,8 @@ public final class TerminalView extends View {
/** If non-zero, this is the last unicode code point received if that was a combining character. */
int mCombiningAccent;

private boolean mAccessibilityEnabled;

public TerminalView(Context context, AttributeSet attributes) { // NO_UCD (unused code)
super(context, attributes);
mGestureRecognizer = new GestureAndScaleRecognizer(context, new GestureAndScaleRecognizer.Listener() {
Expand Down Expand Up @@ -197,6 +200,8 @@ public void onLongPress(MotionEvent e) {
}
});
mScroller = new Scroller(context);
AccessibilityManager am = (AccessibilityManager) context.getSystemService(context.ACCESSIBILITY_SERVICE);
mAccessibilityEnabled = am.isEnabled();
}

/**
Expand Down Expand Up @@ -384,7 +389,7 @@ public void onScreenUpdated() {
mEmulator.clearScrollCounter();

invalidate();
setContentDescription(getText());
if (mAccessibilityEnabled) setContentDescription(getText());
}

/**
Expand Down

0 comments on commit d1f0c76

Please sign in to comment.