Adds pull to refresh functionality on Queue screen (#5104)
This commit is contained in:
parent
754021a795
commit
5fa558e483
@ -4,6 +4,8 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
@ -19,6 +21,8 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.MainActivity;
|
||||
@ -440,6 +444,13 @@ public class QueueFragment extends Fragment implements Toolbar.OnMenuItemClickLi
|
||||
recyclerView.setRecycledViewPool(((MainActivity) getActivity()).getRecycledViewPool());
|
||||
registerForContextMenu(recyclerView);
|
||||
|
||||
SwipeRefreshLayout swipeRefreshLayout = root.findViewById(R.id.swipeRefresh);
|
||||
swipeRefreshLayout.setOnRefreshListener(() -> {
|
||||
AutoUpdateManager.runImmediate(requireContext());
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> swipeRefreshLayout.setRefreshing(false),
|
||||
getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms));
|
||||
});
|
||||
|
||||
itemTouchHelper = new ItemTouchHelper(
|
||||
new ItemTouchHelper.SimpleCallback(ItemTouchHelper.UP | ItemTouchHelper.DOWN,
|
||||
ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
|
||||
|
@ -32,12 +32,19 @@
|
||||
android:layout_below="@id/info_bar"
|
||||
android:background="?android:attr/listDivider"/>
|
||||
|
||||
<de.danoeh.antennapod.view.EpisodeItemListRecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingHorizontal="@dimen/additional_horizontal_spacing"
|
||||
android:layout_below="@id/divider" />
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipeRefresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/divider">
|
||||
|
||||
<de.danoeh.antennapod.view.EpisodeItemListRecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingHorizontal="@dimen/additional_horizontal_spacing" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progLoading"
|
||||
|
Loading…
x
Reference in New Issue
Block a user