diff options
author | Andrew Lee <anwlee@google.com> | 2015-10-13 13:07:58 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-10-15 10:50:23 -0700 |
commit | 8d0847ca13ca46730756e1d3a3dff3d7d27fd18b (patch) | |
tree | 970ac6cd6adda1bb9590027b5409f2b2a2336660 /src/com/android/dialer/CallDetailActivity.java | |
parent | 6988a32f6ee311480dd3657a1d7bf9981144fa5a (diff) |
Polish call blocking rotation/undo behaviors.
+ Correctly dismiss filtered number dialog on rotate.
+ Polish listener interface, and extend across all block/unblock
and undo scenarios.
+ Update UI across all blocking scenarios (call log, call detail,
settings, blocked number list, blocked number search);
+ Conslidate creation of FilterNumberDialogFragment in a single
static method.
The listener interface is not ideal, because it does not maintain
state well across rotation and multiple instances. This option was
selected, however, because of the number of scenarios in which
the dialog is invoked and various circumstances (in a RecyclerView
list item, in a fragment, in an activity). This range of scenarios
makes it convoluted to implement a uniform mechanism in any other
way, so the approach opted for is to set a listener, and dismiss
the dialog on rotation..
Bug: 24638328
Bug: 24109819
Bug: 24871853
Change-Id: I2332edda2cae0341af3e80b13aa96af6068f75ac
Diffstat (limited to 'src/com/android/dialer/CallDetailActivity.java')
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 696168a8f..654a96fcf 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -71,8 +71,7 @@ import com.android.incallui.Call.LogState; */ public class CallDetailActivity extends AppCompatActivity implements MenuItem.OnMenuItemClickListener, View.OnClickListener, - FilterNumberDialogFragment.OnBlockListener, - FilterNumberDialogFragment.OnUndoBlockListener { + FilterNumberDialogFragment.Callback { private static final String TAG = CallDetailActivity.class.getSimpleName(); /** A long array extra containing ids of call log entries to display. */ @@ -305,16 +304,6 @@ public class CallDetailActivity extends AppCompatActivity } @Override - public void onBlockComplete(Uri uri) { - updateBlockActionItem(); - } - - @Override - public void onUndoBlockComplete() { - updateBlockActionItem(); - } - - @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { TouchPointManager.getInstance().setPoint((int) ev.getRawX(), (int) ev.getRawY()); @@ -406,17 +395,15 @@ public class CallDetailActivity extends AppCompatActivity public void onClick(View view) { switch(view.getId()) { case R.id.call_detail_action_block: - // TODO: Use helper, this code is repeated in several places. - FilterNumberDialogFragment newFragment = - FilterNumberDialogFragment.newInstance( - mBlockedNumberId, null, mNumber, null, mDisplayNumber); - // TODO: Cleanup this listener pattern. This only works correctly for undoing - // blocking, not undoing unblocking. - newFragment.setOnBlockListener(this); - newFragment.setOnUndoBlockListener(this); - newFragment.setParentView(findViewById(R.id.call_detail)); - newFragment.show( - getFragmentManager(), FilterNumberDialogFragment.BLOCK_DIALOG_FRAGMENT); + FilterNumberDialogFragment.show( + mBlockedNumberId, + null /* normalizedNumber */, + mNumber, + null /* countryIso */, + mDisplayNumber, + R.id.call_detail, + getFragmentManager(), + this); break; case R.id.call_detail_action_copy: ClipboardUtils.copyText(mContext, null, mNumber, true); @@ -431,6 +418,16 @@ public class CallDetailActivity extends AppCompatActivity } } + @Override + public void onChangeFilteredNumberSuccess() { + updateBlockActionItem(); + } + + @Override + public void onChangeFilteredNumberUndo() { + updateBlockActionItem(); + } + private void updateBlockActionItem() { if (mDetails == null) { return; |