Skip to content

Instantly share code, notes, and snippets.

@skayred
Created November 10, 2011 11:38
Show Gist options
  • Select an option

  • Save skayred/1354666 to your computer and use it in GitHub Desktop.

Select an option

Save skayred/1354666 to your computer and use it in GitHub Desktop.
public void toggleStatus(View view) {
showProgressDialog("", getString(R.string.progress_loading_message));
String status = User.AVAILABLE_STATUS;
if (getApp().getCurrentUser().isAvailable()) {
status = User.OFFLINE_STATUS;
}
final boolean initialAvailability = getApp().getCurrentUser().isAvailable();
jetTaxiClient.updateUserStatus(status, new AjaxCallback<User>() {
@Override
protected void OnSuccess(User user) {
getApp().setCurrentUser(user);
statusButton.setChecked(user.isAvailable());
}
@Override
protected void OnException(Exception e) {
handleError(e);
statusButton.setChecked(initialAvailability);
}
@Override
protected void OnFinally() {
dismissProgressDialog();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment