X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/f991e1e91dce62fbf4b04c9687010a022b09e125..7c4fc0486ffedcbbc35050d285570a4563befb2d:/src/com/owncloud/android/authentication/AuthenticatorActivity.java diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 255ed801..638b5dd8 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -58,6 +58,7 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; +import android.widget.Toast; import com.actionbarsherlock.app.SherlockDialogFragment; import com.owncloud.android.MainApp; @@ -146,6 +147,9 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { private int mAuthStatusText, mAuthStatusIcon; private TextView mAuthStatusLayout; + private ServiceConnection mOperationsConnection = null; + private OperationsServiceBinder mOperationsBinder = null; + private final Handler mHandler = new Handler(); private Thread mOperationThread; private GetRemoteStatusOperation mOcServerChkOperation; @@ -199,6 +203,32 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_NO_TITLE); + // bind to Operations Service + mOperationsConnection = new ServiceConnection() { + + @Override + public void onServiceConnected(ComponentName name, IBinder service) { + Log_OC.d(TAG, "Operations service connected"); + mOperationsBinder = (OperationsServiceBinder) service; + } + + @Override + public void onServiceDisconnected(ComponentName name) { + Log_OC.d(TAG, "Operations service crashed"); + mOperationsBinder = null; + } + + }; + if (!bindService(new Intent(this, OperationsService.class), + mOperationsConnection, + Context.BIND_AUTO_CREATE)) { + Toast.makeText(this, + R.string.error_cant_bind_to_operations_service, + Toast.LENGTH_LONG) + .show(); + finish(); + } + /// set view and get references to view elements setContentView(R.layout.account_setup); mAuthMessage = (TextView) findViewById(R.id.auth_message); @@ -536,6 +566,16 @@ SsoWebViewClientListener, OnSslUntrustedCertListener { mJustCreated = false; } + + + @Override + protected void onDestroy() { + if (mOperationsConnection != null) { + unbindService(mOperationsConnection); + mOperationsBinder = null; + } + super.onDestroy(); + } /**