Skip to content

Commit

Permalink
Empty view for DataSource list
Browse files Browse the repository at this point in the history
  • Loading branch information
andreynovikov committed Feb 5, 2024
1 parent 8a446b2 commit 53eafbd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/main/java/mobi/maptrek/fragments/DataSourceList.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
adapter.setNativeTracksMode(nativeTracks);
if (nativeTracks)
viewBinding.empty.setText(R.string.msgEmptyTrackList);
else
viewBinding.empty.setText(null);
});
dataSourceViewModel.getDataSourcesState().observe(getViewLifecycleOwner(), dataSources -> {
adapter.submitList(dataSources);
viewBinding.empty.setVisibility(dataSources.isEmpty() ? View.VISIBLE : View.GONE);
});
dataSourceViewModel.getDataSourcesState().observe(getViewLifecycleOwner(), adapter::submitList);

trackViewModel = new ViewModelProvider(requireActivity()).get(TrackViewModel.class);
trackViewModel.currentTrack.observe(getViewLifecycleOwner(), adapter::setCurrentTrack);
Expand Down

0 comments on commit 53eafbd

Please sign in to comment.