diff options
author | Jay Shrauner <shrauner@google.com> | 2015-04-03 15:59:25 -0700 |
---|---|---|
committer | Jay Shrauner <shrauner@google.com> | 2015-04-06 09:14:40 -0700 |
commit | 311841ea1eba23afdbaf1e1ec3502c8f6b398efd (patch) | |
tree | c1b0e24c8116e1c191eca94e3c3cb3abbd3856c8 | |
parent | 1251d29d9de70fa2648751d21b843d456acc6528 (diff) |
Handle recreating SelectPhoneAccountDialogFragment
Bug:20064573
Change-Id: I089c2b890d88747c7914432e8f0229137c960856
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 4f0cc3d93..dd49e0728 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -20,6 +20,7 @@ import android.app.ActionBar; import android.app.Activity; import android.app.ActivityManager; import android.app.AlertDialog; +import android.app.DialogFragment; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; @@ -70,6 +71,7 @@ public class InCallActivity extends Activity implements FragmentDisplayManager { private static final String TAG_CONFERENCE_FRAGMENT = "tag_conference_manager_fragment"; private static final String TAG_CALLCARD_FRAGMENT = "tag_callcard_fragment"; private static final String TAG_ANSWER_FRAGMENT = "tag_answer_fragment"; + private static final String TAG_SELECT_ACCT_FRAGMENT = "tag_select_acct_fragment"; private CallButtonFragment mCallButtonFragment; private CallCardFragment mCallCardFragment; @@ -107,6 +109,19 @@ public class InCallActivity extends Activity implements FragmentDisplayManager { } }; + private SelectPhoneAccountListener mSelectAcctListener = new SelectPhoneAccountListener() { + @Override + public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, + boolean setDefault) { + InCallPresenter.getInstance().handleAccountSelection(selectedAccountHandle, + setDefault); + } + @Override + public void onDialogDismissed() { + InCallPresenter.getInstance().cancelAccountSelection(); + } + }; + /** * Stores the current orientation of the activity. Used to determine if a change in orientation * has occurred. @@ -173,6 +188,12 @@ public class InCallActivity extends Activity implements FragmentDisplayManager { mShowDialpadRequested = icicle.getBoolean(SHOW_DIALPAD_EXTRA); mAnimateDialpadOnShow = false; mDtmfText = icicle.getString(DIALPAD_TEXT_EXTRA); + + SelectPhoneAccountDialogFragment dialogFragment = (SelectPhoneAccountDialogFragment) + getFragmentManager().findFragmentByTag(TAG_SELECT_ACCT_FRAGMENT); + if (dialogFragment != null) { + dialogFragment.setListener(mSelectAcctListener); + } } Log.d(this, "onCreate(): exit"); } @@ -548,22 +569,10 @@ public class InCallActivity extends Activity implements FragmentDisplayManager { phoneAccountHandles = new ArrayList<>(); } - SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { - @Override - public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, - boolean setDefault) { - InCallPresenter.getInstance().handleAccountSelection(selectedAccountHandle, - setDefault); - } - @Override - public void onDialogDismissed() { - InCallPresenter.getInstance().cancelAccountSelection(); - } - }; - - SelectPhoneAccountDialogFragment.showAccountDialog(getFragmentManager(), + DialogFragment dialogFragment = SelectPhoneAccountDialogFragment.newInstance( R.string.select_phone_account_for_calls, true, phoneAccountHandles, - listener); + mSelectAcctListener); + dialogFragment.show(getFragmentManager(), TAG_SELECT_ACCT_FRAGMENT); } else if (!newOutgoingCall) { showCallCardFragment(true); } |