diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/filterednumber/BlockedNumberFragment.java | 39 |
1 files changed, 36 insertions, 3 deletions
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; + } } |