diff options
Diffstat (limited to 'src')
3 files changed, 30 insertions, 1 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 458c90bdc..b8b9f0bfc 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -65,7 +65,9 @@ import java.util.HashMap; * Adapter class to fill in data for the Call Log. */ public class CallLogAdapter extends GroupingListAdapter - implements ViewTreeObserver.OnPreDrawListener, CallLogGroupBuilder.GroupCreator { + implements ViewTreeObserver.OnPreDrawListener, + CallLogGroupBuilder.GroupCreator, + VoicemailPlaybackPresenter.OnVoicemailDeletedListener { /** Interface used to initiate a refresh of the content. */ public interface CallFetcher { @@ -314,6 +316,9 @@ public class CallLogAdapter extends GroupingListAdapter mCallFetcher = callFetcher; mContactInfoHelper = contactInfoHelper; mVoicemailPlaybackPresenter = voicemailPlaybackPresenter; + if (mVoicemailPlaybackPresenter != null) { + mVoicemailPlaybackPresenter.setOnVoicemailDeletedListener(this); + } mIsShowingRecentsTab = isShowingRecentsTab; mContactInfoCache = new ContactInfoCache( @@ -619,6 +624,12 @@ public class CallLogAdapter extends GroupingListAdapter return mIsShowingRecentsTab; } + @Override + public void onVoicemailDeleted(Uri uri) { + mCurrentlyExpandedRowId = NO_EXPANDED_LIST_ITEM; + mCurrentlyExpandedPosition = RecyclerView.NO_POSITION; + } + /** * Retrieves the day group of the previous call in the call log. Used to determine if the day * group has changed and to trigger display of the day group text. diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java b/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java index 70d6c6133..213bba164 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java @@ -185,6 +185,7 @@ public class VoicemailPlaybackLayout extends LinearLayout } mPresenter.pausePlayback(); CallLogAsyncTaskUtil.deleteVoicemail(mContext, mVoicemailUri, null); + mPresenter.onVoicemailDeleted(); } }; diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java index 90617df79..c54dfe0c3 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java @@ -92,6 +92,10 @@ public class VoicemailPlaybackPresenter void setPresenter(VoicemailPlaybackPresenter presenter, Uri voicemailUri); } + public interface OnVoicemailDeletedListener { + void onVoicemailDeleted(Uri uri); + } + /** The enumeration of {@link AsyncTask} objects we use in this class. */ public enum Tasks { CHECK_FOR_CONTENT, @@ -155,6 +159,8 @@ public class VoicemailPlaybackPresenter private PowerManager.WakeLock mProximityWakeLock; private AudioManager mAudioManager; + private OnVoicemailDeletedListener mOnVoicemailDeletedListener; + /** * Obtain singleton instance of this class. Use a single instance to provide a consistent * listener to the AudioManager when requesting and abandoning audio focus. @@ -708,10 +714,21 @@ public class VoicemailPlaybackPresenter return mAudioManager.isSpeakerphoneOn(); } + public void setOnVoicemailDeletedListener(OnVoicemailDeletedListener listener) { + mOnVoicemailDeletedListener = listener; + } + public int getMediaPlayerPosition() { return mIsPrepared && mMediaPlayer != null ? mMediaPlayer.getCurrentPosition() : 0; } + /* package */ void onVoicemailDeleted() { + // Trampoline the event notification to the interested listener + if (mOnVoicemailDeletedListener != null) { + mOnVoicemailDeletedListener.onVoicemailDeleted(mVoicemailUri); + } + } + private static synchronized ScheduledExecutorService getScheduledExecutorServiceInstance() { if (mScheduledExecutorService == null) { mScheduledExecutorService = Executors.newScheduledThreadPool(NUMBER_OF_THREADS_IN_POOL); |