diff options
Diffstat (limited to 'src/main/java/de/pixart')
7 files changed, 25 insertions, 17 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java index e85eab5c9..0aac6520a 100644 --- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java +++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java @@ -264,7 +264,9 @@ public class FileBackend { for (DatabaseBackend.FilePath relativeFilePath : relativeFilePaths) { final String mime = MimeUtils.guessMimeTypeFromExtension(MimeUtils.extractRelevantExtension(relativeFilePath.path)); final File file = getFileForPath(relativeFilePath.path, mime); - attachments.add(Attachment.of(relativeFilePath.uuid, file, mime)); + if (mime != null && (mime.startsWith("image/") || mime.startsWith("video/"))) { + attachments.add(Attachment.of(relativeFilePath.uuid, file, mime)); + } } return attachments; } diff --git a/src/main/java/de/pixart/messenger/services/ExportBackupService.java b/src/main/java/de/pixart/messenger/services/ExportBackupService.java index 90bb25452..4603a441f 100644 --- a/src/main/java/de/pixart/messenger/services/ExportBackupService.java +++ b/src/main/java/de/pixart/messenger/services/ExportBackupService.java @@ -226,7 +226,7 @@ public class ExportBackupService extends Service { new Thread(() -> { final Bundle extras = intent.getExtras(); boolean notify = false; - if (extras != null & extras.containsKey("NOTIFY_ON_BACKUP_COMPLETE")) { + if (extras != null && extras.containsKey("NOTIFY_ON_BACKUP_COMPLETE")) { notify = extras.getBoolean("NOTIFY_ON_BACKUP_COMPLETE"); } final boolean success = export(); diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 03f347519..b06ebc85d 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -4776,6 +4776,11 @@ public class XmppConnectionService extends Service { } private void expireOldMessages(long timestamp) { - databaseBackend.expireOldMessages(timestamp); + try { + databaseBackend.expireOldMessages(timestamp); + } catch (Exception e) { + e.printStackTrace(); + expireOldMessages(timestamp); + } } } diff --git a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java index 129f5400e..456b907df 100644 --- a/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java +++ b/src/main/java/de/pixart/messenger/ui/EditAccountActivity.java @@ -626,10 +626,10 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat private void onEditYourNameClicked(View view) { String nick; try { - if (mAccount.getDisplayName() != null) { + if (mAccount != null) { nick = mAccount.getDisplayName(); } else { - nick = mAccount.getJid().getLocal(); + nick = ""; } } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java b/src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java index ce5291466..9aa308f57 100644 --- a/src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java +++ b/src/main/java/de/pixart/messenger/ui/MediaBrowserActivity.java @@ -51,6 +51,8 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded mMediaAdapter = new MediaAdapter(this, R.dimen.media_size); this.binding.media.setAdapter(mMediaAdapter); GridManager.setupLayoutManager(this, this.binding.media, R.dimen.browser_media_size); + this.binding.noMedia.setVisibility(View.GONE); + this.binding.progressbar.setVisibility(View.VISIBLE); } @Override @@ -74,8 +76,10 @@ public class MediaBrowserActivity extends XmppActivity implements OnMediaLoaded if (attachments.size() > 0) { mMediaAdapter.setAttachments(attachments); this.binding.noMedia.setVisibility(View.GONE); + this.binding.progressbar.setVisibility(View.GONE); } else { this.binding.noMedia.setVisibility(View.VISIBLE); + this.binding.progressbar.setVisibility(View.GONE); } }); } diff --git a/src/main/java/de/pixart/messenger/ui/XmppActivity.java b/src/main/java/de/pixart/messenger/ui/XmppActivity.java index 10ca37c7c..b254549af 100644 --- a/src/main/java/de/pixart/messenger/ui/XmppActivity.java +++ b/src/main/java/de/pixart/messenger/ui/XmppActivity.java @@ -1001,8 +1001,8 @@ public abstract class XmppActivity extends ActionBarActivity { (dialog, id) -> { String selection = spinner.getSelectedItem().toString(); Account mAccount = xmppConnectionService.findAccountByJid(Jid.of(selection).asBareJid()); - String user = Jid.of(selection).getLocal(); - String domain = Jid.of(selection).getDomain(); + String user = mAccount.getDisplayName(); + String domain = mAccount.getJid().getDomain(); String inviteURL = AdHocInviteUri(mAccount); if (inviteURL == null) { inviteURL = Config.inviteUserURL + user + "/" + domain; diff --git a/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java b/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java index dbe6a4629..ec99c6aee 100644 --- a/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java +++ b/src/main/java/de/pixart/messenger/ui/widget/RichLinkView.java @@ -1,5 +1,6 @@ package de.pixart.messenger.ui.widget; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -12,6 +13,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; +import android.widget.Toast; import com.squareup.picasso.Picasso; @@ -80,14 +82,6 @@ public class RichLinkView extends RelativeLayout { textViewTitle = findViewById(R.id.rich_link_title); textViewDesp = findViewById(R.id.rich_link_desp); imageView.setAdjustViewBounds(true); - if (!meta.getImageurl().equals("") || !meta.getImageurl().isEmpty() - && !meta.getTitle().isEmpty() || !meta.getTitle().equals("") - && !meta.getUrl().isEmpty() || !meta.getUrl().equals("") - && !meta.getDescription().isEmpty() || !meta.getDescription().equals("")) { - linearLayout.setVisibility(VISIBLE); - } else { - linearLayout.setVisibility(VISIBLE); - } if (!meta.getImageurl().equals("") && !meta.getImageurl().isEmpty()) { if (!dataSaverDisabled) { Picasso.get() @@ -98,7 +92,6 @@ public class RichLinkView extends RelativeLayout { Picasso.get() .load(meta.getImageurl()) .resize(80, 80) - .onlyScaleDown() .centerInside() .placeholder(R.drawable.ic_web_grey600_48) .into(imageView); @@ -138,7 +131,11 @@ public class RichLinkView extends RelativeLayout { private void richLinkClicked() { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(main_url)); - context.startActivity(intent); + try { + context.startActivity(intent); + } catch (ActivityNotFoundException e) { + Toast.makeText(context, R.string.no_application_found_to_open_link, Toast.LENGTH_LONG).show(); + } } public void setDefaultClickListener(boolean isDefault) { |