fixed results being duplicated when reopening the app

pull/16/head
Denis Çerri 4 years ago
parent 5d99255ef7
commit b83c73048b
No known key found for this signature in database
GPG Key ID: 96B3554AF5B193EE

@ -121,8 +121,8 @@ public class DownloadsFragment extends Fragment implements DownloadsRecyclerView
databaseManager = new DatabaseManager(context);
databaseManager.clearHistoryItem(v, false);
int position = downloadsObjects.indexOf(v);
downloadsObjects.remove(v);
downloadsRecyclerViewAdapter.notifyItemRemoved(position);
downloadsObjects.remove(v);
if (downloadsObjects.isEmpty()) initCards();
downloading = false;

@ -297,7 +297,6 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
Thread thread = new Thread(() -> {
databaseManager = new DatabaseManager(context);
resultObjects = databaseManager.getResults();
Log.e(TAG, resultObjects.toString());
String playlistTitle = "";
try {
playlistTitle = resultObjects.get(0).getPlaylistTitle();
@ -329,7 +328,9 @@ public class HomeFragment extends Fragment implements HomeRecyclerViewAdapter.On
}
uiHandler.post(() -> {
homeRecyclerViewAdapter.add(resultObjects);
if (homeRecyclerViewAdapter.getItemCount() != resultObjects.size()){
homeRecyclerViewAdapter.add(resultObjects);
}
shimmerCards.stopShimmer();
shimmerCards.setVisibility(View.GONE);
});

Loading…
Cancel
Save