summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTa-wei Yen <twyen@google.com>2015-10-22 17:25:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-22 17:25:22 +0000
commitd565cc87dded68f4bbe64ead6c868523ad267de4 (patch)
tree27690073a80e04ec45b16eac3c11738204c3ee44
parent3867a0ac286d0c9cc457b81e9db5d36019e786e4 (diff)
parent05b3215d886d8e7787b49bf2390a87725ffa0c23 (diff)
Merge "Fixed highlighter stuck on dialpad while in call." into ub-contactsdialer-a-dev
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonFragment.java24
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java55
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 {