Improve hint animations.
Show the hint text longer so that users have enough time to read it, also "highlight" the corresponding icon by making it fully opaque during the gesture. Bug: 15189049 Change-Id: Ie0429752b63bae41bb6992778ebb3bd5678f9676
This commit is contained in:
@@ -40,8 +40,8 @@ import java.util.ArrayList;
|
||||
public class KeyguardPageSwipeHelper {
|
||||
|
||||
private static final float SWIPE_MAX_ICON_SCALE_AMOUNT = 2.0f;
|
||||
private static final float SWIPE_RESTING_ALPHA_AMOUNT = 0.7f;
|
||||
private static final long HINT_PHASE1_DURATION = 250;
|
||||
public static final float SWIPE_RESTING_ALPHA_AMOUNT = 0.5f;
|
||||
public static final long HINT_PHASE1_DURATION = 250;
|
||||
private static final long HINT_PHASE2_DURATION = 450;
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.view.ViewTreeObserver;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.android.systemui.R;
|
||||
@@ -861,6 +862,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
mStatusBar.onHintFinished();
|
||||
}
|
||||
});
|
||||
startHighlightIconAnimation(right ? getRightIcon() : getLeftIcon());
|
||||
boolean start = getLayoutDirection() == LAYOUT_DIRECTION_RTL ? right : !right;
|
||||
if (start) {
|
||||
mStatusBar.onPhoneHintStarted();
|
||||
@@ -869,6 +871,30 @@ public class NotificationPanelView extends PanelView implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUnlockHintAnimation() {
|
||||
super.startUnlockHintAnimation();
|
||||
startHighlightIconAnimation(getCenterIcon());
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the highlight (making it fully opaque) animation on an icon.
|
||||
*/
|
||||
private void startHighlightIconAnimation(final View icon) {
|
||||
icon.animate()
|
||||
.alpha(1.0f)
|
||||
.setDuration(KeyguardPageSwipeHelper.HINT_PHASE1_DURATION)
|
||||
.setInterpolator(mFastOutSlowInInterpolator)
|
||||
.withEndAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
icon.animate().alpha(KeyguardPageSwipeHelper.SWIPE_RESTING_ALPHA_AMOUNT)
|
||||
.setDuration(KeyguardPageSwipeHelper.HINT_PHASE1_DURATION)
|
||||
.setInterpolator(mFastOutSlowInInterpolator);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getPageWidth() {
|
||||
return getWidth();
|
||||
|
||||
@@ -174,6 +174,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
/** The minimum delay in ms between reports of notification visibility. */
|
||||
private static final int VISIBILITY_REPORT_MIN_DELAY_MS = 500;
|
||||
|
||||
/**
|
||||
* The delay to reset the hint text when the hint animation is finished running.
|
||||
*/
|
||||
private static final int HINT_RESET_DELAY_MS = 1200;
|
||||
|
||||
// fling gesture tuning parameters, scaled to display density
|
||||
private float mSelfExpandVelocityPx; // classic value: 2000px/s
|
||||
private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up")
|
||||
@@ -491,6 +496,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
};
|
||||
|
||||
private final Runnable mResetIndicationRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void setZenMode(int mode) {
|
||||
super.setZenMode(mode);
|
||||
@@ -2960,18 +2972,23 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
public void onUnlockHintStarted() {
|
||||
mStatusBarView.removeCallbacks(mResetIndicationRunnable);
|
||||
mKeyguardIndicationTextView.switchIndication(R.string.keyguard_unlock);
|
||||
}
|
||||
|
||||
public void onHintFinished() {
|
||||
mKeyguardIndicationTextView.switchIndication(mKeyguardHotwordPhrase);
|
||||
|
||||
// Delay the reset a bit so the user can read the text.
|
||||
mStatusBarView.postDelayed(mResetIndicationRunnable, HINT_RESET_DELAY_MS);
|
||||
}
|
||||
|
||||
public void onCameraHintStarted() {
|
||||
mStatusBarView.removeCallbacks(mResetIndicationRunnable);
|
||||
mKeyguardIndicationTextView.switchIndication(R.string.camera_hint);
|
||||
}
|
||||
|
||||
public void onPhoneHintStarted() {
|
||||
mStatusBarView.removeCallbacks(mResetIndicationRunnable);
|
||||
mKeyguardIndicationTextView.switchIndication(R.string.phone_hint);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user