From d77a58b53f4cb0866d99fe652e77e636ab586119 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Tue, 20 Oct 2015 15:56:00 -0700 Subject: Hide the hide blocked call settings if no VVM. We can only honor deleting voicemail for VVM users. Bug:24134270 Change-Id: I2b4ea6856ab4bc79ad93ac111bc78bc7f8b4833e --- .../filterednumber/BlockedNumberFragment.java | 39 ++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'src/com') 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, View.OnClickListener { +public class BlockedNumberFragment extends ListFragment + implements LoaderManager.LoaderCallbacks, 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; + } } -- cgit v1.2.3