mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-17 12:10:41 +01:00
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
|
||||
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
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user