List of usage examples for android.view.accessibility AccessibilityEvent TYPE_WINDOW_CONTENT_CHANGED
int TYPE_WINDOW_CONTENT_CHANGED
To view the source code for android.view.accessibility AccessibilityEvent TYPE_WINDOW_CONTENT_CHANGED.
Click Source Link
From source file:com.android.screenspeak.eventprocessor.ProcessorFocusAndSingleTap.java
@Override public void onAccessibilityEvent(AccessibilityEvent event) { if (!mAccessibilityManager.isTouchExplorationEnabled()) { // Don't manage focus when touch exploration is disabled. return;//ww w. j a v a2 s. com } final AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event); switch (event.getEventType()) { case AccessibilityEvent.TYPE_VIEW_CLICKED: // Prevent conflicts between lift-to-type and single tap. This // is only necessary when a CLICKED event occurs during a touch // interaction sequence (e.g. before an INTERACTION_END event), // but it isn't harmful to call more often. cancelSingleTap(); break; case AccessibilityEvent.TYPE_VIEW_FOCUSED: case AccessibilityEvent.TYPE_VIEW_SELECTED: if (!mFirstWindowFocusManager.shouldProcessFocusEvent(event)) { return; } boolean isViewFocusedEvent = (AccessibilityEvent.TYPE_VIEW_FOCUSED == event.getEventType()); if (!setFocusOnView(record, isViewFocusedEvent)) { // It is possible that the only speakable child of source node is invisible // at the moment, but could be made visible when view scrolls, or window state // changes. Cache it now. And try to focus on the cached record on: // VIEW_SCROLLED, WINDOW_CONTENT_CHANGED, WINDOW_STATE_CHANGED. // The above 3 are the events that could affect view visibility. if (mCachedPotentiallyFocusableRecordQueue.size() == MAX_CACHED_FOCUSED_RECORD_QUEUE) { mCachedPotentiallyFocusableRecordQueue.remove().first.recycle(); } mCachedPotentiallyFocusableRecordQueue .add(new Pair<>(AccessibilityRecordCompat.obtain(record), event.getEventType())); } else { emptyCachedPotentialFocusQueue(); } break; case AccessibilityEvent.TYPE_VIEW_HOVER_ENTER: final AccessibilityNodeInfoCompat touchedNode = record.getSource(); try { if ((touchedNode != null) && !setFocusFromViewHoverEnter(touchedNode)) { mHandler.sendEmptyTouchAreaFeedbackDelayed(touchedNode); } } finally { AccessibilityNodeInfoUtils.recycleNodes(touchedNode); } break; case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: mHandler.cancelEmptyTouchAreaFeedback(); AccessibilityNodeInfo source = event.getSource(); if (source != null) { AccessibilityNodeInfoCompat compatSource = new AccessibilityNodeInfoCompat(source); mLastFocusedItem = AccessibilityNodeInfoCompat.obtain(compatSource); } break; case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: mFirstWindowFocusManager.registerWindowChange(event); handleWindowStateChange(event); break; case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: handleWindowContentChanged(); break; case AccessibilityEvent.TYPE_VIEW_SCROLLED: handleViewScrolled(event, record); break; case AccessibilityEventCompat.TYPE_TOUCH_INTERACTION_START: // This event type only exists on API 17+ (JB MR1). handleTouchInteractionStart(); break; case AccessibilityEventCompat.TYPE_TOUCH_INTERACTION_END: // This event type only exists on API 17+ (JB MR1). handleTouchInteractionEnd(); break; } }
From source file:com.android.talkback.eventprocessor.AccessibilityEventProcessor.java
public void onAccessibilityEvent(AccessibilityEvent event) { if (mTestingListener != null) { mTestingListener.onAccessibilityEvent(event); }/*www .j a v a 2 s . co m*/ if ((mDumpEventMask & event.getEventType()) != 0) { Log.v(DUMP_EVNET_LOG_TAG, event.toString()); } if (shouldDropRefocusEvent(event)) { return; } if (shouldDropEvent(event)) { return; } maintainExplorationState(event); if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED || event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED || event.getEventType() == AccessibilityEvent.TYPE_WINDOWS_CHANGED) { mService.setRootDirty(true); } // We need to save the last focused event so that we can filter out related selected events. if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED) { if (mLastFocusedEvent != null) { mLastFocusedEvent.recycle(); } mLastFocusedEvent = AccessibilityEvent.obtain(event); } if (AccessibilityEventUtils.eventMatchesAnyType(event, MASK_DELAYED_EVENT_TYPES)) { mHandler.postProcessEvent(event); } else { processEvent(event); } if (mTestingListener != null) { mTestingListener.afterAccessibilityEvent(event); } }
From source file:com.android.screenspeak.eventprocessor.ProcessorPhoneticLetters.java
/** * Returns true if a pending phonetic letter should be interrupted. *//* ww w . j a v a2 s . com*/ private boolean shouldCancelPhoneticLetter(AccessibilityEvent event) { return event.getEventType() != AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED && event.getEventType() != AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED && event.getEventType() != AccessibilityEvent.TYPE_VIEW_LONG_CLICKED && event.getEventType() != AccessibilityEvent.TYPE_ANNOUNCEMENT; }
From source file:xyz.berial.textinputlayout.TextInputLayout.java
/** * Set the hint to be displayed in the floating label * * @attr ref android.support.design.R.styleable#TextInputLayout_android_hint *//*from w w w.ja v a 2 s . c o m*/ public void setHint(@Nullable CharSequence hint) { mHint = hint; mCollapsingTextHelper.setText(hint); if (Build.VERSION.SDK_INT >= 14) { sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } }
From source file:com.ucmap.dingdinghelper.services.DingDingHelperAccessibilityService.java
/** * ???//from ww w .j ava 2s . c om */ @RequiresApi(api = Build.VERSION_CODES.KITKAT) @Override public void onAccessibilityEvent(AccessibilityEvent event) { tag_callback_time = System.currentTimeMillis(); int eventType = event.getEventType(); Log.i("Info", " eventType: " + eventType + " getEventTime: " + event.getEventTime() + " getAction" + event.getAction() + "getContentChangeTypes:" + event.getContentChangeTypes() + " getText :" + event.getText().toString() + "getPackageName :" + event.getPackageName() + "getRecordCount : " + event.getRecordCount() + " getClassName:" + event.getClassName() + " :" + event.getClass() + " getParcelableData:" + event.getParcelableData()); switch (eventType) { /*??*/ case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: windowContentChanged(); break; //??? case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED: notificationChanged(event); break; //Activity??? case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: windowChanged(event); break; } }
From source file:android.support.design.widget.TextInputLayout.java
/** * Set the hint to be displayed in the floating label, if enabled. * * @see #setHintEnabled(boolean)/* w w w. j a v a 2s .c o m*/ * * @attr ref android.support.design.R.styleable#TextInputLayout_android_hint */ public void setHint(@Nullable CharSequence hint) { if (mHintEnabled) { setHintInternal(hint); sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } }
From source file:org.buffer.android.buffertextinputlayout.BufferTextInputLayout.java
/** * Set the hint to be displayed in the floating label, if enabled. * * @attr ref android.support.design.R.styleable#TextInputLayout_android_hint * @see #setHintEnabled(boolean)// w w w.j a va2 s . co m */ public void setHint(@Nullable CharSequence hint) { if (isHintEnabled) { setHintInternal(hint); sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); } }
From source file:xyz.berial.textinputlayout.TextInputLayout.java
/** * Sets an error message that will be displayed below our {@link EditText}. If the * {@code error} is {@code null}, the error message will be cleared. * <p/>/*www . j a v a2s. co m*/ * If the error functionality has not been enabled via {@link #setErrorEnabled(boolean)}, then * it will be automatically enabled if {@code error} is not empty. * * @param error Error message to display, or null to clear * @see #getError() */ public void setError(@Nullable CharSequence error) { if (!mErrorEnabled) { if (TextUtils.isEmpty(error)) { // If error isn't enabled, and the error is empty, just return return; } // Else, we'll assume that they want to enable the error functionality setErrorEnabled(true); } if (!TextUtils.isEmpty(error)) { ViewCompat.setAlpha(mErrorView, 0f); mErrorView.setText(error); ViewCompat.animate(mErrorView).alpha(1f).setDuration(ANIMATION_DURATION) .setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationStart(View view) { view.setVisibility(VISIBLE); } }).start(); // Set the EditText's background tint to the error color ViewCompat.setBackgroundTintList(mEditText, ColorStateList.valueOf(mErrorView.getCurrentTextColor())); } else { if (mErrorView.getVisibility() == VISIBLE) { ViewCompat.animate(mErrorView).alpha(0f).setDuration(ANIMATION_DURATION) .setInterpolator(AnimationUtils.FAST_OUT_SLOW_IN_INTERPOLATOR) .setListener(new ViewPropertyAnimatorListenerAdapter() { @Override public void onAnimationEnd(View view) { view.setVisibility(INVISIBLE); } }).start(); /*custom*/ if (mEditText.length() > mCounterMaxLength) { return; } /*custom*/ // Restore the 'original' tint, using colorControlNormal and colorControlActivated final TintManager tintManager = TintManager.get(getContext()); ViewCompat.setBackgroundTintList(mEditText, tintManager.getTintList(R.drawable.abc_edit_text_material)); } } sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); }
From source file:com.googlecode.eyesfree.brailleback.DefaultNavigationMode.java
@Override public boolean onAccessibilityEvent(AccessibilityEvent event) { switch (event.getEventType()) { case AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED: brailleNodeFromEvent(event);/*w ww . j a v a 2 s. c o m*/ break; case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED: brailleFocusedNode(); break; case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: if (!brailleFocusedNode()) { // Since focus is typically not set in a newly opened // window, so braille the window as-if the first focusable // node had focus. We don't update the focus because that // will make other services (e.g. talkback) reflect this // change, which is not desired. brailleFirstFocusableNode(); } break; } return true; }
From source file:com.android.soma.Launcher.java
/** * Opens the user folder described by the specified tag. The opening of the folder * is animated relative to the specified View. If the View is null, no animation * is played.// www. j a v a 2 s.co m * * @param folderInfo The FolderInfo describing the folder to open. */ public void openFolder(FolderIcon folderIcon) { Folder folder = folderIcon.getFolder(); FolderInfo info = folder.mInfo; info.opened = true; // Just verify that the folder hasn't already been added to the DragLayer. // There was a one-off crash where the folder had a parent already. if (folder.getParent() == null) { mDragLayer.addView(folder); mDragController.addDropTarget((DropTarget) folder); } else { Log.w(TAG, "Opening folder (" + folder + ") which already has a parent (" + folder.getParent() + ")."); } folder.animateOpen(); growAndFadeOutFolderIcon(folderIcon); // Notify the accessibility manager that this folder "window" has appeared and occluded // the workspace items folder.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); getDragLayer().sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED); }