Remove usages of deprecated Handler constructor.

This commit is contained in:
Alan Evans
2021-01-05 17:40:18 -04:00
parent 64312f9c7f
commit 6dd3fdaa55
16 changed files with 42 additions and 20 deletions

View File

@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.conversation;
import android.app.Application;
import android.database.ContentObserver;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import androidx.annotation.NonNull;
@@ -35,7 +36,7 @@ class ConversationStickerViewModel extends ViewModel {
this.stickers = new MutableLiveData<>();
this.stickersAvailable = new MutableLiveData<>();
this.availabilityThrottler = new Throttler(500);
this.packObserver = new ContentObserver(new Handler()) {
this.packObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
@Override
public void onChange(boolean selfChange) {
availabilityThrottler.publish(() -> repository.getStickerFeatureAvailability(stickersAvailable::postValue));

View File

@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.conversation.ui.mentions;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -32,7 +33,7 @@ public class MentionsPickerFragment extends LoggingFragment {
private BottomSheetBehavior<View> behavior;
private MentionsPickerViewModel viewModel;
private final Runnable lockSheetAfterListUpdate = () -> behavior.setHideable(false);
private final Handler handler = new Handler();
private final Handler handler = new Handler(Looper.getMainLooper());
@Override
public @Nullable View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {