Implement correct video story sound behaviour.

This commit is contained in:
Alex Hart
2022-06-27 09:19:33 -03:00
committed by Cody Henthorne
parent 521bd2cce4
commit 1cfa5c31f2
13 changed files with 389 additions and 0 deletions

View File

@@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.util;
import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.TimeUnit;
/**
* A class that will throttle the number of runnables executed to be at most once every specified
* interval. However, it could be longer if events are published consistently.
@@ -17,6 +19,10 @@ public class Debouncer {
private final Handler handler;
private final long threshold;
public Debouncer(long threshold, TimeUnit timeUnit) {
this(timeUnit.toMillis(threshold));
}
/**
* @param threshold Only one runnable will be executed via {@link #publish(Runnable)} every
* {@code threshold} milliseconds.