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

Commit 908fb571 authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

Merge changes I66f2c52b,I95f72c9d into oc-dr1-dev

am: 68e45991

Change-Id: Id7fc79cb3aa02889c73efa27f0db9262c3ea7c12
parents 8a9769d6 68e45991
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -26,8 +26,9 @@
               android:layout_gravity="top|end"
               android:layout_gravity="top|end"
               android:layout_marginTop="36dp"
               android:layout_marginTop="36dp"
               android:layout_marginEnd="@dimen/notification_content_margin_end"
               android:layout_marginEnd="@dimen/notification_content_margin_end"
               android:scaleType="centerCrop"/>
               android:scaleType="centerCrop"
    <ImageView android:id="@+id/reply_icon_action"
               android:importantForAccessibility="no" />
    <ImageButton android:id="@+id/reply_icon_action"
               android:layout_width="16dp"
               android:layout_width="16dp"
               android:layout_height="16dp"
               android:layout_height="16dp"
               android:layout_gravity="top|end"
               android:layout_gravity="top|end"
@@ -36,6 +37,7 @@
               android:background="@drawable/notification_reply_background"
               android:background="@drawable/notification_reply_background"
               android:src="@drawable/ic_reply_notification"
               android:src="@drawable/ic_reply_notification"
               android:scaleType="center"
               android:scaleType="center"
               android:contentDescription="@string/notification_reply_button_accessibility"
               visiblity="gone"/>
               visiblity="gone"/>
</FrameLayout>
</FrameLayout>
+3 −0
Original line number Original line Diff line number Diff line
@@ -4713,6 +4713,9 @@
    <!-- Primary ETWS (Earthquake and Tsunami Warning System) default message for test -->
    <!-- Primary ETWS (Earthquake and Tsunami Warning System) default message for test -->
    <string name="etws_primary_default_message_test">Emergency messages test</string>
    <string name="etws_primary_default_message_test">Emergency messages test</string>


    <!-- Content description for the reply button in the notification area [CHAR LIMIT=NONE]-->
    <string name="notification_reply_button_accessibility">Reply</string>

    <!-- Primary ETWS (Earthquake and Tsunami Warning System) default message for others -->
    <!-- Primary ETWS (Earthquake and Tsunami Warning System) default message for others -->
    <string name="etws_primary_default_message_others"></string>
    <string name="etws_primary_default_message_others"></string>


+60 −8
Original line number Original line Diff line number Diff line
@@ -16,15 +16,18 @@


package com.android.systemui.statusbar;
package com.android.systemui.statusbar;


import static com.android.systemui.statusbar.phone.NotificationIconContainer.IconState.NO_VALUE;
import static com.android.systemui.statusbar.phone.NotificationIconContainer.OVERFLOW_EARLY_AMOUNT;

import android.content.Context;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.Resources;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeInfo;

