diff options
author | Jay Shrauner <shrauner@google.com> | 2015-04-09 22:38:52 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-04-09 22:38:52 +0000 |
commit | d8dd0315ecab4d838cd621996d72301c6a35677b (patch) | |
tree | 665b5ed79bfcc8f7c41c769645dd0c130a1db2e8 /InCallUI | |
parent | 175ef5f7a89c06684c74462131ca70c09d15544e (diff) | |
parent | 311841ea1eba23afdbaf1e1ec3502c8f6b398efd (diff) |
Merge "Handle recreating SelectPhoneAccountDialogFragment"
Diffstat (limited to 'InCallUI')
-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); } |