Beispiel #1
0
  private void restoreImportantForAccessibilityHelper(View v) {
    /// M: [ALPS01271317] Just return if view did not set important for accessibility to NO before.
    if (mPreviousValues.get(v) == null) {
      return;
    }

    v.setImportantForAccessibility(mPreviousValues.get(v));
    mPreviousValues.remove(v);

    // Call method on children recursively
    if (v instanceof ViewGroup) {
      ViewGroup vg = (ViewGroup) v;

      // We assume if a class implements OnHierarchyChangeListener, it listens
      // to changes to any of its children (happens to be the case in Launcher)
      if (vg instanceof OnHierarchyChangeListener) {
        vg.setOnHierarchyChangeListener((OnHierarchyChangeListener) vg);
      } else {
        vg.setOnHierarchyChangeListener(null);
      }
      for (int i = 0; i < vg.getChildCount(); i++) {
        View child = vg.getChildAt(i);
        if (includeView(child)) {
          restoreImportantForAccessibilityHelper(child);
        }
      }
    }
  }
Beispiel #2
0
 public static void setAccessibilityIgnore(View view) {
   view.setClickable(false);
   view.setFocusable(false);
   view.setContentDescription("");
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
   }
 }
 @SuppressLint("NewApi")
 public void setEmptyView(View emptyView) {
   mEmptyView = emptyView;
   if (VERSION.SDK_INT >= 16
       && emptyView != null
       && emptyView.getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
     emptyView.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
   }
   final T adapter = getAdapter();
   final boolean empty = adapter == null || adapter.isEmpty();
   updateEmptyStatus(empty);
 }
Beispiel #4
0
  private void setImportantForAccessibilityToNoHelper(View v) {
    mPreviousValues.put(v, v.getImportantForAccessibility());
    v.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);

    // Call method on children recursively
    if (v instanceof ViewGroup) {
      ViewGroup vg = (ViewGroup) v;
      vg.setOnHierarchyChangeListener(this);
      for (int i = 0; i < vg.getChildCount(); i++) {
        View child = vg.getChildAt(i);

        if (includeView(child)) {
          setImportantForAccessibilityToNoHelper(child);
        }
      }
    }
  }
    void refreshChildren() {
        if (mAdapter == null) return;
        for (int i = mCurrentWindowStart; i <= mCurrentWindowEnd; i++) {
            int index = modulo(i, getWindowSize());

            int adapterCount = getCount();
            // get the fresh child from the adapter
            final View updatedChild = mAdapter.getView(modulo(i, adapterCount), null, this);

            if (updatedChild.getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
                updatedChild.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
            }

            if (mViewsMap.containsKey(index)) {
                final FrameLayout fl = (FrameLayout) mViewsMap.get(index).view;
                // add the new child to the frame, if it exists
                if (updatedChild != null) {
                    // flush out the old child
                    fl.removeAllViewsInLayout();
                    fl.addView(updatedChild);
                }
            }
        }
    }
Beispiel #6
0
 public static void setImportantForAccessibility(View view, int mode) {
   view.setImportantForAccessibility(mode);
 }
Beispiel #7
0
 public final void b(View paramView, int paramInt) {
   paramView.setImportantForAccessibility(1);
 }