From 1dcdc09e0338ab8f019a424d2b412b27491e918e Mon Sep 17 00:00:00 2001 From: Tony Mantler Date: Mon, 14 Jul 2014 14:07:11 -0700 Subject: [PATCH] Add "Add Account" to prefs headers Borrowed + icon from authentication widget b/16298155 Change-Id: I36d0eb2c7b9e98442d72481254d9a4da2ae3c999 --- ...authentication.png => ic_settings_add.png} | Bin ...authentication.png => ic_settings_add.png} | Bin ...authentication.png => ic_settings_add.png} | Bin ...authentication.png => ic_settings_add.png} | Bin res/layout-w600dp/authentication_view.xml | 2 +- res/layout/authentication_view.xml | 2 +- res/xml/email_extra_preference_headers.xml | 25 ++++++++++++++++++ res/xml/preference_headers.xml | 1 - .../setup/EmailPreferenceActivity.java | 9 ++++++- 9 files changed, 35 insertions(+), 4 deletions(-) rename res/drawable-hdpi/{ic_setup_add_authentication.png => ic_settings_add.png} (100%) rename res/drawable-mdpi/{ic_setup_add_authentication.png => ic_settings_add.png} (100%) rename res/drawable-xhdpi/{ic_setup_add_authentication.png => ic_settings_add.png} (100%) rename res/drawable-xxhdpi/{ic_setup_add_authentication.png => ic_settings_add.png} (100%) create mode 100644 res/xml/email_extra_preference_headers.xml diff --git a/res/drawable-hdpi/ic_setup_add_authentication.png b/res/drawable-hdpi/ic_settings_add.png similarity index 100% rename from res/drawable-hdpi/ic_setup_add_authentication.png rename to res/drawable-hdpi/ic_settings_add.png diff --git a/res/drawable-mdpi/ic_setup_add_authentication.png b/res/drawable-mdpi/ic_settings_add.png similarity index 100% rename from res/drawable-mdpi/ic_setup_add_authentication.png rename to res/drawable-mdpi/ic_settings_add.png diff --git a/res/drawable-xhdpi/ic_setup_add_authentication.png b/res/drawable-xhdpi/ic_settings_add.png similarity index 100% rename from res/drawable-xhdpi/ic_setup_add_authentication.png rename to res/drawable-xhdpi/ic_settings_add.png diff --git a/res/drawable-xxhdpi/ic_setup_add_authentication.png b/res/drawable-xxhdpi/ic_settings_add.png similarity index 100% rename from res/drawable-xxhdpi/ic_setup_add_authentication.png rename to res/drawable-xxhdpi/ic_settings_add.png diff --git a/res/layout-w600dp/authentication_view.xml b/res/layout-w600dp/authentication_view.xml index 8c6e0f5db..fc3a7fd86 100644 --- a/res/layout-w600dp/authentication_view.xml +++ b/res/layout-w600dp/authentication_view.xml @@ -31,7 +31,7 @@ android:layout_weight="1" android:padding="16dip" android:drawablePadding="16dip" - android:drawableStart="@drawable/ic_setup_add_authentication" + android:drawableStart="@drawable/ic_settings_add" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?android:attr/textColorPrimary"/> diff --git a/res/layout/authentication_view.xml b/res/layout/authentication_view.xml index 4f031fb94..f055bb5e2 100644 --- a/res/layout/authentication_view.xml +++ b/res/layout/authentication_view.xml @@ -42,7 +42,7 @@ android:padding="16dip" android:drawablePadding="16dip" style="@style/account_setup_label_text" - android:drawableStart="@drawable/ic_setup_add_authentication" + android:drawableStart="@drawable/ic_settings_add" android:textAppearance="?android:attr/textAppearanceSmall" android:textColor="?android:attr/textColorPrimary"/> diff --git a/res/xml/email_extra_preference_headers.xml b/res/xml/email_extra_preference_headers.xml new file mode 100644 index 000000000..757e64f8e --- /dev/null +++ b/res/xml/email_extra_preference_headers.xml @@ -0,0 +1,25 @@ + + + + + +
+ + diff --git a/res/xml/preference_headers.xml b/res/xml/preference_headers.xml index 0d2e709d3..f7da4c4c2 100644 --- a/res/xml/preference_headers.xml +++ b/res/xml/preference_headers.xml @@ -17,7 +17,6 @@ --> - xmlns:android="http://schemas.android.com/apk/res/android">
diff --git a/src/com/android/email/activity/setup/EmailPreferenceActivity.java b/src/com/android/email/activity/setup/EmailPreferenceActivity.java index dd29b8fd1..be02bf6bd 100644 --- a/src/com/android/email/activity/setup/EmailPreferenceActivity.java +++ b/src/com/android/email/activity/setup/EmailPreferenceActivity.java @@ -220,7 +220,10 @@ public class EmailPreferenceActivity extends MailPreferenceActivity { @Override public void onBuildExtraHeaders(List
target) { super.onBuildExtraHeaders(target); - // finally, if debug header is enabled, show it + + loadHeadersFromResource(R.xml.email_extra_preference_headers, target); + + // if debug header is enabled, show it if (DEBUG_MENU_ALLOWED) { if (mShowDebugMenu) { // setup lightweight header for debugging @@ -252,6 +255,10 @@ public class EmailPreferenceActivity extends MailPreferenceActivity { } else { mNumGeneralHeaderClicked = 0; } + if (header.id == R.id.add_account_header) { + onAddNewAccount(); + return; + } // Process header click normally super.onHeaderClick(header, position);