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

The following are Jave code examples for showing how to use setAccessibilityDelegate() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: RNLearn_Project1   File: AccessibilityHelper.java   View Source Code Vote up 6 votes
public static void updateAccessibilityComponentType(View view, String componentType) {
  if (componentType == null) {
    view.setAccessibilityDelegate(null);
    return;
  }
  switch (componentType) {
    case BUTTON:
      view.setAccessibilityDelegate(BUTTON_DELEGATE);
      break;
    case RADIOBUTTON_CHECKED:
      view.setAccessibilityDelegate(RADIOBUTTON_CHECKED_DELEGATE);
      break;
    case RADIOBUTTON_UNCHECKED:
      view.setAccessibilityDelegate(RADIOBUTTON_UNCHECKED_DELEGATE);
      break;
    default:
      view.setAccessibilityDelegate(null);
      break;
  }
}
 
Example 2
Project: RNLearn_Project1   File: AccessibilityHelper.java   View Source Code Vote up 6 votes
public static void updateAccessibilityComponentType(View view, String componentType) {
  if (componentType == null) {
    view.setAccessibilityDelegate(null);
    return;
  }
  switch (componentType) {
    case BUTTON:
      view.setAccessibilityDelegate(BUTTON_DELEGATE);
      break;
    case RADIOBUTTON_CHECKED:
      view.setAccessibilityDelegate(RADIOBUTTON_CHECKED_DELEGATE);
      break;
    case RADIOBUTTON_UNCHECKED:
      view.setAccessibilityDelegate(RADIOBUTTON_UNCHECKED_DELEGATE);
      break;
    default:
      view.setAccessibilityDelegate(null);
      break;
  }
}
 
Example 3
Project: Month_Calendar   File: RecycleBin.java   View Source Code Vote up 5 votes
/** 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 4
Project: android_viewtracker   File: ClickManager.java   View Source Code Vote up 5 votes
private void handleViewClick(Activity activity, MotionEvent event, HashMap<String, Object> commonInfo) {
    View view = activity.getWindow().getDecorView();
    View tagView = null;
    View clickView = getClickView(view, event, tagView);
    if (clickView != null) {
        if (mDelegate != null) {
            mDelegate.setCommonInfo(commonInfo);
        }
        clickView.setAccessibilityDelegate(mDelegate);
    }
}
 
Example 5
Project: Mybilibili   File: RecycleBin.java   View Source Code Vote up 5 votes
/** 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 6
Project: Mybilibili   File: RecycleBin.java   View Source Code Vote up 5 votes
/**
 * 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 7
Project: exciting-app   File: AbsHListView.java   View Source Code Vote up 5 votes
/**
 * Move all views (excluding headers and footers) held by this AbsListView
 * into the supplied List. This includes views displayed on the screen as
 * well as views stored in AbsListView's internal view recycler.
 * 
 * @param views
 *            A list into which to put the reclaimed views
 */
@SuppressLint("NewApi")
public void reclaimViews(List<View> views) {
	int childCount = getChildCount();
	RecyclerListener listener = mRecycler.mRecyclerListener;

	// Reclaim views on screen
	for (int i = 0; i < childCount; i++) {
		View child = getChildAt(i);
		AbsHListView.LayoutParams lp = (AbsHListView.LayoutParams) child
				.getLayoutParams();
		// Don't reclaim header or footer views, or views that should be
		// ignored
		if (lp != null && mRecycler.shouldRecycleViewType(lp.viewType)) {
			views.add(child);

			if (android.os.Build.VERSION.SDK_INT >= 14) {
				child.setAccessibilityDelegate(null);
			}

			if (listener != null) {
				// Pretend they went through the scrap heap
				listener.onMovedToScrapHeap(child);
			}
		}
	}
	mRecycler.reclaimScrapViews(views);
	removeAllViewsInLayout();
}
 
