diff options
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 42 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/MimeUtils.java | 1 |
2 files changed, 21 insertions, 22 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index 9d9c68b19..aed314288 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -641,29 +641,27 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.richlinkview.setVisibility(View.GONE); viewHolder.download_button.setVisibility(View.VISIBLE); final String mimeType = message.getMimeType(); - if (mimeType != null) { - if (message.getMimeType().contains("pdf")) { - viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_file_pdf_grey600_48dp, 0, 0, 0); - viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message))); - } else if (message.getMimeType().contains("vcard")) { - try { - showVCard(message, viewHolder); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (message.getMimeType().contains("calendar")) { - viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_calendar_grey600_48dp, 0, 0, 0); - viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message))); - } else if (message.getMimeType().equals("application/vnd.android.package-archive")) { - try { - showAPK(message, viewHolder); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_file_grey600_48dp, 0, 0, 0); - viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message))); + if (mimeType != null && message.getMimeType().contains("pdf")) { + viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_file_pdf_grey600_48dp, 0, 0, 0); + viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message))); + } else if (mimeType != null && message.getMimeType().contains("vcard")) { + try { + showVCard(message, viewHolder); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (mimeType != null && message.getMimeType().contains("calendar")) { + viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_calendar_grey600_48dp, 0, 0, 0); + viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message))); + } else if (mimeType != null && message.getMimeType().equals("application/vnd.android.package-archive")) { + try { + showAPK(message, viewHolder); + } catch (Exception e) { + e.printStackTrace(); } + } else { + viewHolder.download_button.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_file_grey600_48dp, 0, 0, 0); + viewHolder.download_button.setText(activity.getString(R.string.open_x_file, UIHelper.getFileDescriptionString(activity, message))); } viewHolder.download_button.setOnClickListener(v -> openDownloadable(message)); } diff --git a/src/main/java/de/pixart/messenger/utils/MimeUtils.java b/src/main/java/de/pixart/messenger/utils/MimeUtils.java index af170b082..e02dd4c75 100644 --- a/src/main/java/de/pixart/messenger/utils/MimeUtils.java +++ b/src/main/java/de/pixart/messenger/utils/MimeUtils.java @@ -323,6 +323,7 @@ public final class MimeUtils { add("text/plain", "text"); add("text/plain", "diff"); add("text/plain", "po"); // reserve "pot" for vnd.ms-powerpoint + add("text/plain", "ass"); add("text/richtext", "rtx"); add("text/rtf", "rtf"); add("text/text", "phps"); |