summaryrefslogtreecommitdiff
path: root/src/com/android/dialer
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/dialer')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java15
-rw-r--r--src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java1
-rw-r--r--src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java44
-rw-r--r--src/com/android/dialer/widget/EmptyContentView.java2
4 files changed, 50 insertions, 12 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 458c90bdc..9609e4d6f 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 {
@@ -151,7 +153,7 @@ public class CallLogAdapter extends GroupingListAdapter
if (mVoicemailPlaybackPresenter != null) {
// Always reset the voicemail playback state on expand or collapse.
- mVoicemailPlaybackPresenter.reset();
+ mVoicemailPlaybackPresenter.resetAll();
}
if (viewHolder.getAdapterPosition() == mCurrentlyExpandedPosition) {
@@ -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 d8fe21bc1..158ed5834 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..7270af787 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.
@@ -260,7 +266,17 @@ public class VoicemailPlaybackPresenter
}
/**
- * Reset the presenter for playback.
+ * Reset the presenter for playback back to its original state.
+ */
+ public void resetAll() {
+ reset();
+
+ mView = null;
+ mVoicemailUri = null;
+ }
+
+ /**
+ * Reset the presenter such that it is as if the voicemail has not been played.
*/
public void reset() {
if (mMediaPlayer != null) {
@@ -270,13 +286,15 @@ public class VoicemailPlaybackPresenter
disableProximitySensor(false /* waitForFarState */);
- mView = null;
- mVoicemailUri = null;
-
mIsPrepared = false;
mIsPlaying = false;
mPosition = 0;
mDuration.set(0);
+
+ if (mView != null) {
+ mView.onPlaybackStopped();
+ mView.setClipPosition(0, mDuration.get());
+ }
}
/**
@@ -291,16 +309,11 @@ public class VoicemailPlaybackPresenter
}
// Release the media player, otherwise there may be failures.
- if (mMediaPlayer != null) {
- mMediaPlayer.release();
- mMediaPlayer = null;
- mIsPrepared = false;
- }
+ reset();
if (mActivity != null) {
mActivity.getWindow().clearFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
}
- disableProximitySensor(false /* waitForFarState */);
}
/**
@@ -708,10 +721,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);
diff --git a/src/com/android/dialer/widget/EmptyContentView.java b/src/com/android/dialer/widget/EmptyContentView.java
index 2f5e0d9d7..f248967de 100644
--- a/src/com/android/dialer/widget/EmptyContentView.java
+++ b/src/com/android/dialer/widget/EmptyContentView.java
@@ -61,6 +61,8 @@ public class EmptyContentView extends LinearLayout implements View.OnClickListen
final LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(R.layout.empty_content_view, this);
+ // Don't let touches fall through the empty view.
+ setClickable(true);
mImageView = (ImageView) findViewById(R.id.emptyListViewImage);
mDescriptionView = (TextView) findViewById(R.id.emptyListViewMessage);
mActionView = (TextView) findViewById(R.id.emptyListViewAction);