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

Commit dc0adf3e authored by Romain Hunault's avatar Romain Hunault 🚴🏻
Browse files

Merge branch 'features/ui-ux-improvements' into 'develop'

Features/ui ux improvements

See merge request e/apps/BlissLauncher!19
parents a3cf67b6 fc47cc6a
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
            android:resumeWhilePausing="true"
            android:screenOrientation="nosensor"
            android:stateNotNeeded="true"
            android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
            android:theme="@style/HomeScreenTheme"
            android:windowSoftInputMode="adjustPan">
            <intent-filter>
+4 −0
Original line number Diff line number Diff line
@@ -54,6 +54,10 @@ public class BlissLauncher extends Application {
        return deviceProfile;
    }

    public void resetDeviceProfile() {
        deviceProfile = new DeviceProfile(this);
    }

    public IconsHandler getIconsHandler() {
        if (iconsPackHandler == null) {
            iconsPackHandler = new IconsHandler(this);
+11 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;

@@ -27,6 +28,7 @@ public class DeviceProfile {

    public static Path path;
    private final float widthCm;
    private final float ratio;
    private int statusBarHeight;
    public int cellHeightWithoutPaddingPx;
    public int hotseatCellHeightWithoutPaddingPx;
@@ -157,6 +159,7 @@ public class DeviceProfile {

        widthPx = realSize.x;
        double x = widthPx / dm.xdpi;
        ratio = dm.densityDpi / dm.xdpi;
        widthCm = (float) (x * 2.540001f);
        heightPx = realSize.y;

@@ -231,7 +234,15 @@ public class DeviceProfile {
            iconSizePx = 213;
        }*/

        float a = 1.578f;
        float b = 1.23f;

        Log.i(TAG, "updateIconSize: " + (int) a + " " + (int) b);

        iconSizePx = (int) (widthPx / widthCm);
        if (ratio >= 1) {
            iconSizePx = iconSizePx * (int) ratio;
        }

        iconTextSizePx = (int) (Utilities.pxFromSp(12, dm) * scale);
        iconDrawablePaddingPx = (availableWidthPx - iconSizePx * 4) / 5;
+8 −2
Original line number Diff line number Diff line
@@ -229,6 +229,12 @@ public class Utilities {
        return defaultValue;
    }



    /**
     * Ensures that a value is within given bounds. Specifically:
     * If value is less than lowerBound, return lowerBound; else if value is greater than upperBound,
     * return upperBound; else return value unchanged.
     */
    public static int boundToRange(int value, int lowerBound, int upperBound) {
        return Math.max(lowerBound, Math.min(value, upperBound));
    }
}
+14 −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 && inThresholdRegion() && 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 inThresholdRegion() {
        return (mLastMotionRawY / BlissLauncher.getApplication(getContext()).getDeviceProfile().availableHeightPx) > (float) 1 / 5;
    }

    void enableChildrenCache() {
        setChildrenDrawingCacheEnabled(true);
    }
@@ -539,6 +548,7 @@ public class HorizontalPager extends ViewGroup implements Insettable{
        setLayoutParams(lp);
        updateInsetsForChildren();
        this.insets = insets;
        postInvalidate();
    }

    private void updateInsetsForChildren() {
Loading