diff options
author | Nancy Chen <nancychen@google.com> | 2014-07-29 16:32:56 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-07-29 16:32:56 -0700 |
commit | 00067445f4120fca1a3089290f21a46b2384b00e (patch) | |
tree | 56a09d6bddd1ecde942481b3d524c2c195898fb6 /src | |
parent | a96c244d7a4ee2e23302846d337324c3a6d91c46 (diff) |
Fade menu overflow icon in and out for dialpad
When there are no digits, the menu overflow icon should be invisible and
all options disabled. Fade in when a digit is typed and fade out when
there are no longer any digits.
Bug: 15697565
Change-Id: I86540e0b2e456b18686e19ae4a0ab4f751407cfc
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 450b9af75..0491d973a 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -76,8 +76,10 @@ import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.util.DialerUtils; import com.android.phone.common.CallLogAsync; import com.android.phone.common.HapticFeedback; +import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.dialpad.DialpadKeyButton; import com.android.phone.common.dialpad.DialpadView; + import com.google.common.annotations.VisibleForTesting; import java.util.HashSet; @@ -169,6 +171,7 @@ public class DialpadFragment extends Fragment /** Remembers if we need to clear digits field when the screen is completely gone. */ private boolean mClearDigitsOnStop; + private View mOverflowMenuButton; private PopupMenu mOverflowPopupMenu; private View mDelete; private ToneGenerator mToneGenerator; @@ -285,6 +288,9 @@ public class DialpadFragment extends Fragment final Activity activity = getActivity(); if (activity != null) { activity.invalidateOptionsMenu(); + + boolean transitionIn = mWasEmptyBeforeTextChange? true : false; + updateMenuOverflowButton(transitionIn); } } @@ -646,10 +652,11 @@ public class DialpadFragment extends Fragment mSmsPackageComponentName = DialerUtils.getSmsComponent(activity); - View overflowMenuButton = mDialpadView.getOverflowMenuButton(); - mOverflowPopupMenu = buildOptionsMenu(overflowMenuButton); - overflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener()); - overflowMenuButton.setOnClickListener(this); + mOverflowMenuButton = mDialpadView.getOverflowMenuButton(); + mOverflowPopupMenu = buildOptionsMenu(mOverflowMenuButton); + mOverflowMenuButton.setOnTouchListener(mOverflowPopupMenu.getDragToOpenListener()); + mOverflowMenuButton.setOnClickListener(this); + mOverflowMenuButton.setVisibility(View.INVISIBLE); } @Override @@ -1480,6 +1487,21 @@ public class DialpadFragment extends Fragment } /** + * Handle transitions for the menu button depending on the state of the digits edit text. + * Transition out when going from digits to no digits and transition in when the first digit + * is pressed. + * @param transitionIn True if transitioning in, False if transitioning out + */ + private void updateMenuOverflowButton(boolean transitionIn) { + mOverflowMenuButton = mDialpadView.getOverflowMenuButton(); + if (transitionIn) { + AnimUtils.fadeIn(mOverflowMenuButton, AnimUtils.DEFAULT_DURATION); + } else { + AnimUtils.fadeOut(mOverflowMenuButton, AnimUtils.DEFAULT_DURATION); + } + } + + /** * Check if voicemail is enabled/accessible. * * @return true if voicemail is enabled and accessibly. Note that this can be false |