diff options
author | Ta-wei Yen <twyen@google.com> | 2015-10-21 11:27:45 -0700 |
---|---|---|
committer | Ta-wei Yen <twyen@google.com> | 2015-10-21 17:29:01 -0700 |
commit | 05b3215d886d8e7787b49bf2390a87725ffa0c23 (patch) | |
tree | ac039076a1a11a8f9d613ca1b8503b416236d849 | |
parent | 7753b65fb379b5d6a87702ee7e2f8fb1098ebca2 (diff) |
Fixed highlighter stuck on dialpad while in call.
+ InCallActivity.showDialpadFragment() now returns a boolean to indicate if
changes are actually made.
Bug: 18930766
Change-Id: Ib00859a58b289f988606e6427b1d874a69231fbb
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonFragment.java | 24 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 55 |
2 files changed, 50 insertions, 29 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 0987cacc8..1d32d8f1d 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -51,6 +51,7 @@ public class CallButtonFragment extends BaseFragment<CallButtonPresenter, CallButtonPresenter.CallButtonUi> implements CallButtonPresenter.CallButtonUi, OnMenuItemClickListener, OnDismissListener, View.OnClickListener { + private static final int INVALID_INDEX = -1; private int mButtonMaxVisible; // The button is currently visible in the UI @@ -61,6 +62,7 @@ public class CallButtonFragment private static final int BUTTON_MENU = 3; public interface Buttons { + public static final int BUTTON_AUDIO = 0; public static final int BUTTON_MUTE = 1; public static final int BUTTON_DIALPAD = 2; @@ -153,7 +155,7 @@ public class CallButtonFragment mOverflowButton = (ImageButton) parent.findViewById(R.id.overflowButton); mOverflowButton.setOnClickListener(this); mManageVideoCallConferenceButton = (ImageButton) parent.findViewById( - R.id.manageVideoCallConferenceButton); + R.id.manageVideoCallConferenceButton); mManageVideoCallConferenceButton.setOnClickListener(this); return parent; } @@ -181,7 +183,7 @@ public class CallButtonFragment int id = view.getId(); Log.d(this, "onClick(View " + view + ", id " + id + ")..."); - switch(id) { + switch (id) { case R.id.audioButton: onAudioButtonClicked(); break; @@ -258,11 +260,11 @@ public class CallButtonFragment } ImageButton[] normalButtons = { - mSwapButton, - mChangeToVideoButton, - mAddCallButton, - mMergeButton, - mOverflowButton + mSwapButton, + mChangeToVideoButton, + mAddCallButton, + mMergeButton, + mOverflowButton }; for (ImageButton button : normalButtons) { @@ -472,7 +474,7 @@ public class CallButtonFragment } addToOverflowMenu(i, button, menu); } - } else if (visibility == BUTTON_HIDDEN){ + } else if (visibility == BUTTON_HIDDEN) { button.setVisibility(View.GONE); } } @@ -781,9 +783,11 @@ public class CallButtonFragment @Override public void displayDialpad(boolean value, boolean animate) { - mShowDialpadButton.setSelected(value); if (getActivity() != null && getActivity() instanceof InCallActivity) { - ((InCallActivity) getActivity()).showDialpadFragment(value, animate); + boolean changed = ((InCallActivity) getActivity()).showDialpadFragment(value, animate); + if (changed) { + mShowDialpadButton.setSelected(value); + } } } diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 6b80fe02e..aa150ad7b 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -87,16 +87,24 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD private AlertDialog mDialog; - /** Use to pass 'showDialpad' from {@link #onNewIntent} to {@link #onResume} */ + /** + * Use to pass 'showDialpad' from {@link #onNewIntent} to {@link #onResume} + */ private boolean mShowDialpadRequested; - /** Use to determine if the dialpad should be animated on show. */ + /** + * Use to determine if the dialpad should be animated on show. + */ private boolean mAnimateDialpadOnShow; - /** Use to determine the DTMF Text which should be pre-populated in the dialpad. */ + /** + * Use to determine the DTMF Text which should be pre-populated in the dialpad. + */ private String mDtmfText; - /** Use to pass parameters for showing the PostCharDialog to {@link #onResume} */ + /** + * Use to pass parameters for showing the PostCharDialog to {@link #onResume} + */ private boolean mShowPostCharWaitDialogOnResume; private String mShowPostCharWaitDialogCallId; private String mShowPostCharWaitDialogChars; @@ -120,13 +128,16 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD InCallPresenter.getInstance().handleAccountSelection(selectedAccountHandle, setDefault); } + @Override public void onDialogDismissed() { InCallPresenter.getInstance().cancelAccountSelection(); } }; - /** Listener for orientation changes. */ + /** + * Listener for orientation changes. + */ private OrientationEventListener mOrientationEventListener; /** @@ -195,7 +206,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD mDtmfText = icicle.getString(DIALPAD_TEXT_EXTRA); SelectPhoneAccountDialogFragment dialogFragment = (SelectPhoneAccountDialogFragment) - getFragmentManager().findFragmentByTag(TAG_SELECT_ACCT_FRAGMENT); + getFragmentManager().findFragmentByTag(TAG_SELECT_ACCT_FRAGMENT); if (dialogFragment != null) { dialogFragment.setListener(mSelectAcctListener); } @@ -297,7 +308,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD @Override protected void onPause() { Log.d(this, "onPause()..."); - if (mDialpadFragment != null ) { + if (mDialpadFragment != null) { mDialpadFragment.onDialerKeyUp(null); } @@ -438,7 +449,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD public boolean onKeyUp(int keyCode, KeyEvent event) { // push input to the dialer. if (mDialpadFragment != null && (mDialpadFragment.isVisible()) && - (mDialpadFragment.onDialerKeyUp(event))){ + (mDialpadFragment.onDialerKeyUp(event))) { return true; } else if (keyCode == KeyEvent.KEYCODE_CALL) { // Always consume CALL to be sure the PhoneWindow won't do anything with it @@ -521,8 +532,8 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD * Handles changes in device rotation. * * @param rotation The new device rotation (one of: {@link Surface#ROTATION_0}, - * {@link Surface#ROTATION_90}, {@link Surface#ROTATION_180}, - * {@link Surface#ROTATION_270}). + * {@link Surface#ROTATION_90}, {@link Surface#ROTATION_180}, + * {@link Surface#ROTATION_270}). */ private void doOrientationChanged(int rotation) { Log.d(this, "doOrientationChanged prevOrientation=" + sPreviousRotation + @@ -738,10 +749,13 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD throw new IllegalStateException("Unexpected fragment: " + tag); } - public void showDialpadFragment(boolean show, boolean animate) { + /** + * @return {@code true} while the visibility of the dialpad has actually changed. + */ + public boolean showDialpadFragment(boolean show, boolean animate) { // If the dialpad is already visible, don't animate in. If it's gone, don't animate out. if ((show && isDialpadVisible()) || (!show && !isDialpadVisible())) { - return; + return false; } // We don't do a FragmentTransaction on the hide case because it will be dealt with when // the listener is fired after an animation finishes. @@ -760,6 +774,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD if (sensor != null) { sensor.onDialpadVisible(show); } + return true; } public boolean isDialpadVisible() { @@ -774,7 +789,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD * Hides or shows the conference manager fragment. * * @param show {@code true} if the conference manager should be shown, {@code false} if it - * should be hidden. + * should be hidden. */ public void showConferenceFragment(boolean show) { showFragment(TAG_CONFERENCE_FRAGMENT, show, true); @@ -791,7 +806,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD public void showPostCharWaitDialog(String callId, String chars) { if (isVisible()) { - final PostCharDialogFragment fragment = new PostCharDialogFragment(callId, chars); + final PostCharDialogFragment fragment = new PostCharDialogFragment(callId, chars); fragment.show(getFragmentManager(), "postCharWait"); mShowPostCharWaitDialogOnResume = false; @@ -817,7 +832,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD if (!isFinishing() && !TextUtils.isEmpty(disconnectCause.getDescription()) && (disconnectCause.getCode() == DisconnectCause.ERROR || - disconnectCause.getCode() == DisconnectCause.RESTRICTED)) { + disconnectCause.getCode() == DisconnectCause.RESTRICTED)) { showErrorDialog(disconnectCause.getDescription()); } } @@ -846,12 +861,14 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD @Override public void onClick(DialogInterface dialog, int which) { onDialogDismissed(); - }}) + } + }) .setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { onDialogDismissed(); - }}) + } + }) .create(); mDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); @@ -865,10 +882,10 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD } public void setExcludeFromRecents(boolean exclude) { - ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); + ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.AppTask> tasks = am.getAppTasks(); int taskId = getTaskId(); - for (int i=0; i<tasks.size(); i++) { + for (int i = 0; i < tasks.size(); i++) { ActivityManager.AppTask task = tasks.get(i); if (task.getTaskInfo().id == taskId) { try { |