Create avatar's for JID's w/o localparts
This commit is contained in:
parent
5ce0cd3802
commit
1a3327f2b1
|
@ -83,8 +83,10 @@ public class Contact implements ListItem {
|
|||
return this.serverName;
|
||||
} else if (this.presenceName != null) {
|
||||
return this.presenceName;
|
||||
} else {
|
||||
} else if (jid.hasLocalpart()) {
|
||||
return jid.getLocalpart();
|
||||
} else {
|
||||
return jid.getDomainpart();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ public final class Jid {
|
|||
return result;
|
||||
}
|
||||
|
||||
public boolean hasLocalPart() {
|
||||
public boolean hasLocalpart() {
|
||||
return !localpart.isEmpty();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue