Java Code Examples for android.support.v4.view.accessibility.AccessibilityRecordCompat#setItemCount()

The following examples show how to use android.support.v4.view.accessibility.AccessibilityRecordCompat#setItemCount() . 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 check out the related API usage on the sidebar.
Example 1
Source File: DirectionalViewpager.java    From BookReader with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example 2
Source File: VerticalViewPager.java    From Overchan-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(host, event);
    event.setClassName(VerticalViewPager.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);
    }
}
 
Example 3
Source File: VerticalViewPager.java    From ticdesign with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 4
Source File: ViewPager.java    From guideshow with MIT License 5 votes vote down vote up
@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);
    }
}
 
Example 5
Source File: ViewPager.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example 6
Source File: ViewPagerEx.java    From AndroidImageSlider with MIT License 5 votes vote down vote up
@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);
    }
}
 
Example 7
Source File: VelocityViewPager.java    From Muzesto with GNU General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example 8
Source File: ViewPagerEx.java    From ImageSliderWithSwipes with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 9
Source File: ViewPager.java    From ankihelper with GNU General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example 10
Source File: VerticalViewPager.java    From ankihelper with GNU General Public License v3.0 5 votes vote down vote up
@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);
    }
}
 
Example 11
Source File: ViewPager.java    From android-recipes-app with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 12
Source File: NineOldViewPager.java    From ncalc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(host, event);
    event.setClassName(NineOldViewPager.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);
    }
}
 
Example 13
Source File: VelocityViewPager.java    From VelocityViewPager with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 14
Source File: ViewPagerEx.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
@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);
    }
}
 
Example 15
Source File: AllAppsGridAdapter.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
@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());
}
 
Example 16
Source File: ViewPager.java    From android-movies-demo with MIT License 5 votes vote down vote up
@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);
    }
}
 
Example 17
Source File: YViewPager.java    From YViewPagerDemo with Apache License 2.0 5 votes vote down vote up
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(host, event);
    event.setClassName(YViewPager.class.getName());
    final AccessibilityRecordCompat recordCompat =
            AccessibilityEventCompat.asRecord(event);
    recordCompat.setScrollable(canScroll());
    if (event.getEventType() == AccessibilityEventCompat.TYPE_VIEW_SCROLLED
            && mAdapter != null) {
        recordCompat.setItemCount(getAdapterCount());
        recordCompat.setFromIndex(mCurItem);
        recordCompat.setToIndex(mCurItem);
    }
}
 
Example 18
Source File: ViewPager.java    From RxJavaApp with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 19
Source File: AllAppsGridAdapter.java    From LaunchEnr with GNU General Public License v3.0 5 votes vote down vote up
@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())));
}
 
Example 20
Source File: CustomViewPager.java    From youqu_master with Apache License 2.0 5 votes vote down vote up
@Override
public void onInitializeAccessibilityEvent(View host, AccessibilityEvent event) {
    super.onInitializeAccessibilityEvent(host, event);
    event.setClassName(CustomViewPager.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);
    }
}