public AndroidJavaObject ToAJO() { if (GoogleMapUtils.IsNotAndroid) { return(null); } var ajo = new AndroidJavaObject(PolylineOptionsClass); foreach (var point in _points) { ajo.CallAJO("add", point.ToAJO()); } ajo.CallAJO("startCap", _startCap.ToAJO()); ajo.CallAJO("endCap", _endCap.ToAJO()); ajo.CallAJO("jointType", (int)_jointType); ajo.CallAJO(ZIndexMethodName, _zIndex); ajo.CallAJO(IsVisibleMethodName, _visible); ajo.CallAJO(IsClickableMethodName, _clickable); ajo.CallAJO(ColorMethodName, _color.ToAndroidColor()); ajo.CallAJO(IsGeodesicMethodName, _geodesic); ajo.CallAJO(WidthMethodName, _width); return(ajo); }
AndroidJavaObject ToAJO() { var notificationCenterViewBuilderAJO = new AndroidJavaObject("im.getsocial.sdk.ui.pushnotifications.NotificationCenterViewBuilder"); if (_notificationTypes != null && _notificationTypes.Length > 0) { notificationCenterViewBuilderAJO.CallAJO("setFilterByTypes", _notificationTypes.ToList().ToJavaStringArray()); } if (_actionTypes != null && _actionTypes.Length > 0) { notificationCenterViewBuilderAJO.CallAJO("setFilterByActions", _actionTypes.ToList().ToJavaStringArray()); } if (_notificationClickListener != null) { notificationCenterViewBuilderAJO.CallAJO("setNotificationClickListener", new NotificationClickListenerProxy(_notificationClickListener)); } if (_actionButtonClickListener != null) { notificationCenterViewBuilderAJO.CallAJO("setActionButtonClickListener", new NotificationActionButtonClickListenerProxy(_actionButtonClickListener)); } return(notificationCenterViewBuilderAJO); }
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 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); }
public AndroidJavaObject ToAJO() { if (GoogleMapUtils.IsNotAndroid) { return(null); } var ajo = new AndroidJavaObject(PolygonOptionsClass); foreach (var point in _points) { ajo.CallAJO("add", point.ToAJO()); } ajo.CallAJO(ZIndexMethodName, _zIndex); ajo.CallAJO(IsVisibleMethodName, _visible); ajo.CallAJO(IsClickableMethodName, _clickable); ajo.CallAJO(FillColorMethodName, _fillColor.ToAndroidColor()); ajo.CallAJO(StrokeColorMethodName, _strokeColor.ToAndroidColor()); ajo.CallAJO(StrokeWidthMethodName, _strokeWidth); ajo.CallAJO(IsGeodesicMethodName, _geodesic); ajo.CallAJO("strokeJointType", (int)_strokeJointType); foreach (var hole in _holes) { ajo.CallAJO("addHole", hole.ToJavaList(latLng => latLng.ToAJO())); } return(ajo); }
public AndroidJavaObject ToAjo() { var activityPostContentBuilderAjo = new AndroidJavaObject("im.getsocial.sdk.activities.ActivityPostContent$Builder"); if (_text != null) { activityPostContentBuilderAjo.CallAJO("withText", _text); } if (_buttonTitle != null) { if (_buttonAction != null) { activityPostContentBuilderAjo.CallAJO("withButton", _buttonTitle, _buttonAction); } if (_action != null) { activityPostContentBuilderAjo.CallAJO("withButton", _buttonTitle, _action.ToAjo()); } } if (_mediaAttachment != null) { activityPostContentBuilderAjo.CallAJO("withMediaAttachment", _mediaAttachment.ToAjo()); } return(activityPostContentBuilderAjo.CallAJO("build")); }
/// <summary> /// Adds a fence identified by the given key /// </summary> /// <param name="fenceKey"></param> /// <param name="fence">The fence that is to be registered.</param> /// <returns>This <see cref="FenceUpdateRequest.Builder"/> object.</returns> public Builder AddFence(string fenceKey, AwarenessFence fence) { var intent = FenceClient.AwarenessManagerClass.AJCCallStaticOnceAJO("getPendingIntent", JniToolkitUtils.Activity); _ajo.CallAJO("addFence", fenceKey, fence.AJO, intent); 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); }
/// <summary> /// Sets the client prefix for the visual voicemail SMS filter. The client prefix will appear at the start of a visual voicemail SMS message, followed by a colon(:). /// </summary> /// <returns> The same Builder instance </returns> public Builder SetClientPrefix(string clientPrefix) { if (AGUtils.IsNotAndroid() || !Check.IsSdkGreaterOrEqual(AGDeviceInfo.VersionCodes.O)) { return(this); } builderAjo.CallAJO("setClientPrefix", clientPrefix); return(this); }
/// <summary> /// Shows the local notification. Upon click it will open the game if the game is not in foreground. /// </summary> /// <param name="title">Set the title (first row) of the notification, in a standard notification.</param> /// <param name="text">Set the text (second row) of the notification, in a standard notification.</param> /// <param name="when">Set the time that the event occurred. Notifications in the panel are sorted by this time.</param> /// <param name="tickerText">Set the text that is displayed in the status bar when the notification first arrives.</param> /// <param name="iconName">Icon drawable name. Icon must be included in the app in res/drawable folder</param> public static void ShowNotification(string title, string text, DateTime?when = null, string tickerText = null, string iconName = null) { if (AGUtils.IsNotAndroidCheck()) { return; } using (var builderAJO = new AndroidJavaObject(CompatBuilderClass, AGUtils.Activity)) { var intent = new AndroidIntent(AGUtils.GetMainActivityClass()); var pendingIntent = AndroidPendingIntent.GetActivity(intent.AJO); builderAJO.CallAJO("setContentTitle", title); builderAJO.CallAJO("setContentText", text); builderAJO.CallAJO("setAutoCancel", true); builderAJO.CallAJO("setWhen", (when ?? DateTime.Now).ToMillisSinceEpoch()); int icon = string.IsNullOrEmpty(iconName) ? R.UnityLauncherIcon : R.GetAppDrawableId(iconName); builderAJO.CallAJO("setSmallIcon", icon); builderAJO.CallAJO("setDefaults", DEFAULT_ALL); builderAJO.CallAJO("setContentIntent", pendingIntent); //builderAJO.CallAJO("setContentInfo", "Info"); if (!string.IsNullOrEmpty(tickerText)) { builderAJO.CallAJO("setTicker", tickerText); } AGSystemService.NotificationService.Call("notify", 1, builderAJO.CallAJO("build")); intent.Dispose(); pendingIntent.Dispose(); } }
public AndroidJavaObject ToAjo() { var updateUserBuilder = new AndroidJavaObject("im.getsocial.sdk.usermanagement.UserUpdate$Builder"); updateUserBuilder.CallAJO("updateDisplayName", _displayName); updateUserBuilder.CallAJO("updateAvatar", _avatar); updateUserBuilder.CallAJO("updateAvatarUrl", _avatarUrl); foreach (var publicProperty in _publicProperties) { updateUserBuilder.CallAJO("setPublicProperty", publicProperty.Key, publicProperty.Value); } foreach (var privateProperty in _privateProperties) { updateUserBuilder.CallAJO("setPrivateProperty", privateProperty.Key, privateProperty.Value); } foreach (var publicInternalProperty in _publicInternalProperties) { updateUserBuilder.CallAJO("setInternalPublicProperty", publicInternalProperty.Key, publicInternalProperty.Value); } foreach (var privateInternalProperty in _privateInternalProperties) { updateUserBuilder.CallAJO("setInternalPrivateProperty", privateInternalProperty.Key, privateInternalProperty.Value); } return(updateUserBuilder.CallAJO("build")); }
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); }
static void Launch(int request, Action <AndroidJavaObject> intentAction = null) { InitGoogleApi(); var intent = new AndroidJavaObject("android.content.Intent", JniToolkitUtils.Activity, JniToolkitUtils.ClassForName(PickerActivityClass)); intent.CallAJO(PutExtraMethod, EXTRAS_PICKER_TYPE, request); intent.CallAJO("addFlags", FLAG_NO_ANIMATION); if (intentAction != null) { intentAction(intent); } JniToolkitUtils.StartActivity(intent); }
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); }
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 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)); }
private void SetUiActionListenerAJO(AndroidJavaObject builderAJO) { if (_uiActionListener != null) { builderAJO.CallAJO("setUiActionListener", new UiActionListenerProxy(_uiActionListener)); } }
private void SetTitleAJO(AndroidJavaObject builderAJO) { if (_customWindowTitle != null) { builderAJO.CallAJO("setWindowTitle", _customWindowTitle); } }
private void SetViewStateListener(AndroidJavaObject builderAJO) { if (_onOpen != null || _onClose != null) { builderAJO.CallAJO("setViewStateListener", new ViewStateListener(_onOpen, _onClose)); } }
public AndroidJavaObject ToAJO() { if (GoogleMapUtils.IsNotAndroid) { return(null); } var ajo = new AndroidJavaObject(TileOverlayOptionsClass); ajo.CallAJO(TileProviderMethodName, _tileProvider.AJO); ajo.CallAJO(ZIndexMethodName, _zIndex); ajo.CallAJO(IsVisibleMethodName, _visible); ajo.CallAJO(TransparencyMethodName, _transparency); ajo.CallAJO(FadeInMethodName, _fadeIn); return(ajo); }
AndroidJavaObject ToAJO() { var activityDetailsBuilderAJO = new AndroidJavaObject("im.getsocial.sdk.ui.activities.ActivityDetailsViewBuilder", _activityId); activityDetailsBuilderAJO.CallAJO("setShowActivityFeedView", _showActivityFeedView); if (_onButtonClicked != null) { activityDetailsBuilderAJO.CallAJO("setButtonActionListener", new ActionButtonListenerProxy(_onButtonClicked)); } if (_onAvatarClickListener != null) { activityDetailsBuilderAJO.CallAJO("setAvatarClickListener", new AvatarClickListenerProxy(_onAvatarClickListener)); } if (_onMentionClickListener != null) { activityDetailsBuilderAJO.CallAJO("setMentionClickListener", new MentionClickListenerProxy(_onMentionClickListener)); } if (_tagClickListener != null) { activityDetailsBuilderAJO.CallAJO("setTagClickListener", new TagClickListenerProxy(_tagClickListener)); } if (_commentId != null) { activityDetailsBuilderAJO.CallAJO("setCommentId", _commentId); } activityDetailsBuilderAJO.CallAJO("setReadOnly", _readOnly); return(activityDetailsBuilderAJO); }
/// <summary> /// Gets the current information about nearby beacons. Note that beacon snapshots are only available on API level 18 or higher. /// /// Gets the current information about nearby beacons. Note that beacon snapshots are only available on devices running API level 18 or higher. /// If calling from a device running API level 17 or earlier, the Task will fail and calling getStatusCode() will return status code API_NOT_AVAILABLE. /// </summary> /// <param name="beaconTypes">The types of beacon attachments to return. See https://developers.google.com/beacons/ for details about beacon attachments.</param> /// <param name="onSuccess">Success callback.</param> /// <param name="onFailure">Failure callback.</param> public static void GetBeaconState([NotNull] List <BeaconState.TypeFilter> beaconTypes, [NotNull] Action <BeaconState> onSuccess, [CanBeNull] Action <string> onFailure) { if (beaconTypes == null) { throw new ArgumentNullException("beaconTypes"); } if (onSuccess == null) { throw new ArgumentNullException("onSuccess"); } if (beaconTypes.Count == 0) { throw new ArgumentException("beaconTypes must not be empty"); } if (CheckPreconditions()) { return; } if (PermissionHelper.CheckLocationPermission()) { return; } CreateClientLazy(); var onSuccessListenerProxy = new OnSuccessListenerProxy <BeaconState>(onSuccess, ajo => BeaconState.FromAJO(ajo.CallAJO("getBeaconState"))); _client.CallAJO("getBeaconState", beaconTypes.ToJavaList(x => x.AJO)) .CallAJO("addOnSuccessListener", onSuccessListenerProxy) .CallAJO("addOnFailureListener", new OnFailureListenerProxy(onFailure)); }
public static FenceQueryResponse FromAJO(AndroidJavaObject ajo) { var fenceQueryResponse = new FenceQueryResponse(); var stateMapAjo = ajo.CallAJO("getFenceStateMap"); var keys = stateMapAjo.CallAJO("getFenceKeys").FromJavaIterable <string>(); keys.ForEach(key => fenceQueryResponse.FenceStateDictionary[key] = FenceState.FromAJO(stateMapAjo.CallAJO("getFenceState", key))); return(fenceQueryResponse); }
/// <summary> /// Adds or removes a set of fences that are registered with the Awareness API. /// </summary> /// <param name="fenceUpdateRequest">A request indicating a batch of fences to add and/or remove.</param> /// <param name="onSuccess">Success callback.</param> /// <param name="onFailure">Failure callback.</param> public static void UpdateFences([NotNull] FenceUpdateRequest fenceUpdateRequest, [CanBeNull] Action onSuccess, [CanBeNull] Action <string> onFailure) { if (fenceUpdateRequest == null) { throw new ArgumentNullException("fenceUpdateRequest"); } if (CheckPreconditions()) { return; } Action <AndroidJavaObject> wrapper = _ => onSuccess(); _client.CallAJO("updateFences", fenceUpdateRequest.AJO) .CallAJO("addOnSuccessListener", new OnSuccessListenerProxy <AndroidJavaObject>(wrapper, ajo => ajo)) .CallAJO("addOnFailureListener", new OnFailureListenerProxy(onFailure)); }
public AndroidJavaObject ToAjo() { var inviteContentBuilderAJO = new AndroidJavaObject("im.getsocial.sdk.invites.InviteContent$Builder"); if (Subject != null) { inviteContentBuilderAJO.CallAJO("withSubject", Subject); } if (Text != null) { inviteContentBuilderAJO.CallAJO("withText", Text); } if (_mediaAttachment != null) { inviteContentBuilderAJO.CallAJO("withMediaAttachment", _mediaAttachment.ToAjo()); } return(inviteContentBuilderAJO.CallAJO("build")); }
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); }
public static AndroidJavaObject CallAJOSafe(this AndroidJavaObject ajo, string methodName, params object[] args) { try { return(ajo.CallAJO(methodName, args)); } catch (Exception e) { Debug.Log(e); return(null); } }
// https://stackoverflow.com/questions/22794049/how-do-i-maintain-the-immersive-mode-in-dialogs public static void ShowWithImmersiveModeWorkaround(AndroidJavaObject dialog) { var dialogWindow = dialog.CallAJO("getWindow"); const int FLAG_NOT_FOCUSABLE = 8; dialogWindow.Call("setFlags", FLAG_NOT_FOCUSABLE, FLAG_NOT_FOCUSABLE); dialog.Call("show"); var currentVisibility = AGUtils.Window.CallAJO("getDecorView").CallInt("getSystemUiVisibility"); dialogWindow.CallAJO("getDecorView").Call("setSystemUiVisibility", currentVisibility); dialogWindow.Call("clearFlags", FLAG_NOT_FOCUSABLE); }
public AndroidJavaObject ToAjo() { var inviteContentBuilderAJO = new AndroidJavaObject("im.getsocial.sdk.invites.InviteContent$Builder"); if (Subject != null) { inviteContentBuilderAJO.CallAJO("withSubject", Subject); } if (ImageUrl != null) { inviteContentBuilderAJO.CallAJO("withImageUrl", ImageUrl); } if (Image != null) { inviteContentBuilderAJO.CallAJO("withImage", Image.ToAjoBitmap()); } if (Text != null) { inviteContentBuilderAJO.CallAJO("withText", Text); } if (Video != null) { inviteContentBuilderAJO.CallAJO("withVideo", Video); } return(inviteContentBuilderAJO.CallAJO("build")); }