From dce238b63f0e6616ea2e03cc80dea8874dbb3e48 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Wed, 15 Jul 2020 11:55:48 -0400 Subject: [PATCH] Make the build text in QS marquee The text marquees only when visible. Test: manual Test: manual check that it's not announced prematurely Fixes: 158410766 Change-Id: Iede2b8d20de4f87f6bbc95f228376bb5bf488a9e --- .../SystemUI/res/layout/qs_footer_impl.xml | 2 +- .../com/android/systemui/qs/QSFooterImpl.java | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/res/layout/qs_footer_impl.xml b/packages/SystemUI/res/layout/qs_footer_impl.xml index 5c00af5705e99..436188a83d4f1 100644 --- a/packages/SystemUI/res/layout/qs_footer_impl.xml +++ b/packages/SystemUI/res/layout/qs_footer_impl.xml @@ -62,7 +62,7 @@ android:gravity="center_vertical" android:focusable="true" android:singleLine="true" - android:ellipsize="end" + android:ellipsize="marquee" android:textAppearance="@style/TextAppearance.QS.Status" android:layout_marginEnd="4dp" android:visibility="gone"/> diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java index c4bb4e86e41e4..6e4ab9a3323a9 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSFooterImpl.java @@ -78,6 +78,8 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, private SettingsButton mSettingsButton; protected View mSettingsContainer; private PageIndicator mPageIndicator; + private TextView mBuildText; + private boolean mShouldShowBuildText; private boolean mQsDisabled; private QSPanel mQsPanel; @@ -147,6 +149,7 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, mActionsContainer = findViewById(R.id.qs_footer_actions_container); mEditContainer = findViewById(R.id.qs_footer_actions_edit_container); + mBuildText = findViewById(R.id.build); // RenderThread is doing more harm than good when touching the header (to expand quick // settings), so disable it for this view @@ -162,16 +165,19 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, } private void setBuildText() { - TextView v = findViewById(R.id.build); - if (v == null) return; + if (mBuildText == null) return; if (DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)) { - v.setText(mContext.getString( + mBuildText.setText(mContext.getString( com.android.internal.R.string.bugreport_status, Build.VERSION.RELEASE_OR_CODENAME, Build.ID)); - v.setVisibility(View.VISIBLE); + // Set as selected for marquee before its made visible, then it won't be announced when + // it's made visible. + mBuildText.setSelected(true); + mShouldShowBuildText = true; } else { - v.setVisibility(View.GONE); + mShouldShowBuildText = false; + mBuildText.setSelected(false); } } @@ -321,6 +327,8 @@ public class QSFooterImpl extends FrameLayout implements QSFooter, mMultiUserSwitch.setVisibility(showUserSwitcher() ? View.VISIBLE : View.INVISIBLE); mEditContainer.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE); mSettingsButton.setVisibility(isDemo || !mExpanded ? View.INVISIBLE : View.VISIBLE); + + mBuildText.setVisibility(mExpanded && mShouldShowBuildText ? View.VISIBLE : View.GONE); } private boolean showUserSwitcher() {