I'm using HorizontalGridView
in android.support.v17.leanback.widget
package. The problem is that OnChildViewHolderSelectedListener
is called too early.
horizontalGrid.setSelectedPosition(position);
horizontalGrid.setOnChildViewHolderSelectedListener(new OnChildViewHolderSelectedListener() {
@Override
public void onChildViewHolderSelected(RecyclerView parent, RecyclerView.ViewHolder child, int position, int subposition) {
super.onChildViewHolderSelected(parent, child, position, subposition);
//the animation isn't complete
//horizontalGrid.getLayoutManager().isSmoothScrolling() is true;
}
});
The only choices that I'm aware of is to use a TimerTask
with Timer
and check if horizontalGrid.getLayoutManager().isSmoothScrolling()
is false. Another less reliable solution is to use a Handler
with postDelayed
method. Both ways are ugly in my case.
I haven't found any built-in methods. Am I missing something? Is there something more elegant?