Skip to content

Commit

Permalink
set red background when recording audio
Browse files Browse the repository at this point in the history
  • Loading branch information
zoff99 committed Aug 30, 2024
1 parent 5dbf11e commit 120761f
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ public void onNothingSelected(AdapterView<?> parent)
ml_video_icon = (ImageButton) findViewById(R.id.ml_video_icon);
ml_attach_button_01 = (ImageButton) findViewById(R.id.ml_button_01);
ml_button_recaudio = (ImageButton) findViewById(R.id.ml_button_recaudio);
ml_button_recaudio.setBackgroundColor(Color.TRANSPARENT);

ml_is_recording = false;
ml_is_rec_ok = false;
final ImageButton button01_ = ml_attach_button_01;
Expand Down Expand Up @@ -659,6 +661,7 @@ public void run()
ml_is_recording = true;
ml_is_rec_ok = false;
((ImageButton) v).setImageResource(R.drawable.baseline_stop_circle_24);
v.setBackgroundColor(Color.parseColor("#FF0000"));

try
{
Expand All @@ -677,6 +680,7 @@ public void run()
catch(Exception e)
{
((ImageButton) v).setImageResource(R.drawable.baseline_keyboard_voice_24);
v.setBackgroundColor(Color.TRANSPARENT);
ml_is_recording = false;
ml_is_rec_ok = false;
return;
Expand All @@ -696,6 +700,7 @@ public void run()
catch(Exception e)
{
((ImageButton) v).setImageResource(R.drawable.baseline_keyboard_voice_24);
v.setBackgroundColor(Color.TRANSPARENT);
ml_is_recording = false;
ml_is_rec_ok = false;
return;
Expand All @@ -714,6 +719,7 @@ public void run()
{
// HINT: just in case of an endless loop, we return here
((ImageButton) v).setImageResource(R.drawable.baseline_keyboard_voice_24);
v.setBackgroundColor(Color.TRANSPARENT);
ml_is_recording = false;
ml_is_rec_ok = false;
return;
Expand All @@ -729,6 +735,7 @@ public void run()
{
// HINT: some problem on starting the recording
((ImageButton) v).setImageResource(R.drawable.baseline_keyboard_voice_24);
v.setBackgroundColor(Color.TRANSPARENT);
ml_is_recording = false;
ml_is_rec_ok = false;
return;
Expand All @@ -753,6 +760,7 @@ public void run()
}
}
((ImageButton) v).setImageResource(R.drawable.baseline_pending_24);
v.setBackgroundColor(Color.TRANSPARENT);
int rec_result = mAudioRecorder.stopRecord();
Log.i(TAG, "onCreate:record_audio:finished:res=" + rec_result);
if (rec_result == -1)
Expand All @@ -766,6 +774,7 @@ public void run()
e.printStackTrace();
}
((ImageButton) v).setImageResource(R.drawable.baseline_keyboard_voice_24);
v.setBackgroundColor(Color.TRANSPARENT);

if (ml_is_rec_ok)
{
Expand Down Expand Up @@ -820,6 +829,7 @@ protected void onPause()
super.onPause();

ml_button_recaudio.setImageResource(R.drawable.baseline_keyboard_voice_24);
ml_button_recaudio.setBackgroundColor(Color.TRANSPARENT);
ml_is_recording = false;
ml_is_rec_ok = false;

Expand All @@ -842,6 +852,7 @@ protected void onStop()
{
super.onStop();
ml_button_recaudio.setImageResource(R.drawable.baseline_keyboard_voice_24);
ml_button_recaudio.setBackgroundColor(Color.TRANSPARENT);
ml_is_recording = false;
ml_is_rec_ok = false;
}
Expand Down

0 comments on commit 120761f

Please sign in to comment.