diff options
author | Android Dialer <noreply@google.com> | 2018-06-27 13:13:29 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-06-27 13:13:29 -0700 |
commit | 95194792e7f479979bef3290165952480a97af58 (patch) | |
tree | 3a32e17e1d9c79e8306119d817fd7964fbef82d1 /java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java | |
parent | 9f15322971cf09dfed32517a575db887ca180f02 (diff) | |
parent | cd5228be7f4f00d3972343c5c30ca6faebf86986 (diff) |
Merge changes I0f1ed20a,Ia68d3b13,I72047d59,Ieff3c7fb,I53c3896a, ... am: 1b4ec7b954
am: cd5228be7f
Change-Id: I47f0dcffa5d58cf182bfd59a01ef8baac9e69204
Diffstat (limited to 'java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java')
-rw-r--r-- | java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java index 39a791d5f..89e45dca7 100644 --- a/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java +++ b/java/com/android/dialer/voicemail/settings/RecordVoicemailGreetingActivity.java @@ -21,6 +21,7 @@ import android.os.Bundle; import android.support.annotation.IntDef; import android.view.View; import android.view.View.OnClickListener; +import android.widget.Button; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -46,14 +47,21 @@ public class RecordVoicemailGreetingActivity extends Activity implements OnClick private int currentState; private int duration; private RecordButton recordButton; + private Button saveButton; + private Button redoButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_record_voicemail_greeting); + recordButton = findViewById(R.id.record_button); + saveButton = findViewById(R.id.save_button); + redoButton = findViewById(R.id.redo_button); + duration = 0; setState(RECORD_GREETING_INIT); + recordButton.setOnClickListener(this); } @Override @@ -83,18 +91,32 @@ public class RecordVoicemailGreetingActivity extends Activity implements OnClick case RECORD_GREETING_INIT: recordButton.setState(state); recordButton.setTracks(0, 0); + setSaveRedoButtonsEnabled(false); break; case RECORD_GREETING_PLAYING_BACK: case RECORD_GREETING_RECORDED: recordButton.setState(state); recordButton.setTracks(0, (float) duration / MAX_GREETING_DURATION_MS); + setSaveRedoButtonsEnabled(true); break; case RECORD_GREETING_RECORDING: recordButton.setState(state); recordButton.setTracks(0, 1f); + setSaveRedoButtonsEnabled(false); break; default: break; } } + + /** Enables/Disables save and redo buttons in the layout */ + private void setSaveRedoButtonsEnabled(boolean enabled) { + if (enabled) { + saveButton.setVisibility(View.VISIBLE); + redoButton.setVisibility(View.VISIBLE); + } else { + saveButton.setVisibility(View.GONE); + redoButton.setVisibility(View.GONE); + } + } } |