From 64975460d3504cfa3573fe11ed57d2099b29a160 Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Thu, 23 May 2019 21:00:58 +0400 Subject: [PATCH] The ServiceConnection object is directly put in the AppHelper (anonymous) --- .../github/chronosx88/influence/views/LoginActivity.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/github/chronosx88/influence/views/LoginActivity.java b/app/src/main/java/io/github/chronosx88/influence/views/LoginActivity.java index 5d84f37..28adf4b 100644 --- a/app/src/main/java/io/github/chronosx88/influence/views/LoginActivity.java +++ b/app/src/main/java/io/github/chronosx88/influence/views/LoginActivity.java @@ -140,7 +140,7 @@ public class LoginActivity extends AppCompatActivity implements CoreContracts.IL private void doLogin() { loadingScreen(true); startService(new Intent(this, XMPPConnectionService.class)); - ServiceConnection connection = new ServiceConnection() { + AppHelper.setServiceConnection(new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { XMPPConnectionService.XMPPServiceBinder binder = (XMPPConnectionService.XMPPServiceBinder) service; @@ -151,9 +151,8 @@ public class LoginActivity extends AppCompatActivity implements CoreContracts.IL public void onServiceDisconnected(ComponentName name) { AppHelper.setXmppConnection(null); } - }; - AppHelper.setServiceConnection(connection); - bindService(new Intent(this, XMPPConnectionService.class), connection, Context.BIND_AUTO_CREATE); + }); + bindService(new Intent(this, XMPPConnectionService.class), AppHelper.getServiceConnection(), Context.BIND_AUTO_CREATE); } @Subscribe(threadMode = ThreadMode.MAIN)