File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
app/src/main/java/fr/free/nrw/commons/explore/images Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -158,11 +158,15 @@ public void addImagesToList(String query) {
158158 * @param mediaList List of media to be added
159159 */
160160 private void handlePaginationSuccess (List <Media > mediaList ) {
161- queryList .addAll (mediaList );
162161 progressBar .setVisibility (View .GONE );
163- imagesAdapter .addAll (mediaList );
164- imagesAdapter .notifyDataSetChanged ();
165- ((SearchActivity )getContext ()).viewPagerNotifyDataSetChanged ();
162+ if (mediaList .size ()!=0 ){
163+ if (!queryList .get (queryList .size ()-1 ).getFilename ().equals (mediaList .get (mediaList .size ()-1 ).getFilename ())) {
164+ queryList .addAll (mediaList );
165+ imagesAdapter .addAll (mediaList );
166+ imagesAdapter .notifyDataSetChanged ();
167+ ((SearchActivity )getContext ()).viewPagerNotifyDataSetChanged ();
168+ }
169+ }
166170 }
167171
168172
@@ -197,7 +201,6 @@ private void handleSuccess(List<Media> mediaList) {
197201 private void handleError (Throwable throwable ) {
198202 Timber .e (throwable , "Error occurred while loading queried images" );
199203 try {
200- initErrorView ();
201204 ViewUtil .showSnackbar (imagesRecyclerView , R .string .error_loading_images );
202205 }catch (Exception e ){
203206 e .printStackTrace ();
You can’t perform that action at this time.
0 commit comments