diff options
author | Andrew Lee <anwlee@google.com> | 2015-10-20 15:56:00 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-10-20 15:56:00 -0700 |
commit | d77a58b53f4cb0866d99fe652e77e636ab586119 (patch) | |
tree | 80d9a1253fb1e4381e639d69c4c44fe734e094a5 /src | |
parent | b2ae1410907a622c59175f821d07d3c936b2882c (diff) |
Hide the hide blocked call settings if no VVM.
We can only honor deleting voicemail for VVM users.
Bug:24134270
Change-Id: I2b4ea6856ab4bc79ad93ac111bc78bc7f8b4833e
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; + } } |