summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-07-21 22:06:30 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-21 22:06:30 +0000
commitcaffe04eaee46e045d3b2fdb34e572fdd7fe9fdd (patch)
treefd516fedc1902c71040c9e1a8bef5b6d83ba9159
parent664b2018c038fa4626dd06741f117ed3296c11ea (diff)
parent237e0cc3015fb6eb43a0f5caeaff2a817e606ada (diff)
am 237e0cc3: am 27960806: am df0f5065: am f081672f: am 0bb059d6: Don\'t auto expand next voicemail after deleting
* commit '237e0cc3015fb6eb43a0f5caeaff2a817e606ada': Don't auto expand next voicemail after deleting
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java13
-rw-r--r--src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java1
-rw-r--r--src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java17
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 67eaf6a6c..32dd8f300 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -66,7 +66,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 {
@@ -340,6 +342,9 @@ public class CallLogAdapter extends GroupingListAdapter
mCallFetcher = callFetcher;
mContactInfoHelper = contactInfoHelper;
mVoicemailPlaybackPresenter = voicemailPlaybackPresenter;
+ if (mVoicemailPlaybackPresenter != null) {
+ mVoicemailPlaybackPresenter.setOnVoicemailDeletedListener(this);
+ }
mIsShowingRecentsTab = isShowingRecentsTab;
mContactInfoCache = new ContactInfoCache(
@@ -645,6 +650,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);