diff options
Diffstat (limited to 'src/com/android/dialer/calllog/CallLogFragment.java')
| -rw-r--r-- | src/com/android/dialer/calllog/CallLogFragment.java | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java index aceaea7c0..b6140c702 100644 --- a/src/com/android/dialer/calllog/CallLogFragment.java +++ b/src/com/android/dialer/calllog/CallLogFragment.java @@ -47,8 +47,12 @@ import com.android.dialer.voicemail.VoicemailPlaybackPresenter; import com.android.dialer.widget.EmptyContentView; import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClickedListener; import com.android.dialerbind.ObjectFactory; +import com.android.dialer.deeplink.DeepLinkIntegrationManager; import com.android.phone.common.incall.CallMethodInfo; import com.android.phone.common.incall.DialerDataSubscription; +import com.cyanogen.ambient.common.api.ResultCallback; +import com.cyanogen.ambient.deeplink.DeepLink; +import com.cyanogen.ambient.deeplink.applicationtype.DeepLinkApplicationType; import com.cyanogen.ambient.incall.CallLogConstants; import java.util.HashMap; @@ -120,6 +124,10 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis // Exactly same variable is in Fragment as a package private. private boolean mMenuVisible = true; + // track the enabled/disabled status of the DeepLinkApi so we can update the CalLog in onResume + // when returning from settings. + private boolean isDeepLinkApiEnabled = false; + // Default to all calls. private int mCallTypeFilter = CallLogQueryHandler.CALL_TYPE_ALL; @@ -153,6 +161,19 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis } }; + /* DeepLinkApi global on/off settings check callback. */ + private ResultCallback<DeepLink.BooleanResult> mDeepLinkEnabledCallback = + new ResultCallback<DeepLink.BooleanResult>() { + @Override + public void onResult(DeepLink.BooleanResult result) { + boolean value = result.getResults(); + if (isDeepLinkApiEnabled != value) { + refreshData(); + } + isDeepLinkApiEnabled = value; + } + }; + public interface HostInterface { public void showDialpad(); } @@ -221,7 +242,6 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis } mBlockContactPresenter = new BlockContactPresenter(activity, this); - boolean isShowingRecentsTab = mLogLimit != NO_LOG_LIMIT || mDateLimit != NO_DATE_LIMIT; mAdapter = ObjectFactory.newCallLogAdapter( getActivity(), @@ -230,6 +250,7 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis mVoicemailPlaybackPresenter, mBlockContactPresenter, isShowingRecentsTab); + areDeepLinkEnabled(); } /** Called by the CallLogQueryHandler when the list of calls has been fetched or updated. */ @@ -313,6 +334,15 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis String currentCountryIso = GeoUtil.getCurrentCountryIso(getActivity()); mRecyclerView.setAdapter(mAdapter); + mRecyclerView.setRecyclerListener(new RecyclerView.RecyclerListener() { + @Override + public void onViewRecycled(RecyclerView.ViewHolder holder) { + if (holder instanceof CallLogListItemViewHolder) { + final CallLogListItemViewHolder views = (CallLogListItemViewHolder) holder; + mAdapter.mDeepLinkCache.clearPendingQueries(views.number, views.callTimes); + } + } + }); fetchCalls(); return view; @@ -348,12 +378,13 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis updateEmptyMessage(mCallTypeFilter); } mHasReadCallLogPermission = hasReadCallLogPermission; - if (DialerDataSubscription.get(getActivity()) .subscribe(AMBIENT_SUBSCRIPTION_ID, pluginsUpdatedReceiver)) { refreshData(); mAdapter.startCache(); } + + areDeepLinkEnabled(); } @Override @@ -481,6 +512,11 @@ public class CallLogFragment extends Fragment implements CallLogQueryHandler.Lis } } + private void areDeepLinkEnabled() { + DeepLinkIntegrationManager.getInstance().isApplicationTypeEnabled( + DeepLinkApplicationType.NOTE, mDeepLinkEnabledCallback); + } + /** * Updates the call data and notification state on entering or leaving the call log tab. * |
