public ActivityPost ParseFromAJO(AndroidJavaObject ajo)
        {
            using (ajo)
            {
                Id          = ajo.CallStr("getId");
                Text        = ajo.CallStr("getText");
                ImageUrl    = ajo.CallStr("getImageUrl");
                ButtonTitle = ajo.CallStr("getButtonTitle");
#pragma warning disable 0618
                ButtonAction = ajo.CallStr("getButtonAction");
#pragma warning restore 0618
                var action = ajo.CallAJO("getAction");
                if (action != null)
                {
                    Action = new GetSocialAction().ParseFromAJO(action);
                }
                CreatedAt     = DateUtils.FromUnixTime(ajo.CallLong("getCreatedAt"));
                Author        = new PostAuthor().ParseFromAJO(ajo.CallAJO("getAuthor"));
                CommentsCount = ajo.CallInt("getCommentsCount");
                LikesCount    = ajo.CallInt("getLikesCount");
                IsLikedByMe   = ajo.CallBool("isLikedByMe");

                StickyStart = DateUtils.FromUnixTime(ajo.CallLong("getStickyStart"));
                StickyEnd   = DateUtils.FromUnixTime(ajo.CallLong("getStickyEnd"));
                FeedId      = ajo.CallStr("getFeedId");
                Mentions    = ajo.CallAJO("getMentions").FromJavaList().ConvertAll(mentionAjo =>
                {
                    using (mentionAjo)
                    {
                        return(new Mention().ParseFromAJO(mentionAjo));
                    }
                }).ToList();
            }
            return(this);
        }
        public static ActivityRecognitionResult FromAJO(AndroidJavaObject ajo)
        {
            var probableActivities = ajo.CallAJO("getProbableActivities").FromJavaList(
                x => new DetectedActivity(x.CallInt("getConfidence"), (DetectedActivity.ActivityType)x.CallInt("getType")));

            return(new ActivityRecognitionResult(ajo.CallLong("getTime"), ajo.CallLong("getElapsedRealtimeMillis"), probableActivities));
        }
        public static object ParseJavaBoxedValue(AndroidJavaObject boxedValueAjo)
        {
            if (boxedValueAjo == null || boxedValueAjo.IsJavaNull())
            {
                return(null);
            }

            var className = boxedValueAjo.GetClassSimpleName();

            switch (className)
            {
            case "Boolean":
                return(boxedValueAjo.CallBool("booleanValue"));

            case "Float":
                return(boxedValueAjo.CallFloat("floatValue"));

            case "Integer":
                return(boxedValueAjo.CallInt("intValue"));

            case "Long":
                return(boxedValueAjo.CallLong("longValue"));

            case "String":
                return(boxedValueAjo.CallStr("toString"));
            }
            return(boxedValueAjo);
        }
Exemplo n.º 4
0
 private static DateTime?DateFromAjo(AndroidJavaObject ajo)
 {
     if (ajo.IsJavaNull())
     {
         return(null);
     }
     return(new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc)
            .AddSeconds(ajo.CallLong("getTime") / 1000)
            .ToLocalTime());
 }
Exemplo n.º 5
0
 public static FenceState FromAJO(AndroidJavaObject ajo)
 {
     return(new FenceState
     {
         FenceKey = ajo.CallStr("getFenceKey"),
         LastFenceUpdateTimeMillis = ajo.CallLong("getLastFenceUpdateTimeMillis"),
         CurrentState = (State)ajo.CallInt("getCurrentState"),
         PreviousState = (State)ajo.CallInt("getPreviousState")
     });
 }
Exemplo n.º 6
0
 public Notification ParseFromAJO(AndroidJavaObject ajo)
 {
     Id               = ajo.CallStr("getId");
     Action           = (Type)ajo.CallInt("getActionType");
     WasRead          = ajo.CallBool("wasRead");
     NotificationType = (NotificationTypes)ajo.CallInt("getType");
     CreatedAt        = ajo.CallLong("getCreatedAt");
     Title            = ajo.CallStr("getTitle");
     Text             = ajo.CallStr("getText");
     ActionData       = ajo.CallAJO("getActionData").FromJavaHashMap();
     return(this);
 }
Exemplo n.º 7
0
        public new ReferredUser ParseFromAJO(AndroidJavaObject ajo)
        {
            if (ajo.IsJavaNull())
            {
                return(null);
            }

            using (ajo)
            {
                base.ParseFromAJO(ajo);
                InstallationDate    = DateUtils.FromUnixTime(ajo.CallLong("getInstallationDate"));
                InstallationChannel = ajo.CallStr("getInstallationChannel");
            }
            return(this);
        }
Exemplo n.º 8
0
        public new ReferralUser ParseFromAJO(AndroidJavaObject ajo)
        {
            if (ajo.IsJavaNull())
            {
                return(null);
            }

            using (ajo)
            {
                base.ParseFromAJO(ajo);
                EventDate = DateUtils.FromUnixTime(ajo.CallLong("getEventDate"));
                Event     = ajo.CallStr("getEvent");
                EventData = ajo.CallAJO("getEventData").FromJavaHashMap();
            }
            return(this);
        }
Exemplo n.º 9
0
        public CellInfo(AndroidJavaObject ajo)
        {
            if (AGUtils.IsNotAndroid() || !Check.IsSdkGreaterOrEqual(AGDeviceInfo.VersionCodes.JELLY_BEAN_MR1))
            {
                return;
            }

            if (!Check.IsSdkGreaterOrEqual(AGDeviceInfo.VersionCodes.P))
            {
                cellConnectionStatus = Connection.Unknown;
            }
            else
            {
                cellConnectionStatus = (Connection)ajo.CallInt("getCellConnectionStatus");
            }

            timeStamp    = ajo.CallLong("getTimeStamp");
            isRegistered = ajo.CallBool("isRegistered");
        }
Exemplo n.º 10
0
        public Notification ParseFromAJO(AndroidJavaObject ajo)
        {
            Id               = ajo.CallStr("getId");
            Status           = ajo.CallStr("getStatus");
            NotificationType = ajo.CallStr("getType");
#pragma warning disable 618
            Action = (Type)ajo.CallInt("getActionType");
#pragma warning restore 618
            CreatedAt          = ajo.CallLong("getCreatedAt");
            Title              = ajo.CallStr("getTitle");
            Text               = ajo.CallStr("getText");
            NotificationAction = new GetSocialAction().ParseFromAJO(ajo.CallAJO("getAction"));
            ActionButtons      = ajo.CallAJO("getActionButtons").FromJavaList().ConvertAll(item => {
                using (item) {
                    return(new ActionButton().ParseFromAJO(item));
                }
            });
            ImageUrl      = ajo.CallStr("getImageUrl");
            VideoUrl      = ajo.CallStr("getVideoUrl");
            Sender        = new UserReference().ParseFromAJO(ajo.CallAJO("getSender"));
            Customization = new NotificationCustomization().ParseFromAJO(ajo.CallAJO("getCustomization"));
            return(this);
        }