Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40eb7b50 authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Close #172 - Set 2/3 threshold for swipe down to search gesture.

Only consider this gesture when user start the touch  in lower 1/3 portion of the screen.
parent 6ed11528
Loading
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;

import foundation.e.blisslauncher.BlissLauncher;
import foundation.e.blisslauncher.R;
import foundation.e.blisslauncher.features.launcher.DetectSwipeGestureListener;
import foundation.e.blisslauncher.features.launcher.LauncherActivity;
@@ -63,6 +64,7 @@ public class HorizontalPager extends ViewGroup implements Insettable{
    private boolean mIsUiCreated;
    private GestureDetectorCompat gestureDetectorCompat;
    private WindowInsets insets;
    private float mLastMotionRawY;

    public HorizontalPager(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
@@ -276,6 +278,9 @@ public class HorizontalPager extends ViewGroup implements Insettable{
        final float x = ev.getX();
        final float y = ev.getY();

        mLastMotionRawY = ev.getRawY();


        switch (action) {
            case MotionEvent.ACTION_MOVE:
                /*
@@ -329,7 +334,7 @@ public class HorizontalPager extends ViewGroup implements Insettable{

        if (xMoved || yMoved) {

            if (yMoved && (y - mLastMotionY) > 0 && yDiff > xDiff && currentPage != 0) {
            if (yMoved && (y - mLastMotionY) > 0 && yDiff > xDiff && touchedInBottom() && currentPage != 0) {
                mTouchState = TOUCH_STATE_VERTICAL_SCROLLING;
                ((OnSwipeDownListener) getContext()).onSwipeStart();
            } else if (xMoved && yDiff < xDiff) {
@@ -351,6 +356,10 @@ public class HorizontalPager extends ViewGroup implements Insettable{
        }
    }

    private boolean touchedInBottom() {
        return (mLastMotionRawY / BlissLauncher.getApplication(getContext()).getDeviceProfile().availableHeightPx) > (float) 2 / 3;
    }

    void enableChildrenCache() {
        setChildrenDrawingCacheEnabled(true);
    }
+2 −5
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.content.IntentFilter;
import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
@@ -2966,16 +2965,14 @@ public class LauncherActivity extends AppCompatActivity implements
        if (currentAnimator != null) {
            currentAnimator.cancel();
        }
        int animationDuration = (int) (blurLayer.getAlpha() * 300);
        AnimatorSet set = new AnimatorSet();
        /*ValueAnimator blurAnimator = ValueAnimator.ofInt(blurRadius, 18);
        blurAnimator.addUpdateListener(animation ->
                BlurWallpaperProvider.getInstance(this).blurWithLauncherView(mergedView, (Integer) animation.getAnimatedValue()));*/
        set.play(ObjectAnimator.ofFloat(swipeSearchContainer, View.TRANSLATION_Y, 0))
                .with(ObjectAnimator.ofFloat(blurLayer, View.ALPHA, 1f))
                .with(ObjectAnimator.ofFloat(mHorizontalPager, View.ALPHA, 0f))
                .with(ObjectAnimator.ofFloat(mIndicator, View.ALPHA, 0f))
                .with(ObjectAnimator.ofFloat(mDock, View.ALPHA, 0f));
        set.setDuration(300);
        set.setDuration(animationDuration);
        set.setInterpolator(new LinearInterpolator());
        set.addListener(new AnimatorListenerAdapter() {
                            @Override