\r
\r
/// Identifier of operation in progress which result shouldn't be lost \r
- private int mWaitingForOpId = -1;\r
+ private long mWaitingForOpId = Long.MAX_VALUE;\r
\r
\r
/**\r
initAuthTokenType();\r
} else {\r
mAuthTokenType = savedInstanceState.getString(KEY_AUTH_TOKEN_TYPE);\r
- mWaitingForOpId = savedInstanceState.getInt(KEY_WAITING_FOR_OP_ID);\r
+ mWaitingForOpId = savedInstanceState.getLong(KEY_WAITING_FOR_OP_ID);\r
}\r
\r
/// load user interface\r
findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);\r
mRefreshButton = findViewById(R.id.centeredRefreshButton);\r
}\r
- showRefreshButton(mServerIsChecked && !mServerIsValid && mWaitingForOpId == -1);\r
+ showRefreshButton(mServerIsChecked && !mServerIsValid && \r
+ mWaitingForOpId > Integer.MAX_VALUE);\r
mServerStatusView = (TextView) findViewById(R.id.server_status_text);\r
showServerStatus();\r
\r
\r
/// global state\r
outState.putString(KEY_AUTH_TOKEN_TYPE, mAuthTokenType);\r
- outState.putInt(KEY_WAITING_FOR_OP_ID, mWaitingForOpId);\r
+ outState.putLong(KEY_WAITING_FOR_OP_ID, mWaitingForOpId);\r
\r
/// Server PRE-fragment state\r
outState.putInt(KEY_SERVER_STATUS_TEXT, mServerStatusText);\r
}\r
\r
private void onGetUserNameFinish(RemoteOperationResult result) {\r
- mWaitingForOpId = -1;\r
+ mWaitingForOpId = Long.MAX_VALUE;\r
if (result.isSuccess()) {\r
boolean success = false;\r
String username = (String) result.getData().get(0);\r
}\r
\r
private void onSamlBasedFederatedSingleSignOnAuthorizationStart(RemoteOperationResult result) {\r
- mWaitingForOpId = -1;\r
+ mWaitingForOpId = Long.MAX_VALUE;\r
dismissDialog(WAIT_DIALOG_TAG);\r
//if (result.isTemporalRedirection() && result.isIdPRedirection()) {\r
private void onGetServerInfoFinish(RemoteOperationResult result) {\r
/// update activity state\r
mServerIsChecked = true;\r
- mWaitingForOpId = -1;\r
+ mWaitingForOpId = Long.MAX_VALUE;\r
\r
// update server status, but don't show it yet\r
updateServerStatusIconAndText(result);\r
* @param result Result of the operation.\r
*/\r
private void onGetOAuthAccessTokenFinish(RemoteOperationResult result) {\r
- mWaitingForOpId = -1;\r
+ mWaitingForOpId = Long.MAX_VALUE;\r
dismissDialog(WAIT_DIALOG_TAG);\r
\r
String webdav_path = AccountUtils.getWebdavPath(mServerInfo.mVersion, mAuthTokenType);\r
* @param result Result of the operation.\r
*/\r
private void onAuthorizationCheckFinish(RemoteOperationResult result) {\r
- mWaitingForOpId = -1;\r
+ mWaitingForOpId = Long.MAX_VALUE;\r
dismissDialog(WAIT_DIALOG_TAG);\r
\r
result = new RemoteOperationResult(new RuntimeException("FAKE"));\r
private void doOnResumeAndBound() {\r
Log.wtf(TAG, "registering to listen for operation callbacks" );\r
mOperationsServiceBinder.addOperationListener(AuthenticatorActivity.this, mHandler);\r
- if (mWaitingForOpId != -1) {\r
- mOperationsServiceBinder.dispatchResultIfFinished(mWaitingForOpId, this);\r
+ if (mWaitingForOpId <= Integer.MAX_VALUE) {\r
+ mOperationsServiceBinder.dispatchResultIfFinished((int)mWaitingForOpId, this);\r
}\r
}\r
\r
* Creates and adds to the queue a new operation, as described by operationIntent
*
* @param operationIntent Intent describing a new operation to queue and execute.
- * @return Identifier of the operation created, or -1 if failed.
+ * @return Identifier of the operation created, or null if failed.
*/
- public int newOperation(Intent operationIntent) {
+ public long newOperation(Intent operationIntent) {
RemoteOperation operation = null;
Target target = null;
try {
mPendingOperations.add(new Pair<Target , RemoteOperation>(target, operation));
startService(new Intent(OperationsService.this, OperationsService.class));
Log_OC.wtf(TAG, "New operation added, opId: " + operation.hashCode());
+ // better id than hash? ; should be good enough by the time being
return operation.hashCode();
} else {
- Log_OC.wtf(TAG, "New operation failed, returned -1");
- return -1;
+ Log_OC.wtf(TAG, "New operation failed, returned Long.MAX_VALUE");
+ return Long.MAX_VALUE;
}
}
- public RemoteOperationResult getOperationResultIfFinished(int operationId) {
- Pair<RemoteOperation, RemoteOperationResult> undispatched =
- mUndispatchedFinishedOperations.remove(operationId);
- if (undispatched != null) {
- return undispatched.second;
- }
- return null;
- }
-
-
public void dispatchResultIfFinished(int operationId, OnRemoteOperationListener listener) {
Pair<RemoteOperation, RemoteOperationResult> undispatched =
mUndispatchedFinishedOperations.remove(operationId);