From 225fb227d23031da36bcf8e973f4324701ddaf17 Mon Sep 17 00:00:00 2001 From: Jorge Ruesga Date: Sun, 29 Mar 2015 03:44:57 +0200 Subject: email: fix back button If conversation_topmost_overlay is not ready to take the focus, if the drawerlayout has the focus (this happens always that the drawerlayout is shown in a conversation view) then the onBackPressed event never get dispatched to the mail activity, and press the back button doesn't have effect. Just double check that the conversation_topmost_overlay view can take focus. In case it can't take the focus don't response we handled the keyup event. Also, add a double check over the drawer slide event to prevent burger menu to be displayed when the back arrow button should be the one displayed. Change-Id: I964eb1eb779af13c9b2c07b77049147c2ff1f2d9 Signed-off-by: Jorge Ruesga --- src/com/android/mail/ui/AbstractActivityController.java | 3 ++- src/com/android/mail/ui/ConversationViewFragment.java | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/com/android/mail/ui/AbstractActivityController.java b/src/com/android/mail/ui/AbstractActivityController.java index d5122ae97..88c016754 100644 --- a/src/com/android/mail/ui/AbstractActivityController.java +++ b/src/com/android/mail/ui/AbstractActivityController.java @@ -4410,13 +4410,14 @@ public abstract class AbstractActivityController implements ActivityController, if (slideOffset > 0.15f) { mDrawerToggle.setDrawerIndicatorEnabled(true /* enable */); } else { - if (mOldSlideOffset < slideOffset) { + if (mOldSlideOffset < slideOffset || (slideOffset == 0f && mOldSlideOffset > 0f)) { final int mode = mViewMode.getMode(); final boolean isTopLevel = Folder.isRoot(mFolder); mDrawerToggle.setDrawerIndicatorEnabled( getShouldShowDrawerIndicator(mode, isTopLevel)); } } + mDrawerContainer.clearFocus(); mOldSlideOffset = slideOffset; diff --git a/src/com/android/mail/ui/ConversationViewFragment.java b/src/com/android/mail/ui/ConversationViewFragment.java index d3c7600aa..519196ec5 100644 --- a/src/com/android/mail/ui/ConversationViewFragment.java +++ b/src/com/android/mail/ui/ConversationViewFragment.java @@ -1212,10 +1212,7 @@ public class ConversationViewFragment extends AbstractConversationViewFragment i // Finally we handle the special keys if (keyCode == KeyEvent.KEYCODE_BACK && id != R.id.conversation_topmost_overlay) { - if (isActionUp) { - mTopmostOverlay.requestFocus(); - } - return true; + return mTopmostOverlay.requestFocus(); } else if (keyCode == KeyEvent.KEYCODE_ENTER && id == R.id.conversation_topmost_overlay) { if (isActionUp) { -- cgit v1.2.3