[UI] Fix touch events on swipe refresh pages (API 32+). (#129)

* [Hotfix] Fix touch events on swipe refresh pages (API 32)

* Add API SDK version check
This commit is contained in:
Sylwester Zinkiewicz 2022-04-18 11:28:34 +02:00 committed by GitHub
parent 8911ce2bc1
commit 745523c620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@
package pl.szczodrzynski.edziennik.utils;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@ -83,7 +84,9 @@ public class SwipeRefreshLayoutNoIndicator extends SwipeRefreshLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
ev.setSource(0x10000000);
if (Build.VERSION.SDK_INT < 32) {
ev.setSource(0x10000000);
}
boolean parentConsumed = parent.onInterceptTouchEvent(ev);
boolean superConsumed = super.onInterceptTouchEvent(ev);
return parentConsumed && superConsumed;