aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Contact.java14
-rw-r--r--src/main/java/eu/siacs/conversations/services/AvatarService.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java20
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java2
4 files changed, 13 insertions, 29 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Contact.java b/src/main/java/eu/siacs/conversations/entities/Contact.java
index 8fa91b02..9a827f85 100644
--- a/src/main/java/eu/siacs/conversations/entities/Contact.java
+++ b/src/main/java/eu/siacs/conversations/entities/Contact.java
@@ -78,14 +78,16 @@ public class Contact implements ListItem {
public String getDisplayName() {
if (this.systemName != null) {
- return this.systemName;
- } else if (this.serverName != null) {
- return this.serverName;
+ return this.systemName;
+ } else if (this.serverName != null) {
+ return this.serverName;
} else if (this.presenceName != null) {
- return this.presenceName;
+ return this.presenceName;
+ } else if (jid.hasLocalpart()) {
+ return jid.getLocalpart();
} else {
- return jid.getLocalpart();
- }
+ return jid.getDomainpart();
+ }
}
public String getProfilePhoto() {
diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java
index e20b55a5..6f199807 100644
--- a/src/main/java/eu/siacs/conversations/services/AvatarService.java
+++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java
@@ -36,7 +36,7 @@ public class AvatarService {
this.mXmppConnectionService = service;
}
- public Bitmap get(Contact contact, int size) {
+ public Bitmap get(final Contact contact, final int size) {
final String KEY = key(contact, size);
Bitmap avatar = this.mXmppConnectionService.getBitmapCache().get(KEY);
if (avatar != null) {
@@ -49,7 +49,7 @@ public class AvatarService {
avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatar(), size);
}
if (avatar == null) {
- avatar = get(contact.getDisplayName(), size);
+ avatar = get(contact.getDisplayName(), size);
}
this.mXmppConnectionService.getBitmapCache().put(KEY, avatar);
return avatar;
@@ -196,7 +196,7 @@ public class AvatarService {
+ String.valueOf(size);
}
- public Bitmap get(String name, int size) {
+ public Bitmap get(final String name, final int size) {
final String KEY = key(name, size);
Bitmap bitmap = mXmppConnectionService.getBitmapCache().get(KEY);
if (bitmap != null) {
diff --git a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
index 7cccc31b..f9c7d526 100644
--- a/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/EditAccountActivity.java
@@ -1,15 +1,10 @@
package eu.siacs.conversations.ui;
-import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Intent;
-import android.graphics.Bitmap;
-import android.graphics.Color;
-import android.graphics.Point;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
-import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -27,21 +22,8 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
-import com.google.zxing.BarcodeFormat;
-import com.google.zxing.EncodeHintType;
-import com.google.zxing.WriterException;
-import com.google.zxing.common.BitMatrix;
-import com.google.zxing.integration.android.IntentIntegrator;
-import com.google.zxing.integration.android.IntentResult;
-import com.google.zxing.qrcode.QRCodeWriter;
-import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
-
-import java.util.Hashtable;
-
-import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
-import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
import eu.siacs.conversations.utils.UIHelper;
@@ -111,7 +93,7 @@ public class EditAccountActivity extends XmppActivity {
if (mAccount != null) {
mAccount.setPassword(password);
try {
- mAccount.setUsername(jid.hasLocalPart() ? jid.getLocalpart() : "");
+ mAccount.setUsername(jid.hasLocalpart() ? jid.getLocalpart() : "");
mAccount.setServer(jid.getDomainpart());
} catch (final InvalidJidException ignored) {
}
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
index b973ded2..a53c8096 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
@@ -162,7 +162,7 @@ public final class Jid {
return result;
}
- public boolean hasLocalPart() {
+ public boolean hasLocalpart() {
return !localpart.isEmpty();
}