diff options
author | Yorke Lee <yorkelee@google.com> | 2015-07-20 16:18:29 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-07-20 17:33:46 -0700 |
commit | 0bb059d61f1e6648dee6f0a4cf8f02a6a7c26ce7 (patch) | |
tree | eee0c2d0381543c34e4750c5959c0dc823a50df7 /src/com | |
parent | 7e1a68556c419c4b9b1eda9247e80262615fa809 (diff) |
Don't auto expand next voicemail after deleting
Pipe onVoicemailDeleted notification through to CallLogAdapter.
Reset expanded position when that happens.
Bug: 22534894
Change-Id: Iec69082bd8b3259f500b523da6d0710bece69fa4
Diffstat (limited to 'src/com')
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); |