display '#' in generated channel avatars
This commit is contained in:
parent
c898486534
commit
9bcef7a8e7
|
@ -296,6 +296,10 @@ public class HttpDownloadConnection implements Transferable {
|
||||||
retrieveFailed(e);
|
retrieveFailed(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//TODO at this stage we probably also want to persist the file size in the body of the
|
||||||
|
// message via a similar mechansim as updateFileParams() - essentially body needs to read
|
||||||
|
// "url|filesize"
|
||||||
|
// afterwards a file that failed to download mid way will not display 'check file size' anymore
|
||||||
file.setExpectedSize(size);
|
file.setExpectedSize(size);
|
||||||
message.resetFileParams();
|
message.resetFileParams();
|
||||||
if (mHttpConnectionManager.hasStoragePermission()
|
if (mHttpConnectionManager.hasStoragePermission()
|
||||||
|
|
|
@ -58,6 +58,8 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
private static final String PREFIX_ACCOUNT = "account";
|
private static final String PREFIX_ACCOUNT = "account";
|
||||||
private static final String PREFIX_GENERIC = "generic";
|
private static final String PREFIX_GENERIC = "generic";
|
||||||
|
|
||||||
|
private static final String CHANNEL_SYMBOL = "#";
|
||||||
|
|
||||||
final private ArrayList<Integer> sizes = new ArrayList<>();
|
final private ArrayList<Integer> sizes = new ArrayList<>();
|
||||||
final private HashMap<String, Set<String>> conversationDependentKeys = new HashMap<>();
|
final private HashMap<String, Set<String>> conversationDependentKeys = new HashMap<>();
|
||||||
|
|
||||||
|
@ -95,7 +97,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
if (conversation != null) {
|
if (conversation != null) {
|
||||||
return get(conversation,size,cacheOnly);
|
return get(conversation,size,cacheOnly);
|
||||||
}
|
}
|
||||||
return get(result.getName(), room != null ? room.asBareJid().toEscapedString() : result.getName(), size, cacheOnly);
|
return get(CHANNEL_SYMBOL, room != null ? room.asBareJid().toEscapedString() : result.getName(), size, cacheOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Bitmap get(final Contact contact, final int size, boolean cachedOnly) {
|
private Bitmap get(final Contact contact, final int size, boolean cachedOnly) {
|
||||||
|
@ -339,13 +341,17 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
bitmap = mXmppConnectionService.getFileBackend().getAvatar(mucOptions.getAvatar(), size);
|
bitmap = mXmppConnectionService.getFileBackend().getAvatar(mucOptions.getAvatar(), size);
|
||||||
|
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
|
Conversation c = mucOptions.getConversation();
|
||||||
|
if (mucOptions.isPrivateAndNonAnonymous()) {
|
||||||
final List<MucOptions.User> users = mucOptions.getUsersRelevantForNameAndAvatar();
|
final List<MucOptions.User> users = mucOptions.getUsersRelevantForNameAndAvatar();
|
||||||
if (users.size() == 0) {
|
if (users.size() == 0) {
|
||||||
Conversation c = mucOptions.getConversation();
|
|
||||||
bitmap = getImpl(c.getName().toString(), c.getJid().asBareJid().toString(), size);
|
bitmap = getImpl(c.getName().toString(), c.getJid().asBareJid().toString(), size);
|
||||||
} else {
|
} else {
|
||||||
bitmap = getImpl(users, size);
|
bitmap = getImpl(users, size);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
bitmap = getImpl(CHANNEL_SYMBOL, c.getJid().asBareJid().toString(), size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mXmppConnectionService.getBitmapCache().put(KEY, bitmap);
|
this.mXmppConnectionService.getBitmapCache().put(KEY, bitmap);
|
||||||
|
@ -628,7 +634,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
|
|
||||||
private static boolean drawTile(Canvas canvas, String name, String seed, int left, int top, int right, int bottom) {
|
private static boolean drawTile(Canvas canvas, String name, String seed, int left, int top, int right, int bottom) {
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
final String letter = getFirstLetter(name);
|
final String letter = name.equals(CHANNEL_SYMBOL) ? name : getFirstLetter(name);
|
||||||
final int color = UIHelper.getColorForName(seed == null ? name : seed);
|
final int color = UIHelper.getColorForName(seed == null ? name : seed);
|
||||||
drawTile(canvas, letter, color, left, top, right, bottom);
|
drawTile(canvas, letter, color, left, top, right, bottom);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue