diff --git a/build.gradle b/build.gradle index 81f6f02d6e..4878618cdf 100644 --- a/build.gradle +++ b/build.gradle @@ -69,7 +69,7 @@ dependencies { compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.makeramen:roundedimageview:2.1.0' compile 'com.pnikosis:materialish-progress:1.5' - compile 'de.greenrobot:eventbus:2.4.0' + compile 'org.greenrobot:eventbus:3.0.0' compile 'pl.tajchert:waitingdots:0.1.0' compile 'com.soundcloud.android:android-crop:0.9.10@aar' compile 'com.melnykov:floatingactionbutton:1.3.0' @@ -138,7 +138,7 @@ dependencyVerification { 'com.github.bumptech.glide:glide:76ef123957b5fbaebb05fcbe6606dd58c3bc3fcdadb257f99811d0ac9ea9b88b', 'com.makeramen:roundedimageview:1f5a1865796b308c6cdd114acc6e78408b110f0a62fc63553278fbeacd489cd1', 'com.pnikosis:materialish-progress:d71d80e00717a096784482aee21001a9d299fec3833e4ebd87739ed36cf77c54', - 'de.greenrobot:eventbus:61d743a748156a372024d083de763b9e91ac2dcb3f6a1cbc74995c7ddab6e968', + 'org.greenrobot:eventbus:180d4212467df06f2fbc9c8d8a2984533ac79c87769ad883bc421612f0b4e17c', 'pl.tajchert:waitingdots:2835d49e0787dbcb606c5a60021ced66578503b1e9fddcd7a5ef0cd5f095ba2c', 'com.soundcloud.android:android-crop:ffd4b973cf6e97f7d64118a0dc088df50e9066fd5634fe6911dd0c0c5d346177', 'com.melnykov:floatingactionbutton:15d58d4fac0f7a288d0e5301bbaf501a146f5b3f5921277811bf99bd3b397263', diff --git a/src/org/thoughtcrime/redphone/RedPhone.java b/src/org/thoughtcrime/redphone/RedPhone.java index d5b9ecbd99..9a8d187806 100644 --- a/src/org/thoughtcrime/redphone/RedPhone.java +++ b/src/org/thoughtcrime/redphone/RedPhone.java @@ -35,6 +35,9 @@ import android.util.Log; import android.view.Window; import android.view.WindowManager; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; import org.thoughtcrime.redphone.ui.CallControls; import org.thoughtcrime.redphone.ui.CallScreen; import org.thoughtcrime.redphone.util.AudioUtils; @@ -43,7 +46,6 @@ import org.thoughtcrime.securesms.events.RedPhoneEvent; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.util.TextSecurePreferences; -import de.greenrobot.event.EventBus; /** * The main UI class for RedPhone. Most of the heavy lifting is @@ -87,7 +89,7 @@ public class RedPhone extends Activity { super.onResume(); initializeScreenshotSecurity(); - EventBus.getDefault().registerSticky(this); + EventBus.getDefault().register(this); registerBluetoothReceiver(); } @@ -305,7 +307,7 @@ public class RedPhone extends Activity { }, delayMillis); } - @SuppressWarnings("unused") + @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) public void onEventMainThread(final RedPhoneEvent event) { Log.w(TAG, "Got message from service: " + event.getType()); diff --git a/src/org/thoughtcrime/redphone/RedPhoneService.java b/src/org/thoughtcrime/redphone/RedPhoneService.java index 5160682ec8..578c09adbe 100644 --- a/src/org/thoughtcrime/redphone/RedPhoneService.java +++ b/src/org/thoughtcrime/redphone/RedPhoneService.java @@ -37,6 +37,7 @@ import android.text.TextUtils; import android.util.Log; import android.util.Pair; +import org.greenrobot.eventbus.EventBus; import org.thoughtcrime.redphone.audio.IncomingRinger; import org.thoughtcrime.redphone.audio.OutgoingRinger; import org.thoughtcrime.redphone.call.CallManager; @@ -71,7 +72,6 @@ import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.concurrent.ExecutionException; -import de.greenrobot.event.EventBus; /** * The major entry point for all of the heavy lifting associated with diff --git a/src/org/thoughtcrime/securesms/WebRtcCallActivity.java b/src/org/thoughtcrime/securesms/WebRtcCallActivity.java index ab4826ec7d..797cae3aca 100644 --- a/src/org/thoughtcrime/securesms/WebRtcCallActivity.java +++ b/src/org/thoughtcrime/securesms/WebRtcCallActivity.java @@ -35,6 +35,9 @@ import android.view.View; import android.view.Window; import android.view.WindowManager; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; import org.thoughtcrime.redphone.util.AudioUtils; import org.thoughtcrime.securesms.components.webrtc.WebRtcCallControls; import org.thoughtcrime.securesms.components.webrtc.WebRtcCallScreen; @@ -51,8 +54,6 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.ViewUtil; import org.whispersystems.libsignal.IdentityKey; -import de.greenrobot.event.EventBus; - public class WebRtcCallActivity extends Activity { private static final String TAG = WebRtcCallActivity.class.getSimpleName(); @@ -91,7 +92,7 @@ public class WebRtcCallActivity extends Activity { super.onResume(); if (!networkAccess.isCensored(this)) MessageRetrievalService.registerActivityStarted(this); initializeScreenshotSecurity(); - EventBus.getDefault().registerSticky(this); + EventBus.getDefault().register(this); registerBluetoothReceiver(); registerWiredHeadsetReceiver(); @@ -306,7 +307,7 @@ public class WebRtcCallActivity extends Activity { }, delayMillis); } - @SuppressWarnings("unused") + @Subscribe(sticky = true, threadMode = ThreadMode.MAIN) public void onEventMainThread(final WebRtcViewModel event) { Log.w(TAG, "Got message from service: " + event); diff --git a/src/org/thoughtcrime/securesms/components/AudioView.java b/src/org/thoughtcrime/securesms/components/AudioView.java index 40af6de189..438bd09623 100644 --- a/src/org/thoughtcrime/securesms/components/AudioView.java +++ b/src/org/thoughtcrime/securesms/components/AudioView.java @@ -22,6 +22,9 @@ import android.widget.TextView; import com.pnikosis.materialishprogress.ProgressWheel; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.audio.AudioSlidePlayer; import org.thoughtcrime.securesms.crypto.MasterSecret; @@ -34,7 +37,6 @@ import org.thoughtcrime.securesms.util.Util; import java.io.IOException; import java.util.concurrent.TimeUnit; -import de.greenrobot.event.EventBus; public class AudioView extends FrameLayout implements AudioSlidePlayer.Listener { @@ -97,7 +99,7 @@ public class AudioView extends FrameLayout implements AudioSlidePlayer.Listener @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().registerSticky(this); + if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().register(this); } @Override @@ -323,7 +325,7 @@ public class AudioView extends FrameLayout implements AudioSlidePlayer.Listener } } - @SuppressWarnings("unused") + @Subscribe(sticky = true, threadMode = ThreadMode.ASYNC) public void onEventAsync(final PartProgressEvent event) { if (audioSlidePlayer != null && event.attachment.equals(this.audioSlidePlayer.getAudioSlide().asAttachment())) { Util.runOnMain(new Runnable() { diff --git a/src/org/thoughtcrime/securesms/components/TransferControlView.java b/src/org/thoughtcrime/securesms/components/TransferControlView.java index 194878e877..af43c1e2eb 100644 --- a/src/org/thoughtcrime/securesms/components/TransferControlView.java +++ b/src/org/thoughtcrime/securesms/components/TransferControlView.java @@ -20,6 +20,9 @@ import com.nineoldandroids.animation.ValueAnimator; import com.nineoldandroids.animation.ValueAnimator.AnimatorUpdateListener; import com.pnikosis.materialishprogress.ProgressWheel; +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.database.AttachmentDatabase; import org.thoughtcrime.securesms.events.PartProgressEvent; @@ -27,8 +30,6 @@ import org.thoughtcrime.securesms.mms.Slide; import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.ViewUtil; -import de.greenrobot.event.EventBus; - public class TransferControlView extends FrameLayout { private static final int TRANSITION_MS = 300; @@ -81,7 +82,7 @@ public class TransferControlView extends FrameLayout { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); - if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().registerSticky(this); + if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().register(this); } @Override @@ -162,7 +163,7 @@ public class TransferControlView extends FrameLayout { return anim; } - @SuppressWarnings("unused") + @Subscribe(sticky = true, threadMode = ThreadMode.ASYNC) public void onEventAsync(final PartProgressEvent event) { if (this.slide != null && event.attachment.equals(this.slide.asAttachment())) { Util.runOnMain(new Runnable() { diff --git a/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java b/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java index 087910a608..d299451ab0 100644 --- a/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java +++ b/src/org/thoughtcrime/securesms/jobs/AttachmentDownloadJob.java @@ -5,6 +5,7 @@ import android.support.annotation.VisibleForTesting; import android.text.TextUtils; import android.util.Log; +import org.greenrobot.eventbus.EventBus; import org.thoughtcrime.securesms.attachments.Attachment; import org.thoughtcrime.securesms.attachments.AttachmentId; import org.thoughtcrime.securesms.crypto.AsymmetricMasterSecret; @@ -33,7 +34,6 @@ import java.io.InputStream; import javax.inject.Inject; -import de.greenrobot.event.EventBus; import ws.com.google.android.mms.MmsException; public class AttachmentDownloadJob extends MasterSecretJob implements InjectableType { diff --git a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java index 679c8c8b9d..1eb8d6bba3 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushSendJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushSendJob.java @@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.jobs; import android.content.Context; import android.util.Log; +import org.greenrobot.eventbus.EventBus; import org.thoughtcrime.securesms.ApplicationContext; import org.thoughtcrime.securesms.TextSecureExpiredException; import org.thoughtcrime.securesms.attachments.Attachment; @@ -29,7 +30,6 @@ import java.io.InputStream; import java.util.LinkedList; import java.util.List; -import de.greenrobot.event.EventBus; import ws.com.google.android.mms.ContentType; public abstract class PushSendJob extends SendJob { diff --git a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java index 7afcd7f990..241eb55ba4 100644 --- a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java +++ b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java @@ -21,6 +21,7 @@ import android.util.Pair; import com.google.protobuf.InvalidProtocolBufferException; +import org.greenrobot.eventbus.EventBus; import org.thoughtcrime.redphone.RedPhoneService; import org.thoughtcrime.redphone.audio.IncomingRinger; import org.thoughtcrime.redphone.call.LockManager; @@ -95,7 +96,6 @@ import java.util.concurrent.TimeUnit; import javax.inject.Inject; -import de.greenrobot.event.EventBus; import static org.thoughtcrime.securesms.webrtc.CallNotificationManager.TYPE_ESTABLISHED; import static org.thoughtcrime.securesms.webrtc.CallNotificationManager.TYPE_INCOMING_RINGING;