Example #1
0
        public static Place FromAJO(AndroidJavaObject ajo)
        {
            var result = new Place
            {
                Id          = ajo.CallStr("getId"),
                Address     = ajo.CallStr("getAddress"),
                Name        = ajo.CallStr("getName"),
                PhoneNumber = ajo.CallStr("getPhoneNumber"),
                PlaceTypes  = ajo.CallAJO("getPlaceTypes").FromJavaList(x => (PlaceType)x.CallInt("intValue")),
                PriceLevel  = ajo.CallInt("getPriceLevel"),
                Rating      = ajo.CallFloat("getRating"),
                Location    = LatLng.FromAJO(ajo.CallAJO("getLatLng"))
                              // This for some reason causes crashes
                              // Attrubutions = ajo.CallStr("getAttributions")
            };

            if (!ajo.CallAJO("getLocale").IsJavaNull())
            {
                result.Locale = ajo.CallAJO("getLocale").JavaToString();
            }

            if (!ajo.CallAJO("getViewport").IsJavaNull())
            {
                result.Viewport = LatLngBounds.FromAJO(ajo.CallAJO("getViewport"));
            }

            if (!ajo.CallAJO("getWebsiteUri").IsJavaNull())
            {
                result.WebsiteUrl = ajo.CallAJO("getWebsiteUri").JavaToString();
            }

            return(result);
        }
Example #2
0
 public UserReference ParseFromAJO(AndroidJavaObject ajo)
 {
     Id          = ajo.CallStr("getId");
     DisplayName = ajo.CallStr("getDisplayName");
     AvatarUrl   = ajo.CallStr("getAvatarUrl");
     return(this);
 }
Example #3
0
        public ReferralData ParseFromAJO(AndroidJavaObject ajo)
        {
            if (ajo.IsJavaNull())
            {
                return(null);
            }

            using (ajo)
            {
                Token             = ajo.CallStr("getToken");
                ReferrerUserId    = ajo.CallStr("getReferrerUserId");
                ReferrerChannelId = ajo.CallStr("getReferrerChannelId");
                IsFirstMatch      = ajo.CallBool("isFirstMatch");
                IsGuaranteedMatch = ajo.CallBool("isGuaranteedMatch");
                IsReinstall       = ajo.CallBool("isReinstall");
                IsFirstMatchLink  = ajo.CallBool("isFirstMatchLink");
                var linkParamsDict = ajo.CallAJO("getLinkParams").FromJavaHashMap();
                LinkParams = new LinkParams(linkParamsDict);
                var originalLinkParamsDict = ajo.CallAJO("getOriginalLinkParams").FromJavaHashMap();
                OriginalLinkParams = new LinkParams(originalLinkParamsDict);
#pragma warning disable 0618
                CustomReferralData         = new CustomReferralData(LinkParams);
                OriginalCustomReferralData = new CustomReferralData(OriginalLinkParams);
#pragma warning restore 0618
            }
            return(this);
        }
Example #4
0
 public Mention ParseFromAJO(AndroidJavaObject ajo)
 {
     UserId     = ajo.CallStr("getUserId");
     StartIndex = ajo.CallInt("getStartIndex");
     EndIndex   = ajo.CallInt("getEndIndex");
     Type       = ajo.CallStr("getType");
     return(this);
 }
 public PublicUser ParseFromAJO(AndroidJavaObject ajo)
 {
     // NOTE: Don't forget to call Dispose() in subclasses to avoid leaks!!
     Id                = ajo.CallStr("getId");
     DisplayName       = ajo.CallStr("getDisplayName");
     AvatarUrl         = ajo.CallStr("getAvatarUrl");
     Identities        = ajo.CallAJO("getIdentities").FromJavaHashMap();
     _publicProperties = ajo.CallAJO("getAllPublicProperties").FromJavaHashMap();
     return(this);
 }
 public NotificationCustomization ParseFromAJO(AndroidJavaObject ajo)
 {
     if (ajo == null)
     {
         return(null);
     }
     BackgroundImageConfiguration = ajo.CallStr("getBackgroundImageConfiguration");
     TitleColor = ajo.CallStr("getTitleColor");
     TextColor  = ajo.CallStr("getTextColor");
     return(this);
 }
Example #7
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);
 }
