summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/layout/blocked_number_fragment.xml1
-rw-r--r--src/com/android/dialer/filterednumber/BlockedNumberFragment.java39
2 files changed, 37 insertions, 3 deletions
diff --git a/res/layout/blocked_number_fragment.xml b/res/layout/blocked_number_fragment.xml
index 906e8a10c..50c4f44f2 100644
--- a/res/layout/blocked_number_fragment.xml
+++ b/res/layout/blocked_number_fragment.xml
@@ -23,6 +23,7 @@
android:background="@color/blocked_number_background">
<android.support.v7.widget.CardView
+ android:id="@+id/hide_blocked_calls_setting"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
diff --git a/src/com/android/dialer/filterednumber/BlockedNumberFragment.java b/src/com/android/dialer/filterednumber/BlockedNumberFragment.java
index 728d8b287..96dfb7191 100644
--- a/src/com/android/dialer/filterednumber/BlockedNumberFragment.java
+++ b/src/com/android/dialer/filterednumber/BlockedNumberFragment.java
@@ -29,14 +29,20 @@ import android.view.View;
import android.view.ViewGroup;
import com.android.dialer.R;
+import com.android.dialer.calllog.CallLogQueryHandler;
import com.android.dialer.database.FilteredNumberContract;
import com.android.dialer.filterednumber.FilteredNumbersUtil.CheckForSendToVoicemailContactListener;
import com.android.dialer.filterednumber.FilteredNumbersUtil.ImportSendToVoicemailContactsListener;
+import com.android.dialer.voicemail.VoicemailStatusHelper;
+import com.android.dialer.voicemail.VoicemailStatusHelperImpl;
-public class BlockedNumberFragment extends ListFragment implements
- LoaderManager.LoaderCallbacks<Cursor>, View.OnClickListener {
+public class BlockedNumberFragment extends ListFragment
+ implements LoaderManager.LoaderCallbacks<Cursor>, View.OnClickListener,
+ CallLogQueryHandler.Listener {
private BlockedNumberAdapter mAdapter;
+ private CallLogQueryHandler mCallLogQueryHandler;
+ private VoicemailStatusHelper mVoicemailStatusHelper;
private Switch mHideSettingSwitch;
private View mImportSettings;
@@ -52,6 +58,10 @@ public class BlockedNumberFragment extends ListFragment implements
}
setListAdapter(mAdapter);
+ mCallLogQueryHandler
+ = new CallLogQueryHandler(getContext(), getContext().getContentResolver(), this);
+ mVoicemailStatusHelper = new VoicemailStatusHelperImpl();
+
mHideSettingSwitch = (Switch) getActivity().findViewById(R.id.hide_blocked_calls_switch);
mHideSettingSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@@ -93,7 +103,6 @@ public class BlockedNumberFragment extends ListFragment implements
@Override
public void onResume() {
super.onResume();
-
FilteredNumbersUtil.checkForSendToVoicemailContact(
getActivity(), new CheckForSendToVoicemailContactListener() {
@Override
@@ -104,6 +113,7 @@ public class BlockedNumberFragment extends ListFragment implements
});
mHideSettingSwitch.setChecked(FilteredNumbersUtil.shouldHideBlockedCalls(getActivity()));
+ mCallLogQueryHandler.fetchVoicemailStatus();
}
@Override
@@ -147,4 +157,27 @@ public class BlockedNumberFragment extends ListFragment implements
manageBlockedNumbersActivity.enterSearchUi();
}
}
+
+ @Override
+ public void onVoicemailStatusFetched(Cursor cursor) {
+ final boolean hasVisualVoicemailSource =
+ mVoicemailStatusHelper.getNumberActivityVoicemailSources(cursor) > 0;
+ View hideSetting = getActivity().findViewById(R.id.hide_blocked_calls_setting);
+ if (hasVisualVoicemailSource) {
+ hideSetting.setVisibility(View.VISIBLE);
+ } else {
+ hideSetting.setVisibility(View.GONE);
+ }
+ }
+
+ @Override
+ public void onVoicemailUnreadCountFetched(Cursor cursor) {
+ // Do nothing.
+ }
+
+ @Override
+ public boolean onCallsFetched(Cursor cursor) {
+ // Do nothing.
+ return false;
+ }
}