diff options
-rw-r--r-- | res/layout/activity_edit_account.xml | 2 | ||||
-rw-r--r-- | res/values/strings.xml | 1 | ||||
-rw-r--r-- | src/eu/siacs/conversations/entities/Conversation.java | 10 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationActivity.java | 3 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/EditAccountActivity.java | 25 | ||||
-rw-r--r-- | src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java | 49 |
6 files changed, 69 insertions, 21 deletions
diff --git a/res/layout/activity_edit_account.xml b/res/layout/activity_edit_account.xml index 826d895f..2c08b926 100644 --- a/res/layout/activity_edit_account.xml +++ b/res/layout/activity_edit_account.xml @@ -86,7 +86,7 @@ android:layout_marginTop="8dp" android:orientation="vertical" android:padding="16dp" - android:visibility="visible" > + android:visibility="gone" > <TextView android:layout_width="fill_parent" diff --git a/res/values/strings.xml b/res/values/strings.xml index 876b9e9f..12c3f262 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -282,5 +282,6 @@ <string name="next">Next</string> <string name="server_info_session_established">Current session established</string> <string name="additional_information">Additional Information</string> + <string name="skip">Skip</string> </resources>
\ No newline at end of file diff --git a/src/eu/siacs/conversations/entities/Conversation.java b/src/eu/siacs/conversations/entities/Conversation.java index ce29301c..439f9f22 100644 --- a/src/eu/siacs/conversations/entities/Conversation.java +++ b/src/eu/siacs/conversations/entities/Conversation.java @@ -335,6 +335,16 @@ public class Conversation extends AbstractEntity { if ((latestEncryption == Message.ENCRYPTION_DECRYPTED) || (latestEncryption == Message.ENCRYPTION_DECRYPTION_FAILED)) { return Message.ENCRYPTION_PGP; + } else if (latestEncryption == Message.ENCRYPTION_NONE) { + if (getContact().getPresences().size() == 1) { + if (getContact().getOtrFingerprints().size() >= 1) { + return Message.ENCRYPTION_OTR; + } else { + return latestEncryption; + } + } else { + return latestEncryption; + } } else { return latestEncryption; } diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index df8f77cd..c68063d2 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -628,8 +628,7 @@ public class ConversationActivity extends XmppActivity { } } else { if (xmppConnectionService.getAccounts().size() == 0) { - startActivity(new Intent(this, ManageAccountActivity.class)); - finish(); + startActivity(new Intent(this, EditAccountActivity.class)); } else if (conversationList.size() <= 0) { // add no history startActivity(new Intent(this, StartConversationActivity.class)); diff --git a/src/eu/siacs/conversations/ui/EditAccountActivity.java b/src/eu/siacs/conversations/ui/EditAccountActivity.java index 268d32d1..2d24aa49 100644 --- a/src/eu/siacs/conversations/ui/EditAccountActivity.java +++ b/src/eu/siacs/conversations/ui/EditAccountActivity.java @@ -76,7 +76,7 @@ public class EditAccountActivity extends XmppActivity { mAccount.setPassword(password); mAccount.setUsername(username); mAccount.setServer(server); - mAccount.setOption(Account.OPTION_REGISTER,registerNewAccount); + mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount); xmppConnectionService.updateAccount(mAccount); } else { if (xmppConnectionService.findAccountByJid(mAccountJid @@ -116,7 +116,13 @@ public class EditAccountActivity extends XmppActivity { @Override public void run() { - if (jidToEdit == null && mAccount != null + if (mAccount != null + && mAccount.getStatus() != Account.STATUS_ONLINE + && mFetchingAvatar) { + startActivity(new Intent(getApplicationContext(), + ManageAccountActivity.class)); + finish(); + } else if (jidToEdit == null && mAccount != null && mAccount.getStatus() == Account.STATUS_ONLINE) { if (!mFetchingAvatar) { mFetchingAvatar = true; @@ -165,6 +171,7 @@ public class EditAccountActivity extends XmppActivity { intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class); intent.putExtra("account", mAccount.getJid()); + intent.putExtra("setup", true); } startActivity(intent); finish(); @@ -249,7 +256,7 @@ public class EditAccountActivity extends XmppActivity { } } } - + @Override protected void onStop() { if (xmppConnectionServiceBound) { @@ -272,6 +279,7 @@ public class EditAccountActivity extends XmppActivity { getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setDisplayShowHomeEnabled(false); this.mCancelButton.setEnabled(false); + this.mCancelButton.setTextColor(getSecondaryTextColor()); } this.mAccountJid.setAdapter(this.mKnownHostsAdapter); updateSaveButton(); @@ -288,7 +296,8 @@ public class EditAccountActivity extends XmppActivity { this.mRegisterNew.setVisibility(View.GONE); this.mRegisterNew.setChecked(false); } - if (this.mAccount.getStatus() == Account.STATUS_ONLINE && !this.mFetchingAvatar) { + if (this.mAccount.getStatus() == Account.STATUS_ONLINE + && !this.mFetchingAvatar) { this.mStats.setVisibility(View.VISIBLE); this.mSessionEst.setText(UIHelper.readableTimeDifference( getApplicationContext(), this.mAccount.getXmppConnection() @@ -297,7 +306,8 @@ public class EditAccountActivity extends XmppActivity { if (features.carbons()) { this.mServerInfoCarbons.setText(R.string.server_info_available); } else { - this.mServerInfoCarbons.setText(R.string.server_info_unavailable); + this.mServerInfoCarbons + .setText(R.string.server_info_unavailable); } if (features.sm()) { this.mServerInfoSm.setText(R.string.server_info_available); @@ -309,8 +319,9 @@ public class EditAccountActivity extends XmppActivity { } else { this.mServerInfoPep.setText(R.string.server_info_unavailable); } - String fingerprint = this.mAccount.getOtrFingerprint(getApplicationContext()); - if (fingerprint!=null) { + String fingerprint = this.mAccount + .getOtrFingerprint(getApplicationContext()); + if (fingerprint != null) { this.mOtrFingerprintHeadline.setVisibility(View.VISIBLE); this.mOtrFingerprint.setVisibility(View.VISIBLE); this.mOtrFingerprint.setText(fingerprint); diff --git a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java index e874eeb7..c4c1b45e 100644 --- a/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java +++ b/src/eu/siacs/conversations/ui/PublishProfilePictureActivity.java @@ -5,7 +5,6 @@ import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; -import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; @@ -32,9 +31,11 @@ public class PublishProfilePictureActivity extends XmppActivity { private Uri defaultUri; private Account account; - + private boolean support = false; + private boolean mInitialAccountSetup; + private UiCallback<Avatar> avatarPublication = new UiCallback<Avatar>() { @Override @@ -43,6 +44,10 @@ public class PublishProfilePictureActivity extends XmppActivity { @Override public void run() { + if (mInitialAccountSetup) { + startActivity(new Intent(getApplicationContext(), + StartConversationActivity.class)); + } finish(); } }); @@ -104,6 +109,10 @@ public class PublishProfilePictureActivity extends XmppActivity { @Override public void onClick(View v) { + if (mInitialAccountSetup) { + startActivity(new Intent(getApplicationContext(), + StartConversationActivity.class)); + } finish(); } }); @@ -143,21 +152,25 @@ public class PublishProfilePictureActivity extends XmppActivity { if (jid != null) { this.account = xmppConnectionService.findAccountByJid(jid); if (this.account.getXmppConnection() != null) { - this.support = this.account.getXmppConnection().getFeatures().pubsub(); + this.support = this.account.getXmppConnection() + .getFeatures().pubsub(); } if (this.avatarUri == null) { - if (this.account.getAvatar() != null || this.defaultUri == null) { + if (this.account.getAvatar() != null + || this.defaultUri == null) { this.avatar.setImageBitmap(this.account.getImage( getApplicationContext(), 384)); if (this.defaultUri != null) { this.avatar - .setOnLongClickListener(this.backToDefaultListener); + .setOnLongClickListener(this.backToDefaultListener); } else { this.secondaryHint.setVisibility(View.INVISIBLE); } if (!support) { - this.hintOrWarning.setTextColor(getWarningTextColor()); - this.hintOrWarning.setText(R.string.error_publish_avatar_no_server_support); + this.hintOrWarning + .setTextColor(getWarningTextColor()); + this.hintOrWarning + .setText(R.string.error_publish_avatar_no_server_support); } } else { this.avatarUri = this.defaultUri; @@ -173,13 +186,26 @@ public class PublishProfilePictureActivity extends XmppActivity { } + @Override + protected void onStart() { + super.onStart(); + if (getIntent() != null) { + this.mInitialAccountSetup = getIntent().getBooleanExtra("setup", + false); + } + if (this.mInitialAccountSetup) { + this.cancelButton.setText(R.string.skip); + } + } + protected void loadImageIntoPreview(Uri uri) { Bitmap bm = xmppConnectionService.getFileBackend().cropCenterSquare( uri, 384); - if (bm==null) { + if (bm == null) { disablePublishButton(); this.hintOrWarning.setTextColor(getWarningTextColor()); - this.hintOrWarning.setText(R.string.error_publish_avatar_converting); + this.hintOrWarning + .setText(R.string.error_publish_avatar_converting); return; } this.avatar.setImageBitmap(bm); @@ -191,12 +217,13 @@ public class PublishProfilePictureActivity extends XmppActivity { } else { disablePublishButton(); this.hintOrWarning.setTextColor(getWarningTextColor()); - this.hintOrWarning.setText(R.string.error_publish_avatar_no_server_support); + this.hintOrWarning + .setText(R.string.error_publish_avatar_no_server_support); } if (this.defaultUri != null && uri.equals(this.defaultUri)) { this.secondaryHint.setVisibility(View.INVISIBLE); this.avatar.setOnLongClickListener(null); - } else if (this.defaultUri != null ) { + } else if (this.defaultUri != null) { this.secondaryHint.setVisibility(View.VISIBLE); this.avatar.setOnLongClickListener(this.backToDefaultListener); } |