aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-11-15 17:44:51 +0100
committerDaniel Gultsch <daniel@gultsch.de>2014-11-15 17:44:51 +0100
commit69ab8a2adbcaaaea3cbb9916ab0273d59f40c778 (patch)
treed1973cfe4440ea07474b9e3b98d2e434aff126fc /src/main/java/eu/siacs/conversations/ui
parent7ba9854c22c6bcf07356cb018a0cbc2f49377f9f (diff)
parent17cec63c14e15d1a78d124f718a4b51e4f4debd1 (diff)
Merge pull request #668 from SamWhited/auth-pinning
Auth mechanism pinning
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java4
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java17
-rw-r--r--src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/VerifyOTRActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/XmppActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java74
8 files changed, 30 insertions, 79 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/main/java/eu/siacs/conversations/ui/ChooseContactActivity.java
index 57152b264..e7254933e 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 8cd68cff9..96fb7b618 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 bc609fb3a..0742e17e3 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 b179c47b6..dc8185994 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(
@@ -428,8 +428,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate
}
} else {
if (this.mAccount.errorStatus()) {
- this.mAccountJid.setError(getString(this.mAccount
- .getReadableStatusId()));
+ this.mAccountJid.setError(getString(this.mAccount.getStatus().getReadableId()));
this.mAccountJid.requestFocus();
}
this.mStats.setVisibility(View.GONE);
diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java
index 191e0b82a..766b39619 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 31884bd27..af3194e9f 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 992ff9799..98c9cdde0 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 d0ba3374f..139f36575 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/AccountAdapter.java
@@ -36,67 +36,19 @@ public class AccountAdapter extends ArrayAdapter<Account> {
ImageView imageView = (ImageView) view.findViewById(R.id.account_image);
imageView.setImageBitmap(activity.avatarService().get(account,
activity.getPixel(48)));
- switch (account.getStatus()) {
- case Account.STATUS_DISABLED:
- statusView.setText(getContext().getString(
- R.string.account_status_disabled));
- statusView.setTextColor(activity.getSecondaryTextColor());
- break;
- case Account.STATUS_ONLINE:
- statusView.setText(getContext().getString(
- R.string.account_status_online));
- statusView.setTextColor(activity.getPrimaryColor());
- break;
- case Account.STATUS_CONNECTING:
- statusView.setText(getContext().getString(
- R.string.account_status_connecting));
- statusView.setTextColor(activity.getSecondaryTextColor());
- break;
- case Account.STATUS_OFFLINE:
- statusView.setText(getContext().getString(
- R.string.account_status_offline));
- statusView.setTextColor(activity.getWarningTextColor());
- break;
- case Account.STATUS_UNAUTHORIZED:
- statusView.setText(getContext().getString(
- R.string.account_status_unauthorized));
- statusView.setTextColor(activity.getWarningTextColor());
- break;
- case Account.STATUS_SERVER_NOT_FOUND:
- statusView.setText(getContext().getString(
- R.string.account_status_not_found));
- statusView.setTextColor(activity.getWarningTextColor());
- break;
- case Account.STATUS_NO_INTERNET:
- statusView.setText(getContext().getString(
- R.string.account_status_no_internet));
- statusView.setTextColor(activity.getWarningTextColor());
- break;
- case Account.STATUS_REGISTRATION_FAILED:
- statusView.setText(getContext().getString(
- R.string.account_status_regis_fail));
- statusView.setTextColor(activity.getWarningTextColor());
- break;
- case Account.STATUS_REGISTRATION_CONFLICT:
- statusView.setText(getContext().getString(
- R.string.account_status_regis_conflict));
- statusView.setTextColor(activity.getWarningTextColor());
- break;
- case Account.STATUS_REGISTRATION_SUCCESSFULL:
- statusView.setText(getContext().getString(
- R.string.account_status_regis_success));
- statusView.setTextColor(activity.getSecondaryTextColor());
- break;
- case Account.STATUS_REGISTRATION_NOT_SUPPORTED:
- statusView.setText(getContext().getString(
- R.string.account_status_regis_not_sup));
- statusView.setTextColor(activity.getWarningTextColor());
- break;
- 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;
}
}