@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 #2
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 #4
0
 public static int getImportantForAccessibility(View view) {
   return view.getImportantForAccessibility();
 }
Beispiel #5
0
 public final int h(View paramView) {
   return paramView.getImportantForAccessibility();
 }