From 8852c1f480491964c532d944a31b18e69d55051a Mon Sep 17 00:00:00 2001 From: "aurimas@chromium.org" Date: Tue, 2 Apr 2013 19:50:49 +0000 Subject: [android] Clear old notifications on notification update in AutofillDialog. Previously the code did not clear the old notifications so on the second update duplicate notifications would appear. BUG=178536 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/13467008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191881 0039d316-1c4b-4281-b951-d872f2087c98 --- .../org/chromium/chrome/browser/autofill/AutofillDialog.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'chrome/android') diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java index 4f2082e..8f27e03 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java @@ -274,10 +274,17 @@ public class AutofillDialog extends AlertDialog * @param notifications Array of notifications to be displayed in the dialog. */ public void updateNotificationArea(AutofillDialogNotification[] notifications) { + // Clear all the previous notifications + CheckBox checkBox = ((CheckBox) findViewById(R.id.top_notification)); + checkBox.setVisibility(View.GONE); + ViewGroup notificationsContainer = + ((ViewGroup) findViewById(R.id.bottom_notifications)); + notificationsContainer.removeAllViews(); + + // Add new notifications for (AutofillDialogNotification notification: notifications) { if (notification.mHasArrow && notification.mHasCheckbox) { // Assuming that there will always be only one top notification. - CheckBox checkBox = ((CheckBox) findViewById(R.id.top_notification)); checkBox.setBackgroundColor(notification.mBackgroundColor); checkBox.setTextColor(notification.mTextColor); checkBox.setText(notification.mText); @@ -293,9 +300,6 @@ public class AutofillDialog extends AlertDialog int padding = getContext().getResources(). getDimensionPixelSize(R.dimen.autofill_notification_padding); notificationView.setPadding(padding, padding, padding, padding); - - ViewGroup notificationsContainer = - ((ViewGroup) findViewById(R.id.bottom_notifications)); notificationsContainer.addView(notificationView); notificationsContainer.setVisibility(View.VISIBLE); } -- cgit v1.1