From 251f4d6d7f93da6d23c3422cf8eeece780789f45 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Sat, 15 Nov 2014 11:29:58 -0500 Subject: Add incompatible server status --- .../conversations/ui/adapter/AccountAdapter.java | 78 ++++------------------ 1 file changed, 13 insertions(+), 65 deletions(-) (limited to 'src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java') diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java index 7404e161..139f3657 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java @@ -36,71 +36,19 @@ public class AccountAdapter extends ArrayAdapter { ImageView imageView = (ImageView) view.findViewById(R.id.account_image); imageView.setImageBitmap(activity.avatarService().get(account, activity.getPixel(48))); - switch (account.getStatus()) { - case DISABLED: - statusView.setText(getContext().getString( - R.string.account_status_disabled)); - statusView.setTextColor(activity.getSecondaryTextColor()); - break; - case ONLINE: - statusView.setText(getContext().getString( - R.string.account_status_online)); - statusView.setTextColor(activity.getPrimaryColor()); - break; - case CONNECTING: - statusView.setText(getContext().getString( - R.string.account_status_connecting)); - statusView.setTextColor(activity.getSecondaryTextColor()); - break; - case OFFLINE: - statusView.setText(getContext().getString( - R.string.account_status_offline)); - statusView.setTextColor(activity.getWarningTextColor()); - break; - case UNAUTHORIZED: - statusView.setText(getContext().getString( - R.string.account_status_unauthorized)); - statusView.setTextColor(activity.getWarningTextColor()); - break; - case SERVER_NOT_FOUND: - statusView.setText(getContext().getString( - R.string.account_status_not_found)); - statusView.setTextColor(activity.getWarningTextColor()); - break; - case NO_INTERNET: - statusView.setText(getContext().getString( - R.string.account_status_no_internet)); - statusView.setTextColor(activity.getWarningTextColor()); - break; - case REGISTRATION_FAILED: - statusView.setText(getContext().getString( - R.string.account_status_regis_fail)); - statusView.setTextColor(activity.getWarningTextColor()); - break; - case REGISTRATION_CONFLICT: - statusView.setText(getContext().getString( - R.string.account_status_regis_conflict)); - statusView.setTextColor(activity.getWarningTextColor()); - break; - case REGISTRATION_SUCCESSFUL: - statusView.setText(getContext().getString( - R.string.account_status_regis_success)); - statusView.setTextColor(activity.getSecondaryTextColor()); - break; - case REGISTRATION_NOT_SUPPORTED: - statusView.setText(getContext().getString( - R.string.account_status_regis_not_sup)); - statusView.setTextColor(activity.getWarningTextColor()); - break; - case SECURITY_ERROR: - statusView.setText(getContext().getString - (R.string.account_status_security_error)); - statusView.setTextColor(activity.getWarningTextColor()); - default: - statusView.setText(""); - break; - } - + statusView.setText(getContext().getString(account.getStatus().getReadableId())); + switch (account.getStatus()) { + case ONLINE: + statusView.setTextColor(activity.getPrimaryColor()); + break; + case DISABLED: + case CONNECTING: + statusView.setTextColor(activity.getSecondaryTextColor()); + break; + default: + statusView.setTextColor(activity.getWarningTextColor()); + break; + } return view; } } -- cgit v1.2.3