diff options
author | yusufo@chromium.org <yusufo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-11 00:04:22 +0000 |
---|---|---|
committer | yusufo@chromium.org <yusufo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-11 00:04:22 +0000 |
commit | 794886fa6bb39cdac3d0b1e0dd059f95828bdaa6 (patch) | |
tree | c9a1d47af89afe1bdab1d0460c5cc16367f1a3cb /chrome/android/java | |
parent | 7d84e6431c6388f4a3f417d018709710e5089d5f (diff) | |
download | chromium_src-794886fa6bb39cdac3d0b1e0dd059f95828bdaa6.zip chromium_src-794886fa6bb39cdac3d0b1e0dd059f95828bdaa6.tar.gz chromium_src-794886fa6bb39cdac3d0b1e0dd059f95828bdaa6.tar.bz2 |
Fix crash on ICS devices fpr the autofill dialog
Wrapped the onMeasure call with a version check and added xml attributes to
make the ICS version look nicer.
BUG=222051
Review URL: https://chromiumcodereview.appspot.com/14095004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/android/java')
3 files changed, 20 insertions, 11 deletions
diff --git a/chrome/android/java/res/layout/autofill_general_layout.xml b/chrome/android/java/res/layout/autofill_general_layout.xml index 361a3ca..57bb165 100644 --- a/chrome/android/java/res/layout/autofill_general_layout.xml +++ b/chrome/android/java/res/layout/autofill_general_layout.xml @@ -28,8 +28,9 @@ <Spinner android:layout_margin="@dimen/autofill_steady_margin" android:id="@+id/email_spinner" - android:visibility="gone" + android:padding="@dimen/autofill_menu_item_padding" android:layout_gravity="fill_horizontal" + android:dropDownVerticalOffset="@dimen/autofill_spinner_offset" android:layout_columnSpan="4"/> <TextView android:id="@+id/cc_billing_label" @@ -43,7 +44,9 @@ <Spinner android:layout_margin="@dimen/autofill_steady_margin" android:id="@+id/cc_billing_spinner" + android:padding="@dimen/autofill_menu_item_padding" android:layout_gravity="fill_horizontal" + android:dropDownVerticalOffset="@dimen/autofill_spinner_offset" android:layout_columnSpan="4"/> <TextView android:id="@+id/cc_label" @@ -57,7 +60,9 @@ <Spinner android:layout_margin="@dimen/autofill_steady_margin" android:id="@+id/cc_spinner" + android:padding="@dimen/autofill_menu_item_padding" android:layout_gravity="fill_horizontal" + android:dropDownVerticalOffset="@dimen/autofill_spinner_offset" android:layout_columnSpan="4"/> <TextView android:id="@+id/billing_label" @@ -71,7 +76,9 @@ <Spinner android:layout_margin="@dimen/autofill_steady_margin" android:id="@+id/billing_spinner" + android:padding="@dimen/autofill_menu_item_padding" android:layout_gravity="fill_horizontal" + android:dropDownVerticalOffset="@dimen/autofill_spinner_offset" android:visibility="gone" android:layout_columnSpan="4"/> <TextView @@ -92,7 +99,9 @@ <Spinner android:layout_margin="@dimen/autofill_steady_margin" android:id="@+id/address_spinner" + android:padding="@dimen/autofill_menu_item_padding" android:layout_gravity="fill_horizontal" + android:dropDownVerticalOffset="@dimen/autofill_spinner_offset" android:layout_columnSpan="4"/> <LinearLayout android:id="@+id/bottom_notifications" diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index bc86faa..ec1c92d 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml @@ -30,6 +30,7 @@ <dimen name="autofill_field_icon_width">40dp</dimen> <dimen name="autofill_field_icon_height">30dp</dimen> <dimen name="autofill_menu_item_size">44dp</dimen> + <dimen name="autofill_spinner_offset">-54dp</dimen> <dimen name="autofill_notification_padding">5dp</dimen> <dimen name="autofill_notification_text_size">12sp</dimen> <dimen name="autofill_steady_text_size">14sp</dimen> diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogContentView.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogContentView.java index 9842394..7c487fd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogContentView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogContentView.java @@ -8,6 +8,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; +import android.os.Build; import android.text.TextUtils; import android.util.AttributeSet; import android.view.View; @@ -114,7 +115,7 @@ public class AutofillDialogContentView extends LinearLayout { new ArrayList<AutofillDialogMenuItem>()); } mAdapters[i] = adapter; - if (mSpinners[i] != null) mSpinners[i].setAdapter(adapter); + mSpinners[i].setAdapter(adapter); } initializeSpinner(SECTION_SHIPPING, AutofillDialogConstants.ADDRESS_HOME_COUNTRY); @@ -146,12 +147,12 @@ public class AutofillDialogContentView extends LinearLayout { @Override protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); - Spinner ccSpinner = mSpinners[SECTION_CC_BILLING]; - Spinner addressSpinner = mSpinners[SECTION_SHIPPING]; - ccSpinner.setDropDownWidth(ccSpinner.getMeasuredWidth()); - ccSpinner.setDropDownVerticalOffset(-ccSpinner.getMeasuredHeight()); - addressSpinner.setDropDownWidth(addressSpinner.getMeasuredWidth()); - addressSpinner.setDropDownVerticalOffset(-addressSpinner.getMeasuredHeight()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + for (int i = 0; i < NUM_SECTIONS; i++) { + mSpinners[i].setDropDownWidth(mSpinners[i].getMeasuredWidth()); + mSpinners[i].setDropDownVerticalOffset(-mSpinners[i].getMeasuredHeight()); + } + } } /** @@ -159,9 +160,7 @@ public class AutofillDialogContentView extends LinearLayout { * @param listener The listener object to attach to the dropdowns. */ public void setOnItemSelectedListener(OnItemSelectedListener listener) { - for (int i = 0; i < NUM_SECTIONS; i++) { - if (mSpinners[i] != null) mSpinners[i].setOnItemSelectedListener(listener); - } + for (int i = 0; i < NUM_SECTIONS; i++) mSpinners[i].setOnItemSelectedListener(listener); } /** |