diff options
author | Andrew Lee <anwlee@google.com> | 2014-03-28 17:49:56 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2014-03-28 18:01:42 -0700 |
commit | e30f7aeb2d251023b21927a86dd723a299908bb6 (patch) | |
tree | f36b12ede3671a297a5d9ab60222753c102fbe7b /InCallUI/src/com/android/incallui/InCallActivity.java | |
parent | 5c33f882c54c2b356518a54dbdc6e2c6b6e09cc5 (diff) |
Don't show wait dialog if the activity is paused.
Instead, save parameters for the call to show the
PostCharDialogFragment to member variables if InCallUI is not the
foreground activity. When the activity is resumed, show the
PostCharDialogFragment with these saved parameters.
Bug: 13177104
Change-Id: I95629bfdece2f6f9efed2aa06d01b53791ff756d
Diffstat (limited to 'InCallUI/src/com/android/incallui/InCallActivity.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index a97f6a05f..05f0d31af 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -55,6 +55,11 @@ public class InCallActivity extends Activity { /** Use to pass 'showDialpad' from {@link #onNewIntent} to {@link #onResume} */ private boolean mShowDialpadRequested; + /** Use to pass parameters for showing the PostCharDialog to {@link #onResume} */ + private boolean mShowPostCharWaitDialogOnResume; + private int mShowPostCharWaitDialogCallId; + private String mShowPostCharWaitDialogChars; + @Override protected void onCreate(Bundle icicle) { Log.d(this, "onCreate()... this = " + this); @@ -102,6 +107,10 @@ public class InCallActivity extends Activity { mCallButtonFragment.displayDialpad(true); mShowDialpadRequested = false; } + + if (mShowPostCharWaitDialogOnResume) { + showPostCharWaitDialog(mShowPostCharWaitDialogCallId, mShowPostCharWaitDialogChars); + } } // onPause is guaranteed to be called when the InCallActivity goes @@ -427,8 +436,18 @@ public class InCallActivity extends Activity { } public void showPostCharWaitDialog(int callId, String chars) { - final PostCharDialogFragment fragment = new PostCharDialogFragment(callId, chars); - fragment.show(getFragmentManager(), "postCharWait"); + if (isForegroundActivity()) { + final PostCharDialogFragment fragment = new PostCharDialogFragment(callId, chars); + fragment.show(getFragmentManager(), "postCharWait"); + + mShowPostCharWaitDialogOnResume = false; + mShowPostCharWaitDialogCallId = 0; + mShowPostCharWaitDialogChars = null; + } else { + mShowPostCharWaitDialogOnResume = true; + mShowPostCharWaitDialogCallId = callId; + mShowPostCharWaitDialogChars = chars; + } } @Override @@ -468,18 +487,18 @@ public class InCallActivity extends Activity { dismissPendingDialogs(); mDialog = new AlertDialog.Builder(this) - .setMessage(msg) - .setPositiveButton(R.string.ok, new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - onDialogDismissed(); - }}) - .setOnCancelListener(new OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - onDialogDismissed(); - }}) - .create(); + .setMessage(msg) + .setPositiveButton(R.string.ok, new OnClickListener() { + @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); mDialog.show(); |