本文整理汇总了Java中android.support.v4.view.accessibility.AccessibilityRecordCompat.setItemCount方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityRecordCompat.setItemCount方法的具体用法?Java AccessibilityRecordCompat.setItemCount怎么用?Java AccessibilityRecordCompat.setItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.accessibility.AccessibilityRecordCompat
的用法示例。
在下文中一共展示了AccessibilityRecordCompat.setItemCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(DirectionalViewpager.class.getName());
AccessibilityRecordCompat recordCompat = null;
if (isHorizontal()) {
recordCompat =
AccessibilityEventCompat.asRecord(event);
} else {
recordCompat = AccessibilityRecordCompat.obtain();
}
recordCompat.setScrollable(canScroll());
if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
&& mAdapter != null) {
recordCompat.setItemCount(mAdapter.getCount());
recordCompat.setFromIndex(mCurItem);
recordCompat.setToIndex(mCurItem);
}
}
示例2: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
/**
* Called by the accessibility delegate to initialize an accessibility event.
* <p>
* Default implementation adds item count and scroll information to the event.
*
* @param recycler The Recycler that can be used to convert view positions into adapter
* positions
* @param state The current state of RecyclerView
* @param event The event instance to initialize
* @see View#onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent)
*/
public void onInitializeAccessibilityEvent(Recycler recycler, State state,
AccessibilityEvent event) {
final AccessibilityRecordCompat record = AccessibilityEventCompat
.asRecord(event);
if (mRecyclerView == null || record == null) {
return;
}
record.setScrollable(ViewCompat.canScrollVertically(mRecyclerView, 1)
|| ViewCompat.canScrollVertically(mRecyclerView, -1)
|| ViewCompat.canScrollHorizontally(mRecyclerView, -1)
|| ViewCompat.canScrollHorizontally(mRecyclerView, 1));
if (mRecyclerView.mAdapter != null) {
record.setItemCount(mRecyclerView.mAdapter.getItemCount());
}
}
示例3: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
/**
* Called by the accessibility delegate to initialize an accessibility event.
* <p>
* Default implementation adds item count and scroll information to the event.
*
* @param recycler The Recycler that can be used to convert view positions into adapter
* positions
* @param state The current state of RecyclerView
* @param event The event instance to initialize
* @see View#onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent)
*/
public void onInitializeAccessibilityEvent(Recycler recycler, State state,
AccessibilityEvent event) {
final AccessibilityRecordCompat record = AccessibilityEventCompat
.asRecord(event);
if (mRecyclerView == null || record == null) {
return;
}
record.setScrollable(ViewCompat.canScrollVertically(mRecyclerView, 1)
|| ViewCompat.canScrollVertically(mRecyclerView, -1)
|| ViewCompat.canScrollHorizontally(mRecyclerView, -1)
|| ViewCompat.canScrollHorizontally(mRecyclerView, 1));
if (mRecyclerView.mAdapter != null) {
record.setItemCount(mRecyclerView.mAdapter.getItemCount());
}
}
示例4: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
// Ensure that we only report the number apps for accessibility not including other
// adapter views
final AccessibilityRecordCompat record = AccessibilityEventCompat
.asRecord(event);
// count the number of SECTION_BREAK_VIEW_TYPE that is wrongfully
// initialized as a node (also a row) for talk back.
int numEmptyNode = getEmptyRowForAccessibility(-1 /* no view type */);
record.setFromIndex(event.getFromIndex() - numEmptyNode);
record.setToIndex(event.getToIndex() - numEmptyNode);
record.setItemCount(mApps.getNumFilteredApps());
}
示例5: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(ViewPager.class.getName());
final AccessibilityRecordCompat recordCompat = AccessibilityRecordCompat.obtain();
recordCompat.setScrollable(canScroll());
if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
&& mAdapter != null) {
recordCompat.setItemCount(mAdapter.getCount());
recordCompat.setFromIndex(mCurItem);
recordCompat.setToIndex(mCurItem);
}
}
示例6: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
// Ensure that we only report the number apps for accessibility not including other
// adapter views
final AccessibilityRecordCompat record = AccessibilityEventCompat
.asRecord(event);
record.setItemCount(mApps.getNumFilteredApps());
record.setFromIndex(Math.max(0,
record.getFromIndex() - getRowsNotForAccessibility(record.getFromIndex())));
record.setToIndex(Math.max(0,
record.getToIndex() - getRowsNotForAccessibility(record.getToIndex())));
}
示例7: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(XCCycleViewPager.class.getName());
final AccessibilityRecordCompat recordCompat = AccessibilityRecordCompat.obtain();
recordCompat.setScrollable(canScroll());
if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
&& mAdapter != null) {
recordCompat.setItemCount(mAdapter.getCount());
recordCompat.setFromIndex(mCurItem);
recordCompat.setToIndex(mCurItem);
}
}
示例8: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(event);
// Ensure that we only report the number apps for accessibility not including other
// adapter views
final AccessibilityRecordCompat record = AccessibilityEventCompat
.asRecord(event);
record.setItemCount(mApps.getNumFilteredApps());
}
示例9: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(ViewPager.class.getName());
AccessibilityRecordCompat recordCompat = AccessibilityEventCompat.asRecord(event);
recordCompat.setScrollable(canScroll());
if (event.getEventType() == 4096 && ViewPager.this.mAdapter != null) {
recordCompat.setItemCount(ViewPager.this.mAdapter.getCount());
recordCompat.setFromIndex(ViewPager.this.mCurItem);
recordCompat.setToIndex(ViewPager.this.mCurItem);
}
}
示例10: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(YViewPagerOrigin.class.getName());
final AccessibilityRecordCompat recordCompat =
AccessibilityEventCompat.asRecord(event);
recordCompat.setScrollable(canScroll());
if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
&& mAdapter != null) {
recordCompat.setItemCount(mAdapter.getCount());
recordCompat.setFromIndex(mCurItem);
recordCompat.setToIndex(mCurItem);
}
}
示例11: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(ViewPager.class.getName());
final AccessibilityRecordCompat recordCompat =
AccessibilityEventCompat.asRecord(event);
recordCompat.setScrollable(canScroll());
if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
&& mAdapter != null) {
recordCompat.setItemCount(mAdapter.getCount());
recordCompat.setFromIndex(mCurItem);
recordCompat.setToIndex(mCurItem);
}
}
示例12: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(CustomViewPager.class.getName());
final AccessibilityRecordCompat recordCompat = AccessibilityRecordCompat.obtain();
recordCompat.setScrollable(canScroll());
if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
&& mAdapter != null) {
recordCompat.setItemCount(mAdapter.getCount());
recordCompat.setFromIndex(mCurItem);
recordCompat.setToIndex(mCurItem);
}
}
示例13: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
public void onInitializeAccessibilityEvent(Recycler recycler, State state, AccessibilityEvent event) {
boolean z = true;
AccessibilityRecordCompat record = AccessibilityEventCompat.asRecord(event);
if (this.mRecyclerView != null && record != null) {
if (!(ViewCompat.canScrollVertically(this.mRecyclerView, 1) || ViewCompat.canScrollVertically(this.mRecyclerView, -1) || ViewCompat.canScrollHorizontally(this.mRecyclerView, -1) || ViewCompat.canScrollHorizontally(this.mRecyclerView, 1))) {
z = false;
}
record.setScrollable(z);
if (this.mRecyclerView.mAdapter != null) {
record.setItemCount(this.mRecyclerView.mAdapter.getItemCount());
}
}
}
示例14: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(VelocityViewPager.class.getName());
final AccessibilityRecordCompat recordCompat = AccessibilityRecordCompat.obtain();
recordCompat.setScrollable(canScroll());
if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
&& mAdapter != null) {
recordCompat.setItemCount(mAdapter.getCount());
recordCompat.setFromIndex(mCurItem);
recordCompat.setToIndex(mCurItem);
}
}
示例15: onInitializeAccessibilityEvent
import android.support.v4.view.accessibility.AccessibilityRecordCompat; //导入方法依赖的package包/类
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
super.onInitializeAccessibilityEvent(host, event);
event.setClassName(ViewPagerEx.class.getName());
final AccessibilityRecordCompat recordCompat = AccessibilityRecordCompat.obtain();
recordCompat.setScrollable(canScroll());
if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
&& mAdapter != null) {
recordCompat.setItemCount(mAdapter.getCount());
recordCompat.setFromIndex(mCurItem);
recordCompat.setToIndex(mCurItem);
}
}