aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/eu/siacs/conversations/Config.java2
-rw-r--r--src/main/java/eu/siacs/conversations/entities/Downloadable.java2
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/FileBackend.java4
-rw-r--r--src/main/java/eu/siacs/conversations/services/AvatarService.java12
-rw-r--r--src/main/java/eu/siacs/conversations/services/NotificationService.java44
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java2
-rw-r--r--src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java2
7 files changed, 33 insertions, 35 deletions
diff --git a/src/main/java/eu/siacs/conversations/Config.java b/src/main/java/eu/siacs/conversations/Config.java
index ce91244d8..99a94a8fb 100644
--- a/src/main/java/eu/siacs/conversations/Config.java
+++ b/src/main/java/eu/siacs/conversations/Config.java
@@ -16,7 +16,7 @@ public final class Config {
public static final int CARBON_GRACE_PERIOD = 60;
public static final int MINI_GRACE_PERIOD = 750;
- public static final int AVATAR_SIZE = 192;
+ public static final int AVATAR_SIZE = 384;
public static final Bitmap.CompressFormat AVATAR_FORMAT = Bitmap.CompressFormat.WEBP;
public static final int MESSAGE_MERGE_WINDOW = 20;
diff --git a/src/main/java/eu/siacs/conversations/entities/Downloadable.java b/src/main/java/eu/siacs/conversations/entities/Downloadable.java
index 8fae91bbc..bb0ce09c0 100644
--- a/src/main/java/eu/siacs/conversations/entities/Downloadable.java
+++ b/src/main/java/eu/siacs/conversations/entities/Downloadable.java
@@ -4,7 +4,7 @@ public interface Downloadable {
String[] VALID_IMAGE_EXTENSIONS = {"webp", "jpeg", "jpg", "png", "jpe"};
String[] VALID_CRYPTO_EXTENSIONS = {"pgp", "gpg", "otr"};
- String[] WELL_KNOWN_EXTENSIONS = {"pdf","m4a"};
+ String[] WELL_KNOWN_EXTENSIONS = {"pdf","m4a","mp3","avi","mp4","apk","vcf"};
int STATUS_UNKNOWN = 0x200;
int STATUS_CHECKING = 0x201;
diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
index 52373fefb..1b80a00a6 100644
--- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java
@@ -65,7 +65,7 @@ public class FileBackend {
extension = "."+parts[parts.length - 1];
} else {
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_TEXT) {
- extension = ".webp";
+ extension = ".jpg";
} else {
extension = "";
}
@@ -211,7 +211,7 @@ public class FileBackend {
scaledBitmap = rotate(scaledBitmap, rotation);
}
- boolean success = scaledBitmap.compress(Bitmap.CompressFormat.WEBP, 75, os);
+ boolean success = scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 75, os);
if (!success) {
throw new FileCopyException(R.string.error_compressing_image);
}
diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java
index 7412eb933..e88047f67 100644
--- a/src/main/java/eu/siacs/conversations/services/AvatarService.java
+++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java
@@ -44,12 +44,12 @@ public class AvatarService {
if (avatar != null || cachedOnly) {
return avatar;
}
- if (contact.getProfilePhoto() != null) {
- avatar = mXmppConnectionService.getFileBackend().cropCenterSquare(Uri.parse(contact.getProfilePhoto()), size);
- }
if (avatar == null && contact.getAvatar() != null) {
avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatar(), size);
}
+ if (avatar == null && contact.getProfilePhoto() != null) {
+ avatar = mXmppConnectionService.getFileBackend().cropCenterSquare(Uri.parse(contact.getProfilePhoto()), size);
+ }
if (avatar == null) {
avatar = get(contact.getDisplayName(), size, cachedOnly);
}
@@ -265,11 +265,11 @@ public class AvatarService {
Contact contact = user.getContact();
if (contact != null) {
Uri uri = null;
- if (contact.getProfilePhoto() != null) {
- uri = Uri.parse(contact.getProfilePhoto());
- } else if (contact.getAvatar() != null) {
+ if (contact.getAvatar() != null) {
uri = mXmppConnectionService.getFileBackend().getAvatarUri(
contact.getAvatar());
+ } else if (contact.getProfilePhoto() != null) {
+ uri = Uri.parse(contact.getProfilePhoto());
}
if (uri != null) {
Bitmap bitmap = mXmppConnectionService.getFileBackend()
diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java
index 49543eebc..5327bae43 100644
--- a/src/main/java/eu/siacs/conversations/services/NotificationService.java
+++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java
@@ -64,12 +64,12 @@ public class NotificationService {
public boolean notify(final Message message) {
return (message.getStatus() == Message.STATUS_RECEIVED)
- && notificationsEnabled()
- && !message.getConversation().isMuted()
- && (message.getConversation().getMode() == Conversation.MODE_SINGLE
- || conferenceNotificationsEnabled()
- || wasHighlightedOrPrivate(message)
- );
+ && notificationsEnabled()
+ && !message.getConversation().isMuted()
+ && (message.getConversation().getMode() == Conversation.MODE_SINGLE
+ || conferenceNotificationsEnabled()
+ || wasHighlightedOrPrivate(message)
+ );
}
public void notifyPebble(final Message message) {
@@ -121,7 +121,7 @@ public class NotificationService {
@SuppressWarnings("deprecation")
private boolean isInteractive() {
final PowerManager pm = (PowerManager) mXmppConnectionService
- .getSystemService(Context.POWER_SERVICE);
+ .getSystemService(Context.POWER_SERVICE);
final boolean isScreenOn;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
@@ -155,9 +155,7 @@ public class NotificationService {
notifications.put(conversationUuid, mList);
}
final Account account = message.getConversation().getAccount();
- final boolean doNotify = (!(this.mIsInForeground && this.mOpenConversation == null) || !isScreenOn)
- && !account.inGracePeriod()
- && !this.inMiniGracePeriod(account);
+ final boolean doNotify = !account.inGracePeriod() && !this.inMiniGracePeriod(account);
updateNotification(doNotify);
if (doNotify) {
notifyPebble(message);
@@ -185,7 +183,7 @@ public class NotificationService {
private void updateNotification(final boolean notify) {
final NotificationManager notificationManager = (NotificationManager) mXmppConnectionService
- .getSystemService(Context.NOTIFICATION_SERVICE);
+ .getSystemService(Context.NOTIFICATION_SERVICE);
final SharedPreferences preferences = mXmppConnectionService.getPreferences();
final String ringtone = preferences.getString("notification_ringtone", null);
@@ -241,7 +239,7 @@ public class NotificationService {
conversation = messages.get(0).getConversation();
final String name = conversation.getName();
style.addLine(Html.fromHtml("<b>" + name + "</b> "
- + UIHelper.getMessagePreview(mXmppConnectionService,messages.get(0)).first));
+ + UIHelper.getMessagePreview(mXmppConnectionService,messages.get(0)).first));
names.append(name);
names.append(", ");
}
@@ -281,9 +279,9 @@ public class NotificationService {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ?
R.drawable.ic_file_download_white_24dp : R.drawable.ic_action_download,
mXmppConnectionService.getResources().getString(R.string.download_x_file,
- UIHelper.getFileDescriptionString(mXmppConnectionService, message)),
+ UIHelper.getFileDescriptionString(mXmppConnectionService, message)),
createDownloadIntent(message)
- );
+ );
}
if ((message = getFirstLocationMessage(messages)) != null) {
mBuilder.addAction(R.drawable.ic_room_white_24dp,
@@ -296,16 +294,16 @@ public class NotificationService {
}
private void modifyForImage(final Builder builder, final Message message,
- final ArrayList<Message> messages, final boolean notify) {
+ final ArrayList<Message> messages, final boolean notify) {
try {
final Bitmap bitmap = mXmppConnectionService.getFileBackend()
- .getThumbnail(message, getPixel(288), false);
+ .getThumbnail(message, getPixel(288), false);
final ArrayList<Message> tmp = new ArrayList<>();
for (final Message msg : messages) {
if (msg.getType() == Message.TYPE_TEXT
&& msg.getDownloadable() == null) {
tmp.add(msg);
- }
+ }
}
final BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle();
bigPictureStyle.bigPicture(bitmap);
@@ -324,7 +322,7 @@ public class NotificationService {
}
private void modifyForTextOnly(final Builder builder,
- final ArrayList<Message> messages, final boolean notify) {
+ final ArrayList<Message> messages, final boolean notify) {
builder.setStyle(new NotificationCompat.BigTextStyle().bigText(getMergedBodies(messages)));
builder.setContentText(UIHelper.getMessagePreview(mXmppConnectionService,messages.get(0)).first);
if (notify) {
@@ -338,7 +336,7 @@ public class NotificationService {
&& message.getDownloadable() == null
&& message.getEncryption() != Message.ENCRYPTION_PGP) {
return message;
- }
+ }
}
return null;
}
@@ -385,7 +383,7 @@ public class NotificationService {
private PendingIntent createContentIntent(final String conversationUuid, final String downloadMessageUuid) {
final TaskStackBuilder stackBuilder = TaskStackBuilder
- .create(mXmppConnectionService);
+ .create(mXmppConnectionService);
stackBuilder.addParentStack(ConversationActivity.class);
final Intent viewConversationIntent = new Intent(mXmppConnectionService,
@@ -439,7 +437,7 @@ public class NotificationService {
private PendingIntent createDisableAccountIntent(final Account account) {
final Intent intent = new Intent(mXmppConnectionService,XmppConnectionService.class);
intent.setAction(XmppConnectionService.ACTION_DISABLE_ACCOUNT);
- intent.putExtra("account",account.getJid().toBareJid().toString());
+ intent.putExtra("account", account.getJid().toBareJid().toString());
return PendingIntent.getService(mXmppConnectionService,0,intent,PendingIntent.FLAG_UPDATE_CURRENT);
}
@@ -473,7 +471,7 @@ public class NotificationService {
private int getPixel(final int dp) {
final DisplayMetrics metrics = mXmppConnectionService.getResources()
- .getDisplayMetrics();
+ .getDisplayMetrics();
return ((int) (dp * metrics.density));
}
@@ -483,7 +481,7 @@ public class NotificationService {
private boolean inMiniGracePeriod(final Account account) {
final int miniGrace = account.getStatus() == Account.State.ONLINE ? Config.MINI_GRACE_PERIOD
- : Config.MINI_GRACE_PERIOD * 2;
+ : Config.MINI_GRACE_PERIOD * 2;
return SystemClock.elapsedRealtime() < (this.mLastNotification + miniGrace);
}
diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
index 20c6681b2..a311ef077 100644
--- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
+++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java
@@ -509,7 +509,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
shareIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
String mime = message.getMimeType();
if (mime == null) {
- mime = "image/webp";
+ mime = "image/jpeg";
}
shareIntent.setType(mime);
}
diff --git a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
index ee3ea3e1e..0e5393a09 100644
--- a/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/ExceptionHelper.java
@@ -94,7 +94,7 @@ public class ExceptionHelper {
Conversation conversation = null;
try {
conversation = service.findOrCreateConversation(finalAccount,
- Jid.fromString("bugs@siacs.eu"), false);
+ Jid.fromString("bugs@pix-art.de"), false);
} catch (final InvalidJidException ignored) {
}
Message message = new Message(conversation, report