Loading packages/SystemUI/res/values/dimens.xml +5 −0 Original line number Diff line number Diff line Loading @@ -933,6 +933,11 @@ <dimen name="smart_reply_button_font_size">14sp</dimen> <dimen name="smart_reply_button_line_spacing_extra">6sp</dimen> <!-- Total line height 20sp. --> <!-- A reasonable upper bound for the height of the smart reply button. The measuring code needs to start with a guess for the maximum size. Currently two-line smart reply buttons add about 88dp of height to the notifications. --> <dimen name="smart_reply_button_max_height">100dp</dimen> <!-- Fingerprint Dialog values --> <dimen name="fingerprint_dialog_fp_icon_size">64dp</dimen> <dimen name="fingerprint_dialog_animation_translation_offset">350dp</dimen> Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +9 −4 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class NotificationContentView extends FrameLayout { private RemoteInputView mHeadsUpRemoteInput; private SmartReplyConstants mSmartReplyConstants; private SmartReplyView mExpandedSmartReplyView; private SmartReplyLogger mSmartReplyLogger; private NotificationViewWrapper mContractedWrapper; Loading Loading @@ -184,7 +185,11 @@ public class NotificationContentView extends FrameLayout { } int maxChildHeight = 0; if (mExpandedChild != null) { int size = Math.min(maxSize, mNotificationMaxHeight); int notificationMaxHeight = mNotificationMaxHeight; if (mExpandedSmartReplyView != null) { notificationMaxHeight += mExpandedSmartReplyView.getHeightUpperLimit(); } int size = Math.min(maxSize, notificationMaxHeight); ViewGroup.LayoutParams layoutParams = mExpandedChild.getLayoutParams(); boolean useExactly = false; if (layoutParams.height >= 0) { Loading Loading @@ -1348,10 +1353,10 @@ public class NotificationContentView extends FrameLayout { private void applySmartReplyView(RemoteInput remoteInput, PendingIntent pendingIntent, NotificationData.Entry entry) { if (mExpandedChild != null) { SmartReplyView view = mExpandedSmartReplyView = applySmartReplyView(mExpandedChild, remoteInput, pendingIntent, entry); if (view != null && remoteInput != null && remoteInput.getChoices() != null && remoteInput.getChoices().length > 0) { if (mExpandedSmartReplyView != null && remoteInput != null && remoteInput.getChoices() != null && remoteInput.getChoices().length > 0) { mSmartReplyLogger.smartRepliesAdded(entry, remoteInput.getChoices().length); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +19 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.SmartReplyLogger; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import java.text.BreakIterator; Loading @@ -48,6 +49,12 @@ public class SmartReplyView extends ViewGroup { private final SmartReplyConstants mConstants; private final KeyguardDismissUtil mKeyguardDismissUtil; /** * The upper bound for the height of this view in pixels. Notifications are automatically * recreated on density or font size changes so caching this should be fine. */ private final int mHeightUpperLimit; /** Spacing to be applied between views. */ private final int mSpacing; Loading @@ -69,6 +76,9 @@ public class SmartReplyView extends ViewGroup { mConstants = Dependency.get(SmartReplyConstants.class); mKeyguardDismissUtil = Dependency.get(KeyguardDismissUtil.class); mHeightUpperLimit = NotificationUtils.getFontScaledHeight(mContext, R.dimen.smart_reply_button_max_height); int spacing = 0; int singleLineButtonPaddingHorizontal = 0; int doubleLineButtonPaddingHorizontal = 0; Loading Loading @@ -98,10 +108,19 @@ public class SmartReplyView extends ViewGroup { mSingleToDoubleLineButtonWidthIncrease = 2 * (doubleLineButtonPaddingHorizontal - singleLineButtonPaddingHorizontal); mBreakIterator = BreakIterator.getLineInstance(); reallocateCandidateButtonQueueForSqueezing(); } /** * Returns an upper bound for the height of this view in pixels. This method is intended to be * invoked before onMeasure, so it doesn't do any analysis on the contents of the buttons. */ public int getHeightUpperLimit() { return mHeightUpperLimit; } private void reallocateCandidateButtonQueueForSqueezing() { // Instead of clearing the priority queue, we re-allocate so that it would fit all buttons // exactly. This avoids (1) wasting memory because PriorityQueue never shrinks and Loading Loading
packages/SystemUI/res/values/dimens.xml +5 −0 Original line number Diff line number Diff line Loading @@ -933,6 +933,11 @@ <dimen name="smart_reply_button_font_size">14sp</dimen> <dimen name="smart_reply_button_line_spacing_extra">6sp</dimen> <!-- Total line height 20sp. --> <!-- A reasonable upper bound for the height of the smart reply button. The measuring code needs to start with a guess for the maximum size. Currently two-line smart reply buttons add about 88dp of height to the notifications. --> <dimen name="smart_reply_button_max_height">100dp</dimen> <!-- Fingerprint Dialog values --> <dimen name="fingerprint_dialog_fp_icon_size">64dp</dimen> <dimen name="fingerprint_dialog_animation_translation_offset">350dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java +9 −4 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ public class NotificationContentView extends FrameLayout { private RemoteInputView mHeadsUpRemoteInput; private SmartReplyConstants mSmartReplyConstants; private SmartReplyView mExpandedSmartReplyView; private SmartReplyLogger mSmartReplyLogger; private NotificationViewWrapper mContractedWrapper; Loading Loading @@ -184,7 +185,11 @@ public class NotificationContentView extends FrameLayout { } int maxChildHeight = 0; if (mExpandedChild != null) { int size = Math.min(maxSize, mNotificationMaxHeight); int notificationMaxHeight = mNotificationMaxHeight; if (mExpandedSmartReplyView != null) { notificationMaxHeight += mExpandedSmartReplyView.getHeightUpperLimit(); } int size = Math.min(maxSize, notificationMaxHeight); ViewGroup.LayoutParams layoutParams = mExpandedChild.getLayoutParams(); boolean useExactly = false; if (layoutParams.height >= 0) { Loading Loading @@ -1348,10 +1353,10 @@ public class NotificationContentView extends FrameLayout { private void applySmartReplyView(RemoteInput remoteInput, PendingIntent pendingIntent, NotificationData.Entry entry) { if (mExpandedChild != null) { SmartReplyView view = mExpandedSmartReplyView = applySmartReplyView(mExpandedChild, remoteInput, pendingIntent, entry); if (view != null && remoteInput != null && remoteInput.getChoices() != null && remoteInput.getChoices().length > 0) { if (mExpandedSmartReplyView != null && remoteInput != null && remoteInput.getChoices() != null && remoteInput.getChoices().length > 0) { mSmartReplyLogger.smartRepliesAdded(entry, remoteInput.getChoices().length); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +19 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.SmartReplyLogger; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import java.text.BreakIterator; Loading @@ -48,6 +49,12 @@ public class SmartReplyView extends ViewGroup { private final SmartReplyConstants mConstants; private final KeyguardDismissUtil mKeyguardDismissUtil; /** * The upper bound for the height of this view in pixels. Notifications are automatically * recreated on density or font size changes so caching this should be fine. */ private final int mHeightUpperLimit; /** Spacing to be applied between views. */ private final int mSpacing; Loading @@ -69,6 +76,9 @@ public class SmartReplyView extends ViewGroup { mConstants = Dependency.get(SmartReplyConstants.class); mKeyguardDismissUtil = Dependency.get(KeyguardDismissUtil.class); mHeightUpperLimit = NotificationUtils.getFontScaledHeight(mContext, R.dimen.smart_reply_button_max_height); int spacing = 0; int singleLineButtonPaddingHorizontal = 0; int doubleLineButtonPaddingHorizontal = 0; Loading Loading @@ -98,10 +108,19 @@ public class SmartReplyView extends ViewGroup { mSingleToDoubleLineButtonWidthIncrease = 2 * (doubleLineButtonPaddingHorizontal - singleLineButtonPaddingHorizontal); mBreakIterator = BreakIterator.getLineInstance(); reallocateCandidateButtonQueueForSqueezing(); } /** * Returns an upper bound for the height of this view in pixels. This method is intended to be * invoked before onMeasure, so it doesn't do any analysis on the contents of the buttons. */ public int getHeightUpperLimit() { return mHeightUpperLimit; } private void reallocateCandidateButtonQueueForSqueezing() { // Instead of clearing the priority queue, we re-allocate so that it would fit all buttons // exactly. This avoids (1) wasting memory because PriorityQueue never shrinks and Loading