本文整理汇总了Java中com.googlecode.eyesfree.braille.selfbraille.WriteData类的典型用法代码示例。如果您正苦于以下问题:Java WriteData类的具体用法?Java WriteData怎么用?Java WriteData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WriteData类属于com.googlecode.eyesfree.braille.selfbraille包,在下文中一共展示了WriteData类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: write
import com.googlecode.eyesfree.braille.selfbraille.WriteData; //导入依赖的package包/类
@Override
public void write(IBinder clientToken, WriteData writeData) {
if (clientToken == null) {
LogUtils.log(SelfBrailleService.this, Log.ERROR,
"null client token to write");
return;
}
ServiceUtil serviceUtil = new ServiceUtil(mPackageManager);
if (!serviceUtil.verifyCaller(Binder.getCallingUid())) {
LogUtils.log(SelfBrailleService.this, Log.ERROR,
"non-google signed package try to invoke service, rejected.");
return;
}
if (writeData == null) {
LogUtils.log(SelfBrailleService.this, Log.ERROR,
"null writeData to write");
return;
}
LogUtils.log(SelfBrailleService.this, Log.VERBOSE,
"write %s, %s", writeData.getText(),
writeData.getAccessibilityNodeInfo());
try {
writeData.validate();
} catch (IllegalStateException ex) {
LogUtils.log(SelfBrailleService.this, Log.ERROR,
"Invalid write data: %s", ex);
return;
}
NodeState state = new NodeState();
state.mClientToken = clientToken;
state.mWriteData = writeData;
mHandler.setNodeState(state);
}
开发者ID:google,项目名称:brailleback,代码行数:35,代码来源:SelfBrailleService.java
示例2: contentForNode
import com.googlecode.eyesfree.braille.selfbraille.WriteData; //导入依赖的package包/类
public DisplayManager.Content contentForNode(
AccessibilityNodeInfoCompat node) {
if (mNodeStates.isEmpty()) {
return null;
}
AccessibilityNodeInfoCompat match =
AccessibilityNodeInfoUtils.getSelfOrMatchingAncestor(
this, node, mFilterHaveNodeState);
if (match == null) {
return null;
}
AccessibilityNodeInfo unwrappedMatch =
(AccessibilityNodeInfo) match.getInfo();
WriteData writeData = mNodeStates.get(unwrappedMatch).mWriteData;
if (writeData == null) {
return null;
}
SpannableStringBuilder sb = new SpannableStringBuilder(
writeData.getText());
// NOTE: it is important to use a node returned by the accessibility
// framework and not a node from a client of this service.
// The rest of BrailleBack will assume that the node we are adding
// here is sealed, supports actions etc.
DisplaySpans.setAccessibilityNode(sb, match);
int selectionStart = writeData.getSelectionStart();
if (selectionStart >= 0) {
int selectionEnd = writeData.getSelectionEnd();
if (selectionEnd < selectionStart) {
selectionEnd = selectionStart;
}
DisplaySpans.addSelection(sb, selectionStart, selectionEnd);
}
return new DisplayManager.Content(sb)
.setFirstNode(match)
.setLastNode(match)
.setPanStrategy(DisplayManager.Content.PAN_CURSOR);
}
开发者ID:google,项目名称:brailleback,代码行数:38,代码来源:SelfBrailleService.java
示例3: sendBrailleText
import com.googlecode.eyesfree.braille.selfbraille.WriteData; //导入依赖的package包/类
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);
}
开发者ID:jrconlin,项目名称:mc_backup,代码行数:10,代码来源:GeckoAccessibility.java
示例4: braille
import com.googlecode.eyesfree.braille.selfbraille.WriteData; //导入依赖的package包/类
@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);
}
}
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:16,代码来源:AccessibilityInjector.java
注:本文中的com.googlecode.eyesfree.braille.selfbraille.WriteData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论