Merge pull request #6199 from ByteHamster/home-pull-refresh
Add pull-to-refresh to home screen
This commit is contained in:
commit
1ee85b5bb0
app/src/main
@ -3,6 +3,8 @@ package de.danoeh.antennapod.ui.home;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -70,6 +72,14 @@ public class HomeFragment extends Fragment implements Toolbar.OnMenuItemClickLis
|
|||||||
refreshToolbarState();
|
refreshToolbarState();
|
||||||
populateSectionList();
|
populateSectionList();
|
||||||
updateWelcomeScreenVisibility();
|
updateWelcomeScreenVisibility();
|
||||||
|
|
||||||
|
viewBinding.swipeRefresh.setDistanceToTriggerSync(getResources().getInteger(R.integer.swipe_refresh_distance));
|
||||||
|
viewBinding.swipeRefresh.setOnRefreshListener(() -> {
|
||||||
|
AutoUpdateManager.runImmediate(requireContext());
|
||||||
|
new Handler(Looper.getMainLooper()).postDelayed(() -> viewBinding.swipeRefresh.setRefreshing(false),
|
||||||
|
getResources().getInteger(R.integer.swipe_to_refresh_duration_in_ms));
|
||||||
|
});
|
||||||
|
|
||||||
return viewBinding.getRoot();
|
return viewBinding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,18 +65,25 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/homeScrollView"
|
android:id="@+id/swipeRefresh"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.core.widget.NestedScrollView
|
||||||
android:id="@+id/homeContainer"
|
android:id="@+id/homeScrollView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingBottom="12dp" />
|
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
<LinearLayout
|
||||||
|
android:id="@+id/homeContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="12dp" />
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user