mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Implement correct video story sound behaviour.
This commit is contained in:
committed by
Cody Henthorne
parent
521bd2cce4
commit
1cfa5c31f2
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user