List of usage examples for android.view.accessibility AccessibilityNodeInfo ACTION_ARGUMENT_ROW_INT
String ACTION_ARGUMENT_ROW_INT
To view the source code for android.view.accessibility AccessibilityNodeInfo ACTION_ARGUMENT_ROW_INT.
Click Source Link
From source file:simonlang.coastdove.messengerencryption.ChatOverlay.java
@Override public void inflate() { super.inflate(); mListView = (ListView) findViewById(R.id.list); mListView.setAdapter(mListAdapter);//from w ww. ja v a 2 s . com Button previous = (Button) findViewById(R.id.button_load_previous); Button next = (Button) findViewById(R.id.button_load_next); if (Build.VERSION.SDK_INT >= 23) { previous.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mService.requestAction(mIdListNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); } }); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bundle args = new Bundle(); args.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_ROW_INT, 103); mService.requestAction(mIdListNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } }); } mListView.setOnScrollListener(new AbsListView.OnScrollListener() { private boolean mScrollingUp = false; private int mPrevFirstVisibileItem = 0; @Override public void onScrollStateChanged(AbsListView view, int scrollState) { if (mPrevFirstVisibileItem > view.getFirstVisiblePosition()) mScrollingUp = true; else mScrollingUp = false; if (scrollState == SCROLL_STATE_IDLE) { mPrevFirstVisibileItem = view.getFirstVisiblePosition(); Bundle args = new Bundle(); if (view.getFirstVisiblePosition() == 0) { mService.requestAction(mIdListNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_BACKWARD); } else if (view.getLastVisiblePosition() == view.getCount() - 1) { mService.requestAction(mIdListNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD); } else { int differenceFromLast = mLastListItemMapping.first - (mScrollingUp ? view.getFirstVisiblePosition() : view.getLastVisiblePosition()); args.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_ROW_INT, mLastListItemMapping.second - differenceFromLast); mService.requestAction(mIdListNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_TO_POSITION, args); } } } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); }