Commit 141d450e authored by Adrien Béraud's avatar Adrien Béraud

build: use rxjava3

Change-Id: I2d2c3f30f45fa0f467d886d81a8c5d6b86f39543
parent 00d96b0e
......@@ -119,7 +119,7 @@ dependencies {
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
// RxAndroid
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'com.jsibbold:zoomage:1.2.0'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.11.2'
......
......@@ -30,7 +30,7 @@ import ezvcard.property.FormattedName;
import ezvcard.property.Photo;
import ezvcard.property.RawProperty;
import ezvcard.property.Uid;
import io.reactivex.Single;
import io.reactivex.rxjava3.core.Single;
public class AccountCreationModelImpl extends AccountCreationModel implements Serializable {
......
......@@ -25,7 +25,8 @@ import javax.inject.Named;
import net.jami.model.Account;
import net.jami.mvp.RootPresenter;
import net.jami.services.AccountService;
import io.reactivex.Scheduler;
import io.reactivex.rxjava3.core.Scheduler;
public class AccountEditionPresenter extends RootPresenter<AccountEditionView> {
private final AccountService mAccountService;
......
......@@ -54,8 +54,8 @@ import cx.ring.mvp.BaseActivity;
import net.jami.mvp.AccountCreationModel;
import net.jami.utils.VCardUtils;
import ezvcard.VCard;
import io.reactivex.Single;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.schedulers.Schedulers;
public class AccountWizardActivity extends BaseActivity<AccountWizardPresenter> implements AccountWizardView {
static final String TAG = AccountWizardActivity.class.getName();
......
......@@ -41,7 +41,7 @@ import cx.ring.application.JamiApplication;
import cx.ring.databinding.FragAccHomeCreateBinding;
import cx.ring.mvp.BaseSupportFragment;
import cx.ring.utils.AndroidFileUtils;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
public class HomeAccountCreationFragment extends BaseSupportFragment<HomeAccountCreationPresenter> implements HomeAccountCreationView {
private static final int ARCHIVE_REQUEST_CODE = 42;
......
......@@ -82,10 +82,10 @@ import cx.ring.utils.BitmapUtils;
import cx.ring.utils.ContentUriHandler;
import cx.ring.views.AvatarDrawable;
import cx.ring.views.SwitchButton;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
public class JamiAccountSummaryFragment extends BaseSupportFragment<JamiAccountSummaryPresenter> implements
RegisterNameDialog.RegisterNameDialogListener,
......
......@@ -56,7 +56,7 @@ import cx.ring.mvp.BaseSupportFragment;
import cx.ring.utils.AndroidFileUtils;
import cx.ring.utils.ContentUriHandler;
import cx.ring.views.AvatarDrawable;
import io.reactivex.Single;
import io.reactivex.rxjava3.core.Single;
public class ProfileCreationFragment extends BaseSupportFragment<ProfileCreationPresenter> implements ProfileCreationView {
public static final String TAG = ProfileCreationFragment.class.getSimpleName();
......
......@@ -42,8 +42,8 @@ import cx.ring.databinding.FragRegisterNameBinding;
import net.jami.services.AccountService;
import cx.ring.utils.RegisteredNameFilter;
import cx.ring.utils.RegisteredNameTextWatcher;
import io.reactivex.Scheduler;
import io.reactivex.disposables.Disposable;
import io.reactivex.rxjava3.core.Scheduler;
import io.reactivex.rxjava3.disposables.Disposable;
public class RegisterNameDialog extends DialogFragment {
static final String TAG = RegisterNameDialog.class.getSimpleName();
......
......@@ -93,8 +93,8 @@ import cx.ring.utils.GlideApp;
import cx.ring.utils.GlideOptions;
import cx.ring.utils.ResourceMapper;
import cx.ring.views.ConversationViewHolder;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHolder> {
private final static String TAG = ConversationAdapter.class.getSimpleName();
......@@ -144,7 +144,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
.override(mPictureMaxSize)
.transform(new RoundedCorners(corner));
timestampUpdateTimer = Observable.interval(10, TimeUnit.SECONDS, AndroidSchedulers.mainThread())
.startWith(0L);
.startWithItem(0L);
}
/**
......@@ -513,7 +513,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationViewHo
((ImageView) viewHolder.btnAccept).setImageResource(R.drawable.baseline_play_arrow_24);
});
viewHolder.compositeDisposable.add(Observable.interval(1L, TimeUnit.SECONDS, AndroidSchedulers.mainThread())
.startWith(0L)
.startWithItem(0L)
.subscribe(t -> {
int pS = player.getCurrentPosition() / 1000;
int dS = player.getDuration() / 1000;
......
......@@ -37,24 +37,24 @@ import java.io.IOException;
import java.util.List;
import cx.ring.R;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.subjects.PublishSubject;
import io.reactivex.rxjava3.subjects.Subject;
import net.jami.model.Ringtone;
import net.jami.utils.Log;
import io.reactivex.Observable;
import io.reactivex.subjects.PublishSubject;
import io.reactivex.subjects.Subject;
public class RingtoneAdapter extends RecyclerView.Adapter<RingtoneAdapter.RingtoneViewHolder> {
private final String TAG = RingtoneAdapter.class.getSimpleName();
private List<Ringtone> ringtoneList;
private final List<Ringtone> ringtoneList;
private int currentlySelectedPosition = 1; // default item
private MediaPlayer mp = new MediaPlayer();
private Subject<Ringtone> ringtoneSubject = PublishSubject.create();
class RingtoneViewHolder extends RecyclerView.ViewHolder {
private TextView name;
private ImageView isSelected, isPlaying, ringtoneIcon;
private final MediaPlayer mp = new MediaPlayer();
private final Subject<Ringtone> ringtoneSubject = PublishSubject.create();
static class RingtoneViewHolder extends RecyclerView.ViewHolder {
private final TextView name;
private final ImageView isSelected, isPlaying, ringtoneIcon;
RingtoneViewHolder(View view) {
super(view);
......
......@@ -24,7 +24,7 @@ import cx.ring.databinding.ItemSmartlistBinding;
import cx.ring.databinding.ItemSmartlistHeaderBinding;
import net.jami.smartlist.SmartListViewModel;
import cx.ring.viewholders.SmartListViewHolder;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import android.os.Parcelable;
import android.view.LayoutInflater;
......
......@@ -72,8 +72,8 @@ import cx.ring.dependencyinjection.ServiceInjectionModule;
import cx.ring.service.DRingService;
import cx.ring.service.JamiJobService;
import cx.ring.utils.AndroidFileUtils;
import io.reactivex.Completable;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.schedulers.Schedulers;
public abstract class JamiApplication extends Application {
private static final String TAG = JamiApplication.class.getSimpleName();
......
......@@ -37,9 +37,9 @@ import cx.ring.R;
import cx.ring.databinding.ItemToolbarSelectedBinding;
import cx.ring.databinding.ItemToolbarSpinnerBinding;
import cx.ring.views.AvatarDrawable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
public class AccountSpinnerAdapter extends ArrayAdapter<Account> {
private static final String TAG = AccountSpinnerAdapter.class.getSimpleName();
......
......@@ -71,8 +71,8 @@ import cx.ring.fragments.ConversationFragment;
import cx.ring.services.SharedPreferencesServiceImpl;
import cx.ring.utils.ConversationPath;
import cx.ring.views.AvatarDrawable;
import io.reactivex.Single;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class ContactDetailsActivity extends AppCompatActivity {
private static final String TAG = ContactDetailsActivity.class.getName();
......
......@@ -47,8 +47,8 @@ import net.jami.services.CallService;
import net.jami.smartlist.SmartListViewModel;
import cx.ring.utils.ConversationPath;
import cx.ring.viewholders.SmartListViewHolder;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class ConversationSelectionActivity extends AppCompatActivity {
private final static String TAG = ConversationSelectionActivity.class.getSimpleName();
......
......@@ -92,10 +92,10 @@ import cx.ring.utils.ContentUriHandler;
import cx.ring.utils.ConversationPath;
import cx.ring.utils.DeviceUtils;
import cx.ring.views.SwitchButton;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
public class HomeActivity extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener,
Spinner.OnItemSelectedListener, Colorable {
......
......@@ -50,11 +50,11 @@ import cx.ring.application.JamiApplication;
import cx.ring.databinding.ActivityLogsBinding;
import cx.ring.utils.AndroidFileUtils;
import cx.ring.utils.ContentUriHandler;
import io.reactivex.Maybe;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Maybe;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
public class LogsActivity extends AppCompatActivity {
private static final String TAG = LogsActivity.class.getSimpleName();
......
......@@ -59,9 +59,10 @@ import net.jami.model.ConfigKey;
import net.jami.model.Ringtone;
import net.jami.services.AccountService;
import cx.ring.utils.AndroidFileUtils;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.disposables.Disposable;
import net.jami.utils.Log;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
public class RingtoneActivity extends AppCompatActivity {
......@@ -366,7 +367,7 @@ public class RingtoneActivity extends AppCompatActivity {
cr.takePersistableUriPermission(uri, takeFlags);
AndroidFileUtils.getCacheFile(this, uri)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(file -> onFileFound(file),
.subscribe(this::onFileFound,
err -> Toast.makeText(this, "Can't load ringtone !", Toast.LENGTH_SHORT).show());
}
}
......
......@@ -45,7 +45,7 @@ import cx.ring.mvp.BaseSupportFragment;
import net.jami.smartlist.SmartListViewModel;
import cx.ring.viewholders.SmartListViewHolder;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class ContactRequestsFragment extends BaseSupportFragment<ContactRequestsPresenter> implements ContactRequestsView,
SmartListViewHolder.SmartListListeners {
......
......@@ -24,8 +24,8 @@ import android.content.Context;
import cx.ring.application.JamiApplication;
import dagger.Module;
import dagger.Provides;
import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Scheduler;
@Module
public class JamiInjectionModule {
......
......@@ -52,8 +52,8 @@ import cx.ring.services.SharedPreferencesServiceImpl;
import cx.ring.services.VCardServiceImpl;
import dagger.Module;
import dagger.Provides;
import io.reactivex.Scheduler;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Scheduler;
@Module
public class ServiceInjectionModule {
......
......@@ -45,12 +45,13 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import cx.ring.R;
import cx.ring.application.JamiApplication;
import cx.ring.databinding.FragAccountMigrationBinding;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import net.jami.model.Account;
import net.jami.model.AccountConfig;
import net.jami.model.ConfigKey;
import net.jami.services.AccountService;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
public class AccountMigrationFragment extends Fragment {
public static final String ACCOUNT_ID = "ACCOUNT_ID";
......
......@@ -127,7 +127,7 @@ import cx.ring.utils.ConversationPath;
import cx.ring.utils.DeviceUtils;
import cx.ring.utils.MediaButtonsHelper;
import cx.ring.views.AvatarDrawable;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class CallFragment extends BaseSupportFragment<CallPresenter> implements CallView, MediaButtonsHelper.MediaButtonsHelperCallback, RecyclerPickerLayoutManager.ItemSelectedListener {
......
......@@ -31,8 +31,8 @@ import net.jami.model.Contact;
import net.jami.smartlist.SmartListViewModel;
import cx.ring.viewholders.SmartListViewHolder;
import cx.ring.views.AvatarDrawable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class ContactPickerFragment extends BottomSheetDialogFragment {
......
......@@ -33,8 +33,8 @@ import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.os.Bundle;
import android.os.Environment;
import android.os.IBinder;
......@@ -56,8 +56,6 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.snackbar.Snackbar;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.view.menu.MenuBuilder;
......@@ -71,6 +69,21 @@ import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import net.jami.conversation.ConversationPresenter;
import net.jami.conversation.ConversationView;
import net.jami.daemon.JamiService;
import net.jami.model.Account;
import net.jami.model.Contact;
import net.jami.model.Conversation;
import net.jami.model.DataTransfer;
import net.jami.model.Error;
import net.jami.model.Interaction;
import net.jami.model.Phone;
import net.jami.model.Uri;
import net.jami.services.NotificationService;
import java.io.File;
import java.util.HashMap;
import java.util.List;
......@@ -83,39 +96,26 @@ import cx.ring.client.CallActivity;
import cx.ring.client.ContactDetailsActivity;
import cx.ring.client.ConversationActivity;
import cx.ring.client.HomeActivity;
import cx.ring.views.AvatarFactory;
import net.jami.conversation.ConversationPresenter;
import net.jami.conversation.ConversationView;
import cx.ring.databinding.FragConversationBinding;
import cx.ring.interfaces.Colorable;
import net.jami.daemon.JamiService;
import net.jami.model.Account;
import net.jami.model.Contact;
import net.jami.model.Conversation;
import net.jami.model.Interaction;
import net.jami.model.DataTransfer;
import net.jami.model.Phone;
import net.jami.model.Error;
import net.jami.model.Uri;
import cx.ring.mvp.BaseSupportFragment;
import cx.ring.service.DRingService;
import cx.ring.services.LocationSharingService;
import net.jami.services.NotificationService;
import cx.ring.service.LocationSharingService;
import cx.ring.services.NotificationServiceImpl;
import cx.ring.services.SharedPreferencesServiceImpl;
import cx.ring.utils.ActionHelper;
import cx.ring.utils.AndroidFileUtils;
import cx.ring.utils.ContentUriHandler;
import cx.ring.utils.DeviceUtils;
import cx.ring.utils.ConversationPath;
import cx.ring.utils.DeviceUtils;
import cx.ring.utils.MediaButtonsHelper;
import cx.ring.views.AvatarDrawable;
import io.reactivex.Completable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.schedulers.Schedulers;
import cx.ring.views.AvatarFactory;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import io.reactivex.rxjava3.schedulers.Schedulers;
import static android.app.Activity.RESULT_OK;
......
......@@ -31,7 +31,8 @@ import net.jami.mvp.RootPresenter;
import net.jami.services.AccountService;
import net.jami.services.HardwareService;
import net.jami.services.PreferencesService;
import io.reactivex.Scheduler;
import io.reactivex.rxjava3.core.Scheduler;
public class GeneralAccountPresenter extends RootPresenter<GeneralAccountView> {
......
......@@ -82,12 +82,12 @@ import cx.ring.databinding.FragLocationSharingBinding;
import cx.ring.services.LocationSharingService;
import cx.ring.utils.ConversationPath;
import cx.ring.utils.TouchClickListener;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.subjects.BehaviorSubject;
import io.reactivex.subjects.Subject;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.Disposable;
import io.reactivex.rxjava3.subjects.BehaviorSubject;
import io.reactivex.rxjava3.subjects.Subject;
public class LocationSharingFragment extends Fragment {
private static final String TAG = LocationSharingFragment.class.getSimpleName();
......
......@@ -32,7 +32,8 @@ import net.jami.model.ConfigKey;
import net.jami.mvp.RootPresenter;
import net.jami.services.AccountService;
import net.jami.services.DeviceRuntimeService;
import io.reactivex.Scheduler;
import io.reactivex.rxjava3.core.Scheduler;
public class MediaPreferencePresenter extends RootPresenter<MediaPreferenceView>
{
......
......@@ -50,8 +50,8 @@ import cx.ring.client.ConversationActivity;
import cx.ring.databinding.FragSharewithBinding;
import cx.ring.utils.ConversationPath;
import cx.ring.viewholders.SmartListViewHolder;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class ShareWithFragment extends Fragment {
private final static String TAG = ShareWithFragment.class.getSimpleName();
......
......@@ -74,7 +74,7 @@ import cx.ring.utils.ClipboardHelper;
import cx.ring.utils.ConversationPath;
import cx.ring.utils.DeviceUtils;
import cx.ring.viewholders.SmartListViewHolder;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class SmartListFragment extends BaseSupportFragment<SmartListPresenter> implements SearchView.OnQueryTextListener,
SmartListViewHolder.SmartListListeners,
......
......@@ -74,7 +74,7 @@ import net.jami.services.PreferencesService;
import cx.ring.tv.call.TVCallActivity;
import cx.ring.utils.ConversationPath;
import cx.ring.utils.DeviceUtils;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;
public class DRingService extends Service {
private static final String TAG = DRingService.class.getSimpleName();
......
......@@ -73,13 +73,13 @@ import net.jami.daemon.StringMap;
import net.jami.daemon.UintVect;
import net.jami.utils.Tuple;
import cx.ring.views.AutoFitTextureView;
import io.reactivex.Completable;
import io.reactivex.Maybe;
import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.subjects.BehaviorSubject;
import io.reactivex.subjects.Subject;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Maybe;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.subjects.BehaviorSubject;
import io.reactivex.rxjava3.subjects.Subject;
public class CameraService {
private static final String TAG = CameraService.class.getSimpleName();
......
......@@ -47,9 +47,9 @@ import javax.inject.Inject;
import cx.ring.utils.AndroidFileUtils;
import cx.ring.views.AvatarFactory;
import ezvcard.VCard;
import io.reactivex.Completable;
import io.reactivex.Single;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.schedulers.Schedulers;
public class ContactServiceImpl extends ContactService {
......