Exemplo n.º 1
0
  private String getType(String dbName, String id, String format, String mimeType) {
    String type;
    if (FORMAT_THUMBNAIL.equals(format)) {
      type = "image/png";
    } else {
      final Account account = Preferences.getPreferences(getContext()).getAccount(dbName);

      try {
        final LocalStore localStore = LocalStore.getInstance(account, getContext());

        AttachmentInfo attachmentInfo = localStore.getAttachmentInfo(id);
        if (FORMAT_VIEW.equals(format) && mimeType != null) {
          type = mimeType;
        } else {
          type = attachmentInfo.type;
        }
      } catch (MessagingException e) {
        Log.e(K9.LOG_TAG, "Unable to retrieve LocalStore for " + account, e);
        type = null;
      }
    }

    return type;
  }