Java Code Examples for android.view.View#setAccessibilityDelegate()

The following examples show how to use android.view.View#setAccessibilityDelegate() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public void cleanup() {
    for (final Map.Entry<View, TrackingAccessibilityDelegate> entry :
            mWatching.entrySet()) {
        final View v = entry.getKey();
        final TrackingAccessibilityDelegate toCleanup = entry.getValue();
        final View.AccessibilityDelegate currentViewDelegate = getOldDelegate(v);
        if (currentViewDelegate == toCleanup) {
            v.setAccessibilityDelegate(toCleanup.getRealDelegate());
        } else if (currentViewDelegate instanceof TrackingAccessibilityDelegate) {
            final TrackingAccessibilityDelegate newChain =
                    (TrackingAccessibilityDelegate) currentViewDelegate;
            newChain.removeFromDelegateChain(toCleanup);
        } else {
            // Assume we've been replaced, zeroed out, or for some other reason we're
            // already gone.
            // (This isn't too weird, for example, it's expected when views get recycled)
        }
    }
    mWatching.clear();
}
 
Example 2
Source Project: Dashchan   File: DrawerLayout.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
	super.addView(child, index, params);

	final View openDrawer = findOpenDrawer();
	if (openDrawer != null || isDrawerView(child)) {
		// A drawer is already open or the new view is a drawer, so the
		// new view should start out hidden.
		child.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
	} else {
		// Otherwise this is a content view and no drawer is open, so the
		// new view should start out visible.
		child.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
	}

	// We only need a delegate here if the framework doesn't understand
	// NO_HIDE_DESCENDANTS importance.
	if (!CAN_HIDE_DESCENDANTS) {
		child.setAccessibilityDelegate(mChildAccessibilityDelegate);
	}
}
 
Example 3
Source Project: letv   File: AbsHListView.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressLint({"NewApi"})
public void reclaimViews(List<View> views) {
    int childCount = getChildCount();
    RecyclerListener listener = RecycleBin.access$2200(this.mRecycler);
    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        if (lp != null && this.mRecycler.shouldRecycleViewType(lp.viewType)) {
            views.add(child);
            if (VERSION.SDK_INT >= 14) {
                child.setAccessibilityDelegate(null);
            }
            if (listener != null) {
                listener.onMovedToScrapHeap(child);
            }
        }
    }
    this.mRecycler.reclaimScrapViews(views);
    removeAllViewsInLayout();
}
 
Example 4
Source Project: Noyze   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/** Move all views remaining in activeViews to scrapViews. */
void scrapActiveViews() {
    final View[] activeViews = this.activeViews;
    final int[] activeViewTypes = this.activeViewTypes;
    final boolean multipleScraps = viewTypeCount > 1;

    SparseArray<View> scrapViews = currentScrapViews;
    final int count = activeViews.length;
    for (int i = count - 1; i >= 0; i--) {
        final View victim = activeViews[i];
        if (victim != null) {
            int whichScrap = activeViewTypes[i];

            activeViews[i] = null;
            activeViewTypes[i] = -1;

            if (!shouldRecycleViewType(whichScrap)) {
                continue;
            }

            if (multipleScraps) {
                scrapViews = this.scrapViews[whichScrap];
            }
            scrapViews.put(i, victim);

            victim.setAccessibilityDelegate(null);
        }
    }

    pruneScrapViews();
}
 
Example 5
Source Project: UltimateAndroid   File: Recycler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Put a view into the ScrapViews list. These views are unordered.
 * 
 * @param scrap
 *            The view to add
 */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void addScrapView(View scrap, int position, int viewType) {
	// create a new Scrap
	Scrap item = new Scrap(scrap, true);
	
	if (viewTypeCount == 1) {
		currentScraps.put(position, item);
	} else {
		scraps[viewType].put(position, item);
	}
	if (Build.VERSION.SDK_INT >= 14) {
		scrap.setAccessibilityDelegate(null);
	}
}
 
Example 6
Source Project: tubatu-viewpager   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Move all views remaining in activeViews to scrapViews.
 */
