From e5ac64a1037d62d5cf8815f835fbcd38ad199e8d Mon Sep 17 00:00:00 2001 From: Tony Mantler Date: Mon, 8 Sep 2014 15:51:05 -0700 Subject: [PATCH] Fix spinners layout mangling Setting the gravity to center_vertical seems to make them behave. Not asking. Also clean up the layout file in general. b/17380851 Change-Id: I45ac202825295c577dd1a13a3176ac685bd9b9d8 --- .../account_setup_options_fragment.xml | 105 ++++++++---------- res/layout/account_setup_options_fragment.xml | 27 ++--- .../setup/AccountSetupOptionsFragment.java | 13 ++- 3 files changed, 62 insertions(+), 83 deletions(-) diff --git a/res/layout-w600dp/account_setup_options_fragment.xml b/res/layout-w600dp/account_setup_options_fragment.xml index 006455c47..e92b2eb8c 100644 --- a/res/layout-w600dp/account_setup_options_fragment.xml +++ b/res/layout-w600dp/account_setup_options_fragment.xml @@ -16,119 +16,102 @@ - - - - - - + app:columnCount="2" > + + + - - - - - + + + + + - + android:background="@color/account_setup_divider_color" + android:visibility="gone" /> + - + - + android:background="@color/account_setup_divider_color" /> + - - - + diff --git a/res/layout/account_setup_options_fragment.xml b/res/layout/account_setup_options_fragment.xml index d5c6c8dd6..8dd44d61c 100644 --- a/res/layout/account_setup_options_fragment.xml +++ b/res/layout/account_setup_options_fragment.xml @@ -28,23 +28,18 @@ android:id="@+id/account_check_frequency" android:layout_height="wrap_content" android:layout_width="match_parent" /> - - - - + android:layout_width="match_parent" + android:text="@string/account_setup_options_mail_window_label" + android:visibility="gone" + style="@style/account_setup_label_text" /> + checkFrequenciesAdapter = - new ArrayAdapter(getActivity(), android.R.layout.simple_spinner_item, + new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, checkFrequencies); checkFrequenciesAdapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); @@ -130,7 +130,8 @@ public class AccountSetupOptionsFragment extends AccountSetupFragment { */ private void enableLookbackSpinner(Account account) { // Show everything - mAccountSyncWindowRow.setVisibility(View.VISIBLE); + mSyncWindowView.setVisibility(View.VISIBLE); + mSyncwindowLabel.setVisibility(View.VISIBLE); // Generate spinner entries using XML arrays used by the preferences final CharSequence[] windowValues = getResources().getTextArray( @@ -164,7 +165,7 @@ public class AccountSetupOptionsFragment extends AccountSetupFragment { } final ArrayAdapter windowOptionsAdapter = - new ArrayAdapter(getActivity(), android.R.layout.simple_spinner_item, + new ArrayAdapter<>(getActivity(), android.R.layout.simple_spinner_item, windowOptions); windowOptionsAdapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); @@ -188,7 +189,7 @@ public class AccountSetupOptionsFragment extends AccountSetupFragment { * @return Sync window value or null if view is hidden */ public Integer getAccountSyncWindowValue() { - if (mAccountSyncWindowRow.getVisibility() != View.VISIBLE) { + if (mSyncWindowView.getVisibility() != View.VISIBLE) { return null; } return (Integer)((SpinnerOption)mSyncWindowView.getSelectedItem()).value;