diff --git a/res/layout/recording_layout.xml b/res/layout/recording_layout.xml
index 587242bf6f..c2a8efa0cc 100644
--- a/res/layout/recording_layout.xml
+++ b/res/layout/recording_layout.xml
@@ -11,18 +11,32 @@
tools:visibility="visible"
tools:showIn="@layout/conversation_input_panel">
+
+
@@ -36,9 +50,10 @@
android:layout_marginEnd="8dp"
android:ellipsize="none"
android:gravity="center_vertical"
+ android:padding="4dp"
android:text="@string/conversation_input_panel__cancel"
android:textAllCaps="true"
- android:textColor="@color/red_A700"
+ android:textColor="@color/red_500"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/src/org/thoughtcrime/securesms/components/InputPanel.java b/src/org/thoughtcrime/securesms/components/InputPanel.java
index 7cb170c827..6f3d9ddd01 100644
--- a/src/org/thoughtcrime/securesms/components/InputPanel.java
+++ b/src/org/thoughtcrime/securesms/components/InputPanel.java
@@ -16,6 +16,7 @@ import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
+import android.view.animation.Interpolator;
import android.view.animation.TranslateAnimation;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -99,6 +100,7 @@ public class InputPanel extends LinearLayout
this.microphoneRecorderView = findViewById(R.id.recorder_view);
this.microphoneRecorderView.setListener(this);
this.recordTime = new RecordTime(findViewById(R.id.record_time),
+ findViewById(R.id.microphone),
TimeUnit.HOURS.toSeconds(1),
() -> microphoneRecorderView.cancelAction());
@@ -359,13 +361,15 @@ public class InputPanel extends LinearLayout
private static class RecordTime implements Runnable {
- private final TextView recordTimeView;
- private final long limitSeconds;
- private final Runnable onLimitHit;
- private long startTime;
+ private final @NonNull TextView recordTimeView;
+ private final @NonNull View microphone;
+ private final @NonNull Runnable onLimitHit;
+ private final long limitSeconds;
+ private long startTime;
- private RecordTime(TextView recordTimeView, long limitSeconds, Runnable onLimitHit) {
+ private RecordTime(@NonNull TextView recordTimeView, @NonNull View microphone, long limitSeconds, @NonNull Runnable onLimitHit) {
this.recordTimeView = recordTimeView;
+ this.microphone = microphone;
this.limitSeconds = limitSeconds;
this.onLimitHit = onLimitHit;
}
@@ -376,6 +380,8 @@ public class InputPanel extends LinearLayout
this.recordTimeView.setText(DateUtils.formatElapsedTime(0));
ViewUtil.fadeIn(this.recordTimeView, FADE_TIME);
Util.runOnMainDelayed(this, TimeUnit.SECONDS.toMillis(1));
+ microphone.setVisibility(View.VISIBLE);
+ microphone.startAnimation(pulseAnimation());
}
@MainThread
@@ -383,6 +389,8 @@ public class InputPanel extends LinearLayout
long elapsedTime = System.currentTimeMillis() - startTime;
this.startTime = 0;
ViewUtil.fadeOut(this.recordTimeView, FADE_TIME, View.INVISIBLE);
+ microphone.clearAnimation();
+ ViewUtil.fadeOut(this.microphone, FADE_TIME, View.INVISIBLE);
return elapsedTime;
}
@@ -401,6 +409,26 @@ public class InputPanel extends LinearLayout
}
}
}
+
+ private static Animation pulseAnimation() {
+ AlphaAnimation animation = new AlphaAnimation(0, 1);
+
+ animation.setInterpolator(pulseInterpolator());
+ animation.setRepeatCount(Animation.INFINITE);
+ animation.setDuration(1000);
+
+ return animation;
+ }
+
+ private static Interpolator pulseInterpolator() {
+ return input -> {
+ input *= 5;
+ if (input > 1) {
+ input = 4 - input;
+ }
+ return Math.max(0, Math.min(1, input));
+ };
+ }
}
public interface MediaListener {