Example #8
0
        public InviteChannel ParseFromAJO(AndroidJavaObject ajo)
        {
            JniUtils.CheckIfClassIsCorrect(ajo, "InviteChannel");

            using (ajo)
            {
                Id           = ajo.CallStr("getChannelId");
                Name         = ajo.CallStr("getChannelName");
                IconImageUrl = ajo.CallStr("getIconImageUrl");
                DisplayOrder = ajo.CallInt("getDisplayOrder");
                IsEnabled    = ajo.CallBool("isEnabled");
            }
            return(this);
        }
        public InvitePackage ParseFromAJO(AndroidJavaObject ajo)
        {
            JniUtils.CheckIfClassIsCorrect(ajo, "InvitePackage");

            using (ajo)
            {
                Subject         = ajo.CallStr("getSubject");
                Text            = ajo.CallStr("getText");
                UserName        = ajo.CallStr("getUserName");
                ReferralDataUrl = ajo.CallStr("getReferralUrl");
                Image           = ajo.CallAJO("getImage").FromAndroidBitmap();
                ImageUrl        = ajo.CallStr("getImageUrl");
            }
            return(this);
        }
        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);
        }
Example #11
0
        public GetSocialAction ParseFromAJO(AndroidJavaObject ajo)
        {
            Type = ajo.CallStr("getType");
            Data = ajo.CallAJO("getData").FromJavaHashMap();

            return(this);
        }
        public static Dictionary <string, string> FromJavaHashMap(this AndroidJavaObject javaHashMap)
        {
            if (javaHashMap == null)
            {
                return(new Dictionary <string, string>());
            }

            if (javaHashMap.IsJavaNull())
            {
                return(new Dictionary <string, string>());
            }

            var size       = javaHashMap.CallInt("size");
            var dictionary = new Dictionary <string, string>(size);

            var iterator = javaHashMap.CallAJO("keySet").CallAJO("iterator");

            while (iterator.CallBool("hasNext"))
            {
                string key   = iterator.CallStr("next");
                string value = javaHashMap.CallStr("get", key);
                dictionary.Add(key, value);
            }

            javaHashMap.Dispose();
            return(dictionary);
        }
        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");
                InstallPlatform     = ajo.CallStr("getInstallPlatform");
                Reinstall           = ajo.CallBool("isReinstall");
                InstallSuspicious   = ajo.CallBool("isInstallSuspicious");
            }
            return(this);
        }
Example #14
0
 public GetSocialError ParseFromAJO(AndroidJavaObject ajo)
 {
     using (ajo)
     {
         ErrorCode = ajo.CallInt("getErrorCode");
         Message   = ajo.CallStr("getMessage");
     }
     return(this);
 }
Example #15
0
        public static string GetAbsolutePath(this AndroidJavaObject ajo)
        {
            if (ajo.GetClassName() != C.JavaIoFile)
            {
                Debug.LogError("Trying to get absolute path but object class is not " + C.JavaIoFile);
                return(string.Empty);
            }

            return(ajo.CallStr("getAbsolutePath"));
        }
Example #16
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")
     });
 }
        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);
        }
Example #18
0
 public PromoCode ParseFromAJO(AndroidJavaObject ajo)
 {
     using (ajo) {
         Code          = ajo.CallStr("getCode");
         Data          = ajo.CallAJO("getData").FromJavaHashMap();
         MaxClaimCount = (uint)ajo.CallInt("getMaxClaimCount");
         StartDate     = DateFromAjo(ajo.CallAJO("getStartDate")).Value;
         EndDate       = DateFromAjo(ajo.CallAJO("getEndDate"));
         Creator       = new UserReference().ParseFromAJO(ajo.CallAJO("getCreator"));
         ClaimCount    = (uint)ajo.CallInt("getClaimCount");
         Enabled       = ajo.CallBool("isEnabled");
         Claimable     = ajo.CallBool("isClaimable");
     }
     return(this);
 }
Example #19
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);
        }
        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);
        }
 public string GetStringExtra(string name)
 {
     return(_intent.CallStr("getStringExtra", name));
 }
 public ActionButton ParseFromAJO(AndroidJavaObject ajo)
 {
     Title = ajo.CallStr("getTitle");
     Id    = ajo.CallStr("getId");
     return(this);
 }
Example #23
0
 public void onFailToLoadRewards(AndroidJavaObject throwable)
 {
     Debug.Log("Failed to load rewards: " + throwable?.CallStr("getMessage"));
     InBrainSceneHelper.Queue(() => _onFailedToReceiveFailedToReceiveRewards());
 }