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

Commit 7538580f authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Add PagedView to replace HorizontalPager

parent a3c09fee
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -177,4 +177,12 @@ public class Utilities {
        return defaultValue;
        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));
    }
}
}
+1595 −0

File added.

Preview size limit exceeded, changes collapsed.

+4 −0
Original line number Original line Diff line number Diff line
package foundation.e.blisslauncher.core.customviews;

public class Workspace {
}
+40 −0
Original line number Original line Diff line number Diff line
package foundation.e.blisslauncher.core.touch;

/**
 * Utility methods for overscroll damping and related effect.
 */
public class OverScroll {

    private static final float OVERSCROLL_DAMP_FACTOR = 0.07f;

    /**
     * This curve determines how the effect of scrolling over the limits of the page diminishes
     * as the user pulls further and further from the bounds
     *
     * @param f The percentage of how much the user has overscrolled.
     * @return A transformed percentage based on the influence curve.
     */
    private static float overScrollInfluenceCurve(float f) {
        f -= 1.0f;
        return f * f * f + 1.0f;
    }

    /**
     * @param amount The original amount overscrolled.
     * @param max The maximum amount that the View can overscroll.
     * @return The dampened overscroll amount.
     */
    public static int dampedScroll(float amount, int max) {
        if (Float.compare(amount, 0) == 0) return 0;

        float f = amount / max;
        f = f / (Math.abs(f)) * (overScrollInfluenceCurve(Math.abs(f)));

        // Clamp this factor, f, to -1 < f < 1
        if (Math.abs(f) >= 1) {
            f /= Math.abs(f);
        }

        return Math.round(OVERSCROLL_DAMP_FACTOR * f * max);
    }
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -167,4 +167,6 @@
    <string name="tap_to_setup_usageaccess">Tap to setup App Suggestions</string>
    <string name="tap_to_setup_usageaccess">Tap to setup App Suggestions</string>
    <string name="activity_not_found">App isn\'t installed</string>
    <string name="activity_not_found">App isn\'t installed</string>


    <string name="default_scroll_format">Page %1$d of %2$d</string>

</resources>
</resources>