diff options
author | Christian S <christian@pix-art.de> | 2015-07-16 20:25:35 +0200 |
---|---|---|
committer | Christian S <christian@pix-art.de> | 2015-07-16 20:25:35 +0200 |
commit | 17099605e7e58c2562fca752622f485ceb6ae414 (patch) | |
tree | a6e3253a3a9a28c62ca56b643ec8a7f4fc5f7ddd /src/main/java/eu | |
parent | e9149682a81751092233e31dd42887b58f98b302 (diff) | |
parent | 4f62793a67415e91f589924b70fdd5bdd35c284d (diff) |
copy commits
Diffstat (limited to 'src/main/java/eu')
3 files changed, 26 insertions, 14 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java index 2c7fbd6af..6b0f89b1c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationActivity.java @@ -1074,6 +1074,9 @@ public class ConversationActivity extends XmppActivity } private void attachLocationToConversation(Conversation conversation, Uri uri) { + if (conversation == null) { + return; + } xmppConnectionService.attachLocationToConversation(conversation,uri, new UiCallback<Message>() { @Override @@ -1094,8 +1097,10 @@ public class ConversationActivity extends XmppActivity } private void attachFileToConversation(Conversation conversation, Uri uri) { - prepareFileToast = Toast.makeText(getApplicationContext(), - getText(R.string.preparing_file), Toast.LENGTH_LONG); + if (conversation == null) { + return; + } + prepareFileToast = Toast.makeText(getApplicationContext(),getText(R.string.preparing_file), Toast.LENGTH_LONG); prepareFileToast.show(); xmppConnectionService.attachFileToConversation(conversation,uri, new UiCallback<Message>() { @Override @@ -1117,8 +1122,10 @@ public class ConversationActivity extends XmppActivity } private void attachImageToConversation(Conversation conversation, Uri uri) { - prepareFileToast = Toast.makeText(getApplicationContext(), - getText(R.string.preparing_image), Toast.LENGTH_LONG); + if (conversation == null) { + return; + } + prepareFileToast = Toast.makeText(getApplicationContext(),getText(R.string.preparing_image), Toast.LENGTH_LONG); prepareFileToast.show(); xmppConnectionService.attachImageToConversation(conversation, uri, new UiCallback<Message>() { diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java index 71bbd33ca..96d864634 100644 --- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java @@ -124,11 +124,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); } } @@ -164,7 +164,7 @@ public class EditAccountActivity extends XmppActivity implements OnAccountUpdate updateSaveButton(); } if (mAccount != null) { - updateAccountInformation(); + updateAccountInformation(false); } } }); @@ -385,7 +385,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); @@ -420,9 +420,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(Config.AVATAR_SIZE))); @@ -502,11 +504,13 @@ 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) { + this.mAccountJid.requestFocus(); + } } else { this.mAccountJid.setError(null); } this.mStats.setVisibility(View.GONE); } } -}
\ No newline at end of file +} diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index e6639e7b0..2e768ad91 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -145,7 +145,8 @@ public class UIHelper { if (d != null ) { switch (d.getStatus()) { case Transferable.STATUS_CHECKING: - return new Pair<>(context.getString(R.string.checking_file),true); + return new Pair<>(context.getString(R.string.checking_x, + getFileDescriptionString(context,message)),true); case Transferable.STATUS_DOWNLOADING: return new Pair<>(context.getString(R.string.receiving_x_file, getFileDescriptionString(context,message), |