From 12dea3d2f084e0b4f349d1ab987e3b996b68a656 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 28 Oct 2015 16:33:26 -0700 Subject: Simplify FilteredNumberDialogFragment params. Reconstruct the normalized phone number from other params. Bug: 25343277 Change-Id: Ibb526b0808e0b50a4e946d91279e5570af44c3ca --- src/com/android/dialer/CallDetailActivity.java | 1 - .../android/dialer/calllog/CallLogListItemViewHolder.java | 1 - .../dialer/database/FilteredNumberAsyncQueryHandler.java | 12 ++++++++++-- .../dialer/filterednumber/BlockNumberDialogFragment.java | 14 ++------------ .../dialer/filterednumber/BlockedNumbersAdapter.java | 1 - src/com/android/dialer/list/BlockedListSearchFragment.java | 2 -- 6 files changed, 12 insertions(+), 19 deletions(-) (limited to 'src/com') diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 773938cdf..47c3cf0ea 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -360,7 +360,6 @@ public class CallDetailActivity extends AppCompatActivity case R.id.call_detail_action_block: BlockNumberDialogFragment.show( mBlockedNumberId, - null /* normalizedNumber */, mNumber, mDetails.countryIso, mDisplayNumber, diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java index d07f05a65..c6337bc67 100644 --- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java +++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java @@ -329,7 +329,6 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder case R.id.context_menu_block_number: BlockNumberDialogFragment.show( blockId, - info.normalizedNumber, number, countryIso, displayNumber, diff --git a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java index a8fa06ded..5e9d30825 100644 --- a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java +++ b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java @@ -191,11 +191,19 @@ public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler { null); } + public final void blockNumber( + final OnBlockNumberListener listener, String number, String countryIso) { + blockNumber(null, number, countryIso); + } + /** * Add a number manually blocked by the user. */ - public final void blockNumber(final OnBlockNumberListener listener, - String normalizedNumber, String number, String countryIso) { + public final void blockNumber( + final OnBlockNumberListener listener, + String normalizedNumber, + String number, + String countryIso) { if (normalizedNumber == null) { normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso); } diff --git a/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java b/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java index fcd74f368..425a729db 100644 --- a/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java +++ b/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java @@ -58,7 +58,6 @@ public class BlockNumberDialogFragment extends DialogFragment { private static final String BLOCK_DIALOG_FRAGMENT = "BlockNumberDialog"; private static final String ARG_BLOCK_ID = "argBlockId"; - private static final String ARG_NORMALIZED_NUMBER = "argNormalizedNumber"; private static final String ARG_NUMBER = "argNumber"; private static final String ARG_COUNTRY_ISO = "argCountryIso"; private static final String ARG_DISPLAY_NUMBER = "argDisplayNumber"; @@ -66,7 +65,6 @@ public class BlockNumberDialogFragment extends DialogFragment { private String mNumber; private String mDisplayNumber; - private String mNormalizedNumber; private String mCountryIso; private FilteredNumberAsyncQueryHandler mHandler; @@ -75,7 +73,6 @@ public class BlockNumberDialogFragment extends DialogFragment { public static void show( Integer blockId, - String normalizedNumber, String number, String countryIso, String displayNumber, @@ -83,7 +80,7 @@ public class BlockNumberDialogFragment extends DialogFragment { FragmentManager fragmentManager, Callback callback) { final BlockNumberDialogFragment newFragment = BlockNumberDialogFragment.newInstance( - blockId, normalizedNumber, number, countryIso, displayNumber, parentViewId); + blockId, number, countryIso, displayNumber, parentViewId); newFragment.setCallback(callback); newFragment.show(fragmentManager, BlockNumberDialogFragment.BLOCK_DIALOG_FRAGMENT); @@ -91,7 +88,6 @@ public class BlockNumberDialogFragment extends DialogFragment { private static BlockNumberDialogFragment newInstance( Integer blockId, - String normalizedNumber, String number, String countryIso, String displayNumber, @@ -104,7 +100,6 @@ public class BlockNumberDialogFragment extends DialogFragment { if (parentViewId != null) { args.putInt(ARG_PARENT_VIEW_ID, parentViewId.intValue()); } - args.putString(ARG_NORMALIZED_NUMBER, normalizedNumber); args.putString(ARG_NUMBER, number); args.putString(ARG_COUNTRY_ISO, countryIso); args.putString(ARG_DISPLAY_NUMBER, displayNumber); @@ -119,12 +114,8 @@ public class BlockNumberDialogFragment extends DialogFragment { mNumber = getArguments().getString(ARG_NUMBER); mDisplayNumber = getArguments().getString(ARG_DISPLAY_NUMBER); - mNormalizedNumber = getArguments().getString(ARG_NORMALIZED_NUMBER); mCountryIso = getArguments().getString(ARG_COUNTRY_ISO); - if (TextUtils.isEmpty(mNormalizedNumber)) { - mNormalizedNumber = PhoneNumberUtils.formatNumberToE164(mNumber, mCountryIso); - } if (TextUtils.isEmpty(mDisplayNumber)) { mDisplayNumber = mNumber; } @@ -160,7 +151,7 @@ public class BlockNumberDialogFragment extends DialogFragment { @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - if (!FilteredNumbersUtil.canBlockNumber(getActivity(), mNormalizedNumber)) { + if (!FilteredNumbersUtil.canBlockNumber(getActivity(), mNumber)) { dismiss(); Toast.makeText(getContext(), getString(R.string.invalidNumber, mDisplayNumber), Toast.LENGTH_SHORT).show(); @@ -237,7 +228,6 @@ public class BlockNumberDialogFragment extends DialogFragment { mHandler.blockNumber( onBlockNumberListener, - mNormalizedNumber, mNumber, mCountryIso); } diff --git a/src/com/android/dialer/filterednumber/BlockedNumbersAdapter.java b/src/com/android/dialer/filterednumber/BlockedNumbersAdapter.java index 71a054721..ad9e7a652 100644 --- a/src/com/android/dialer/filterednumber/BlockedNumbersAdapter.java +++ b/src/com/android/dialer/filterednumber/BlockedNumbersAdapter.java @@ -61,7 +61,6 @@ public class BlockedNumbersAdapter extends NumbersAdapter { public void onClick(View view) { BlockNumberDialogFragment.show( id, - normalizedNumber, number, countryIso, number, diff --git a/src/com/android/dialer/list/BlockedListSearchFragment.java b/src/com/android/dialer/list/BlockedListSearchFragment.java index 805d969a3..be97664b2 100644 --- a/src/com/android/dialer/list/BlockedListSearchFragment.java +++ b/src/com/android/dialer/list/BlockedListSearchFragment.java @@ -177,7 +177,6 @@ public class BlockedListSearchFragment extends RegularSearchFragment if (id == null) { BlockNumberDialogFragment.show( id, - null, number, countryIso, number, @@ -226,7 +225,6 @@ public class BlockedListSearchFragment extends RegularSearchFragment BlockNumberDialogFragment.show( blockId, - null, number, GeoUtil.getCurrentCountryIso(getContext()), number, -- cgit v1.2.3