Merge pull request #395 from nitehu/fix/podcasts

Fixed layout to correctly display podcasts
This commit is contained in:
Nite 2021-03-17 17:41:23 +01:00 committed by GitHub
commit 63572d84ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 12 deletions

View File

@ -50,11 +50,17 @@ public class PodcastFragment extends Fragment {
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
cancellationToken = new CancellationToken();
swipeRefresh = view.findViewById(R.id.podcasts_refresh);
swipeRefresh.setEnabled(false);
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener()
{
@Override
public void onRefresh() {
load(view.getContext(), true);
}
});
FragmentTitle.Companion.setTitle(this, R.string.podcasts_label);
@ -74,7 +80,7 @@ public class PodcastFragment extends Fragment {
}
});
load(view.getContext());
load(view.getContext(), false);
}
@Override
@ -83,7 +89,7 @@ public class PodcastFragment extends Fragment {
super.onDestroyView();
}
private void load(final Context context)
private void load(final Context context, final boolean refresh)
{
BackgroundTask<List<PodcastsChannel>> task = new FragmentBackgroundTask<List<PodcastsChannel>>(getActivity(), true, swipeRefresh, cancellationToken)
{
@ -91,7 +97,7 @@ public class PodcastFragment extends Fragment {
protected List<PodcastsChannel> doInBackground() throws Throwable
{
MusicService musicService = MusicServiceFactory.getMusicService(context);
return musicService.getPodcastsChannels(false, context);
return musicService.getPodcastsChannels(refresh, context);
}
@Override

View File

@ -3,18 +3,18 @@
a:layout_width="fill_parent"
a:layout_height="fill_parent"
a:orientation="vertical" >
<TextView
a:id="@+id/select_podcasts_empty"
a:layout_width="fill_parent"
a:layout_height="wrap_content"
a:padding="10dip"
a:text="@string/podcasts_channels.empty"
a:visibility="gone" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
a:id="@+id/podcasts_refresh"
a:layout_width="fill_parent"
a:layout_height="0dp"
a:layout_weight="1.0">
<TextView
a:id="@+id/select_podcasts_empty"
a:layout_width="fill_parent"
a:layout_height="wrap_content"
a:padding="10dip"
a:text="@string/podcasts_channels.empty"
a:visibility="gone" />
<ListView
a:id="@+id/podcasts_channels_items_list"