Loading packages/SystemUI/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -396,4 +396,8 @@ one bar higher than they actually are --> <bool name="config_inflateSignalStrength">false</bool> <!-- Should we vibrate on an icon animation of the shelf. This should only be active if the vibrator is capable of subtle vibrations --> <bool name="config_vibrateOnIconAnimation">false</bool> </resources> packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +15 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ public class NotificationShelf extends ActivatableNotificationView implements private boolean mNoAnimationsInThisFrame; private boolean mAnimationsEnabled = true; private boolean mShowNotificationShelf; private boolean mVibrationOnAnimation; private boolean mUserTouchingScreen; private boolean mTouchActive; public NotificationShelf(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -94,12 +97,24 @@ public class NotificationShelf extends ActivatableNotificationView implements setClipChildren(false); setClipToPadding(false); mShelfIcons.setShowAllIcons(false); mVibrationOnAnimation = mContext.getResources().getBoolean( R.bool.config_vibrateOnIconAnimation); updateVibrationOnAnimation(); mViewInvertHelper = new ViewInvertHelper(mShelfIcons, NotificationPanelView.DOZE_ANIMATION_DURATION); mShelfState = new ShelfState(); initDimens(); } private void updateVibrationOnAnimation() { mShelfIcons.setVibrateOnAnimation(mVibrationOnAnimation && mTouchActive); } public void setTouchActive(boolean touchActive) { mTouchActive = touchActive; updateVibrationOnAnimation(); } public void bind(AmbientState ambientState, NotificationStackScrollLayout hostLayout) { mAmbientState = ambientState; mHostLayout = hostLayout; Loading packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +9 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ public class StatusBarIconView extends AnimatedImageView { private final NotificationIconDozeHelper mDozer; private int mContrastedDrawableColor; private int mCachedContrastBackgroundColor = NO_COLOR; private boolean mIsInShelf; public StatusBarIconView(Context context, String slot, StatusBarNotification sbn) { this(context, slot, sbn, false); Loading Loading @@ -766,6 +767,14 @@ public class StatusBarIconView extends AnimatedImageView { } } public void setIsInShelf(boolean isInShelf) { mIsInShelf = isInShelf; } public boolean isInShelf() { return mIsInShelf; } public interface OnVisibilityChangedListener { void onVisibilityChanged(int newVisibility); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java +16 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.drawable.Icon; import android.os.VibrationEffect; import android.os.Vibrator; import android.support.v4.util.ArrayMap; import android.support.v4.util.ArraySet; import android.util.AttributeSet; Loading Loading @@ -122,6 +124,8 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { private float mVisualOverflowAdaption; private boolean mDisallowNextAnimation; private boolean mAnimationsEnabled = true; private boolean mVibrateOnAnimation; private Vibrator mVibrator; private ArrayMap<String, ArrayList<StatusBarIcon>> mReplacingIcons; private int mDarkOffsetX; Loading @@ -129,6 +133,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { super(context, attrs); initDimens(); setWillNotDraw(!DEBUG); mVibrator = mContext.getSystemService(Vibrator.class); } private void initDimens() { Loading Loading @@ -499,6 +504,10 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { return width - (getWidth() - getActualPaddingStart() - getActualPaddingEnd()) > 0; } public void setVibrateOnAnimation(boolean vibrateOnAnimation) { mVibrateOnAnimation = vibrateOnAnimation; } public int getIconSize() { return mIconSize; } Loading Loading @@ -611,6 +620,13 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { } else { super.applyToView(view); } boolean wasInShelf = icon.isInShelf(); boolean inShelf = iconAppearAmount == 1.0f; icon.setIsInShelf(inShelf); if (mVibrateOnAnimation && !justAdded && mAnimationsEnabled && wasInShelf != inShelf) { mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_TICK)); } } justAdded = false; justReplaced = false; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +5 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.os.SystemClock; import android.os.VibrationEffect; import android.os.Vibrator; import android.util.AttributeSet; import android.util.Log; import android.view.InputDevice; Loading Loading @@ -98,6 +100,7 @@ public abstract class PanelView extends FrameLayout { private FlingAnimationUtils mFlingAnimationUtilsClosing; private FlingAnimationUtils mFlingAnimationUtilsDismissing; private FalsingManager mFalsingManager; private final Vibrator mVibrator; /** * Whether an instant expand request is currently pending and we are just waiting for layout. Loading Loading @@ -199,6 +202,7 @@ public abstract class PanelView extends FrameLayout { mFalsingManager = FalsingManager.getInstance(context); mNotificationsDragEnabled = getResources().getBoolean(R.bool.config_enableNotificationShadeDrag); mVibrator = mContext.getSystemService(Vibrator.class); } protected void loadDimens() { Loading Loading @@ -390,6 +394,7 @@ public abstract class PanelView extends FrameLayout { runPeekAnimation(INITIAL_OPENING_PEEK_DURATION, getOpeningHeight(), false /* collapseWhenFinished */); notifyBarPanelExpansionChanged(); mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_CLICK)); } protected abstract float getOpeningHeight(); Loading Loading
packages/SystemUI/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -396,4 +396,8 @@ one bar higher than they actually are --> <bool name="config_inflateSignalStrength">false</bool> <!-- Should we vibrate on an icon animation of the shelf. This should only be active if the vibrator is capable of subtle vibrations --> <bool name="config_vibrateOnIconAnimation">false</bool> </resources>
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +15 −0 Original line number Diff line number Diff line Loading @@ -78,6 +78,9 @@ public class NotificationShelf extends ActivatableNotificationView implements private boolean mNoAnimationsInThisFrame; private boolean mAnimationsEnabled = true; private boolean mShowNotificationShelf; private boolean mVibrationOnAnimation; private boolean mUserTouchingScreen; private boolean mTouchActive; public NotificationShelf(Context context, AttributeSet attrs) { super(context, attrs); Loading @@ -94,12 +97,24 @@ public class NotificationShelf extends ActivatableNotificationView implements setClipChildren(false); setClipToPadding(false); mShelfIcons.setShowAllIcons(false); mVibrationOnAnimation = mContext.getResources().getBoolean( R.bool.config_vibrateOnIconAnimation); updateVibrationOnAnimation(); mViewInvertHelper = new ViewInvertHelper(mShelfIcons, NotificationPanelView.DOZE_ANIMATION_DURATION); mShelfState = new ShelfState(); initDimens(); } private void updateVibrationOnAnimation() { mShelfIcons.setVibrateOnAnimation(mVibrationOnAnimation && mTouchActive); } public void setTouchActive(boolean touchActive) { mTouchActive = touchActive; updateVibrationOnAnimation(); } public void bind(AmbientState ambientState, NotificationStackScrollLayout hostLayout) { mAmbientState = ambientState; mHostLayout = hostLayout; Loading
packages/SystemUI/src/com/android/systemui/statusbar/StatusBarIconView.java +9 −0 Original line number Diff line number Diff line Loading @@ -131,6 +131,7 @@ public class StatusBarIconView extends AnimatedImageView { private final NotificationIconDozeHelper mDozer; private int mContrastedDrawableColor; private int mCachedContrastBackgroundColor = NO_COLOR; private boolean mIsInShelf; public StatusBarIconView(Context context, String slot, StatusBarNotification sbn) { this(context, slot, sbn, false); Loading Loading @@ -766,6 +767,14 @@ public class StatusBarIconView extends AnimatedImageView { } } public void setIsInShelf(boolean isInShelf) { mIsInShelf = isInShelf; } public boolean isInShelf() { return mIsInShelf; } public interface OnVisibilityChangedListener { void onVisibilityChanged(int newVisibility); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java +16 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.drawable.Icon; import android.os.VibrationEffect; import android.os.Vibrator; import android.support.v4.util.ArrayMap; import android.support.v4.util.ArraySet; import android.util.AttributeSet; Loading Loading @@ -122,6 +124,8 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { private float mVisualOverflowAdaption; private boolean mDisallowNextAnimation; private boolean mAnimationsEnabled = true; private boolean mVibrateOnAnimation; private Vibrator mVibrator; private ArrayMap<String, ArrayList<StatusBarIcon>> mReplacingIcons; private int mDarkOffsetX; Loading @@ -129,6 +133,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { super(context, attrs); initDimens(); setWillNotDraw(!DEBUG); mVibrator = mContext.getSystemService(Vibrator.class); } private void initDimens() { Loading Loading @@ -499,6 +504,10 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { return width - (getWidth() - getActualPaddingStart() - getActualPaddingEnd()) > 0; } public void setVibrateOnAnimation(boolean vibrateOnAnimation) { mVibrateOnAnimation = vibrateOnAnimation; } public int getIconSize() { return mIconSize; } Loading Loading @@ -611,6 +620,13 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { } else { super.applyToView(view); } boolean wasInShelf = icon.isInShelf(); boolean inShelf = iconAppearAmount == 1.0f; icon.setIsInShelf(inShelf); if (mVibrateOnAnimation && !justAdded && mAnimationsEnabled && wasInShelf != inShelf) { mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_TICK)); } } justAdded = false; justReplaced = false; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +5 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.os.SystemClock; import android.os.VibrationEffect; import android.os.Vibrator; import android.util.AttributeSet; import android.util.Log; import android.view.InputDevice; Loading Loading @@ -98,6 +100,7 @@ public abstract class PanelView extends FrameLayout { private FlingAnimationUtils mFlingAnimationUtilsClosing; private FlingAnimationUtils mFlingAnimationUtilsDismissing; private FalsingManager mFalsingManager; private final Vibrator mVibrator; /** * Whether an instant expand request is currently pending and we are just waiting for layout. Loading Loading @@ -199,6 +202,7 @@ public abstract class PanelView extends FrameLayout { mFalsingManager = FalsingManager.getInstance(context); mNotificationsDragEnabled = getResources().getBoolean(R.bool.config_enableNotificationShadeDrag); mVibrator = mContext.getSystemService(Vibrator.class); } protected void loadDimens() { Loading Loading @@ -390,6 +394,7 @@ public abstract class PanelView extends FrameLayout { runPeekAnimation(INITIAL_OPENING_PEEK_DURATION, getOpeningHeight(), false /* collapseWhenFinished */); notifyBarPanelExpansionChanged(); mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_CLICK)); } protected abstract float getOpeningHeight(); Loading