|
|
@@ -35,6 +35,7 @@ public class CustomListicleImageView extends ConstraintLayout {
|
|
|
private TextView textViewTitleNumber;
|
|
|
private TextView textViewTitle;
|
|
|
private TextView textViewSubTitle;
|
|
|
+ private int prevIndex = 0;
|
|
|
|
|
|
public CustomListicleImageView(Context context) {
|
|
|
super(context);
|
|
|
@@ -110,7 +111,11 @@ public class CustomListicleImageView extends ConstraintLayout {
|
|
|
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
|
|
@Override
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
- textViewCurrentPage.setText(String.valueOf(linearLayoutManager.findFirstVisibleItemPosition() + 1));
|
|
|
+ int index = linearLayoutManager.findFirstVisibleItemPosition();
|
|
|
+ if (prevIndex != index) {
|
|
|
+ prevIndex = index;
|
|
|
+ textViewCurrentPage.setText(String.valueOf(index + 1));
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|