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

Commit 70617d9c authored by Rohan Shah's avatar Rohan Shah Committed by android-build-merger
Browse files

Merge "[QS] Fix alarm text in QS header" into pi-dev am: df59556a

am: ccd43fde

Change-Id: Ib60d327476a46dc4fced91e1339b032739ac3977
parents e6f94296 ccd43fde
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -61,6 +62,8 @@ import java.util.Locale;
 */
public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue.Callbacks,
        View.OnClickListener, NextAlarmController.NextAlarmChangeCallback {
    private static final String TAG = "QuickStatusBarHeader";
    private static final boolean DEBUG = false;

    /** Delay for auto fading out the long press tooltip after it's fully visible (in ms). */
    private static final long AUTO_FADE_OUT_DELAY_MS = DateUtils.SECOND_IN_MILLIS * 6;
@@ -293,6 +296,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue
    @Override
    public void onNextAlarmChanged(AlarmManager.AlarmClockInfo nextAlarm) {
        mNextAlarmText = nextAlarm != null ? formatNextAlarm(nextAlarm) : null;

        if (mNextAlarmText != null) {
            hideLongPressTooltip(true /* shouldFadeInAlarmText */);
        } else {
@@ -352,6 +356,7 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue
                    .setListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            if (DEBUG) Log.d(TAG, "hideLongPressTooltip: Hid long press tip");
                            mLongPressTooltipView.setVisibility(View.INVISIBLE);

                            if (shouldShowAlarmText) {
@@ -362,7 +367,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue
                    .start();
        } else {
            mLongPressTooltipView.setVisibility(View.INVISIBLE);

            if (shouldShowAlarmText) {
                showAlarmText();
            }
@@ -378,9 +382,11 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue
        mNextAlarmView.setVisibility(View.VISIBLE);
        mNextAlarmTextView.setText(mNextAlarmText);

        // Animate the alarm back in. Make sure to clear the animator listener for the animation!
        mNextAlarmView.animate()
                .alpha(1f)
                .setDuration(FADE_ANIMATION_DURATION_MS)
                .setListener(null)
                .start();
    }

@@ -395,6 +401,8 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue
                    .setListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            if (DEBUG) Log.d(TAG, "hideAlarmText: Hid alarm text");

                            // Reset the alpha regardless of how the animation ends for the next
                            // time we show this view/want to animate it.
                            mNextAlarmView.setVisibility(View.INVISIBLE);