diff options
author | Sai Cheemalapati <saicheems@google.com> | 2014-07-16 15:06:26 -0700 |
---|---|---|
committer | Sai Cheemalapati <saicheems@google.com> | 2014-07-16 15:06:26 -0700 |
commit | 48da258e6a4fd42379816c03ef7c9d75980cc40f (patch) | |
tree | 6b09e3e94b02d2612aca0bc814b52ff0d329aea9 /src | |
parent | 0c41ef04d2d5ad0bbe5f498f9492052a4a4725b8 (diff) |
Added AsyncTask to report dialog/fixed rot (2/2).
Dialog used to cause crash on rotation due to issues with Fragment
Manager. The solution now is to dismiss it before rotation and
reinitialize it in onCreate.
Bug: 11150383
Change-Id: I972785637e0c302547cd9ac11b5c8f84723b2863
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index 852370566..5d09e7445 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -71,6 +71,10 @@ public class CallLogFragment extends ListFragment CallLogAdapter.CallItemExpandedListener { private static final String TAG = "CallLogFragment"; + private static final String REPORT_DIALOG_TAG = "report_dialog"; + private String mReportDialogNumber; + private boolean mIsReportDialogShowing; + /** * ID of the empty loader to defer other fragments. */ @@ -80,6 +84,8 @@ public class CallLogFragment extends ListFragment private static final String KEY_LOG_LIMIT = "log_limit"; private static final String KEY_DATE_LIMIT = "date_limit"; private static final String KEY_SHOW_FOOTER = "show_footer"; + private static final String KEY_IS_REPORT_DIALOG_SHOWING = "is_report_dialog_showing"; + private static final String KEY_REPORT_DIALOG_NUMBER = "report_dialog_number"; private CallLogAdapter mAdapter; private CallLogQueryHandler mCallLogQueryHandler; @@ -184,6 +190,9 @@ public class CallLogFragment extends ListFragment mLogLimit = state.getInt(KEY_LOG_LIMIT, mLogLimit); mDateLimit = state.getLong(KEY_DATE_LIMIT, mDateLimit); mHasFooterView = state.getBoolean(KEY_SHOW_FOOTER, mHasFooterView); + mIsReportDialogShowing = state.getBoolean(KEY_IS_REPORT_DIALOG_SHOWING, + mIsReportDialogShowing); + mReportDialogNumber = state.getString(KEY_REPORT_DIALOG_NUMBER, mReportDialogNumber); } String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity()); @@ -210,6 +219,14 @@ public class CallLogFragment extends ListFragment mFadeOutDuration = getResources().getInteger(R.integer.call_log_actions_fade_out_duration); mExpandCollapseDuration = getResources().getInteger( R.integer.call_log_expand_collapse_duration); + + if (mIsReportDialogShowing) { + DialogFragment df = ObjectFactory.getReportDialogFragment(mReportDialogNumber); + if (df != null) { + df.setTargetFragment(this, 0); + df.show(getActivity().getFragmentManager(), REPORT_DIALOG_TAG); + } + } } /** Called by the CallLogQueryHandler when the list of calls has been fetched or updated. */ @@ -396,6 +413,8 @@ public class CallLogFragment extends ListFragment outState.putInt(KEY_LOG_LIMIT, mLogLimit); outState.putLong(KEY_DATE_LIMIT, mDateLimit); outState.putBoolean(KEY_SHOW_FOOTER, mHasFooterView); + outState.putBoolean(KEY_IS_REPORT_DIALOG_SHOWING, mIsReportDialogShowing); + outState.putString(KEY_REPORT_DIALOG_NUMBER, mReportDialogNumber); } @Override @@ -668,6 +687,10 @@ public class CallLogFragment extends ListFragment } public void onBadDataReported(String number) { + mIsReportDialogShowing = false; + if (number == null) { + return; + } mAdapter.onBadDataReported(number); mAdapter.notifyDataSetChanged(); } @@ -676,7 +699,9 @@ public class CallLogFragment extends ListFragment DialogFragment df = ObjectFactory.getReportDialogFragment(number); if (df != null) { df.setTargetFragment(this, 0); - df.show(getActivity().getFragmentManager(), "report_dialog"); + df.show(getActivity().getFragmentManager(), REPORT_DIALOG_TAG); + mReportDialogNumber = number; + mIsReportDialogShowing = true; } } } |