コード例 #1
0
 private static void sendBrailleText(
     final View view, final String text, final int selectionStart, final int selectionEnd) {
   AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(view, VIRTUAL_CURSOR_POSITION);
   WriteData data = WriteData.forInfo(info);
   data.setText(text);
   // Set either the focus blink or the current caret position/selection
   data.setSelectionStart(selectionStart);
   data.setSelectionEnd(selectionEnd);
   sSelfBrailleClient.write(data);
 }
コード例 #2
0
    @JavascriptInterface
    @SuppressWarnings("unused")
    public void braille(String jsonString) {
      try {
        JSONObject jsonObj = new JSONObject(jsonString);

        WriteData data = WriteData.forView(mView);
        data.setText(jsonObj.getString("text"));
        data.setSelectionStart(jsonObj.getInt("startIndex"));
        data.setSelectionEnd(jsonObj.getInt("endIndex"));
        mSelfBrailleClient.write(data);
      } catch (JSONException ex) {
        Log.w(TAG, "Error parsing JS JSON object", ex);
      }
    }
コード例 #3
0
 @SuppressWarnings("unused")
 protected void shutdownInternal() {
   mTextToSpeech.shutdown();
   mSelfBrailleClient.shutdown();
 }