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

Commit 160ab1a2 authored by Amit Kumar's avatar Amit Kumar 💻
Browse files

Add more quickstep related code

parent 0dc03860
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -95,6 +95,8 @@ android {
            res.srcDirs = ['src/apiOreo/res']
        }
    }

    addFrameworkJar('framework.jar')
}

dependencies {
@@ -103,7 +105,7 @@ dependencies {
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
    implementation files('libs/sysui_shared.jar')

    compileOnly files('libs/framework.jar')
    apiNougatImplementation 'org.cyanogenmod:platform.sdk:6.0'
    apiOreoImplementation files('libs/lineage-sdk-oreo.jar')

app/libs/framework.jar

0 → 100644
+29.8 MiB

File added.

No diff preview for this file type.

+27 −0
Original line number Diff line number Diff line
@@ -13,9 +13,12 @@ import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
@@ -69,6 +72,8 @@ public class Utilities {
    public static final boolean ATLEAST_MARSHMALLOW =
        Build.VERSION.SDK_INT >= 23;

    public static final int SINGLE_FRAME_MS = 16;

    // These values are same as that in {@link AsyncTask}.
    private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
    private static final int CORE_POOL_SIZE = CPU_COUNT + 1;
@@ -398,4 +403,26 @@ public class Utilities {
            throw new RuntimeException(e);
        }
    }

    public static void scaleRectFAboutCenter(RectF r, float scale) {
        if (scale != 1.0f) {
            float cx = r.centerX();
            float cy = r.centerY();
            r.offset(-cx, -cy);
            r.left = r.left * scale;
            r.top = r.top * scale ;
            r.right = r.right * scale;
            r.bottom = r.bottom * scale;
            r.offset(cx, cy);
        }
    }

    /**
     * Utility method to post a runnable on the handler, skipping the synchronization barriers.
     */
    public static void postAsyncCallback(Handler handler, Runnable callback) {
        Message msg = Message.obtain(handler, callback);
        msg.setAsynchronous(true);
        handler.sendMessage(msg);
    }
}
+12 −0
Original line number Diff line number Diff line
@@ -15,6 +15,18 @@ open class InsettableFrameLayout(private val mContext: Context, attrs: Attribute

    var windowInsets: WindowInsets? = null

    val insets: Rect
        get() {
            var tempInsets = Rect()
            if (this.windowInsets != null) {
                tempInsets.left = this.windowInsets!!.systemWindowInsetLeft
                tempInsets.top = this.windowInsets!!.systemWindowInsetTop
                tempInsets.right = this.windowInsets!!.systemWindowInsetRight
                tempInsets.bottom = this.windowInsets!!.systemWindowInsetBottom
            }
            return tempInsets
        }

    private fun setFrameLayoutChildInsets(child: View, newInsets: WindowInsets?, oldInsets: Rect) {
        if (newInsets == null) return
        val lp: LayoutParams =
+19 −2
Original line number Diff line number Diff line
@@ -576,7 +576,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
        final int scrollOffsetRight = getWidth() - getPaddingRight() - mInsets.right;
        boolean pageScrollChanged = false;

        for (int i = startIndex, childLeft = scrollOffsetLeft; i != endIndex; i += delta) {
        for (int i = startIndex, childLeft = scrollOffsetLeft + offsetForPageScrolls(); i != endIndex; i += delta) {
            final View child = getPageAt(i);
            if (scrollLogic.shouldIncludeView(child)) {
                final int childWidth = child.getMeasuredWidth();
@@ -654,6 +654,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
        return getPageAt(index).getLeft();
    }

    protected int offsetForPageScrolls() {
        return 0;
    }

    @Override
    public boolean requestChildRectangleOnScreen(View child, Rect rectangle, boolean immediate) {
        int page = indexToPage(indexOfChild(child));
@@ -1016,6 +1020,10 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
        mAllowOverScroll = enable;
    }

    protected void restoreScrollOnLayout() {
        setCurrentPage(getNextPage());
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        super.onTouchEvent(ev);
@@ -1398,7 +1406,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
        return snapToPage(whichPage, duration, false);
    }

    protected boolean snapToPage(int whichPage, int duration, boolean immediate) {
    public boolean snapToPage(int whichPage, int duration, boolean immediate) {
        whichPage = validateNewPage(whichPage);

        int newX = getScrollForPage(whichPage);
@@ -1477,6 +1485,15 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
        return mDownMotionY;
    }

    protected boolean isPageOrderFlipped() {
        return false;
    }

    protected String getCurrentPageDescription() {
        return getContext().getString(R.string.default_scroll_format,
            getNextPage() + 1, getChildCount());
    }

    protected interface ComputePageScrollsLogic {

        boolean shouldIncludeView(View view);
Loading