summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/layout-w600dp/account_setup_options_fragment.xml105
-rw-r--r--res/layout/account_setup_options_fragment.xml25
-rw-r--r--src/com/android/email/activity/setup/AccountSetupOptionsFragment.java13
3 files changed, 61 insertions, 82 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 @@
<!-- Common data-entry area of account options setup screen - check freq, options, etc. -->
<!-- tablet version -->
-<RelativeLayout
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:orientation="vertical"
>
<!-- Spinners in a table to line everything up nicely -->
- <TableLayout
- android:id="@+id/spinners_table"
- android:layout_alignParentTop="true"
+ <android.support.v7.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:stretchColumns="1" >
- <TableRow
- android:paddingTop="16dip" >
- <TextView
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_marginRight="16dip"
- android:text="@string/account_setup_options_mail_check_frequency_label"
- style="@style/account_setup_label_text" />
- <Spinner
- android:id="@+id/account_check_frequency"
- android:layout_height="wrap_content"
- android:layout_width="match_parent" />
- </TableRow>
+ app:columnCount="2" >
+
+ <TextView
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ app:layout_gravity="center_vertical"
+ android:layout_margin="8dp"
+ android:text="@string/account_setup_options_mail_check_frequency_label"
+ style="@style/account_setup_label_text" />
+ <Spinner
+ android:id="@+id/account_check_frequency"
+ android:layout_height="wrap_content"
+ app:layout_gravity="center_vertical|fill_horizontal"/>
<!-- 2nd row is shown only for EAS accounts -->
- <TableRow
- android:id="@+id/account_sync_window_row"
- android:paddingTop="16dip"
- android:visibility="gone" >
- <TextView
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_marginRight="16dip"
- android:text="@string/account_setup_options_mail_window_label"
- style="@style/account_setup_label_text" />
- <Spinner
- android:id="@+id/account_sync_window"
- android:layout_height="wrap_content"
- android:layout_width="match_parent" />
- </TableRow>
- </TableLayout>
+ <TextView
+ android:id="@+id/account_sync_window_label"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ app:layout_gravity="center_vertical"
+ android:layout_margin="8dp"
+ android:text="@string/account_setup_options_mail_window_label"
+ android:visibility="gone"
+ style="@style/account_setup_label_text" />
+ <Spinner
+ android:id="@+id/account_sync_window"
+ android:layout_height="wrap_content"
+ app:layout_gravity="center_vertical|fill_horizontal"
+ android:visibility="gone" />
+
+ </android.support.v7.widget.GridLayout>
<CheckBox
android:id="@+id/account_notify"
- android:layout_below="@+id/spinners_table"
style="@style/account_setup_checkbox"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/account_setup_options_notify_label" />
+ <!-- Contacts sync - hide unless EAS -->
<View
- android:id="@+id/account_notify_divider"
- android:layout_below="@+id/account_notify"
+ android:id="@+id/account_sync_contacts_divider"
android:layout_width="match_parent"
android:layout_height="1px"
- android:background="@color/account_setup_divider_color" />
- <!-- Contacts sync - hide unless EAS -->
+ android:background="@color/account_setup_divider_color"
+ android:visibility="gone" />
<CheckBox
android:id="@+id/account_sync_contacts"
- android:layout_below="@+id/account_notify_divider"
style="@style/account_setup_checkbox"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/account_setup_options_sync_contacts_label"
android:visibility="gone" />
+ <!-- Calendar sync - hide unless EAS -->
<View
- android:id="@+id/account_sync_contacts_divider"
- android:layout_below="@+id/account_sync_contacts"
+ android:id="@+id/account_sync_calendar_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/account_setup_divider_color"
android:visibility="gone" />
- <!-- Calendar sync - hide unless EAS -->
<CheckBox
android:id="@+id/account_sync_calendar"
- android:layout_below="@+id/account_sync_contacts_divider"
style="@style/account_setup_checkbox"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/account_setup_options_sync_calendar_label"
android:visibility="gone" />
+ <!-- Email sync - always show -->
<View
- android:id="@+id/account_sync_calendar_divider"
- android:layout_below="@+id/account_sync_calendar"
android:layout_width="match_parent"
android:layout_height="1px"
- android:background="@color/account_setup_divider_color"
- android:visibility="gone" />
- <!-- Email sync - always show -->
+ android:background="@color/account_setup_divider_color" />
<CheckBox
android:id="@+id/account_sync_email"
- android:layout_below="@+id/account_sync_calendar_divider"
style="@style/account_setup_checkbox"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/account_setup_options_sync_email_label" />
+ <!-- Auto-download attachments - always show, unless POP3 -->
<View
- android:id="@+id/account_sync_email_divider"
- android:layout_below="@+id/account_sync_email"
+ android:id="@+id/account_background_attachments_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/account_setup_divider_color" />
- <!-- Auto-download attachments - always show, unless POP3 -->
<CheckBox
android:id="@+id/account_background_attachments"
- android:layout_below="@+id/account_sync_email_divider"
style="@style/account_setup_checkbox"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/account_setup_options_background_attachments_label" />
- <View
- android:id="@+id/account_background_attachments_divider"
- android:layout_below="@+id/account_sync_email"
- android:layout_width="match_parent"
- android:layout_height="1px"
- android:background="@color/account_setup_divider_color" />
-</RelativeLayout>
+</LinearLayout>
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" />
- <LinearLayout
- android:id="@+id/account_sync_window_row"
+ <TextView
+ android:id="@+id/account_sync_window_label"
+ android:layout_height="wrap_content"
android:layout_width="match_parent"
+ android:text="@string/account_setup_options_mail_window_label"
+ android:visibility="gone"
+ style="@style/account_setup_label_text" />
+ <Spinner
+ android:id="@+id/account_sync_window"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:visibility="gone" >
- <TextView
- android:id="@+id/account_sync_window_label"
- android:text="@string/account_setup_options_mail_window_label"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- style="@style/account_setup_label_text" />
- <Spinner
- android:id="@+id/account_sync_window"
- android:layout_height="wrap_content"
- android:layout_width="match_parent" />
- </LinearLayout>
+ android:layout_width="match_parent"
+ android:visibility="gone" />
<CheckBox
android:id="@+id/account_notify"
style="@style/account_setup_checkbox"
diff --git a/src/com/android/email/activity/setup/AccountSetupOptionsFragment.java b/src/com/android/email/activity/setup/AccountSetupOptionsFragment.java
index 0264cb18c..9d048c119 100644
--- a/src/com/android/email/activity/setup/AccountSetupOptionsFragment.java
+++ b/src/com/android/email/activity/setup/AccountSetupOptionsFragment.java
@@ -34,12 +34,12 @@ import com.android.emailcommon.service.SyncWindow;
public class AccountSetupOptionsFragment extends AccountSetupFragment {
private Spinner mCheckFrequencyView;
private Spinner mSyncWindowView;
+ private View mSyncwindowLabel;
private CheckBox mNotifyView;
private CheckBox mSyncContactsView;
private CheckBox mSyncCalendarView;
private CheckBox mSyncEmailView;
private CheckBox mBackgroundAttachmentsView;
- private View mAccountSyncWindowRow;
/** Default sync window for new EAS accounts */
private static final int SYNC_WINDOW_EAS_DEFAULT = SyncWindow.SYNC_WINDOW_1_WEEK;
@@ -68,7 +68,7 @@ public class AccountSetupOptionsFragment extends AccountSetupFragment {
mSyncEmailView.setChecked(true);
mBackgroundAttachmentsView = UiUtilities.getView(view, R.id.account_background_attachments);
mBackgroundAttachmentsView.setChecked(true);
- mAccountSyncWindowRow = UiUtilities.getView(view, R.id.account_sync_window_row);
+ mSyncwindowLabel = UiUtilities.getView(view, R.id.account_sync_window_label);
return view;
}
@@ -96,7 +96,7 @@ public class AccountSetupOptionsFragment extends AccountSetupFragment {
Integer.valueOf(frequencyValues[i].toString()), frequencyEntries[i].toString());
}
final ArrayAdapter<SpinnerOption> checkFrequenciesAdapter =
- new ArrayAdapter<SpinnerOption>(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<SpinnerOption> windowOptionsAdapter =
- new ArrayAdapter<SpinnerOption>(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;