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

Commit 4ddc340f authored by Winson Chung's avatar Winson Chung
Browse files

Fixing crash when drawing prediction bar divider.

parent f7e85f85
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -396,6 +396,7 @@ public class AppsContainerView extends BaseContainerView implements DragSource,
                inset, 0, inset, 0);
        mContentView.setBackground(background);
        mAppsRecyclerView.updateBackgroundPadding(background);
        mAdapter.updateBackgroundPadding(background);
        getRevealView().setBackground(background.getConstantState().newDrawable());
    }

+12 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
@@ -112,9 +113,9 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {

                if (shouldDrawItemDivider(holder, items) && !hasDrawnPredictedAppsDivider) {
                    // Draw the divider under the predicted apps
                    parent.getBackground().getPadding(mTmpBounds);
                    int top = child.getTop() + child.getHeight();
                    c.drawLine(mTmpBounds.left, top, parent.getWidth() - mTmpBounds.right, top,
                    c.drawLine(mBackgroundPadding.left, top,
                            parent.getWidth() - mBackgroundPadding.right, top,
                            mPredictedAppsDividerPaint);
                    hasDrawnPredictedAppsDivider = true;

@@ -265,6 +266,7 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
    private View.OnTouchListener mTouchListener;
    private View.OnClickListener mIconClickListener;
    private View.OnLongClickListener mIconLongClickListener;
    @Thunk final Rect mBackgroundPadding = new Rect();
    @Thunk int mPredictionBarHeight;
    @Thunk int mAppsPerRow;
    @Thunk boolean mIsRtl;
@@ -340,6 +342,14 @@ class AppsGridAdapter extends RecyclerView.Adapter<AppsGridAdapter.ViewHolder> {
        mEmptySearchText = query;
    }

    /**
     * Notifies the adapter of the background padding so that it can draw things correctly in the
     * item decorator.
     */
    public void updateBackgroundPadding(Drawable background) {
        background.getPadding(mBackgroundPadding);
    }

    /**
     * Returns the grid layout manager.
     */