void scrapActiveViews() {
    final View[] activeViews = this.activeViews;
    final int[] activeViewTypes = this.activeViewTypes;
    final boolean multipleScraps = viewTypeCount > 1;

    SparseArray<View> scrapViews = currentScrapViews;
    final int count = activeViews.length;
    for (int i = count - 1; i >= 0; i--) {
        final View victim = activeViews[i];
        if (victim != null) {
            int whichScrap = activeViewTypes[i];

            activeViews[i] = null;
            activeViewTypes[i] = -1;

            if (!shouldRecycleViewType(whichScrap)) {
                continue;
            }

            if (multipleScraps) {
                scrapViews = this.scrapViews[whichScrap];
            }
            scrapViews.put(i, victim);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                victim.setAccessibilityDelegate(null);
            }
        }
    }

    pruneScrapViews();
}
 
Example 7
Source Project: salvage   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Put a view into the ScrapViews list. These views are unordered.
 *
 * @param scrap The view to add
 */
void addScrapView(View scrap, int position, int viewType) {
  if (viewTypeCount == 1) {
    currentScrapViews.put(position, scrap);
  } else {
    scrapViews[viewType].put(position, scrap);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    scrap.setAccessibilityDelegate(null);
  }
}
 
Example 8
Source Project: ParallaxViewPager   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Put a view into the ScrapViews list. These views are unordered.
 *
 * @param scrap The view to add
 */
void addScrapView(View scrap, int position, int viewType) {
  if (viewTypeCount == 1) {
    currentScrapViews.put(position, scrap);
  } else {
    scrapViews[viewType].put(position, scrap);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    scrap.setAccessibilityDelegate(null);
  }
}
 
Example 9
Source Project: ParallaxViewPager   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/** Move all views remaining in activeViews to scrapViews. */
void scrapActiveViews() {
  final View[] activeViews = this.activeViews;
  final int[] activeViewTypes = this.activeViewTypes;
  final boolean multipleScraps = viewTypeCount > 1;

  SparseArray<View> scrapViews = currentScrapViews;
  final int count = activeViews.length;
  for (int i = count - 1; i >= 0; i--) {
    final View victim = activeViews[i];
    if (victim != null) {
      int whichScrap = activeViewTypes[i];

      activeViews[i] = null;
      activeViewTypes[i] = -1;

      if (!shouldRecycleViewType(whichScrap)) {
        continue;
      }

      if (multipleScraps) {
        scrapViews = this.scrapViews[whichScrap];
      }
      scrapViews.put(i, victim);

      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        victim.setAccessibilityDelegate(null);
      }
    }
  }

  pruneScrapViews();
}
 
Example 10
/**
 * Put a view into the ScrapViews list. These views are unordered.
 * 
 * @param scrap
 *            The view to add
 */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void addScrapView(View scrap, int position, int viewType) {
	// create a new Scrap
	Scrap item = new Scrap(scrap, true);
	
	if (viewTypeCount == 1) {
		currentScraps.put(position, item);
	} else {
		scraps[viewType].put(position, item);
	}
	if (Build.VERSION.SDK_INT >= 14) {
		scrap.setAccessibilityDelegate(null);
	}
}
 
Example 11
Source Project: SprintNBA   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Put a view into the ScrapViews list. These views are unordered.
 * 
 * @param scrap
 *            The view to add
 */
@SuppressLint("NewApi")
void addScrapView(View scrap, int position, int viewType) {
	if (viewTypeCount == 1) {
		currentScrapViews.put(position, scrap);
	} else {
		scrapViews[viewType].put(position, scrap);
	}

	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
		scrap.setAccessibilityDelegate(null);
	}
}
 
