public void run(){ view.setSelection(lineToMoveTo); } });
public void scrollToTop() { if (child instanceof AbsListView) { AbsListView absListView = (AbsListView) child; absListView.setSelection(0); } else if (child instanceof RecyclerView) { RecyclerView recyclerView = (RecyclerView) child; RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); layoutManager.scrollToPosition(0); } }
@Override public void run() { absListView.setSelection(absListView.getAdapter().getCount() - 1); } });
mNestedAbsListView.setSelection(0);
@Override public void run() { boardGrid.setSelection(selectedPos); } });
@Override public void run() { absListView.setSelection(n); } });
@Override public void run() { absListView.setSelection(0); } });
@Override public void run() { boardGrid.setSelection(toPos); } });
@Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { view.setSelection( visibleItemCount / 2 ); }
public void run(){ view.setSelection(lineToMoveTo); } });
public void run() { view.setSelection(lineToMoveTo); } });
@Override public void run() { absListView.setSelection(absListView.getAdapter().getCount() - 1); } });
@Override public void run() { absListView.setSelection(absListView.getAdapter().getCount() - 1); } });
@Override public void run() { absListView.setSelection(absListView.getAdapter().getCount() - 1); } });
/** * Called when the observed {@link androidx.lifecycle.LiveData} is changed. * <p> * This method will update the related adapter and the {@link androidx.swiperefreshlayout.widget.SwipeRefreshLayout} if present. * * @param model The data observed by the {@link androidx.lifecycle.LiveData}. */ @Override protected void onDataReady(List<ArtistModel> model) { super.onDataReady(model); // Reset old scroll position if (mLastPosition >= 0) { mListView.setSelection(mLastPosition); mLastPosition = -1; } }
@Override public void run() { if (absListView == null) { if (DEBUG) Log.i(TAG, "scrollToPost() postNo=" + scrollToPostNo + " null list view, exiting"); return; } if (DEBUG) Log.i(TAG, "scrollToPost() postNo=" + scrollToPostNo + " scrolling to pos=" + postPos + " on UI thread"); //(new ScrollerRunnable(absListView)).start(postPos); //absListView.smoothScrollToPosition(postPos); absListView.requestFocusFromTouch(); absListView.setSelection(postPos); //if (uiCallback != null) // uiCallback.run(); } }, 100);
/** * Called when the observed {@link androidx.lifecycle.LiveData} is changed. * <p> * This method will update the related adapter and the {@link androidx.swiperefreshlayout.widget.SwipeRefreshLayout} if present. * * @param model The data observed by the {@link androidx.lifecycle.LiveData}. */ @Override protected void onDataReady(List<AlbumModel> model) { super.onDataReady(model); // Reset old scroll position if (mLastPosition >= 0) { mListView.setSelection(mLastPosition); mLastPosition = -1; } }
public void onBookmarkClick(File file) { if (!file.exists()) { Toast.makeText(mActivity, getString(R.string.cantopenfile), Toast.LENGTH_SHORT).show(); return; } if (file.isDirectory()) { navigateTo(file.getAbsolutePath()); // go to the top of the ListView mListView.setSelection(0); } else { listItemAction(file); } }
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { final File file = new File((mListView.getAdapter() .getItem(position)).toString()); if (file.isDirectory()) { navigateTo(file.getAbsolutePath()); // go to the top of the ListView mListView.setSelection(0); } else { listItemAction(file); } } });
public void onNavigate(String path) { // navigate to path when Navigation button is clicked if (mActionController.isActionMode()) { mActionController.finishActionMode(); } navigateTo(path); // go to the top of the ListView mListView.setSelection(0); }