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

Commit df59556a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 0cee663b a160ab18
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.TextView;
@@ -61,6 +62,8 @@ import java.util.Locale;
 */
 */
public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue.Callbacks,
public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue.Callbacks,
        View.OnClickListener, NextAlarmController.NextAlarmChangeCallback {
        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). */
    /** 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;
    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
    @Override
    public void onNextAlarmChanged(AlarmManager.AlarmClockInfo nextAlarm) {
    public void onNextAlarmChanged(AlarmManager.AlarmClockInfo nextAlarm) {
        mNextAlarmText = nextAlarm != null ? formatNextAlarm(nextAlarm) : null;
        mNextAlarmText = nextAlarm != null ? formatNextAlarm(nextAlarm) : null;

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


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

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


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


@@ -395,6 +401,8 @@ public class QuickStatusBarHeader extends RelativeLayout implements CommandQueue
                    .setListener(new AnimatorListenerAdapter() {
                    .setListener(new AnimatorListenerAdapter() {
                        @Override
                        @Override
                        public void onAnimationEnd(Animator animation) {
                        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
                            // Reset the alpha regardless of how the animation ends for the next
                            // time we show this view/want to animate it.
                            // time we show this view/want to animate it.
                            mNextAlarmView.setVisibility(View.INVISIBLE);
                            mNextAlarmView.setVisibility(View.INVISIBLE);