diff options
author | Sam Whited <sam@samwhited.com> | 2014-11-15 11:09:02 -0500 |
---|---|---|
committer | Sam Whited <sam@samwhited.com> | 2014-11-15 11:12:41 -0500 |
commit | d94b07c916757b351c5d85762b9441ad5e7354f0 (patch) | |
tree | 6fbb06dc80a708a30f9efe8b5353d42a4204aed6 /src/main/java/eu/siacs/conversations/ui | |
parent | 847877f9d2954130a73860118cb7b6fe073aafe8 (diff) |
Make account status an enum
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui')
8 files changed, 27 insertions, 27 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java index 57152b26..e7254933 100644 --- a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java @@ -130,7 +130,7 @@ public class ChooseContactActivity extends XmppActivity { protected void filterContacts(String needle) { this.contacts.clear(); for (Account account : xmppConnectionService.getAccounts()) { - if (account.getStatus() != Account.STATUS_DISABLED) { + if (account.getStatus() != Account.State.DISABLED) { for (Contact contact : account.getRoster().getContacts()) { if (contact.showInRoster() && contact.match(needle)) { this.contacts.add(contact); diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java index 8cd68cff..96fb7b61 100644 --- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -266,7 +266,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd receive.setChecked(false); } } - if (contact.getAccount().getStatus() == Account.STATUS_ONLINE) { + if (contact.getAccount().getStatus() == Account.State.ONLINE) { receive.setEnabled(true); send.setEnabled(true); } else { diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index bc609fb3..0742e17e 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -544,7 +544,7 @@ public class ConversationFragment extends Fragment { } else if (conversation.getMode() == Conversation.MODE_SINGLE) { makeFingerprintWarning(); } else if (!conversation.getMucOptions().online() - && conversation.getAccount().getStatus() == Account.STATUS_ONLINE) { + && conversation.getAccount().getStatus() == Account.State.ONLINE) { int error = conversation.getMucOptions().getError(); switch (error) { case MucOptions.ERROR_NICK_IN_USE: @@ -648,7 +648,7 @@ public class ConversationFragment extends Fragment { public void updateSendButton() { Conversation c = this.conversation; if (activity.useSendButtonToIndicateStatus() && c != null - && c.getAccount().getStatus() == Account.STATUS_ONLINE) { + && c.getAccount().getStatus() == Account.State.ONLINE) { if (c.getMode() == Conversation.MODE_SINGLE) { switch (c.getContact().getMostAvailableStatus()) { case Presences.CHAT: diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index b179c47b..82be4eed 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -62,7 +62,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate @Override public void onClick(View v) { if (mAccount != null - && mAccount.getStatus() == Account.STATUS_DISABLED) { + && mAccount.getStatus() == Account.State.DISABLED) { mAccount.setOption(Account.OPTION_DISABLED, false); xmppConnectionService.updateAccount(mAccount); return; @@ -139,13 +139,13 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate @Override public void run() { if (mAccount != null - && mAccount.getStatus() != Account.STATUS_ONLINE + && mAccount.getStatus() != Account.State.ONLINE && mFetchingAvatar) { startActivity(new Intent(getApplicationContext(), ManageAccountActivity.class)); finish(); } else if (jidToEdit == null && mAccount != null - && mAccount.getStatus() == Account.STATUS_ONLINE) { + && mAccount.getStatus() == Account.State.ONLINE) { if (!mFetchingAvatar) { mFetchingAvatar = true; xmppConnectionService.checkForAvatar(mAccount, @@ -231,12 +231,12 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate protected void updateSaveButton() { if (mAccount != null - && mAccount.getStatus() == Account.STATUS_CONNECTING) { + && mAccount.getStatus() == Account.State.CONNECTING) { this.mSaveButton.setEnabled(false); this.mSaveButton.setTextColor(getSecondaryTextColor()); this.mSaveButton.setText(R.string.account_status_connecting); } else if (mAccount != null - && mAccount.getStatus() == Account.STATUS_DISABLED) { + && mAccount.getStatus() == Account.State.DISABLED) { this.mSaveButton.setEnabled(true); this.mSaveButton.setTextColor(getPrimaryTextColor()); this.mSaveButton.setText(R.string.enable); @@ -245,7 +245,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate this.mSaveButton.setTextColor(getPrimaryTextColor()); if (jidToEdit != null) { if (mAccount != null - && mAccount.getStatus() == Account.STATUS_ONLINE) { + && mAccount.getStatus() == Account.State.ONLINE) { this.mSaveButton.setText(R.string.save); if (!accountInfoEdited()) { this.mSaveButton.setEnabled(false); @@ -379,7 +379,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate this.mRegisterNew.setVisibility(View.GONE); this.mRegisterNew.setChecked(false); } - if (this.mAccount.getStatus() == Account.STATUS_ONLINE + if (this.mAccount.getStatus() == Account.State.ONLINE && !this.mFetchingAvatar) { this.mStats.setVisibility(View.VISIBLE); this.mSessionEst.setText(UIHelper.readableTimeDifference( diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 191e0b82..766b3961 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -555,7 +555,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU protected void onBackendConnected() { this.mActivatedAccounts.clear(); for (Account account : xmppConnectionService.getAccounts()) { - if (account.getStatus() != Account.STATUS_DISABLED) { + if (account.getStatus() != Account.State.DISABLED) { this.mActivatedAccounts.add(account.getJid().toBareJid().toString()); } } @@ -646,7 +646,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU protected void filterContacts(String needle) { this.contacts.clear(); for (Account account : xmppConnectionService.getAccounts()) { - if (account.getStatus() != Account.STATUS_DISABLED) { + if (account.getStatus() != Account.State.DISABLED) { for (Contact contact : account.getRoster().getContacts()) { if (contact.showInRoster() && contact.match(needle)) { this.contacts.add(contact); @@ -661,7 +661,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU protected void filterConferences(String needle) { this.conferences.clear(); for (Account account : xmppConnectionService.getAccounts()) { - if (account.getStatus() != Account.STATUS_DISABLED) { + if (account.getStatus() != Account.State.DISABLED) { for (Bookmark bookmark : account.getBookmarks()) { if (bookmark.match(needle)) { this.conferences.add(bookmark); diff --git a/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java b/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java index 31884bd2..af3194e9 100644 --- a/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java @@ -143,7 +143,7 @@ public class VerifyOTRActivity extends XmppActivity implements XmppConnectionSer } protected boolean isAccountOnline() { - if (this.mAccount.getStatus() != Account.STATUS_ONLINE) { + if (this.mAccount.getStatus() != Account.State.ONLINE) { Toast.makeText(this,R.string.not_connected_try_again,Toast.LENGTH_SHORT).show(); return false; } else { diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 992ff979..98c9cdde 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -517,7 +517,7 @@ public abstract class XmppActivity extends Activity { if (presences.size() == 0) { if (!contact.getOption(Contact.Options.TO) && !contact.getOption(Contact.Options.ASKING) - && contact.getAccount().getStatus() == Account.STATUS_ONLINE) { + && contact.getAccount().getStatus() == Account.State.ONLINE) { showAskForPresenceDialog(contact); } else if (!contact.getOption(Contact.Options.TO) || !contact.getOption(Contact.Options.FROM)) { 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 d0ba3374..25e0f99d 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java @@ -37,57 +37,57 @@ public class AccountAdapter extends ArrayAdapter<Account> { imageView.setImageBitmap(activity.avatarService().get(account, activity.getPixel(48))); switch (account.getStatus()) { - case Account.STATUS_DISABLED: + case DISABLED: statusView.setText(getContext().getString( R.string.account_status_disabled)); statusView.setTextColor(activity.getSecondaryTextColor()); break; - case Account.STATUS_ONLINE: + case ONLINE: statusView.setText(getContext().getString( R.string.account_status_online)); statusView.setTextColor(activity.getPrimaryColor()); break; - case Account.STATUS_CONNECTING: + case CONNECTING: statusView.setText(getContext().getString( R.string.account_status_connecting)); statusView.setTextColor(activity.getSecondaryTextColor()); break; - case Account.STATUS_OFFLINE: + case OFFLINE: statusView.setText(getContext().getString( R.string.account_status_offline)); statusView.setTextColor(activity.getWarningTextColor()); break; - case Account.STATUS_UNAUTHORIZED: + case UNAUTHORIZED: statusView.setText(getContext().getString( R.string.account_status_unauthorized)); statusView.setTextColor(activity.getWarningTextColor()); break; - case Account.STATUS_SERVER_NOT_FOUND: + case SERVER_NOT_FOUND: statusView.setText(getContext().getString( R.string.account_status_not_found)); statusView.setTextColor(activity.getWarningTextColor()); break; - case Account.STATUS_NO_INTERNET: + case NO_INTERNET: statusView.setText(getContext().getString( R.string.account_status_no_internet)); statusView.setTextColor(activity.getWarningTextColor()); break; - case Account.STATUS_REGISTRATION_FAILED: + case REGISTRATION_FAILED: statusView.setText(getContext().getString( R.string.account_status_regis_fail)); statusView.setTextColor(activity.getWarningTextColor()); break; - case Account.STATUS_REGISTRATION_CONFLICT: + case REGISTRATION_CONFLICT: statusView.setText(getContext().getString( R.string.account_status_regis_conflict)); statusView.setTextColor(activity.getWarningTextColor()); break; - case Account.STATUS_REGISTRATION_SUCCESSFULL: + case REGISTRATION_SUCCESSFUL: statusView.setText(getContext().getString( R.string.account_status_regis_success)); statusView.setTextColor(activity.getSecondaryTextColor()); break; - case Account.STATUS_REGISTRATION_NOT_SUPPORTED: + case REGISTRATION_NOT_SUPPORTED: statusView.setText(getContext().getString( R.string.account_status_regis_not_sup)); statusView.setTextColor(activity.getWarningTextColor()); |