diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-05 23:53:32 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-05 23:53:49 +0000 |
commit | 3ba851c3df0429bb4c5a0a376ea669f8ea5be9e0 (patch) | |
tree | bdaf0d31bda678a97a61f46af0437ec387638f16 /src | |
parent | 24084af3b3b6906872c843b706e93e7c48d5345e (diff) | |
parent | 3ffb71b6dd1963f55972f4af1df279f7cd0ae91a (diff) |
Merge "Add delete action to voicemail in call log." into mnc-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java | 26 | ||||
-rw-r--r-- | src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java | 4 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java b/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java index 703004d07..0313f4004 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackLayout.java @@ -37,6 +37,7 @@ import android.widget.TextView; import com.android.common.io.MoreCloseables; import com.android.dialer.R; +import com.android.dialer.calllog.CallLogAsyncTaskUtil; import com.google.common.base.Preconditions; @@ -124,7 +125,7 @@ public class VoicemailPlaybackLayout extends LinearLayout /** * Handle state changes when the user manipulates the seek bar. */ - private final OnSeekBarChangeListener seekBarChangeListener = new OnSeekBarChangeListener() { + private final OnSeekBarChangeListener mSeekBarChangeListener = new OnSeekBarChangeListener() { @Override public void onStartTrackingTouch(SeekBar seekBar) { if (mPresenter != null) { @@ -148,7 +149,7 @@ public class VoicemailPlaybackLayout extends LinearLayout /** * Click listener to toggle speakerphone. */ - private final View.OnClickListener speakerphoneListener = new View.OnClickListener() { + private final View.OnClickListener mSpeakerphoneListener = new View.OnClickListener() { @Override public void onClick(View v) { if (mPresenter != null) { @@ -160,7 +161,7 @@ public class VoicemailPlaybackLayout extends LinearLayout /** * Click listener to play or pause voicemail playback. */ - private final View.OnClickListener startStopButtonListener = new View.OnClickListener() { + private final View.OnClickListener mStartStopButtonListener = new View.OnClickListener() { @Override public void onClick(View view) { if (mPresenter == null) { @@ -175,6 +176,16 @@ public class VoicemailPlaybackLayout extends LinearLayout } }; + private final View.OnClickListener mDeleteButtonListener = new View.OnClickListener() { + @Override + public void onClick(View view ) { + if (mPresenter == null) { + return; + } + CallLogAsyncTaskUtil.deleteVoicemail(mContext, mPresenter.getVoicemailUri(), null); + } + }; + private Context mContext; private VoicemailPlaybackPresenter mPresenter; @@ -183,6 +194,7 @@ public class VoicemailPlaybackLayout extends LinearLayout private SeekBar mPlaybackSeek; private ImageButton mStartStopButton; private ImageButton mPlaybackSpeakerphone; + private ImageButton mDeleteButton; private TextView mPlaybackPosition; private PositionUpdater mPositionUpdater; @@ -212,11 +224,13 @@ public class VoicemailPlaybackLayout extends LinearLayout mPlaybackSeek = (SeekBar) findViewById(R.id.playback_seek); mStartStopButton = (ImageButton) findViewById(R.id.playback_start_stop); mPlaybackSpeakerphone = (ImageButton) findViewById(R.id.playback_speakerphone); + mDeleteButton = (ImageButton) findViewById(R.id.delete_voicemail); mPlaybackPosition = (TextView) findViewById(R.id.playback_position_text); - mPlaybackSeek.setOnSeekBarChangeListener(seekBarChangeListener); - mStartStopButton.setOnClickListener(startStopButtonListener); - mPlaybackSpeakerphone.setOnClickListener(speakerphoneListener); + mPlaybackSeek.setOnSeekBarChangeListener(mSeekBarChangeListener); + mStartStopButton.setOnClickListener(mStartStopButtonListener); + mPlaybackSpeakerphone.setOnClickListener(mSpeakerphoneListener); + mDeleteButton.setOnClickListener(mDeleteButtonListener); } @Override diff --git a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java index 8db785212..1a1547692 100644 --- a/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java +++ b/src/com/android/dialer/voicemail/VoicemailPlaybackPresenter.java @@ -556,6 +556,10 @@ public class VoicemailPlaybackPresenter return mAudioManager.isSpeakerphoneOn(); } + public Uri getVoicemailUri() { + return mVoicemailUri; + } + private static synchronized ScheduledExecutorService getScheduledExecutorServiceInstance() { if (mScheduledExecutorService == null) { mScheduledExecutorService = Executors.newScheduledThreadPool(NUMBER_OF_THREADS_IN_POOL); |