diff options
author | Andrew Lee <anwlee@google.com> | 2015-06-05 14:14:28 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-06-05 14:15:57 -0700 |
commit | 3ffb71b6dd1963f55972f4af1df279f7cd0ae91a (patch) | |
tree | 474c26a8069b4fb076b99fa3d236cdde757ca8db /src/com/android/dialer | |
parent | feddb49ced2eb10328f9f3db52c950668472ffef (diff) |
Add delete action to voicemail in call log.
+ Cleanup some asset and variable naming.
Bug: 21239168
Change-Id: I4c99484bee1fcd300857cf44080c38e19a98cb5a
Diffstat (limited to 'src/com/android/dialer')
-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 99d2734eb..ebe45a131 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); |