Example 8
Project: Watermark   File: RecyclingPagerAdapter.java   View Source Code Vote up 5 votes
/**
 * 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
Project: Watermark   File: RecyclingPagerAdapter.java   View Source Code Vote up 5 votes
/**
 * 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
Project: PicShow-zhaipin   File: RecycleBin.java   View Source Code Vote up 5 votes
/**
 * 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 11
Project: PicShow-zhaipin   File: RecycleBin.java   View Source Code Vote up 5 votes
/** 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 12
Project: boohee_v5.6   File: RecycleBin.java   View Source Code Vote up 5 votes
void addScrapView(View scrap, int position, int viewType) {
    if (this.viewTypeCount == 1) {
        this.currentScrapViews.put(position, scrap);
    } else {
        this.scrapViews[viewType].put(position, scrap);
    }
    if (VERSION.SDK_INT >= 14) {
        scrap.setAccessibilityDelegate(null);
    }
}
 
Example 13
Project: boohee_v5.6   File: RecycleBin.java   View Source Code Vote up 5 votes
void scrapActiveViews() {
    boolean multipleScraps = true;
    View[] activeViews = this.activeViews;
    int[] activeViewTypes = this.activeViewTypes;
    if (this.viewTypeCount <= 1) {
        multipleScraps = false;
    }
    SparseArray<View> scrapViews = this.currentScrapViews;
    for (int i = activeViews.length - 1; i >= 0; i--) {
        View victim = activeViews[i];
        if (victim != null) {
            int whichScrap = activeViewTypes[i];
            activeViews[i] = null;
            activeViewTypes[i] = -1;
            if (shouldRecycleViewType(whichScrap)) {
                if (multipleScraps) {
                    scrapViews = this.scrapViews[whichScrap];
                }
                scrapViews.put(i, victim);
                if (VERSION.SDK_INT >= 14) {
                    victim.setAccessibilityDelegate(null);
                }
            }
        }
    }
    pruneScrapViews();
}
 
Example 14
Project: Week_Calendar   File: RecycleBin.java   View Source Code Vote up 5 votes
/**
 * 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 15
Project: Week_Calendar   File: RecycleBin.java   View Source Code Vote up 5 votes
/** 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 16
Project: LaunchEnr   File: PopupContainerWithArrow.java   View Source Code Vote up 4 votes
private void addDummyViews(PopupPopulator.Item[] itemTypesToPopulate,
        boolean notificationFooterHasIcons) {
    final Resources res = getResources();
    final int spacing = res.getDimensionPixelSize(R.dimen.popup_items_spacing);
    final LayoutInflater inflater = LayoutInflater.from(new ContextThemeWrapper(mLauncher, R.style.Base_Theme));

    int numItems = itemTypesToPopulate.length;
    for (int i = 0; i < numItems; i++) {
        PopupPopulator.Item itemTypeToPopulate = itemTypesToPopulate[i];
        PopupPopulator.Item nextItemTypeToPopulate =
                i < numItems - 1 ? itemTypesToPopulate[i + 1] : null;
        final View item = inflater.inflate(itemTypeToPopulate.layoutId, this, false);

        if (itemTypeToPopulate == PopupPopulator.Item.NOTIFICATION) {
            mNotificationItemView = (NotificationItemView) item;
            int footerHeight = notificationFooterHasIcons ?
                    res.getDimensionPixelSize(R.dimen.notification_footer_height) : 0;
            item.findViewById(R.id.footer).getLayoutParams().height = footerHeight;
            mNotificationItemView.getMainView().setAccessibilityDelegate(mAccessibilityDelegate);
        } else if (itemTypeToPopulate == PopupPopulator.Item.SHORTCUT) {
            item.setAccessibilityDelegate(mAccessibilityDelegate);
        }

        boolean shouldAddBottomMargin = nextItemTypeToPopulate != null
                && itemTypeToPopulate.isShortcut ^ nextItemTypeToPopulate.isShortcut;

        if (itemTypeToPopulate.isShortcut) {
            if (mShortcutsItemView == null) {
                mShortcutsItemView = (ShortcutsItemView) inflater.inflate(
                        R.layout.shortcuts_item, this, false);
                addView(mShortcutsItemView);
            }
            mShortcutsItemView.addShortcutView(item, itemTypeToPopulate);
            if (shouldAddBottomMargin) {
                ((LayoutParams) mShortcutsItemView.getLayoutParams()).bottomMargin = spacing;
            }
        } else {
            addView(item);
            if (shouldAddBottomMargin) {
                ((LayoutParams) item.getLayoutParams()).bottomMargin = spacing;
            }
        }
    }
}
 
Example 17
Project: letv   File: ViewCompatICS.java   View Source Code Vote up 4 votes
public static void setAccessibilityDelegate(View v, @Nullable Object delegate) {
    v.setAccessibilityDelegate((AccessibilityDelegate) delegate);
}
 
Example 18
Project: exciting-app   File: AbsHListView.java   View Source Code Vote up 4 votes
/**
 * Put a view into the ScrapViews list. These views are unordered.
 * 
 * @param scrap
 *            The view to add
 */
