@@ -0,0 +1,2638 @@
+package com.alwaysallthetime.adnlibutils;%0A%0Aimport android.util.Log;%0A%0Aimport com.alwaysallthetime.adnlib.Annotations;%0Aimport com.alwaysallthetime.adnlib.data.Annotation;%0Aimport com.alwaysallthetime.adnlib.data.Message;%0A%0Aimport java.text.ParseException;%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.Date;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A/**%0A * Created by brambley on 10/9/13.%0A */%0Apublic class AnnotationUtility %7B%0A    private static final String TAG = %22ADNLibUtils_AnnotationUtility%22;%0A%0A    public static final String OEMBED_TYPE_PHOTO = %22photo%22;%0A    public static final String OEMBED_TYPE_HTML5VIDEO = %22html5video%22;%0A%0A    private static SimpleDateFormat mIso8601Format;%0A%0A    public static Date getJournalEntryDate(Message message) %7B%0A        Annotation displayDate = message.getFirstAnnotationOfType(Annotations.OHAI_DISPLAY_DATE);%0A        if(displayDate != null) %7B%0A            String date = (String) displayDate.getValue().get(%22date%22);%0A            if(mIso8601Format == null) %7B%0A                mIso8601Format = new SimpleDateFormat(%22yyyy-MM-dd'T'HH:mm:ss'Z'%22);%0A            %7D%0A            try %7B%0A                return mIso8601Format.parse(date);%0A            %7D catch(ParseException e) %7B%0A                Log.d(TAG, e.getMessage(), e);%0A            %7D%0A        %7D%0A        return message.getCreatedAt();%0A    %7D%0A%0A    public static Annotation getFirstOEmbedPhotoAnnotation(Message message) %7B%0A        Annotation oEmbedAnnotation = message.getFirstAnnotationOfType(Annotations.OEMBED);%0A        if(oEmbedAnnotation != null && OEMBED_TYPE_PHOTO.equals(oEmbedAnnotation.getValue().get(%22type%22))) %7B%0A            return oEmbedAnnotation;%0A        %7D%0A        return null;%0A    %7D%0A%0A    public static String getFirstOEmbedPhotoUrl(Message message) %7B%0A        Annotation oEmbedAnnotation = getFirstOEmbedPhotoAnnotation(message);%0A        if(oEmbedAnnotation != null) %7B%0A            return (String) oEmbedAnnotation.getValue().get(%22url%22);%0A        %7D%0A        return null;%0A    %7D%0A%0A    public static String getFirstHTML5VideoSource(Message message) %7B%0A        Annotation oEmbedAnnotation = message.getFirstAnnotationOfType(Annotations.OEMBED);%0A        if(OEMBED_TYPE_HTML5VIDEO.equals(oEmbedAnnotation.getValue().get(%22type%22))) %7B%0A            List%3CMap%3CString, String%3E%3E sources = (List%3CMap%3CString, String%3E%3E) oEmbedAnnotation.getValue().get(%22sources%22);%0A            if(sources != null && sources.size() %3E 0) %7B%0A                Map%3CString, String%3E firstSource = sources.get(0);%0A                String url = firstSource.get(%22url%22);%0A                if(url != null) %7B%0A                    return url;%0A                %7D%0A            %7D%0A        %7D%0A        return null;%0A    %7D%0A%7D%0A

add AnnotationUtility