Control Center: Disable swipe layout if refresh on swipe is disabled

This commit is contained in:
José Rebelo
2025-09-01 22:53:04 +01:00
parent ecc9240900
commit 6cc910af5a
@@ -248,16 +248,19 @@ public class ControlCenterv2 extends AppCompatActivity
// Make sure the SwipeRefreshLayout doesn't interfere with the ViewPager2
viewPager.getChildAt(0).setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_MOVE) {
swipeLayout.setEnabled(false);
} else {
swipeLayout.setEnabled(true);
if (prefs.refreshOnSwipe()) {
if (event.getAction() == MotionEvent.ACTION_MOVE) {
swipeLayout.setEnabled(false);
} else {
swipeLayout.setEnabled(true);
}
}
return false;
});
// Set pull-down-to-refresh action
swipeLayout = findViewById(R.id.dashboard_swipe_layout);
swipeLayout.setEnabled(prefs.refreshOnSwipe());
swipeLayout.setOnRefreshListener(() -> {
if (prefs.refreshOnSwipe()) {
// Fetch activity for all connected devices