You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto jump to DetailFragment in branch bonus_recyclerview_code #61
in your code, autoSelectView=true
in the method onLoadFinish() in Class ForecastFragment
updateEmptyView();
if ( data.getCount() > 0 ) {
mRecyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
// Since we know we're going to get items, we keep the listener around until
// we see Children.
if (mRecyclerView.getChildCount() > 0) {
mRecyclerView.getViewTreeObserver().removeOnPreDrawListener(this);
int itemPosition = mForecastAdapter.getSelectedItemPosition();
if ( RecyclerView.NO_POSITION == itemPosition ) itemPosition = 0;
RecyclerView.ViewHolder vh = mRecyclerView.findViewHolderForAdapterPosition(itemPosition);
if ( null != vh && mAutoSelectView ) {
mForecastAdapter.selectView( vh );
}
return true;
}
return false;
}
});
}
app will invoke onClick() method and jump to DetailActivity, is that right in logic?
Activity