aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-11-23 13:20:03 +0100
committerChristian Schneppe <christian@pix-art.de>2018-11-23 13:20:03 +0100
commit24e5d84e4e3eb31d7460cc272f41eddc7d797668 (patch)
treedc27d26f36e3c9f548a382cb27ff209c119ed565 /src
parentef779d5c2e4e5c63160e7da85c90ddb5a165ebbd (diff)
avatar code changes
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/services/AvatarService.java19
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/StartConversationActivity.java10
3 files changed, 12 insertions, 19 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AvatarService.java b/src/main/java/de/pixart/messenger/services/AvatarService.java
index aa861c147..bb05004d2 100644
--- a/src/main/java/de/pixart/messenger/services/AvatarService.java
+++ b/src/main/java/de/pixart/messenger/services/AvatarService.java
@@ -80,7 +80,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
if (avatar != null || cachedOnly) {
return avatar;
}
- if (avatar == null && contact.getAvatarFilename() != null) {
+ if (contact.getAvatarFilename() != null) {
avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatarFilename(), size);
}
if (avatar == null && contact.getProfilePhoto() != null) {
@@ -91,7 +91,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
}
}
if (avatar == null) {
- avatar = get(contact.getDisplayName(), contact.getJid().asBareJid().toString(), size, cachedOnly);
+ avatar = get(contact.getDisplayName(), contact.getJid().asBareJid().toString(), size, false);
}
this.mXmppConnectionService.getBitmapCache().put(KEY, avatar);
return avatar;
@@ -165,10 +165,10 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
if (avatar == null) {
Contact contact = user.getContact();
if (contact != null) {
- avatar = get(contact, size, cachedOnly);
+ avatar = get(contact, size, false);
} else {
String seed = user.getRealJid() != null ? user.getRealJid().asBareJid().toString() : null;
- avatar = get(user.getName(), seed, size, cachedOnly);
+ avatar = get(user.getName(), seed, size, false);
}
}
this.mXmppConnectionService.getBitmapCache().put(KEY, avatar);
@@ -524,11 +524,14 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
Contact contact = user.getContact();
if (contact != null) {
Uri uri = null;
- if (contact.getProfilePhoto() != null) {
+ if (contact.getAvatarFilename() != null) {
+ try {
+ uri = mXmppConnectionService.getFileBackend().getAvatarUri(contact.getAvatarFilename());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else if (contact.getProfilePhoto() != null) {
uri = Uri.parse(contact.getProfilePhoto());
- } else if (contact.getAvatarFilename() != null) {
- uri = mXmppConnectionService.getFileBackend().getAvatarUri(
- contact.getAvatarFilename());
}
if (drawTile(canvas, uri, left, top, right, bottom)) {
return true;
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index 91501f623..f93fa7fd4 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -860,7 +860,7 @@ public class NotificationService {
return SystemClock.elapsedRealtime() < (this.mLastNotification + miniGrace);
}
- public Notification createForegroundNotification() {
+ Notification createForegroundNotification() {
final Notification.Builder mBuilder = new Notification.Builder(mXmppConnectionService);
mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.conversations_foreground_service));
if (Compatibility.runsAndTargetsTwentySix(mXmppConnectionService) || Config.SHOW_CONNECTED_ACCOUNTS) {
diff --git a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
index 462fb4429..4df1c8280 100644
--- a/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/StartConversationActivity.java
@@ -886,16 +886,6 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
mContactsAdapter.notifyDataSetChanged();
}
- private static boolean isSingleAccountActive(final List<Account> accounts) {
- int i = 0;
- for(Account account : accounts) {
- if (account.getStatus() != Account.State.DISABLED) {
- ++i;
- }
- }
- return i == 1;
- }
-
protected void filterConferences(String needle) {
this.conferences.clear();
for (Account account : xmppConnectionService.getAccounts()) {