Merge "Remove QS initial tooltip" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9aa53da1be
@@ -22,17 +22,6 @@
|
||||
android:paddingStart="@dimen/status_bar_padding_start"
|
||||
android:paddingEnd="@dimen/status_bar_padding_end">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/long_press_tooltip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:alpha="0"
|
||||
android:text="@string/quick_settings_header_onboarding_text"
|
||||
android:textAppearance="@style/TextAppearance.QS.TileLabel"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
@@ -45,8 +34,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start|center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:alpha="0" >
|
||||
android:gravity="center_vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id = "@+id/alarm_container"
|
||||
|
||||
@@ -18,8 +18,6 @@ import static android.app.StatusBarManager.DISABLE2_QUICK_SETTINGS;
|
||||
|
||||
import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.annotation.ColorInt;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlarmManager;
|
||||
@@ -39,7 +37,6 @@ import android.provider.Settings;
|
||||
import android.service.notification.ZenModeConfig;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.util.StatsLog;
|
||||
import android.view.DisplayCutout;
|
||||
@@ -56,7 +53,6 @@ import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.BatteryMeterView;
|
||||
import com.android.systemui.Prefs;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.plugins.DarkIconDispatcher;
|
||||
@@ -123,10 +119,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
private View mSystemIconsView;
|
||||
private View mQuickQsStatusIcons;
|
||||
private View mHeaderTextContainerView;
|
||||
/** View containing the next alarm and ringer mode info. */
|
||||
private View mStatusContainer;
|
||||
/** Tooltip for educating users that they can long press on icons to see more details. */
|
||||
private View mLongPressTooltipView;
|
||||
|
||||
private int mRingerMode = AudioManager.RINGER_MODE_NORMAL;
|
||||
private AlarmManager.AlarmClockInfo mNextAlarm;
|
||||
@@ -146,8 +138,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
private BatteryMeterView mBatteryRemainingIcon;
|
||||
|
||||
private PrivacyItemController mPrivacyItemController;
|
||||
/** Counts how many times the long press tooltip has been shown to the user. */
|
||||
private int mShownCount;
|
||||
|
||||
private final BroadcastReceiver mRingerReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
@@ -159,11 +149,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
private boolean mHasTopCutout = false;
|
||||
private boolean mPrivacyChipLogged = false;
|
||||
|
||||
/**
|
||||
* Runnable for automatically fading out the long press tooltip (as if it were animating away).
|
||||
*/
|
||||
private final Runnable mAutoFadeOutTooltipRunnable = () -> hideLongPressTooltip(false);
|
||||
|
||||
private PrivacyItemController.Callback mPICCallback = new PrivacyItemController.Callback() {
|
||||
@Override
|
||||
public void privacyChanged(List<PrivacyItem> privacyItems) {
|
||||
@@ -183,7 +168,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
mStatusBarIconController = statusBarIconController;
|
||||
mActivityStarter = activityStarter;
|
||||
mPrivacyItemController = privacyItemController;
|
||||
mShownCount = getStoredShownCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,10 +183,8 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
iconContainer.setShouldRestrictIcons(false);
|
||||
mIconManager = new TintedIconManager(iconContainer);
|
||||
|
||||
// Views corresponding to the header info section (e.g. tooltip and next alarm).
|
||||
// Views corresponding to the header info section (e.g. ringer and next alarm).
|
||||
mHeaderTextContainerView = findViewById(R.id.header_text_container);
|
||||
mLongPressTooltipView = findViewById(R.id.long_press_tooltip);
|
||||
mStatusContainer = findViewById(R.id.status_container);
|
||||
mStatusSeparator = findViewById(R.id.status_separator);
|
||||
mNextAlarmIcon = findViewById(R.id.next_alarm_icon);
|
||||
mNextAlarmTextView = findViewById(R.id.next_alarm_text);
|
||||
@@ -267,7 +249,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
boolean ringerVisible = mRingerModeTextView.getVisibility() == View.VISIBLE;
|
||||
mStatusSeparator.setVisibility(alarmVisible && ringerVisible ? View.VISIBLE
|
||||
: View.GONE);
|
||||
updateTooltipShow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,8 +332,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
mClockView.useWallpaperTextColor(shouldUseWallpaperTextColor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onRtlPropertiesChanged(int layoutDirection) {
|
||||
super.onRtlPropertiesChanged(layoutDirection);
|
||||
@@ -457,21 +436,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
mPrivacyChip.setExpanded(expansionFraction > 0.5);
|
||||
mPrivacyChipAlphaAnimator.setPosition(keyguardExpansionFraction);
|
||||
}
|
||||
|
||||
// Check the original expansion fraction - we don't want to show the tooltip until the
|
||||
// panel is pulled all the way out.
|
||||
if (expansionFraction == 1f) {
|
||||
// QS is fully expanded, bring in the tooltip.
|
||||
showLongPressTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns the latest stored tooltip shown count from SharedPreferences. */
|
||||
private int getStoredShownCount() {
|
||||
return Prefs.getInt(
|
||||
mContext,
|
||||
Prefs.Key.QS_LONG_PRESS_TOOLTIP_SHOWN_COUNT,
|
||||
TOOLTIP_NOT_YET_SHOWN_COUNT);
|
||||
}
|
||||
|
||||
public void disable(int state1, int state2, boolean animate) {
|
||||
@@ -592,109 +556,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements
|
||||
updateStatusText();
|
||||
}
|
||||
|
||||
private void updateTooltipShow() {
|
||||
if (hasStatusText()) {
|
||||
hideLongPressTooltip(true /* shouldShowStatusText */);
|
||||
} else {
|
||||
hideStatusText();
|
||||
}
|
||||
updateHeaderTextContainerAlphaAnimator();
|
||||
}
|
||||
|
||||
private boolean hasStatusText() {
|
||||
return mNextAlarmTextView.getVisibility() == View.VISIBLE
|
||||
|| mRingerModeTextView.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Animates in the long press tooltip (as long as the next alarm text isn't currently occupying
|
||||
* the space).
|
||||
*/
|
||||
public void showLongPressTooltip() {
|
||||
// If we have status text to show, don't bother fading in the tooltip.
|
||||
if (hasStatusText()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mShownCount < MAX_TOOLTIP_SHOWN_COUNT) {
|
||||
mLongPressTooltipView.animate().cancel();
|
||||
mLongPressTooltipView.setVisibility(View.VISIBLE);
|
||||
mLongPressTooltipView.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(FADE_ANIMATION_DURATION_MS)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mHandler.postDelayed(
|
||||
mAutoFadeOutTooltipRunnable, AUTO_FADE_OUT_DELAY_MS);
|
||||
}
|
||||
})
|
||||
.start();
|
||||
|
||||
// Increment and drop the shown count in prefs for the next time we're deciding to
|
||||
// fade in the tooltip. We first sanity check that the tooltip count hasn't changed yet
|
||||
// in prefs (say, from a long press).
|
||||
if (getStoredShownCount() <= mShownCount) {
|
||||
Prefs.putInt(mContext, Prefs.Key.QS_LONG_PRESS_TOOLTIP_SHOWN_COUNT, ++mShownCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fades out the long press tooltip if it's partially visible - short circuits any running
|
||||
* animation. Additionally has the ability to fade in the status info text.
|
||||
*
|
||||
* @param shouldShowStatusText whether we should fade in the status text
|
||||
*/
|
||||
private void hideLongPressTooltip(boolean shouldShowStatusText) {
|
||||
mLongPressTooltipView.animate().cancel();
|
||||
if (mLongPressTooltipView.getVisibility() == View.VISIBLE
|
||||
&& mLongPressTooltipView.getAlpha() != 0f) {
|
||||
mHandler.removeCallbacks(mAutoFadeOutTooltipRunnable);
|
||||
mLongPressTooltipView.animate()
|
||||
.alpha(0f)
|
||||
.setDuration(FADE_ANIMATION_DURATION_MS)
|
||||
.setListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (DEBUG) Log.d(TAG, "hideLongPressTooltip: Hid long press tip");
|
||||
mLongPressTooltipView.setVisibility(View.INVISIBLE);
|
||||
|
||||
if (shouldShowStatusText) {
|
||||
showStatus();
|
||||
}
|
||||
}
|
||||
})
|
||||
.start();
|
||||
} else {
|
||||
mLongPressTooltipView.setVisibility(View.INVISIBLE);
|
||||
if (shouldShowStatusText) {
|
||||
showStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fades in the updated status text. Note that if there's already a status showing, this will
|
||||
* immediately fade it out and fade in the updated status.
|
||||
*/
|
||||
private void showStatus() {
|
||||
mStatusContainer.setAlpha(0f);
|
||||
|
||||
mStatusContainer.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(FADE_ANIMATION_DURATION_MS)
|
||||
.start();
|
||||
}
|
||||
|
||||
/** Fades out the status text. */
|
||||
private void hideStatusText() {
|
||||
mStatusContainer.animate()
|
||||
.alpha(0f)
|
||||
.setDuration(FADE_ANIMATION_DURATION_MS)
|
||||
.start();
|
||||
}
|
||||
|
||||
public void updateEverything() {
|
||||
post(() -> setClickable(!mExpanded));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user