Example 12
Source Project: SprintNBA   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/** Move all views remaining in activeViews to scrapViews. */
@SuppressLint("NewApi")
void scrapActiveViews() {
	final View[] activeViews = this.activeViews;
	final int[] activeViewTypes = this.activeViewTypes;
	final boolean multipleScraps = viewTypeCount > 1;

	SparseArray<View> scrapViews = currentScrapViews;
	final int count = activeViews.length;
	for (int i = count - 1; i >= 0; i--) {
		final View victim = activeViews[i];
		if (victim != null) {
			int whichScrap = activeViewTypes[i];

			activeViews[i] = null;
			activeViewTypes[i] = -1;

			if (!shouldRecycleViewType(whichScrap)) {
				continue;
			}

			if (multipleScraps) {
				scrapViews = this.scrapViews[whichScrap];
			}
			scrapViews.put(i, victim);

			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
				victim.setAccessibilityDelegate(null);
			}
		}
	}

	pruneScrapViews();
}
 
Example 13
Source Project: InfiniteViewPager   File: RecycleBin.java    License: MIT License 5 votes vote down vote up
/**
 * Put a view into the ScrapViews list. These views are unordered.
 *
 * @param scrap The view to add
 */
void addScrapView(View scrap, int position, int viewType) {
  if (viewTypeCount == 1) {
    currentScrapViews.put(position, scrap);
  } else {
    scrapViews[viewType].put(position, scrap);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    scrap.setAccessibilityDelegate(null);
  }
}
 
Example 14
Source Project: Noyze   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/** Move all views remaining in activeViews to scrapViews. */
void scrapActiveViews() {
    final View[] activeViews = this.activeViews;
    final int[] activeViewTypes = this.activeViewTypes;
    final boolean multipleScraps = viewTypeCount > 1;

    SparseArray<View> scrapViews = currentScrapViews;
    final int count = activeViews.length;
    for (int i = count - 1; i >= 0; i--) {
        final View victim = activeViews[i];
        if (victim != null) {
            int whichScrap = activeViewTypes[i];

            activeViews[i] = null;
            activeViewTypes[i] = -1;

            if (!shouldRecycleViewType(whichScrap)) {
                continue;
            }

            if (multipleScraps) {
                scrapViews = this.scrapViews[whichScrap];
            }
            scrapViews.put(i, victim);

            victim.setAccessibilityDelegate(null);
        }
    }

    pruneScrapViews();
}
 
Example 15
Source Project: UltimateAndroid   File: Recycler.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Put a view into the ScrapViews list. These views are unordered.
 * 
 * @param scrap
 *            The view to add
 */
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void addScrapView(View scrap, int position, int viewType) {
	// create a new Scrap
	Scrap item = new Scrap(scrap, true);
	
	if (viewTypeCount == 1) {
		currentScraps.put(position, item);
	} else {
		scraps[viewType].put(position, item);
	}
	if (Build.VERSION.SDK_INT >= 14) {
		scrap.setAccessibilityDelegate(null);
	}
}
 
Example 16
Source Project: tubatu-viewpager   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Put a view into the ScrapViews list. These views are unordered.
 *
 * @param scrap The view to add
 */
void addScrapView(View scrap, int position, int viewType) {
    if (viewTypeCount == 1) {
        currentScrapViews.put(position, scrap);
    } else {
        scrapViews[viewType].put(position, scrap);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        scrap.setAccessibilityDelegate(null);
    }
}
 
Example 17
Source Project: COCOFramework   File: RecycleBin.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Put a view into the ScrapViews list. These views are unordered.
 *
 * @param scrap The view to add
 */
void addScrapView(View scrap, int position, int viewType) {
    if (viewTypeCount == 1) {
        currentScrapViews.put(position, scrap);
    } else {
        scrapViews[viewType].put(position, scrap);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        scrap.setAccessibilityDelegate(null);
    }
}
 
Example 18
public static void setAccessibilityDelegate(View v, Object delegate) {
    v.setAccessibilityDelegate((AccessibilityDelegate) delegate);
}
 
Example 19
Source Project: MiBandDecompiled   File: al.java    License: Apache License 2.0 4 votes vote down vote up
public static void a(View view, Object obj)
{
    view.setAccessibilityDelegate((android.view.View.AccessibilityDelegate)obj);
}
 
Example 20
Source Project: guideshow   File: ViewCompatICS.java    License: MIT License 4 votes vote down vote up
public static void setAccessibilityDelegate(View v, Object delegate) {
    v.setAccessibilityDelegate((AccessibilityDelegate) delegate);
}