diff options
21 files changed, 94 insertions, 19 deletions
diff --git a/res/drawable-hdpi/ic_compose_56dp.png b/res/drawable-hdpi/ic_compose_56dp.png Binary files differnew file mode 100644 index 000000000..98f2c918f --- /dev/null +++ b/res/drawable-hdpi/ic_compose_56dp.png diff --git a/res/drawable-hdpi/ic_compose_pressed_56dp.png b/res/drawable-hdpi/ic_compose_pressed_56dp.png Binary files differnew file mode 100644 index 000000000..0ccc5051f --- /dev/null +++ b/res/drawable-hdpi/ic_compose_pressed_56dp.png diff --git a/res/drawable-mdpi/ic_compose_56dp.png b/res/drawable-mdpi/ic_compose_56dp.png Binary files differnew file mode 100644 index 000000000..8aeeb17c8 --- /dev/null +++ b/res/drawable-mdpi/ic_compose_56dp.png diff --git a/res/drawable-mdpi/ic_compose_pressed_56dp.png b/res/drawable-mdpi/ic_compose_pressed_56dp.png Binary files differnew file mode 100644 index 000000000..dff7c0391 --- /dev/null +++ b/res/drawable-mdpi/ic_compose_pressed_56dp.png diff --git a/res/drawable-xhdpi/ic_compose_56dp.png b/res/drawable-xhdpi/ic_compose_56dp.png Binary files differnew file mode 100644 index 000000000..1f06eb979 --- /dev/null +++ b/res/drawable-xhdpi/ic_compose_56dp.png diff --git a/res/drawable-xhdpi/ic_compose_pressed_56dp.png b/res/drawable-xhdpi/ic_compose_pressed_56dp.png Binary files differnew file mode 100644 index 000000000..cab4987f7 --- /dev/null +++ b/res/drawable-xhdpi/ic_compose_pressed_56dp.png diff --git a/res/drawable-xxhdpi/ic_compose_56dp.png b/res/drawable-xxhdpi/ic_compose_56dp.png Binary files differnew file mode 100644 index 000000000..5595dc181 --- /dev/null +++ b/res/drawable-xxhdpi/ic_compose_56dp.png diff --git a/res/drawable-xxhdpi/ic_compose_pressed_56dp.png b/res/drawable-xxhdpi/ic_compose_pressed_56dp.png Binary files differnew file mode 100644 index 000000000..be9799c3a --- /dev/null +++ b/res/drawable-xxhdpi/ic_compose_pressed_56dp.png diff --git a/res/drawable/compose_button.xml b/res/drawable/compose_button.xml new file mode 100644 index 000000000..f75886948 --- /dev/null +++ b/res/drawable/compose_button.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2014 Google Inc. + Licensed to The Android Open Source Project. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/ic_compose_pressed_56dp" /> + <item android:drawable="@drawable/ic_compose_56dp" /> +</selector> diff --git a/res/layout/floating_action_bar.xml b/res/layout/floating_action_bar.xml new file mode 100644 index 000000000..7af8374ae --- /dev/null +++ b/res/layout/floating_action_bar.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2014 Google Inc. + Licensed to The Android Open Source Project. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<ImageButton xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/compose_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom|end" + android:background="@drawable/compose_button" + android:layout_marginBottom="@dimen/floating_action_bar_margin" + style="@style/FloatingActionBarStyle"/> diff --git a/res/layout/one_pane_activity.xml b/res/layout/one_pane_activity.xml index 38973b602..986a05a6c 100644 --- a/res/layout/one_pane_activity.xml +++ b/res/layout/one_pane_activity.xml @@ -32,6 +32,8 @@ <include layout="@layout/conversation_pager" /> + <include layout="@layout/floating_action_bar" /> + <com.android.mail.ui.ActionableToastBar android:id="@+id/toast_bar" style="@style/ToastBarStyle" /> diff --git a/res/layout/two_pane_activity.xml b/res/layout/two_pane_activity.xml index 1cff4756b..1caec817a 100644 --- a/res/layout/two_pane_activity.xml +++ b/res/layout/two_pane_activity.xml @@ -77,6 +77,8 @@ android:layout_height="match_parent" android:layout_gravity="left" /> + <include layout="@layout/floating_action_bar" /> + <com.android.mail.ui.ActionableToastBar android:id="@+id/toast_bar" style="@style/ToastBarStyle" /> diff --git a/res/menu-sw600dp-land/conversation_actions.xml b/res/menu-sw600dp-land/conversation_actions.xml index 1c3d1f9cf..720af7346 100644 --- a/res/menu-sw600dp-land/conversation_actions.xml +++ b/res/menu-sw600dp-land/conversation_actions.xml @@ -18,12 +18,11 @@ <!-- Action bar items for the tablet when viewing a conversation in landscape mode. --> <menu xmlns:android="http://schemas.android.com/apk/res/android"> - <!-- Since we show the conversation list in landscape mode, we show compose and search - even in the conversation view. --> - <item android:id="@+id/compose" + <!-- This invisible menu item is used to map CTRL-C to the compose action --> + <item + android:id="@+id/compose" android:title="@string/menu_compose" - android:showAsAction="always" - android:icon="@drawable/ic_menu_compose_normal_holo_light" + android:visible="false" android:alphabeticShortcut="@string/trigger_compose_char" /> <item android:id="@+id/search" diff --git a/res/menu-sw600dp-land/conversation_list_search_results_actions.xml b/res/menu-sw600dp-land/conversation_list_search_results_actions.xml index 14b68fbe5..125c70a37 100644 --- a/res/menu-sw600dp-land/conversation_list_search_results_actions.xml +++ b/res/menu-sw600dp-land/conversation_list_search_results_actions.xml @@ -17,10 +17,11 @@ --> <menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:id="@+id/compose" + <!-- This invisible menu item is used to map CTRL-C to the compose action --> + <item + android:id="@+id/compose" android:title="@string/menu_compose" - android:showAsAction="always" - android:icon="@drawable/ic_menu_compose_normal_holo_light" + android:visible="false" android:alphabeticShortcut="@string/trigger_compose_char" /> <item android:id="@+id/search" diff --git a/res/menu-sw600dp/conversation_list_menu.xml b/res/menu-sw600dp/conversation_list_menu.xml index 7f755b876..c09f3ae79 100644 --- a/res/menu-sw600dp/conversation_list_menu.xml +++ b/res/menu-sw600dp/conversation_list_menu.xml @@ -18,10 +18,11 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:id="@+id/compose" + <!-- This invisible menu item is used to map CTRL-C to the compose action --> + <item + android:id="@+id/compose" android:title="@string/menu_compose" - android:showAsAction="always" - android:icon="@drawable/ic_menu_compose_normal_holo_light" + android:visible="false" android:alphabeticShortcut="@string/trigger_compose_char" /> <!-- Available only for accounts with SERVER_SEARCH and in a folder diff --git a/res/menu/conversation_list_menu.xml b/res/menu/conversation_list_menu.xml index 025fbe9ef..be111c899 100644 --- a/res/menu/conversation_list_menu.xml +++ b/res/menu/conversation_list_menu.xml @@ -17,11 +17,11 @@ --> <menu xmlns:android="http://schemas.android.com/apk/res/android"> - <!-- Always available --> - <item android:id="@+id/compose" + <!-- This invisible menu item is used to map CTRL-C to the compose action --> + <item + android:id="@+id/compose" android:title="@string/menu_compose" - android:showAsAction="ifRoom" - android:icon="@drawable/ic_menu_compose_normal_holo_light" + android:visible="false" android:alphabeticShortcut="@string/trigger_compose_char" /> <!-- Available only for accounts with SERVER_SEARCH and in a folder diff --git a/res/menu/conversation_list_search_results_actions.xml b/res/menu/conversation_list_search_results_actions.xml index 309cbc808..bbc64c487 100644 --- a/res/menu/conversation_list_search_results_actions.xml +++ b/res/menu/conversation_list_search_results_actions.xml @@ -18,10 +18,11 @@ <menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:id="@+id/compose" + <!-- This invisible menu item is used to map CTRL-C to the compose action --> + <item + android:id="@+id/compose" android:title="@string/menu_compose" - android:showAsAction="ifRoom" - android:icon="@drawable/ic_menu_compose_normal_holo_light" + android:visible="false" android:alphabeticShortcut="@string/trigger_compose_char" /> <item android:id="@+id/search" diff --git a/res/values-ldrtl/styles-ldrtl.xml b/res/values-ldrtl/styles-ldrtl.xml index d286aea74..d7b5d2217 100644 --- a/res/values-ldrtl/styles-ldrtl.xml +++ b/res/values-ldrtl/styles-ldrtl.xml @@ -213,6 +213,10 @@ <item name="android:layout_alignParentStart">true</item> </style> + <style name="FloatingActionBarStyle"> + <item name="android:layout_marginEnd">@dimen/floating_action_bar_margin</item> + </style> + <style name="FolderSelectionItemStyle" parent="AbstractFolderSelectionItemStyle"> <item name="android:layout_marginStart">@dimen/folder_selection_margin_start</item> <item name="android:layout_marginEnd">@dimen/folder_selection_margin_end</item> diff --git a/res/values/dimen.xml b/res/values/dimen.xml index d34b6fe1c..b5451f355 100644 --- a/res/values/dimen.xml +++ b/res/values/dimen.xml @@ -68,6 +68,7 @@ <dimen name="message_header_inner_side_padding">16dp</dimen> <dimen name="attachment_toast_yoffset">-100dip</dimen> <dimen name="spinner_frame_width">196dip</dimen> + <dimen name="floating_action_bar_margin">16dp</dimen> <dimen name="folder_selection_margin_start">16dp</dimen> <dimen name="folder_selection_margin_end">24dp</dimen> <dimen name="folder_list_heading_padding_side">16dp</dimen> diff --git a/res/values/styles.xml b/res/values/styles.xml index d4ebcb850..c5fb051d3 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -182,6 +182,10 @@ </style> <!-- End browse list item styles --> + <style name="FloatingActionBarStyle"> + <item name="android:layout_marginRight">@dimen/floating_action_bar_margin</item> + </style> + <!-- Undo bar styles --> <style name="AbstractUndoTextStyle"> <item name="android:textSize">12sp</item> diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java index 019d458d3..96cc4b9a6 100644 --- a/src/com/android/mail/ui/AbstractActivityController.java +++ b/src/com/android/mail/ui/AbstractActivityController.java @@ -140,7 +140,7 @@ import java.util.TimerTask; * </p> */ public abstract class AbstractActivityController implements ActivityController, - EmptyFolderDialogFragment.EmptyFolderDialogFragmentListener { + EmptyFolderDialogFragment.EmptyFolderDialogFragmentListener, View.OnClickListener { // Keys for serialization of various information in Bundles. /** Tag for {@link #mAccount} */ private static final String SAVED_ACCOUNT = "saved-account"; @@ -1271,6 +1271,9 @@ public abstract class AbstractActivityController implements ActivityController, mRecentFolderList.initialize(mActivity); mVeiledMatcher.initialize(this); + final View composeButton = mActivity.findViewById(R.id.compose_button); + composeButton.setOnClickListener(this); + mDrawerToggle = new ActionBarDrawerToggle(mActivity, mDrawerContainer, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close); mDrawerContainer.setDrawerListener(mDrawerListener); @@ -1332,6 +1335,16 @@ public abstract class AbstractActivityController implements ActivityController, } /** + * This controller listens for clicks on items in the floating action bar. + * + * @param view the item that was clicked in the floating action bar + */ + @Override + public void onClick(View view) { + ComposeActivity.compose(mActivity.getActivityContext(), getAccount()); + } + + /** * If drawer is open/visible (even partially), close it. */ protected void closeDrawerIfOpen() { |