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

Commit 1336fbab authored by Caitlin Shkuratov's avatar Caitlin Shkuratov Committed by Android (Google) Code Review
Browse files

Merge changes Icbafc8bb,I8ae07863,I35823347,I9c50f3f0 into main

* changes:
  [SB][Screen Chips] Disable the old icons if flag is enabled.
  [SB][Screen Chips] Don't let the timers reset on theme change.
  [SB][Screen Chips] Show 3-2-1 countdown for screen record chip.
  [SB][Screen Chips] Use correct icon for share-to-app chip.
parents 98e260a9 c208c6e4
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@
            android:tint="?android:attr/colorPrimary"
        />

        <!-- Only one of [ongoing_activity_chip_time, ongoing_activity_chip_text] will ever
             be shown at one time. -->
        <com.android.systemui.statusbar.chips.ui.view.ChipChronometer
            android:id="@+id/ongoing_activity_chip_time"
            android:layout_width="wrap_content"
@@ -58,5 +60,19 @@
            android:textColor="?android:attr/colorPrimary"
        />

        <!-- Used to show generic text in the chip instead of a timer. -->
        <TextView
            android:id="@+id/ongoing_activity_chip_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:gravity="center|start"
            android:paddingStart="@dimen/ongoing_activity_chip_icon_text_padding"
            android:textAppearance="@android:style/TextAppearance.Material.Small"
            android:fontFamily="@*android:string/config_headlineFontFamily"
            android:textColor="?android:attr/colorPrimary"
            android:visibility="gone"
            />

    </com.android.systemui.statusbar.chips.ui.view.ChipBackgroundContainer>
</FrameLayout>
+10 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.common.ui.binder

import android.view.View
import android.widget.ImageView
import com.android.systemui.common.shared.model.Icon

@@ -30,4 +31,13 @@ object IconViewBinder {
            is Icon.Resource -> view.setImageResource(icon.res)
        }
    }

    fun bindNullable(icon: Icon?, view: ImageView) {
        if (icon != null) {
            view.visibility = View.VISIBLE
            bind(icon, view)
        } else {
            view.visibility = View.GONE
        }
    }
}
+4 −2
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import com.android.systemui.qs.pipeline.domain.interactor.PanelInteractor;
import com.android.systemui.qs.tileimpl.QSTileImpl;
import com.android.systemui.res.R;
import com.android.systemui.screenrecord.RecordingController;
import com.android.systemui.screenrecord.data.model.ScreenRecordModel;
import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.statusbar.phone.KeyguardDismissUtil;
import com.android.systemui.statusbar.policy.KeyguardStateController;
@@ -146,8 +147,9 @@ public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState>
        if (isRecording) {
            state.secondaryLabel = mContext.getString(R.string.quick_settings_screen_record_stop);
        } else if (isStarting) {
            // round, since the timer isn't exact
            int countdown = (int) Math.floorDiv(mMillisUntilFinished + 500, 1000);
            int countdown =
                    (int) ScreenRecordModel.Starting.Companion.toCountdownSeconds(
                            mMillisUntilFinished);
            state.secondaryLabel = String.format("%d...", countdown);
        } else {
            state.secondaryLabel = mContext.getString(R.string.quick_settings_screen_record_start);
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ constructor(
                            contentDescription = null
                        )
                    icon = { loadedIcon }
                    val countDown = Math.floorDiv(data.millisUntilStarted + 500, 1000)
                    val countDown = data.countdownSeconds
                    sideViewIcon = QSTileState.SideViewIcon.None
                    secondaryLabel = String.format("%d...", countDown)
                }
+11 −1
Original line number Diff line number Diff line
@@ -22,7 +22,17 @@ sealed interface ScreenRecordModel {
    data object Recording : ScreenRecordModel

    /** A screen recording will begin in [millisUntilStarted] ms. */
    data class Starting(val millisUntilStarted: Long) : ScreenRecordModel
    data class Starting(val millisUntilStarted: Long) : ScreenRecordModel {
        val countdownSeconds = millisUntilStarted.toCountdownSeconds()

        companion object {
            /**
             * Returns the number of seconds until screen recording will start, used to show a 3-2-1
             * countdown.
             */
            fun Long.toCountdownSeconds() = Math.floorDiv(this + 500, 1000)
        }
    }

    /** There's nothing related to screen recording happening. */
    data object DoingNothing : ScreenRecordModel
Loading