mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Remove usages of deprecated Handler constructor.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.MainThread;
|
||||
@@ -52,6 +53,10 @@ public class ThrottledDebouncer {
|
||||
|
||||
private static class OverflowHandler extends Handler {
|
||||
|
||||
public OverflowHandler() {
|
||||
super(Looper.getMainLooper());
|
||||
}
|
||||
|
||||
private Runnable runnable;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
/**
|
||||
* A class that will throttle the number of runnables executed to be at most once every specified
|
||||
@@ -26,7 +27,7 @@ public class Throttler {
|
||||
* {@code threshold} milliseconds.
|
||||
*/
|
||||
public Throttler(long threshold) {
|
||||
this.handler = new Handler();
|
||||
this.handler = new Handler(Looper.getMainLooper());
|
||||
this.threshold = threshold;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.thoughtcrime.securesms.util.livedata;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LiveData;
|
||||
@@ -162,7 +163,7 @@ public final class LiveDataUtil {
|
||||
@Override
|
||||
protected void onActive() {
|
||||
if (emittedValue) return;
|
||||
new Handler().postDelayed(() -> setValue(value), delay);
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> setValue(value), delay);
|
||||
emittedValue = true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user