diff options
Diffstat (limited to 'java/com/android')
-rw-r--r-- | java/com/android/dialer/main/impl/MainActivity.java | 16 | ||||
-rw-r--r-- | java/com/android/dialer/main/impl/NewMainActivityPeer.java | 16 |
2 files changed, 18 insertions, 14 deletions
diff --git a/java/com/android/dialer/main/impl/MainActivity.java b/java/com/android/dialer/main/impl/MainActivity.java index fbcbeff38..1d705f06c 100644 --- a/java/com/android/dialer/main/impl/MainActivity.java +++ b/java/com/android/dialer/main/impl/MainActivity.java @@ -19,6 +19,8 @@ package com.android.dialer.main.impl; import android.content.Context; import android.content.Intent; import android.os.Bundle; +import android.support.v4.content.LocalBroadcastManager; +import com.android.dialer.blockreportspam.ShowBlockReportSpamDialogReceiver; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProviderBindings; @@ -39,6 +41,12 @@ public class MainActivity extends TransactionSafeActivity private MainActivityPeer activePeer; + /** + * {@link android.content.BroadcastReceiver} that shows a dialog to block a number and/or report + * it as spam when notified. + */ + private ShowBlockReportSpamDialogReceiver showBlockReportSpamDialogReceiver; + public static Intent getShowCallLogIntent(Context context) { return getShowTabIntent(context, TabIndex.CALL_LOG); } @@ -69,6 +77,8 @@ public class MainActivity extends TransactionSafeActivity // If peer was set by the super, don't reset it. activePeer = getNewPeer(); activePeer.onActivityCreate(savedInstanceState); + + showBlockReportSpamDialogReceiver = new ShowBlockReportSpamDialogReceiver(getFragmentManager()); } protected MainActivityPeer getNewPeer() { @@ -90,6 +100,10 @@ public class MainActivity extends TransactionSafeActivity protected void onResume() { super.onResume(); activePeer.onActivityResume(); + + LocalBroadcastManager.getInstance(this) + .registerReceiver( + showBlockReportSpamDialogReceiver, ShowBlockReportSpamDialogReceiver.getIntentFilter()); } @Override @@ -102,6 +116,8 @@ public class MainActivity extends TransactionSafeActivity protected void onPause() { super.onPause(); activePeer.onActivityPause(); + + LocalBroadcastManager.getInstance(this).unregisterReceiver(showBlockReportSpamDialogReceiver); } @Override diff --git a/java/com/android/dialer/main/impl/NewMainActivityPeer.java b/java/com/android/dialer/main/impl/NewMainActivityPeer.java index 081559a2b..960787972 100644 --- a/java/com/android/dialer/main/impl/NewMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/NewMainActivityPeer.java @@ -22,8 +22,6 @@ import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; -import android.support.v4.content.LocalBroadcastManager; -import com.android.dialer.blockreportspam.ShowBlockReportSpamDialogReceiver; import com.android.dialer.calllog.CallLogComponent; import com.android.dialer.calllog.ui.NewCallLogFragment; import com.android.dialer.common.concurrent.DefaultFutureCallback; @@ -39,12 +37,9 @@ import com.google.common.util.concurrent.MoreExecutors; public class NewMainActivityPeer implements MainActivityPeer { private final MainActivity mainActivity; - private final ShowBlockReportSpamDialogReceiver showBlockReportSpamDialogReceiver; public NewMainActivityPeer(MainActivity mainActivity) { this.mainActivity = mainActivity; - this.showBlockReportSpamDialogReceiver = - new ShowBlockReportSpamDialogReceiver(mainActivity.getFragmentManager()); } @Override @@ -59,20 +54,13 @@ public class NewMainActivityPeer implements MainActivityPeer { } @Override - public void onActivityResume() { - LocalBroadcastManager.getInstance(mainActivity) - .registerReceiver( - showBlockReportSpamDialogReceiver, ShowBlockReportSpamDialogReceiver.getIntentFilter()); - } + public void onActivityResume() {} @Override public void onUserLeaveHint() {} @Override - public void onActivityPause() { - LocalBroadcastManager.getInstance(mainActivity) - .unregisterReceiver(showBlockReportSpamDialogReceiver); - } + public void onActivityPause() {} @Override public void onActivityStop() {} |