android.view.accessibility.AccessibilityNodeInfo#isEditable ( )源码实例Demo

下面列出了android.view.accessibility.AccessibilityNodeInfo#isEditable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: AutofillManager.java
private boolean notifyViewEntered(int windowId, long nodeId, Rect focusedBounds) {
    final int virtualId = AccessibilityNodeInfo.getVirtualDescendantId(nodeId);
    if (!isVirtualNode(virtualId)) {
        return false;
    }
    final View view = findViewByAccessibilityId(windowId, nodeId);
    if (view == null) {
        return false;
    }
    final AccessibilityNodeInfo node = findVirtualNodeByAccessibilityId(view, virtualId);
    if (node == null) {
        return false;
    }
    if (!node.isEditable()) {
        return false;
    }
    final Rect newBounds = mTempBounds;
    node.getBoundsInScreen(newBounds);
    if (newBounds.equals(focusedBounds)) {
        return false;
    }
    focusedBounds.set(newBounds);
    AutofillManager.this.notifyViewEntered(view, virtualId, newBounds);
    return true;
}
 
源代码2 项目: oversec   文件: Tree.java
public void refresh(AccessibilityNodeInfo node) {
    if (sealed) {
        throw new IllegalArgumentException("sealed! " + super.toString());
    }

    mFocused = node.isFocused();
    node.getBoundsInScreen(mBoundsInScreen);
    node.getBoundsInParent(mBoundsInParent);

    mBoundsInScreen.offset(0, -OverlayDecryptView.SCREEN_OFFSET_Y);


    mText = AccessibilityNodeInfoUtils.getNodeText(node);
    mTextString = mText == null ? null : mText.toString();

    mIsEncoded = mText == null ? false : CryptoHandlerFacade.Companion.isEncoded(mCtx, mTextString);
    if (mIsEncoded) {
        mIsTextView = true;
    }
    mIsEditableTextNode = (node.isEditable()
            && node.isEnabled()
            && mIsEditText
            && !node.isPassword());
}
 
源代码3 项目: oversec   文件: OversecAccessibilityService.java
public boolean isEditableEditTextFocussed() {
    boolean res = false;
    AccessibilityNodeInfo anode = null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        anode = findFocus(AccessibilityNodeInfo.FOCUS_INPUT);
    } else {
        anode = findFocus_PreLollipop();
    }
    if (anode != null) {
        if (anode.isEditable() && anode.isEnabled()) {
            if (mTree.isAEditText(anode)) {
                res = true;
            }
        }
        anode.recycle();
    }
    return res;
}
 
源代码4 项目: Clip-Stack   文件: ExperienceEnhanceService.java
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {

    //Check package name
    AccessibilityNodeInfo nodeInfo = event.getSource();
    if (nodeInfo != null) {
        String packageName = String.valueOf(nodeInfo.getPackageName());
        if (packageName.contains("catchingnow.tinyclipboardmanager")) {
            stopFloatingWindow();
            return;
        }
    }

    //FW
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        AccessibilityNodeInfo findFocus = findFocus(AccessibilityNodeInfo.FOCUS_INPUT);
        if (findFocus != null &&
                findFocus.isEditable()) {
            //Log.i("AccessibilityNodeInfo", "true");
            startFloatingWindow();
        } else {
            //Log.i("AccessibilityNodeInfo", "false");
            stopFloatingWindow();
        }
    }
}
 
源代码5 项目: SoloPi   文件: AccessibilityNodeTree.java
private void initAccessibilityNodeInfo(AccessibilityNodeInfo info) {
    this.className = StringUtil.nonNullString(info.getClassName());
    this.packageName = StringUtil.nonNullString(info.getPackageName());
    this.resourceId = info.getViewIdResourceName();
    this.text = StringUtil.nonNullString(info.getText());
    this.description = StringUtil.nonNullString(info.getContentDescription());
    Rect rect = new Rect();
    info.getBoundsInScreen(rect);
    this.nodeBound = rect;
    this.isScrollable = info.isScrollable();
    this.visible = info.isVisibleToUser();
    this.isClickable = info.isClickable();
    this.isFocusable = info.isFocusable();
    this.isEditable = info.isEditable();
}
 
源代码6 项目: SmsCode   文件: SmsCodeAutoInputService.java
/**
 * 手动对焦下的尝试自动输入
 * @param smsCode SMS code
 * @return 成功输入则返回true,否则返回false
 */
private boolean tryToAutoInputByManualFocus(String smsCode, boolean isRootAutoInputMode) {
    if (isRootAutoInputMode){
        return ShellUtils.inputText(smsCode);
    } else {
        AccessibilityNodeInfo focusedNodeInfo = findFocusNodeInfo();
        if (focusedNodeInfo != null && focusedNodeInfo.isEditable()) {
            inputText(focusedNodeInfo, smsCode);
            return true;
        }
        return false;
    }
}
 
Builder(int id, @Nullable ViewHierarchyElementAndroid parent, AccessibilityNodeInfo fromInfo) {
  // Bookkeeping
  this.id = id;
  this.parentId = (parent != null) ? parent.getId() : null;

  // API 18+ properties
  this.resourceName = AT_18 ? fromInfo.getViewIdResourceName() : null;
  this.editable = AT_18 ? fromInfo.isEditable() : null;

  // API 16+ properties
  this.visibleToUser = AT_16 ? fromInfo.isVisibleToUser() : null;

  // API 21+ properties
  if (AT_21) {
    ImmutableList.Builder<ViewHierarchyActionAndroid> actionBuilder =
        new ImmutableList.Builder<>();
    actionBuilder.addAll(
        Lists.transform(
            fromInfo.getActionList(),
            action -> ViewHierarchyActionAndroid.newBuilder(action).build()));
    this.actionList = actionBuilder.build();
  }

  // API 24+ properties
  this.drawingOrder = AT_24 ? fromInfo.getDrawingOrder() : null;

  // API 29+ properties
  this.hasTouchDelegate = AT_29 ? (fromInfo.getTouchDelegateInfo() != null) : null;

  // Base properties
  this.className = fromInfo.getClassName();
  this.packageName = fromInfo.getPackageName();
  this.accessibilityClassName = fromInfo.getClassName();
  this.contentDescription = SpannableStringAndroid.valueOf(fromInfo.getContentDescription());
  this.text = SpannableStringAndroid.valueOf(fromInfo.getText());

  this.importantForAccessibility = true;
  this.clickable = fromInfo.isClickable();
  this.longClickable = fromInfo.isLongClickable();
  this.focusable = fromInfo.isFocusable();
  this.scrollable = fromInfo.isScrollable();
  this.canScrollForward =
      ((fromInfo.getActions() & AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) != 0);
  this.canScrollBackward =
      ((fromInfo.getActions() & AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) != 0);
  this.checkable = fromInfo.isCheckable();
  this.checked = fromInfo.isChecked();
  this.touchDelegateBounds = new ArrayList<>(); // Populated after construction
  android.graphics.Rect tempRect = new android.graphics.Rect();
  fromInfo.getBoundsInScreen(tempRect);
  this.boundsInScreen = new Rect(tempRect.left, tempRect.top, tempRect.right, tempRect.bottom);
  this.nonclippedHeight = null;
  this.nonclippedWidth = null;
  this.textSize = null;
  this.textColor = null;
  this.backgroundDrawableColor = null;
  this.typefaceStyle = null;
  this.enabled = fromInfo.isEnabled();
}