Example usage for android.view.accessibility AccessibilityEvent CONTENT_CHANGE_TYPE_SUBTREE

List of usage examples for android.view.accessibility AccessibilityEvent CONTENT_CHANGE_TYPE_SUBTREE

Introduction

In this page you can find the example usage for android.view.accessibility AccessibilityEvent CONTENT_CHANGE_TYPE_SUBTREE.

Prototype

int CONTENT_CHANGE_TYPE_SUBTREE

To view the source code for android.view.accessibility AccessibilityEvent CONTENT_CHANGE_TYPE_SUBTREE.

Click Source Link

Document

Change type for #TYPE_WINDOW_CONTENT_CHANGED event: One or more content changes occurred in the the subtree rooted at the source node, or the subtree's structure changed when a node was added or removed.

Usage

From source file:com.android.launcher3.CellLayout.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void enableAccessibleDrag(boolean enable, int dragType) {
    mUseTouchHelper = enable;//  w w w.j av a  2  s  .  com
    if (!enable) {
        ViewCompat.setAccessibilityDelegate(this, null);
        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
        getShortcutsAndWidgets().setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
        setOnClickListener(mLauncher);
    } else {
        if (dragType == WORKSPACE_ACCESSIBILITY_DRAG
                && !(mTouchHelper instanceof WorkspaceAccessibilityHelper)) {
            mTouchHelper = new WorkspaceAccessibilityHelper(this);
        } else if (dragType == FOLDER_ACCESSIBILITY_DRAG
                && !(mTouchHelper instanceof FolderAccessibilityHelper)) {
            mTouchHelper = new FolderAccessibilityHelper(this);
        }
        ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
        getShortcutsAndWidgets().setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
        setOnClickListener(mTouchHelper);
    }

    // Invalidate the accessibility hierarchy
    if (getParent() != null) {
        getParent().notifySubtreeAccessibilityStateChanged(this, this,
                AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE);
    }
}