import com.android.systemui.Interpolators;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.ViewInvertHelper;
import com.android.systemui.ViewInvertHelper;
@@ -315,26 +318,65 @@ public class NotificationShelf extends ActivatableNotificationView implements
    private float updateIconAppearance(ExpandableNotificationRow row, float expandAmount,
    private float updateIconAppearance(ExpandableNotificationRow row, float expandAmount,
            boolean scrolling, boolean scrollingFast, boolean expandingAnimated,
            boolean scrolling, boolean scrollingFast, boolean expandingAnimated,
            boolean isLastChild) {
            boolean isLastChild) {
        StatusBarIconView icon = row.getEntry().expandedIcon;
        NotificationIconContainer.IconState iconState = getIconState(icon);
        if (iconState == null) {
            return 0.0f;
        }

        // Let calculate how much the view is in the shelf
        // Let calculate how much the view is in the shelf
        float viewStart = row.getTranslationY();
        float viewStart = row.getTranslationY();
        int fullHeight = row.getActualHeight() + mPaddingBetweenElements;
        int fullHeight = row.getActualHeight() + mPaddingBetweenElements;
        float iconTransformDistance = getIntrinsicHeight() * 1.5f;
        float iconTransformDistance = getIntrinsicHeight() * 1.5f;
        iconTransformDistance *= NotificationUtils.interpolate(1.f, 1.5f, expandAmount);
        iconTransformDistance *= NotificationUtils.interpolate(1.f, 1.5f, expandAmount);
        iconTransformDistance = Math.min(iconTransformDistance, fullHeight);
        if (isLastChild) {
        if (isLastChild) {
            fullHeight = Math.min(fullHeight, row.getMinHeight() - getIntrinsicHeight());
            fullHeight = Math.min(fullHeight, row.getMinHeight() - getIntrinsicHeight());
            iconTransformDistance = Math.min(iconTransformDistance, row.getMinHeight()
            iconTransformDistance = Math.min(iconTransformDistance, row.getMinHeight()
                    - getIntrinsicHeight());
                    - getIntrinsicHeight());
        }
        }
        float viewEnd = viewStart + fullHeight;
        float viewEnd = viewStart + fullHeight;
        if (expandingAnimated && mAmbientState.getScrollY() == 0
                && !mAmbientState.isOnKeyguard() && !iconState.isLastExpandIcon) {
            // We are expanding animated. Because we switch to a linear interpolation in this case,
            // the last icon may be stuck in between the shelf position and the notification
            // position, which looks pretty bad. We therefore optimize this case by applying a
            // shorter transition such that the icon is either fully in the notification or we clamp
            // it into the shelf if it's close enough.
            // We need to persist this, since after the expansion, the behavior should still be the
            // same.
            float position = mAmbientState.getIntrinsicPadding()
                    + mHostLayout.getPositionInLinearLayout(row);
            int maxShelfStart = mMaxLayoutHeight - getIntrinsicHeight();
            if (position < maxShelfStart && position + row.getIntrinsicHeight() >= maxShelfStart
                    && row.getTranslationY() < position) {
                iconState.isLastExpandIcon = true;
                iconState.customTransformHeight = NO_VALUE;
                // Let's check if we're close enough to snap into the shelf
                boolean forceInShelf = mMaxLayoutHeight - getIntrinsicHeight() - position
                        < getIntrinsicHeight();
                if (!forceInShelf) {
                    // We are overlapping the shelf but not enough, so the icon needs to be
                    // repositioned
                    iconState.customTransformHeight = (int) (mMaxLayoutHeight
                            - getIntrinsicHeight() - position);
                }
            }
        }
        float fullTransitionAmount;
        float fullTransitionAmount;
        float iconTransitionAmount;
        float iconTransitionAmount;
        float shelfStart = getTranslationY();
        float shelfStart = getTranslationY();
        if (iconState.hasCustomTransformHeight()) {
            fullHeight = iconState.customTransformHeight;
            iconTransformDistance = iconState.customTransformHeight;
        }
        boolean fullyInOrOut = true;
        if (viewEnd >= shelfStart && (!mAmbientState.isUnlockHintRunning() || row.isInShelf())
        if (viewEnd >= shelfStart && (!mAmbientState.isUnlockHintRunning() || row.isInShelf())
                && (mAmbientState.isShadeExpanded()
                && (mAmbientState.isShadeExpanded()
                        || (!row.isPinned() && !row.isHeadsUpAnimatingAway()))) {
                        || (!row.isPinned() && !row.isHeadsUpAnimatingAway()))) {
            if (viewStart < shelfStart) {
            if (viewStart < shelfStart) {

                float fullAmount = (shelfStart - viewStart) / fullHeight;
                float fullAmount = (shelfStart - viewStart) / fullHeight;
                fullAmount = Math.min(1.0f, fullAmount);
                float interpolatedAmount =  Interpolators.ACCELERATE_DECELERATE.getInterpolation(
                float interpolatedAmount =  Interpolators.ACCELERATE_DECELERATE.getInterpolation(
                        fullAmount);
                        fullAmount);
                interpolatedAmount = NotificationUtils.interpolate(
                interpolatedAmount = NotificationUtils.interpolate(
@@ -344,7 +386,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
                iconTransitionAmount = (shelfStart - viewStart) / iconTransformDistance;
                iconTransitionAmount = (shelfStart - viewStart) / iconTransformDistance;
                iconTransitionAmount = Math.min(1.0f, iconTransitionAmount);
                iconTransitionAmount = Math.min(1.0f, iconTransitionAmount);
                iconTransitionAmount = 1.0f - iconTransitionAmount;
                iconTransitionAmount = 1.0f - iconTransitionAmount;

                fullyInOrOut = false;
            } else {
            } else {
                fullTransitionAmount = 1.0f;
                fullTransitionAmount = 1.0f;
                iconTransitionAmount = 1.0f;
                iconTransitionAmount = 1.0f;
@@ -353,6 +395,10 @@ public class NotificationShelf extends ActivatableNotificationView implements
            fullTransitionAmount = 0.0f;
            fullTransitionAmount = 0.0f;
            iconTransitionAmount = 0.0f;
            iconTransitionAmount = 0.0f;
        }
        }
        if (fullyInOrOut && !expandingAnimated && iconState.isLastExpandIcon) {
            iconState.isLastExpandIcon = false;
            iconState.customTransformHeight = NO_VALUE;
        }
        updateIconPositioning(row, iconTransitionAmount, fullTransitionAmount,
        updateIconPositioning(row, iconTransitionAmount, fullTransitionAmount,
                iconTransformDistance, scrolling, scrollingFast, expandingAnimated, isLastChild);
                iconTransformDistance, scrolling, scrollingFast, expandingAnimated, isLastChild);
        return fullTransitionAmount;
        return fullTransitionAmount;
@@ -366,9 +412,10 @@ public class NotificationShelf extends ActivatableNotificationView implements
        if (iconState == null) {
        if (iconState == null) {
            return;
            return;
        }
        }
        boolean forceInShelf = iconState.isLastExpandIcon && !iconState.hasCustomTransformHeight();
        float clampedAmount = iconTransitionAmount > 0.5f ? 1.0f : 0.0f;
        float clampedAmount = iconTransitionAmount > 0.5f ? 1.0f : 0.0f;
        if (clampedAmount == fullTransitionAmount) {
        if (clampedAmount == fullTransitionAmount) {
            iconState.noAnimations = scrollingFast || expandingAnimated;
            iconState.noAnimations = (scrollingFast || expandingAnimated) && !forceInShelf;
            iconState.useFullTransitionAmount = iconState.noAnimations
            iconState.useFullTransitionAmount = iconState.noAnimations
                || (!ICON_ANMATIONS_WHILE_SCROLLING && fullTransitionAmount == 0.0f && scrolling);
                || (!ICON_ANMATIONS_WHILE_SCROLLING && fullTransitionAmount == 0.0f && scrolling);
            iconState.useLinearTransitionAmount = !ICON_ANMATIONS_WHILE_SCROLLING
            iconState.useLinearTransitionAmount = !ICON_ANMATIONS_WHILE_SCROLLING
@@ -376,12 +423,18 @@ public class NotificationShelf extends ActivatableNotificationView implements
            iconState.translateContent = mMaxLayoutHeight - getTranslationY()
            iconState.translateContent = mMaxLayoutHeight - getTranslationY()
                    - getIntrinsicHeight() > 0;
                    - getIntrinsicHeight() > 0;
        }
        }
        if (scrollingFast || (expandingAnimated && iconState.useFullTransitionAmount
        if (!forceInShelf && (scrollingFast || (expandingAnimated
                && !ViewState.isAnimatingY(icon))) {
                && iconState.useFullTransitionAmount && !ViewState.isAnimatingY(icon)))) {
            iconState.cancelAnimations(icon);
            iconState.cancelAnimations(icon);
            iconState.useFullTransitionAmount = true;
            iconState.useFullTransitionAmount = true;
            iconState.noAnimations = true;
            iconState.noAnimations = true;
        }
        }
        if (iconState.hasCustomTransformHeight()) {
            iconState.useFullTransitionAmount = true;
        }
        if (iconState.isLastExpandIcon) {
            iconState.translateContent = false;
        }
        float transitionAmount;
        float transitionAmount;
        if (isLastChild || !USE_ANIMATIONS_WHEN_OPENING || iconState.useFullTransitionAmount
        if (isLastChild || !USE_ANIMATIONS_WHEN_OPENING || iconState.useFullTransitionAmount
                || iconState.useLinearTransitionAmount) {
                || iconState.useLinearTransitionAmount) {
@@ -548,8 +601,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
        if (!hasOverflow) {
        if (!hasOverflow) {
            // we have to ensure that adding the low priority notification won't lead to an
            // we have to ensure that adding the low priority notification won't lead to an
            // overflow
            // overflow
            collapsedPadding -= (1.0f + NotificationIconContainer.OVERFLOW_EARLY_AMOUNT)
            collapsedPadding -= (1.0f + OVERFLOW_EARLY_AMOUNT) * mCollapsedIcons.getIconSize();
                    * mCollapsedIcons.getIconSize();
        }
        }
        float padding = NotificationUtils.interpolate(collapsedPadding,
        float padding = NotificationUtils.interpolate(collapsedPadding,
                mShelfIcons.getPaddingEnd(),
                mShelfIcons.getPaddingEnd(),
+7 −0
Original line number Original line Diff line number Diff line
@@ -526,6 +526,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
    }
    }


    public class IconState extends ViewState {
    public class IconState extends ViewState {
        public static final int NO_VALUE = NotificationIconContainer.NO_VALUE;
        public float iconAppearAmount = 1.0f;
        public float iconAppearAmount = 1.0f;
        public float clampedAppearAmount = 1.0f;
        public float clampedAppearAmount = 1.0f;
        public int visibleState;
        public int visibleState;
@@ -538,6 +539,8 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
        public boolean justUndarkened;
        public boolean justUndarkened;
        public int iconColor = StatusBarIconView.NO_COLOR;
        public int iconColor = StatusBarIconView.NO_COLOR;
        public boolean noAnimations;
        public boolean noAnimations;
        public boolean isLastExpandIcon;
        public int customTransformHeight = NO_VALUE;


        @Override
        @Override
        public void applyToView(View view) {
        public void applyToView(View view) {
@@ -615,6 +618,10 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout {
            justUndarkened = false;
            justUndarkened = false;
        }
        }


        public boolean hasCustomTransformHeight() {
            return isLastExpandIcon && customTransformHeight != NO_VALUE;
        }

        @Override
        @Override
        public void initFrom(View view) {
        public void initFrom(View view) {
            super.initFrom(view);
            super.initFrom(view);
+9 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@ public class AmbientState {
    private boolean mHasPulsingNotifications;
    private boolean mHasPulsingNotifications;
    private boolean mUnlockHintRunning;
    private boolean mUnlockHintRunning;
    private boolean mQsCustomizerShowing;
    private boolean mQsCustomizerShowing;
    private int mIntrinsicPadding;


    public AmbientState(Context context) {
    public AmbientState(Context context) {
        reload(context);
        reload(context);
@@ -323,4 +324,12 @@ public class AmbientState {
    public void setQsCustomizerShowing(boolean qsCustomizerShowing) {
    public void setQsCustomizerShowing(boolean qsCustomizerShowing) {
        mQsCustomizerShowing = qsCustomizerShowing;
        mQsCustomizerShowing = qsCustomizerShowing;
    }
    }

    public void setIntrinsicPadding(int intrinsicPadding) {
        mIntrinsicPadding = intrinsicPadding;
    }

    public int getIntrinsicPadding() {
        return mIntrinsicPadding;
    }
}
}
Loading