diff options
Diffstat (limited to 'chrome/android')
3 files changed, 42 insertions, 7 deletions
diff --git a/chrome/android/java/res/layout/autofill_general_layout.xml b/chrome/android/java/res/layout/autofill_general_layout.xml index db78233..6884d48 100644 --- a/chrome/android/java/res/layout/autofill_general_layout.xml +++ b/chrome/android/java/res/layout/autofill_general_layout.xml @@ -9,6 +9,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:columnCount="4"> + <CheckBox + android:id="@+id/top_notification" + android:padding="5dp" + android:textSize="12sp" + android:visibility="gone" + android:layout_columnSpan="4"/> <Spinner android:layout_margin="5dp" android:id="@+id/email_spinner" @@ -54,12 +60,10 @@ android:id="@+id/address_spinner" android:layout_gravity="fill_horizontal" android:layout_columnSpan="4"/> - <CheckBox - android:id="@+id/check_box" - android:layout_margin="5dp" + <LinearLayout + android:id="@+id/bottom_notifications" android:visibility="gone" - android:textSize="12sp" - android:text="@string/autofill_use_wallet" + android:layout_gravity="fill_horizontal" android:layout_columnSpan="4"/> <View android:id="@+id/line_bottom" diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index d3e73f6..54fafca 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml @@ -25,6 +25,8 @@ <dimen name="autofill_edit_margin">2dp</dimen> <dimen name="autofill_edit_text_size">18sp</dimen> <dimen name="autofill_edit_height">48dp</dimen> - <dimen name="autofill_menu_item_size">44dp</dimen> + <dimen name="autofill_menu_item_size">44dp</dimen> + <dimen name="autofill_notification_padding">5dp</dimen> + <dimen name="autofill_notification_text_size">12sp</dimen> <dimen name="autofill_translation_anim_distance">300dp</dimen> </resources> 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 72f0227..5fcbef4e 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 @@ -11,11 +11,15 @@ import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.res.Resources; import android.text.TextUtils; +import android.util.TypedValue; import android.view.View; +import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; +import android.widget.CheckBox; import android.widget.EditText; import android.widget.ScrollView; +import android.widget.TextView; import org.chromium.chrome.R; @@ -244,7 +248,32 @@ public class AutofillDialog extends AlertDialog * @param notifications Array of notifications to be displayed in the dialog. */ public void updateNotificationArea(AutofillDialogNotification[] notifications) { - // TODO(yusufo): Start displaying these 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); + checkBox.setVisibility(View.VISIBLE); + } else { + TextView notificationView = new TextView(getContext()); + notificationView.setBackgroundColor(notification.mBackgroundColor); + notificationView.setTextColor(notification.mTextColor); + notificationView.setText(notification.mText); + notificationView.setTextSize(TypedValue.COMPLEX_UNIT_PX, + getContext().getResources().getDimension( + R.dimen.autofill_notification_text_size)); + 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); + } + } } /** |