本文整理汇总了Java中android.view.View.setAccessibilityDelegate方法的典型用法代码示例。如果您正苦于以下问题:Java View.setAccessibilityDelegate方法的具体用法?Java View.setAccessibilityDelegate怎么用?Java View.setAccessibilityDelegate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setAccessibilityDelegate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAccessibilityComponentType
import android.view.View; //导入方法依赖的package包/类
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;
}
}
示例2: scrapActiveViews
import android.view.View; //导入方法依赖的package包/类
/** 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();
}
示例3: handleViewClick
import android.view.View; //导入方法依赖的package包/类
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);
}
}
示例4: addScrapView
import android.view.View; //导入方法依赖的package包/类
/**
* 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);
}
}
示例5: reclaimViews
import android.view.View; //导入方法依赖的package包/类
/**
* 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();
}
示例6: addScrapView
import android.view.View; //导入方法依赖的package包/类
/**
* 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);
}
}
示例7: scrapActiveViews
import android.view.View; //导入方法依赖的package包/类
/**
* 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();
}
示例8: addScrapView
import android.view.View; //导入方法依赖的package包/类
/**
* 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);
}
}
示例9: scrapActiveViews
import android.view.View; //导入方法依赖的package包/类
/** 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();
}
示例10: addScrapView
import android.view.View; //导入方法依赖的package包/类
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);
}
}
示例11: scrapActiveViews
import android.view.View; //导入方法依赖的package包/类
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();
}
示例12: addDummyViews
import android.view.View; //导入方法依赖的package包/类
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;
}
}
}
}
示例13: setAccessibilityDelegate
import android.view.View; //导入方法依赖的package包/类
public static void setAccessibilityDelegate(View v, @Nullable Object delegate) {
v.setAccessibilityDelegate((AccessibilityDelegate) delegate);
}
示例14: addScrapView
import android.view.View; //导入方法依赖的package包/类
/**
* 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);
}
}
示例15: scrapActiveViews
import android.view.View; //导入方法依赖的package包/类
/**
* 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();
}