diff options
author | lookshe <github@lookshe.org> | 2015-08-11 20:30:11 +0200 |
---|---|---|
committer | lookshe <github@lookshe.org> | 2015-08-11 20:30:11 +0200 |
commit | 639babfdb5289a035e0a22bf607c068caefa5c99 (patch) | |
tree | 6a11aa6a189f3a5988d5d1e1c733d2027bc3494f /src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java | |
parent | 1b5966ae3b1108c88a810d7d32a0aefa8812d11f (diff) | |
parent | 8fd688ca96005152be754eeba1be72c7c0aab9ad (diff) |
Merge branch 'trz/rebase' into trz/rename
Conflicts:
build.gradle
src/main/java/de/thedevstack/conversationsplus/crypto/OtrEngine.java
src/main/java/de/thedevstack/conversationsplus/entities/Account.java
src/main/java/de/thedevstack/conversationsplus/entities/Contact.java
src/main/java/de/thedevstack/conversationsplus/entities/Downloadable.java
src/main/java/de/thedevstack/conversationsplus/entities/DownloadableFile.java
src/main/java/de/thedevstack/conversationsplus/entities/DownloadablePlaceholder.java
src/main/java/de/thedevstack/conversationsplus/entities/Message.java
src/main/java/de/thedevstack/conversationsplus/generator/IqGenerator.java
src/main/java/de/thedevstack/conversationsplus/http/HttpConnection.java
src/main/java/de/thedevstack/conversationsplus/http/HttpConnectionManager.java
src/main/java/de/thedevstack/conversationsplus/parser/AbstractParser.java
src/main/java/de/thedevstack/conversationsplus/parser/MessageParser.java
src/main/java/de/thedevstack/conversationsplus/parser/PresenceParser.java
src/main/java/de/thedevstack/conversationsplus/persistance/DatabaseBackend.java
src/main/java/de/thedevstack/conversationsplus/persistance/FileBackend.java
src/main/java/de/thedevstack/conversationsplus/services/NotificationService.java
src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java
src/main/java/de/thedevstack/conversationsplus/ui/ConversationActivity.java
src/main/java/de/thedevstack/conversationsplus/ui/ConversationFragment.java
src/main/java/de/thedevstack/conversationsplus/ui/SettingsActivity.java
src/main/java/de/thedevstack/conversationsplus/ui/StartConversationActivity.java
src/main/java/de/thedevstack/conversationsplus/ui/adapter/AccountAdapter.java
src/main/java/de/thedevstack/conversationsplus/ui/adapter/ConversationAdapter.java
src/main/java/de/thedevstack/conversationsplus/ui/adapter/ListItemAdapter.java
src/main/java/de/thedevstack/conversationsplus/ui/adapter/MessageAdapter.java
src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java
src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnection.java
src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleConnectionManager.java
src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleInbandTransport.java
src/main/java/de/thedevstack/conversationsplus/xmpp/jingle/JingleSocks5Transport.java
src/main/java/de/thedevstack/conversationsplus/xmpp/stanzas/MessagePacket.java
src/main/java/eu/siacs/conversations/crypto/OtrEngine.java
src/main/java/eu/siacs/conversations/crypto/OtrService.java
src/main/java/eu/siacs/conversations/entities/DownloadablePlaceholder.java
src/main/java/eu/siacs/conversations/entities/TransferablePlaceholder.java
src/main/java/eu/siacs/conversations/http/HttpConnection.java
src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java
src/main/res/layout/activity_about.xml
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java b/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java index 0023d6ed..efcd4128 100644 --- a/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java +++ b/src/main/java/de/thedevstack/conversationsplus/ui/EditAccountActivity.java @@ -67,7 +67,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate @Override public void onClick(final View v) { - if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED) { + if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !accountInfoEdited()) { mAccount.setOption(Account.OPTION_DISABLED, false); xmppConnectionService.updateAccount(mAccount); return; @@ -123,11 +123,11 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount); xmppConnectionService.createAccount(mAccount); } - if (jidToEdit != null) { + if (jidToEdit != null && !mAccount.isOptionSet(Account.OPTION_DISABLED)) { finish(); } else { updateSaveButton(); - updateAccountInformation(); + updateAccountInformation(true); } } @@ -163,7 +163,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate updateSaveButton(); } if (mAccount != null) { - updateAccountInformation(); + updateAccountInformation(false); } } }); @@ -223,7 +223,9 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate if (avatar != null) { intent = new Intent(getApplicationContext(), StartConversationActivity.class); - intent.putExtra("init",true); + if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) { + intent.putExtra("init", true); + } } else { intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class); @@ -237,7 +239,11 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate } protected void updateSaveButton() { - if (mAccount != null && (mAccount.getStatus() == Account.State.CONNECTING || mFetchingAvatar)) { + if (accountInfoEdited() && jidToEdit != null) { + this.mSaveButton.setText(R.string.save); + this.mSaveButton.setEnabled(true); + this.mSaveButton.setTextColor(getPrimaryTextColor()); + } else if (mAccount != null && (mAccount.getStatus() == Account.State.CONNECTING || mFetchingAvatar)) { this.mSaveButton.setEnabled(false); this.mSaveButton.setTextColor(getSecondaryTextColor()); this.mSaveButton.setText(R.string.account_status_connecting); @@ -265,9 +271,9 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate } protected boolean accountInfoEdited() { - return (!this.mAccount.getJid().toBareJid().toString().equals( - this.mAccountJid.getText().toString())) - || (!this.mAccount.getPassword().equals( + return this.mAccount != null && (!this.mAccount.getJid().toBareJid().toString().equals( + this.mAccountJid.getText().toString()) + || !this.mAccount.getPassword().equals( this.mPassword.getText().toString())); } @@ -378,7 +384,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate xmppConnectionService.getKnownHosts()); if (this.jidToEdit != null) { this.mAccount = xmppConnectionService.findAccountByJid(jidToEdit); - updateAccountInformation(); + updateAccountInformation(true); } else if (this.xmppConnectionService.getAccounts().size() == 0) { if (getActionBar() != null) { getActionBar().setDisplayHomeAsUpEnabled(false); @@ -413,9 +419,11 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate return super.onOptionsItemSelected(item); } - private void updateAccountInformation() { - this.mAccountJid.setText(this.mAccount.getJid().toBareJid().toString()); - this.mPassword.setText(this.mAccount.getPassword()); + private void updateAccountInformation(boolean init) { + if (init) { + this.mAccountJid.setText(this.mAccount.getJid().toBareJid().toString()); + this.mPassword.setText(this.mAccount.getPassword()); + } if (this.jidToEdit != null) { this.mAvatar.setVisibility(View.VISIBLE); this.mAvatar.setImageBitmap(avatarService().get(this.mAccount, getPixel(72))); @@ -464,7 +472,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate } else { this.mServerInfoSm.setText(R.string.server_info_unavailable); } - if (features.pubsub()) { + if (features.pep()) { this.mServerInfoPep.setText(R.string.server_info_available); } else { this.mServerInfoPep.setText(R.string.server_info_unavailable); @@ -495,7 +503,9 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate } else { if (this.mAccount.errorStatus()) { this.mAccountJid.setError(getString(this.mAccount.getStatus().getReadableId())); - this.mAccountJid.requestFocus(); + if (init || !accountInfoEdited()) { + this.mAccountJid.requestFocus(); + } } else { this.mAccountJid.setError(null); } |