Skip to content

Commit 6f96e89

Browse files
Fixes #5344 Some categories hidden at top of Upload Wizard suggestions, need to manually scroll up (#5370)
* Fix Issue #5344 * fix update Issue #5344 * Add Comment
1 parent b7913fa commit 6f96e89

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

app/src/main/java/fr/free/nrw/commons/upload/categories/UploadCategoriesFragment.java

+16
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,22 @@ public void setCategories(List<CategoryItem> categories) {
198198
} else {
199199
adapter.setItems(categories);
200200
}
201+
adapter.notifyDataSetChanged();
202+
203+
// Nested waiting for search result data to load into the category
204+
// list and smoothly scroll to the top of the search result list.
205+
rvCategories.post(new Runnable() {
206+
@Override
207+
public void run() {
208+
rvCategories.smoothScrollToPosition(0);
209+
rvCategories.post(new Runnable() {
210+
@Override
211+
public void run() {
212+
rvCategories.smoothScrollToPosition(0);
213+
}
214+
});
215+
}
216+
});
201217
}
202218

203219
@Override

app/src/main/java/fr/free/nrw/commons/upload/depicts/DepictsFragment.java

+15-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,21 @@ public void setDepictsList(List<DepictedItem> depictedItemList) {
246246
adapter.setItems(depictedItemList);
247247
}
248248
}
249-
depictsRecyclerView.smoothScrollToPosition(0);
249+
250+
// Nested waiting for search result data to load into the depicted item
251+
// list and smoothly scroll to the top of the search result list.
252+
depictsRecyclerView.post(new Runnable() {
253+
@Override
254+
public void run() {
255+
depictsRecyclerView.smoothScrollToPosition(0);
256+
depictsRecyclerView.post(new Runnable() {
257+
@Override
258+
public void run() {
259+
depictsRecyclerView.smoothScrollToPosition(0);
260+
}
261+
});
262+
}
263+
});
250264
}
251265

252266
/**

0 commit comments

Comments
 (0)