Fixed layout to correctly display podcasts
Added working swipe refresh
This commit is contained in:
parent
88cd866e03
commit
a9ea033802
|
@ -50,11 +50,17 @@ public class PodcastFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View view, @Nullable Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
cancellationToken = new CancellationToken();
|
cancellationToken = new CancellationToken();
|
||||||
swipeRefresh = view.findViewById(R.id.podcasts_refresh);
|
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);
|
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
|
@Override
|
||||||
|
@ -83,7 +89,7 @@ public class PodcastFragment extends Fragment {
|
||||||
super.onDestroyView();
|
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)
|
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
|
protected List<PodcastsChannel> doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService(context);
|
MusicService musicService = MusicServiceFactory.getMusicService(context);
|
||||||
return musicService.getPodcastsChannels(false, context);
|
return musicService.getPodcastsChannels(refresh, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,18 +3,18 @@
|
||||||
a:layout_width="fill_parent"
|
a:layout_width="fill_parent"
|
||||||
a:layout_height="fill_parent"
|
a:layout_height="fill_parent"
|
||||||
a:orientation="vertical" >
|
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
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
a:id="@+id/podcasts_refresh"
|
a:id="@+id/podcasts_refresh"
|
||||||
a:layout_width="fill_parent"
|
a:layout_width="fill_parent"
|
||||||
a:layout_height="0dp"
|
a:layout_height="0dp"
|
||||||
a:layout_weight="1.0">
|
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
|
<ListView
|
||||||
a:id="@+id/podcasts_channels_items_list"
|
a:id="@+id/podcasts_channels_items_list"
|
||||||
|
|
Loading…
Reference in New Issue