Merge "Show privacy chip in QQS" into sc-dev

This commit is contained in:
Fabian Kozynski
2021-05-04 18:27:38 +00:00
committed by Android (Google) Code Review
2 changed files with 37 additions and 6 deletions

View File

@@ -55,9 +55,13 @@ public class QuickStatusBarHeader extends FrameLayout {
private TouchAnimator mAlphaAnimator; private TouchAnimator mAlphaAnimator;
private TouchAnimator mTranslationAnimator; private TouchAnimator mTranslationAnimator;
private TouchAnimator mIconsAlphaAnimator;
private TouchAnimator mIconsAlphaAnimatorFixed;
protected QuickQSPanel mHeaderQsPanel; protected QuickQSPanel mHeaderQsPanel;
private View mDatePrivacyView; private View mDatePrivacyView;
private View mDateView;
private View mSecurityHeaderView;
private View mClockIconsView; private View mClockIconsView;
private View mContainer; private View mContainer;
@@ -66,7 +70,7 @@ public class QuickStatusBarHeader extends FrameLayout {
private Space mSpace; private Space mSpace;
private BatteryMeterView mBatteryRemainingIcon; private BatteryMeterView mBatteryRemainingIcon;
private StatusIconContainer mIconContainer; private StatusIconContainer mIconContainer;
private View mPrivacyChip;
private TintedIconManager mTintedIconManager; private TintedIconManager mTintedIconManager;
private QSExpansionPathInterpolator mQSExpansionPathInterpolator; private QSExpansionPathInterpolator mQSExpansionPathInterpolator;
@@ -79,7 +83,6 @@ public class QuickStatusBarHeader extends FrameLayout {
private int mCutOutPaddingLeft; private int mCutOutPaddingLeft;
private int mCutOutPaddingRight; private int mCutOutPaddingRight;
private float mClockIconsAlpha = 1.0f; private float mClockIconsAlpha = 1.0f;
private float mDatePrivacyAlpha = 1.0f;
private float mKeyguardExpansionFraction; private float mKeyguardExpansionFraction;
private int mTextColorPrimary = Color.TRANSPARENT; private int mTextColorPrimary = Color.TRANSPARENT;
private int mTopViewMeasureHeight; private int mTopViewMeasureHeight;
@@ -113,6 +116,9 @@ public class QuickStatusBarHeader extends FrameLayout {
mQSCarriers = findViewById(R.id.carrier_group); mQSCarriers = findViewById(R.id.carrier_group);
mContainer = findViewById(R.id.container); mContainer = findViewById(R.id.container);
mIconContainer = findViewById(R.id.statusIcons); mIconContainer = findViewById(R.id.statusIcons);
mPrivacyChip = findViewById(R.id.privacy_chip);
mDateView = findViewById(R.id.date);
mSecurityHeaderView = findViewById(R.id.header_text_container);
mClockView = findViewById(R.id.clock); mClockView = findViewById(R.id.clock);
mSpace = findViewById(R.id.space); mSpace = findViewById(R.id.space);
@@ -126,6 +132,11 @@ public class QuickStatusBarHeader extends FrameLayout {
// QS will always show the estimate, and BatteryMeterView handles the case where // QS will always show the estimate, and BatteryMeterView handles the case where
// it's unavailable or charging // it's unavailable or charging
mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE); mBatteryRemainingIcon.setPercentShowMode(BatteryMeterView.MODE_ESTIMATE);
mIconsAlphaAnimatorFixed = new TouchAnimator.Builder()
.addFloat(mIconContainer, "alpha", 0, 1)
.addFloat(mBatteryRemainingIcon, "alpha", 0, 1)
.build();
} }
void onAttach(TintedIconManager iconManager, void onAttach(TintedIconManager iconManager,
@@ -226,8 +237,12 @@ public class QuickStatusBarHeader extends FrameLayout {
StatusBarIconView callStrengthIcon = StatusBarIconView callStrengthIcon =
((StatusBarIconView) mIconContainer.getViewForSlot(mCallStrengthSlotName)); ((StatusBarIconView) mIconContainer.getViewForSlot(mCallStrengthSlotName));
TouchAnimator.Builder builder = new TouchAnimator.Builder() TouchAnimator.Builder builder = new TouchAnimator.Builder()
.addFloat(mQSCarriers, "alpha", 0, 1) // The following two views have to be hidden manually, so as not to hide the
.addFloat(mDatePrivacyView, "alpha", 0, mDatePrivacyAlpha); // Privacy chip in QQS
.addFloat(mDateView, "alpha", 0, 1)
.addFloat(mSecurityHeaderView, "alpha", 0, 1)
.addFloat(mQSCarriers, "alpha", 0, 1);
if (noCallingIcon != null || callStrengthIcon != null) { if (noCallingIcon != null || callStrengthIcon != null) {
if (noCallingIcon != null) { if (noCallingIcon != null) {
builder.addFloat(noCallingIcon, "alpha", 1, 0); builder.addFloat(noCallingIcon, "alpha", 1, 0);
@@ -259,6 +274,20 @@ public class QuickStatusBarHeader extends FrameLayout {
mAlphaAnimator = builder.build(); mAlphaAnimator = builder.build();
} }
void setChipVisibility(boolean visibility) {
mPrivacyChip.setVisibility(visibility ? View.VISIBLE : View.GONE);
if (visibility) {
// Animates the icons and battery indicator from alpha 0 to 1, when the chip is visible
mIconsAlphaAnimator = mIconsAlphaAnimatorFixed;
mIconsAlphaAnimator.setPosition(mKeyguardExpansionFraction);
} else {
mIconsAlphaAnimator = null;
mIconContainer.setAlpha(1);
mBatteryRemainingIcon.setAlpha(1);
}
}
/** */ /** */
public void setExpanded(boolean expanded, QuickQSPanelController quickQSPanelController) { public void setExpanded(boolean expanded, QuickQSPanelController quickQSPanelController) {
if (mExpanded == expanded) return; if (mExpanded == expanded) return;
@@ -285,6 +314,9 @@ public class QuickStatusBarHeader extends FrameLayout {
if (mTranslationAnimator != null) { if (mTranslationAnimator != null) {
mTranslationAnimator.setPosition(keyguardExpansionFraction); mTranslationAnimator.setPosition(keyguardExpansionFraction);
} }
if (mIconsAlphaAnimator != null) {
mIconsAlphaAnimator.setPosition(keyguardExpansionFraction);
}
// If forceExpanded (we are opening QS from lockscreen), the animators have been set to // If forceExpanded (we are opening QS from lockscreen), the animators have been set to
// position = 1f. // position = 1f.
if (forceExpanded) { if (forceExpanded) {

View File

@@ -225,7 +225,6 @@ class QuickStatusBarHeaderController extends ViewController<QuickStatusBarHeader
private void setChipVisibility(boolean chipVisible) { private void setChipVisibility(boolean chipVisible) {
if (chipVisible && getChipEnabled()) { if (chipVisible && getChipEnabled()) {
mPrivacyChip.setVisibility(View.VISIBLE);
mPrivacyLogger.logChipVisible(true); mPrivacyLogger.logChipVisible(true);
// Makes sure that the chip is logged as viewed at most once each time QS is opened // Makes sure that the chip is logged as viewed at most once each time QS is opened
// mListening makes sure that the callback didn't return after the user closed QS // mListening makes sure that the callback didn't return after the user closed QS
@@ -235,8 +234,8 @@ class QuickStatusBarHeaderController extends ViewController<QuickStatusBarHeader
} }
} else { } else {
mPrivacyLogger.logChipVisible(false); mPrivacyLogger.logChipVisible(false);
mPrivacyChip.setVisibility(View.GONE);
} }
mView.setChipVisibility(chipVisible);
} }
private List<String> getIgnoredIconSlots() { private List<String> getIgnoredIconSlots() {