@@ -647,6 +647,7 @@ public void onSaveInstanceState(@NonNull Bundle outState) {
647
647
648
648
Timber .i (">> memorize position %s" , topItemPosition );
649
649
outState .putInt (KEY_LAST_LIST_POSITION , topItemPosition );
650
+ topItemPosition = -1 ;
650
651
}
651
652
652
653
@ Override
@@ -1038,7 +1039,7 @@ private void updateTitle(long totalSelectedCount, long totalCount) {
1038
1039
private boolean onBookClick (ContentItem item , int position ) {
1039
1040
if (0 == selectExtension .getSelectedItems ().size ()) {
1040
1041
if (!invalidateNextBookClick ) {
1041
- topItemPosition = position ; // TODO - still useful ?
1042
+ topItemPosition = position ;
1042
1043
ContentHelper .openHentoidViewer (requireContext (), item .getContent (), viewModel .getSearchManagerBundle ());
1043
1044
} else invalidateNextBookClick = false ;
1044
1045
@@ -1130,20 +1131,15 @@ private void viewQueue() {
1130
1131
}
1131
1132
1132
1133
private void differEndCallback () {
1133
- Timber .i (">> differEnd::topItem = %s" , topItemPosition );
1134
1134
if (topItemPosition > -1 ) {
1135
1135
int currentPosition = getTopItemPosition ();
1136
- Timber .i (">> differEnd::current vs. memorized %s / %s" , currentPosition , topItemPosition );
1137
- if (currentPosition != topItemPosition ) {
1138
- Timber .i (">> differEnd::scrolling to last memorized position : %s" , topItemPosition );
1139
- // llm.scrollToPositionWithOffset(topItemPosition, 0); // TODO - enable or delete the whole method
1140
- topItemPosition = -1 ;
1141
- }
1136
+ if (currentPosition != topItemPosition )
1137
+ llm .scrollToPositionWithOffset (topItemPosition , 0 ); // Used to restore position after activity has been stopped and recreated
1138
+ topItemPosition = -1 ;
1142
1139
}
1143
1140
}
1144
1141
1145
1142
private int getTopItemPosition () {
1146
- Timber .i (">> [gettopitem %s %s]" , llm .findFirstVisibleItemPosition (), llm .findFirstCompletelyVisibleItemPosition ());
1147
1143
return Math .max (llm .findFirstVisibleItemPosition (), llm .findFirstCompletelyVisibleItemPosition ());
1148
1144
}
1149
1145
}
0 commit comments