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

Commit 55c6d4d2 authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez Committed by Android (Google) Code Review
Browse files

Merge "Making sure cached properties are updated set on configuration changes." into main

parents 63cd5a1e 8b864518
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
        }
    };

    private final int mFalsingThreshold;
    private int mFalsingThreshold;
    private boolean mTouchAboveFalsingThreshold;
    private boolean mDisableHwLayers;
    private final boolean mFadeDependingOnAmountSwiped;
@@ -149,8 +149,7 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
        // Extra long-press!
        mLongPressTimeout = (long) (ViewConfiguration.getLongPressTimeout() * 1.5f);

        mDensityScale =  resources.getDisplayMetrics().density;
        mFalsingThreshold = resources.getDimensionPixelSize(R.dimen.swipe_helper_falsing_threshold);
        updateResourceProperties(resources);
        mFadeDependingOnAmountSwiped = resources.getBoolean(
                R.bool.config_fadeDependingOnAmountSwiped);
        mFalsingManager = falsingManager;
@@ -165,6 +164,14 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
                getMaxEscapeAnimDuration() / 1000f);
    }

    /** Update ane properties that depend on Resources */
    public void updateResourceProperties(Resources resources) {
        float density = resources.getDisplayMetrics().density;
        setDensityScale(density);
        mCallback.onDensityScaleChange(density);
        mFalsingThreshold = resources.getDimensionPixelSize(R.dimen.swipe_helper_falsing_threshold);
    }

    public void setDensityScale(float densityScale) {
        mDensityScale = densityScale;
    }
@@ -1001,5 +1008,8 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
         * @return If true, the given view is draggable.
         */
        default boolean canChildBeDragged(@NonNull View animView) { return true; }

        /** The density scale has changed */
        void onDensityScaleChange(float density);
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -906,6 +906,7 @@ public class NotificationStackScrollLayout
        mOverflingDistance = configuration.getScaledOverflingDistance();

        Resources res = context.getResources();
        mSwipeHelper.updateResourceProperties(res);
        final boolean isSmallScreenLandscape = res.getBoolean(R.bool.is_small_screen_landscape);
        boolean useSmallLandscapeLockscreenResources = mIsSmallLandscapeLockscreenEnabled
                && isSmallScreenLandscape;
@@ -2083,8 +2084,6 @@ public class NotificationStackScrollLayout
        Resources res = getResources();
        updateSplitNotificationShade();
        mStatusBarHeight = SystemBarUtils.getStatusBarHeight(mContext);
        float densityScale = res.getDisplayMetrics().density;
        mSwipeHelper.setDensityScale(densityScale);
        float pagingTouchSlop = ViewConfiguration.get(getContext()).getScaledPagingTouchSlop();
        mSwipeHelper.setPagingTouchSlop(pagingTouchSlop);
        reinitView();
+0 −8
Original line number Diff line number Diff line
@@ -533,12 +533,6 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc
        mPulsing = pulsing;
    }

    @Override
    public void setDensityScale(float densityScale) {
        super.setDensityScale(densityScale);
        mCallback.onDensityScaleChange(densityScale);
    }

    @Override
    public void resetTouchState() {
        super.resetTouchState();
@@ -565,8 +559,6 @@ class NotificationSwipeHelper extends SwipeHelper implements NotificationSwipeAc
         */
        float getTotalTranslationLength(View animView);

        void onDensityScaleChange(float density);

        boolean handleSwipeableViewTranslation(SwipeableView view, float translate);

        // Reset any ongoing magnetic interactions