@SuppressLint("NewApi")
public void addScrapView(View scrap, int position) {
	AbsHListView.LayoutParams lp = (AbsHListView.LayoutParams) scrap
			.getLayoutParams();
	if (lp == null) {
		return;
	}

	lp.scrappedFromPosition = position;

	// Don't put header or footer views or views that should be ignored
	// into the scrap heap
	int viewType = lp.viewType;

	final boolean scrapHasTransientState = android.os.Build.VERSION.SDK_INT >= 16 ? scrap
			.hasTransientState() : false;

	if (!shouldRecycleViewType(viewType) || scrapHasTransientState) {
		if (viewType != ITEM_VIEW_TYPE_HEADER_OR_FOOTER
				|| scrapHasTransientState) {
			if (mSkippedScrap == null) {
				mSkippedScrap = new ArrayList<View>();
			}
			mSkippedScrap.add(scrap);
		}
		if (scrapHasTransientState) {
			if (mTransientStateViews == null) {
				mTransientStateViews = new SparseArrayCompat<View>();
			}
			scrap.onStartTemporaryDetach();
			mTransientStateViews.put(position, scrap);
		}
		return;
	}

	scrap.onStartTemporaryDetach();
	if (mViewTypeCount == 1) {
		mCurrentScrap.add(scrap);
	} else {
		mScrapViews[viewType].add(scrap);
	}

	if (android.os.Build.VERSION.SDK_INT >= 14) {
		scrap.setAccessibilityDelegate(null);
	}

	if (mRecyclerListener != null) {
		mRecyclerListener.onMovedToScrapHeap(scrap);
	}
}
 
Example 19
Project: exciting-app   File: AbsHListView.java   View Source Code Vote up 4 votes
/**
 * Move all views remaining in mActiveViews to mScrapViews.
 */
@SuppressLint("NewApi")
public void scrapActiveViews() {
	final View[] activeViews = mActiveViews;
	final boolean hasListener = mRecyclerListener != null;
	final boolean multipleScraps = mViewTypeCount > 1;

	ArrayList<View> scrapViews = mCurrentScrap;
	final int count = activeViews.length;
	for (int i = count - 1; i >= 0; i--) {
		final View victim = activeViews[i];
		if (victim != null) {
			final AbsHListView.LayoutParams lp = (AbsHListView.LayoutParams) victim
					.getLayoutParams();
			int whichScrap = lp.viewType;

			activeViews[i] = null;

			final boolean scrapHasTransientState = android.os.Build.VERSION.SDK_INT >= 16 ? victim
					.hasTransientState() : false;
			if (!shouldRecycleViewType(whichScrap)
					|| scrapHasTransientState) {
				// Do not move views that should be ignored
				if (whichScrap != ITEM_VIEW_TYPE_HEADER_OR_FOOTER
						|| scrapHasTransientState) {
					removeDetachedView(victim, false);
				}
				if (scrapHasTransientState) {
					if (mTransientStateViews == null) {
						mTransientStateViews = new SparseArrayCompat<View>();
					}
					mTransientStateViews.put(mFirstActivePosition + i,
							victim);
				}
				continue;
			}

			if (multipleScraps) {
				scrapViews = mScrapViews[whichScrap];
			}
			victim.onStartTemporaryDetach();
			lp.scrappedFromPosition = mFirstActivePosition + i;
			scrapViews.add(victim);

			if (android.os.Build.VERSION.SDK_INT >= 14) {
				victim.setAccessibilityDelegate(null);
			}

			if (hasListener) {
				mRecyclerListener.onMovedToScrapHeap(victim);
			}
		}
	}

	pruneScrapViews();
}
 
Example 20
Project: boohee_v5.6   File: ViewCompatICS.java   View Source Code Vote up 4 votes
public static void setAccessibilityDelegate(View v, @Nullable Object delegate) {
    v.setAccessibilityDelegate((AccessibilityDelegate) delegate);
}