public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString) { try { string text = itemString.ToString(); if (text == GetString(Resource.String.Btn_Paypal)) { InitPayPalPayment.BtnPaypalOnClick(DataObject.Amount); } else if (text == GetString(Resource.String.Btn_GooglePlay)) { BillingPayment.SetConnInAppBilling(); BillingPayment.InitInAppBilling(DataObject.Amount, "Funding", ""); } else if (text == GetString(Resource.String.Lbl_CreditCard)) { OpenIntentCreditCard(); } else if (text == GetString(Resource.String.Lbl_BankTransfer)) { OpenIntentBankTransfer(); } else if (text == GetString(Resource.String.Lbl_Share)) { ShareEvent(); } else if (text == GetString(Resource.String.Lbl_Edit)) { EditEvent(); } else if (text == GetString(Resource.String.Lbl_Copy)) { CopyLinkEvent(); } else if (text == GetString(Resource.String.Lbl_Delete)) { DialogType = "Delete"; var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Title(Resource.String.Lbl_Warning); dialog.Content(GetText(Resource.String.Lbl_DeleteFunding)); dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive((materialDialog, action) => { try { // Send Api delete if (Methods.CheckConnectivity()) { var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.FundId == DataObject.Id); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.FundId == DataObject.Id); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } var dataFunding = FundingActivity.GetInstance()?.MAdapter?.FundingList?.FirstOrDefault(a => a.Id == DataObject.Id); if (dataFunding != null) { FundingActivity.GetInstance()?.MAdapter?.FundingList.Remove(dataFunding); FundingActivity.GetInstance().MAdapter.NotifyItemRemoved(FundingActivity.GetInstance().MAdapter.FundingList.IndexOf(dataFunding)); } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short).Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Funding.DeleteFunding(DataObject.Id) }); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception e) { Console.WriteLine(e); } }); dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.ItemsCallback(this).Build().Show(); } } catch (Exception e) { Console.WriteLine(e); } }
public void PlayVideo(string videoUrL, GetMoviesObject.Movie videoObject) { try { if (videoObject != null) { VideoData = videoObject; VideoViewerActivity.GetInstance()?.TabVideosAbout?.LoadVideo_Data(videoObject); TabbedMainActivity.GetInstance()?.SetOnWakeLock(); ReleaseVideo(); MFullScreenIcon.SetImageDrawable(ActivityContext.GetDrawable(Resource.Drawable.ic_action_ic_fullscreen_expand)); Uri videoUrl = Uri.Parse(!string.IsNullOrEmpty(videoUrL) ? videoUrL : VideoData.Source); AdaptiveTrackSelection.Factory trackSelectionFactory = new AdaptiveTrackSelection.Factory(); var trackSelector = new DefaultTrackSelector(trackSelectionFactory); trackSelector.SetParameters(new DefaultTrackSelector.ParametersBuilder().Build()); Player = ExoPlayerFactory.NewSimpleInstance(ActivityContext, trackSelector); DefaultDataMediaFactory = new DefaultDataSourceFactory(ActivityContext, Util.GetUserAgent(ActivityContext, AppSettings.ApplicationName), BandwidthMeter); // Produces DataSource instances through which media data is loaded. var defaultSource = GetMediaSourceFromUrl(videoUrl, "normal"); VideoSource = null !; //Set Interactive Media Ads if (PlayerSettings.ShowInteractiveMediaAds) { VideoSource = CreateMediaSourceWithAds(defaultSource, PlayerSettings.ImAdsUri); } if (SimpleExoPlayerView == null) { Initialize(); } //Set Cache Media Load if (PlayerSettings.EnableOfflineMode) { VideoSource = VideoSource == null?CreateCacheMediaSource(defaultSource, videoUrl) : CreateCacheMediaSource(VideoSource, videoUrl); if (VideoSource != null) { SimpleExoPlayerView.Player = Player; Player.Prepare(VideoSource); Player.AddListener(PlayerListener); Player.PlayWhenReady = true; bool haveResumePosition = ResumeWindow != C.IndexUnset; if (haveResumePosition) { Player.SeekTo(ResumeWindow, ResumePosition); } return; } } if (VideoSource == null) { if (!string.IsNullOrEmpty(videoUrL)) { if (videoUrL.Contains("youtube") || videoUrL.Contains("Youtube") || videoUrL.Contains("youtu")) { //Task.Factory.StartNew(async () => //{ // var newurl = await VideoInfoRetriever.GetEmbededVideo(VideoData.source); // videoSource = CreateDefaultMediaSource(Android.Net.Uri.Parse(newurl)); //}); } else { VideoSource = GetMediaSourceFromUrl(Uri.Parse(videoUrL), "normal"); SimpleExoPlayerView.Player = Player; Player.Prepare(VideoSource); Player.AddListener(PlayerListener); Player.PlayWhenReady = true; bool haveResumePosition = ResumeWindow != C.IndexUnset; if (haveResumePosition) { Player.SeekTo(ResumeWindow, ResumePosition); } } } } else { SimpleExoPlayerView.Player = Player; Player.Prepare(VideoSource); Player.AddListener(PlayerListener); Player.PlayWhenReady = true; bool haveResumePosition = ResumeWindow != C.IndexUnset; if (haveResumePosition) { Player.SeekTo(ResumeWindow, ResumePosition); } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void ResultApi(int apiStatus, dynamic respond) { try { if (apiStatus == 200) { if (respond is SharePostToObject result) { AndHUD.Shared.Dismiss(this); if (result.Data.SharedInfo.SharedInfoClass == null) { result.Data.ParentId = PostData.PostId; result.Data.SharedInfo = new SharedInfoUnion { SharedInfoClass = PostData }; } var globalContextTabbed = TabbedMainActivity.GetInstance(); var countList = globalContextTabbed.NewsFeedTab.PostFeedAdapter.ItemCount; var combine = new FeedCombiner(result.Data, globalContextTabbed?.NewsFeedTab?.PostFeedAdapter?.ListDiffer, this); combine.CombineDefaultPostSections("Top"); int countIndex = 1; var model1 = globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.Story); var model2 = globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AddPostBox); var model3 = globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.FilterSection); var model4 = globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AlertBox); var model5 = globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.SearchForPosts); if (model5 != null) { countIndex += globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.IndexOf(model5) + 1; } else if (model4 != null) { countIndex += globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.IndexOf(model4) + 1; } else if (model3 != null) { countIndex += globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.IndexOf(model3) + 1; } else if (model2 != null) { countIndex += globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.IndexOf(model2) + 1; } else if (model1 != null) { countIndex += globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.IndexOf(model1) + 1; } else { countIndex = 0; } var emptyStateChecker = globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.EmptyState); if (emptyStateChecker != null && globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.Count > 1) { globalContextTabbed.NewsFeedTab.MainRecyclerView.RemoveByRowIndex(emptyStateChecker); } globalContextTabbed.NewsFeedTab.PostFeedAdapter.NotifyItemRangeInserted(countIndex, globalContextTabbed.NewsFeedTab.PostFeedAdapter.ListDiffer.Count - countList); //if (TypePost == "MyTimeline") //{ // MyProfileActivity myProfileActivity = MyProfileActivity.GetInstance(); // if (myProfileActivity == null) // return; // var countList1 = myProfileActivity.PostFeedAdapter.ItemCount; // var combine1 = new FeedCombiner(result.Data, myProfileActivity.PostFeedAdapter.ListDiffer, this); // var check1 = myProfileActivity.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.PostData != null && a.TypeView != PostModelType.AddPostBox && a.TypeView != PostModelType.FilterSection && a.TypeView != PostModelType.SearchForPosts); // if (check1 != null) // combine1.CombineDefaultPostSections("Top"); // else // combine1.CombineDefaultPostSections(); // int countIndex1 = 1; // var model11 = myProfileActivity.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.Story); // var model21 = myProfileActivity.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AddPostBox); // var model31 = myProfileActivity.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.FilterSection); // var model41 = myProfileActivity.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.AlertBox); // var model51 = myProfileActivity.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.SearchForPosts); // if (model51 != null) // countIndex1 += myProfileActivity.PostFeedAdapter.ListDiffer.IndexOf(model51) + 1; // else if (model41 != null) // countIndex1 += myProfileActivity.PostFeedAdapter.ListDiffer.IndexOf(model41) + 1; // else if (model31 != null) // countIndex1 += myProfileActivity.PostFeedAdapter.ListDiffer.IndexOf(model31) + 1; // else if (model21 != null) // countIndex1 += myProfileActivity.PostFeedAdapter.ListDiffer.IndexOf(model21) + 1; // else if (model11 != null) // countIndex1 += myProfileActivity.PostFeedAdapter.ListDiffer.IndexOf(model11) + 1; // else // countIndex1 = 0; // var emptyStateChecker1 = myProfileActivity.PostFeedAdapter.ListDiffer.FirstOrDefault(a => a.TypeView == PostModelType.EmptyState); // if (emptyStateChecker1 != null && myProfileActivity.PostFeedAdapter.ListDiffer.Count > 1) // myProfileActivity.MainRecyclerView.RemoveByRowIndex(emptyStateChecker1); // myProfileActivity.PostFeedAdapter.NotifyItemRangeInserted(countIndex1, myProfileActivity.PostFeedAdapter.ListDiffer.Count - countList1); //} Toast.MakeText(this, GetText(Resource.String.Lbl_PostSuccessfullyShared), ToastLength.Short)?.Show(); if (UserDetails.SoundControl) { Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("PopNotificationPost.mp3"); } Finish(); } } else { Methods.DisplayAndHudErrorResult(this, respond); } } catch (Exception e) { AndHUD.Shared.Dismiss(this); Methods.DisplayReportResultTrack(e); } }
private async void btnLike_Click(object sender, EventArgs e) { try { var ActivityContext = TabbedMainActivity.GetInstance(); if (Helpers.Utils.Methods.CheckConnectivity()) { if (UserDetails.IsLogin) { try { //If User Liked if (btnLike.Tag.ToString() == "0") { btnLike.Tag = "1"; btnLike.SetImageResource(Resource.Drawable.like_blue); if (!txtLikeNumber.Text.Contains("K") && !txtLikeNumber.Text.Contains("M")) { var x = Convert.ToDouble(txtLikeNumber.Text); x++; txtLikeNumber.Text = x.ToString(System.Globalization.CultureInfo.InvariantCulture); } int index = mediaList.FindIndex(x => x.Id == selectedMedia.Id); mediaList[index].IsLiked = "1"; mediaList[index].Likes = (Convert.ToDouble(mediaList[index].Likes) + 1).ToString(); //AddToLiked //ActivityContext.LibrarySynchronizer.AddToLiked(VideoDataHandler); Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_Video_Liked), ToastLength.Short).Show(); //Send API Request here for Like using (var client = new System.Net.Http.HttpClient()) { var formContent = new System.Net.Http.FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("server_key", "0913cbbd8c729a5db4db40e4aa267a17"), new KeyValuePair <string, string>("video_id", selectedMedia.Id.ToString()), new KeyValuePair <string, string>("user_id", UserDetails.UserId), new KeyValuePair <string, string>("s", UserDetails.AccessToken) }); // send a Post request var uri = PlayTubeClient.Client.WebsiteUrl + "/api/v1.0/?type=like_response_videos"; var result = await client.PostAsync(uri, formContent); //if (result.IsSuccessStatusCode) //{ // // handling the answer // var resultString = await result.Content.ReadAsStringAsync(); // var jConfigObject = Newtonsoft.Json.Linq.JObject.Parse(resultString); // if (jConfigObject["api_status"].ToString() == "200" && jConfigObject["data"] != null) // { // } //} } } else { btnLike.Tag = "0"; btnLike.SetImageResource(Resource.Drawable.like_white); if (!txtLikeNumber.Text.Contains("K") && !txtLikeNumber.Text.Contains("M")) { var x = Convert.ToDouble(txtLikeNumber.Text); if (x > 0) { x--; } else { x = 0; } txtLikeNumber.Text = x.ToString(System.Globalization.CultureInfo.CurrentCulture); } int index = mediaList.FindIndex(x => x.Id == selectedMedia.Id); mediaList[index].IsLiked = "0"; var y = Convert.ToDouble(mediaList[index].Likes); if (y > 0) { y--; } else { y = 0; } mediaList[index].Likes = y.ToString(); Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_Remove_Video_Liked), ToastLength.Short).Show(); //Send API Request here for Remove Like using (var client = new System.Net.Http.HttpClient()) { var formContent = new System.Net.Http.FormUrlEncodedContent(new[] { new KeyValuePair <string, string>("server_key", "0913cbbd8c729a5db4db40e4aa267a17"), new KeyValuePair <string, string>("video_id", selectedMedia.Id.ToString()), new KeyValuePair <string, string>("user_id", UserDetails.UserId), new KeyValuePair <string, string>("s", UserDetails.AccessToken) }); // send a Post request var uri = PlayTubeClient.Client.WebsiteUrl + "/api/v1.0/?type=like_response_videos"; var result = await client.PostAsync(uri, formContent); //if (result.IsSuccessStatusCode) //{ // // handling the answer // var resultString = await result.Content.ReadAsStringAsync(); // var jConfigObject = Newtonsoft.Json.Linq.JObject.Parse(resultString); // if (jConfigObject["api_status"].ToString() == "200" && jConfigObject["data"] != null) // { // } //} } } TabbedMainActivity.GetInstance().MyChannelFragment.latestResponse.adpater.LatestResponse = new ObservableCollection <AdminVideoResponse>(UserResponseAPI.GetAdminVideos().VideoResponse); //await ActivityContext.VideoDataWithEventsLoader.ResponseFragment.GetResponseList(ActivityContext.VideoData.VideoId); //ActivityContext.VideoDataWithEventsLoader.ResponseFragment.GetUserResponse(ActivityContext.VideoData.VideoId); } catch (Exception exception) { Console.WriteLine(exception); } } else { PopupDialogController dialog = new PopupDialogController(ActivityContext, ActivityContext.VideoDataWithEventsLoader.VideoDataHandler, "Login"); dialog.ShowNormalDialog(this.GetText(Resource.String.Lbl_Warning), this.GetText(Resource.String.Lbl_Please_sign_in_Like), ActivityContext.GetText(Resource.String.Lbl_Yes), ActivityContext.GetText(Resource.String.Lbl_No)); } } else { Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.AgoraVideoCallActivityLayout); GlobalContext = TabbedMainActivity.GetInstance(); SensorManager = (SensorManager)GetSystemService(SensorService); Proximity = SensorManager.GetDefaultSensor(SensorType.Proximity); UserId = Intent.GetStringExtra("UserID"); Avatar = Intent.GetStringExtra("avatar"); Name = Intent.GetStringExtra("name"); var dataCallId = Intent.GetStringExtra("CallID") ?? "Data not available"; if (dataCallId != "Data not available" && !String.IsNullOrEmpty(dataCallId)) { CallId = dataCallId; FromId = Intent.GetStringExtra("from_id"); Active = Intent.GetStringExtra("active"); var time = Intent.GetStringExtra("time"); Status = Intent.GetStringExtra("status"); RoomName = Intent.GetStringExtra("room_name"); CallType = Intent.GetStringExtra("type"); Console.WriteLine(time); } SwitchCamButton = FindViewById <Button>(Resource.Id.switch_cam_button); MuteVideoButton = FindViewById <CircleButton>(Resource.Id.mute_video_button); EndCallButton = FindViewById <CircleButton>(Resource.Id.end_call_button); MuteAudioButton = FindViewById <CircleButton>(Resource.Id.mute_audio_button); UserInfoviewContainer = FindViewById <RelativeLayout>(Resource.Id.userInfoview_container); UserImageView = FindViewById <ImageView>(Resource.Id.userImageView); UserNameTextView = FindViewById <TextView>(Resource.Id.userNameTextView); NoteTextView = FindViewById <TextView>(Resource.Id.noteTextView); PictureInToPictureButton = FindViewById <ImageView>(Resource.Id.pictureintopictureButton); if (!PackageManager.HasSystemFeature(PackageManager.FeaturePictureInPicture)) { PictureInToPictureButton.Visibility = ViewStates.Gone; } SwitchCamButton.Click += Switch_cam_button_Click; MuteVideoButton.Click += Mute_video_button_Click; EndCallButton.Click += End_call_button_Click; MuteAudioButton.Click += Mute_audio_button_Click; PictureInToPictureButton.Click += PictureInToPictureButton_Click; LoadUserInfo(UserId); if (CallType == "Agora_video_calling_start") { Start_Call_Action("call"); } else { Start_Call_Action("recieve_call"); } } catch (Exception e) { Console.WriteLine(e); } }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your fragment here GlobalContext = (TabbedMainActivity)Activity ?? TabbedMainActivity.GetInstance(); }
public override async void OnDestroy() { try { base.OnDestroy(); await TabbedMainActivity.GetInstance().VideoDataWithEventsLoader.ResponseFragment.GetResponseList(TabbedMainActivity.GetInstance().VideoData.VideoId); TabbedMainActivity.GetInstance().VideoDataWithEventsLoader.ResponseFragment.GetUserResponse(TabbedMainActivity.GetInstance().VideoData.VideoId); } catch (System.Exception ex) { } }
private void IconView_Click() { try { if (DataUser == null) { return; } try { if (AppSettings.LastChatSystem == SystemApiGetLastChat.New) { var item = TabbedMainActivity.GetInstance()?.LastChatTab?.MAdapter?.ChatList?.FirstOrDefault(a => a.UserId == DataUser.UserId); if (item != null && item.LastMessage.LastMessageClass.ToId == UserDetails.UserId && item.LastMessage.LastMessageClass.FromId != UserDetails.UserId) { item.LastMessage.LastMessageClass.Seen = "1"; item.LastMessage.LastMessageClass.MessageCount = "0"; TabbedMainActivity.GetInstance()?.LastChatTab?.MAdapter?.NotifyDataSetChanged(); } } else { var item = TabbedMainActivity.GetInstance()?.LastMessagesTab?.MAdapter?.MLastMessagesUser?.FirstOrDefault(a => a.UserId == DataUser.UserId); if (item != null && item.LastMessage.ToId == UserDetails.UserId && item.LastMessage.FromId != UserDetails.UserId) { item.LastMessage.Seen = "1"; TabbedMainActivity.GetInstance()?.LastMessagesTab?.MAdapter?.NotifyDataSetChanged(); } } } catch (Exception exception) { Console.WriteLine(exception); } if (DataUser.ChatColor == null) { DataUser.ChatColor = AppSettings.MainColor; } var mainChatColor = DataUser.ChatColor.Contains("rgb") ? Methods.FunString.ConvertColorRgBtoHex(DataUser.ChatColor) : DataUser.ChatColor ?? AppSettings.MainColor; if (DataUser.ChatType == "user") { Intent intent = new Intent(Application.Context, typeof(ChatWindowActivity)); intent.SetFlags(ActivityFlags.NewTask); intent.AddFlags(ActivityFlags.SingleTop); intent.SetAction(Intent.ActionView); intent.PutExtra("UserID", DataUser.UserId); intent.PutExtra("TypeChat", "User"); intent.PutExtra("ColorChat", mainChatColor); intent.PutExtra("UserItem", JsonConvert.SerializeObject(new ChatObject() { ChatType = DataUser.ChatType, UserId = DataUser.UserId, GroupId = DataUser.GroupId, PageId = DataUser.PageId, Avatar = DataUser.Avatar, Name = DataUser.Name, Lastseen = DataUser.LastSeen, LastseenUnixTime = DataUser.LastSeenUnixTime, LastMessage = new LastMessageUnion() { LastMessageClass = new MessageData() { Product = new ProductUnion() } }, })); Application.Context.StartActivity(intent); } Destroy(); } catch (Exception exception) { Console.WriteLine(exception); } }
//private IMediaSource CreateCacheMediaSource(IMediaSource videoSource, Android.Net.Uri videoUrL) //{ // try // { // var url = System.IO.Path.Combine(UserResponseURL.DirectoryURL, selectedMedia.VideoLocation); // var file = VideoDownloadAsyncController.GetDownloadedDiskVideoUri(url); // SimpleCache cache = new SimpleCache(this.CacheDir, new LeastRecentlyUsedCacheEvictor(1024 * 1024 * 10)); // CacheDataSourceFactory cacheDataSource = new CacheDataSourceFactory(cache, DefaultDataMediaFactory); // if (!string.IsNullOrEmpty(file)) // { // videoUrL = Android.Net.Uri.Parse(file); // videoSource = GetMediaSourceFromUrl(videoUrL, "normal"); // return videoSource; // } // else // { // return null; // } // } // catch (Exception exception) // { // Console.WriteLine(exception); // return null; // } //} public void PlayAsync() { try { progressBar.Visibility = ViewStates.Visible; if (Player != null) { Player.Stop(); Player.Release(); } InitializePlayer(); if (selectedMedia.VideoLocation.Contains(".mp4")) { imgAudio.Visibility = ViewStates.Gone; SimpleExoPlayerView.Visibility = ViewStates.Visible; SimpleExoPlayerView.ResizeMode = AspectRatioFrameLayout.ResizeModeZoom; SimpleExoPlayerView.Player = Player; SimpleExoPlayerView.UseController = false; swipListener.SwipeEvent -= SwipListener_SwipeEvent; swipListener.SwipeEvent += SwipListener_SwipeEvent; SimpleExoPlayerView.SetOnTouchListener(swipListener); } else { imgAudio.Visibility = ViewStates.Visible; SimpleExoPlayerView.Visibility = ViewStates.Gone; swipListener.SwipeEvent -= SwipListener_SwipeEvent; swipListener.SwipeEvent += SwipListener_SwipeEvent; imgAudio.SetOnTouchListener(swipListener); Glide.With(this).Load(System.IO.Path.Combine(UserResponseURL.DirectoryURL, selectedMedia.Thumbnail)).Into(imgAudio); } var url = Android.Net.Uri.Parse(System.IO.Path.Combine(UserResponseURL.DirectoryURL, selectedMedia.VideoLocation)); var VideoSource = GetMediaSourceFromUrl(url, "normal"); Player.Prepare(VideoSource); PlayerListener playerListener = new PlayerListener(this); playerListener.MediaPlayCompleted = () => { if (!string.IsNullOrEmpty(UserDetails.AccessToken)) { UserResponseAPI.ViewVideoResponse(selectedMedia.RvId); TabbedMainActivity.GetInstance().VideoDataWithEventsLoader .ResponseFragment.UserResponseAdapter.UserResponseList .Where(x => x.VideoLocation == selectedMedia.VideoLocation) .FirstOrDefault().RvvId = string.Empty; TabbedMainActivity.GetInstance().VideoDataWithEventsLoader .ResponseFragment.UserResponseAdapter .NotifyItemChanged(mediaList.FindIndex(x => x.VideoLocation == selectedMedia.VideoLocation)); } }; Player.AddListener(playerListener); Player.PlayWhenReady = true; Glide.With(this).Load(UserResponseURL.DirectoryUserSettings + selectedMedia.Avatar).Into(imgProfile); txtUserName.Text = selectedMedia.Username; txtdays.Text = Helpers.DateTimeHelper.GetDateTimeString(selectedMedia.Timestamp); txtDescription.Text = selectedMedia.Description; txtLikeNumber.Text = selectedMedia.Likes; txtShareNumber.Text = selectedMedia.Shares; txtCommentNumber.Text = selectedMedia.Comments; if (selectedMedia.IsLiked == "1") // true { btnLike.Tag = "1"; btnLike.SetImageResource(Resource.Drawable.like_blue); } else { btnLike.Tag = "0"; btnLike.SetImageResource(Resource.Drawable.like_white); } } catch (System.Exception ex) { } }
private async void SendMess(string text) { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { var unixTimestamp = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; var time2 = unixTimestamp.ToString(); //Here on This function will send Selected audio file to the user var(apiStatus, respond) = await RequestsAsync.Message.Send_Message(UserId, time2, text); if (apiStatus == 200) { if (respond is SendMessageObject result) { Console.WriteLine(result.MessageData); if (!string.IsNullOrEmpty(CallId)) { var ckd = TabbedMainActivity.GetInstance().LastCallsTab?.MAdapter?.MCallUser?.FirstOrDefault(a => a.Id == CallId); // id >> Call_Id if (ckd == null) { Classes.CallUser cv = new Classes.CallUser { Id = CallId, UserId = UserId, Avatar = Avatar, Name = Name, AccessToken = TwilioAccessToken, AccessToken2 = TwilioAccessTokenUser2, FromId = FromId, Active = Active, Time = "Missed call", Status = Status, RoomName = RoomName, Type = CallType, TypeIcon = "Cancel", TypeColor = "#FF0000" }; TabbedMainActivity.GetInstance().LastCallsTab.MAdapter?.Insert(cv); SqLiteDatabase dbDatabase = new SqLiteDatabase(); dbDatabase.Insert_CallUser(cv); dbDatabase.Dispose(); } } switch (CallType) { case "Twilio_video_call": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Video) }); break; case "Twilio_audio_call": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Audio) }); break; case "Agora_video_call_recieve": case "Agora_audio_call_recieve": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => ApiRequest.Send_Agora_Call_Action_Async("decline", CallId) }); break; } FinishVideoAudio(); } } else { Methods.DisplayReportResult(this, respond); } } } catch (Exception e) { Console.WriteLine(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (DialogType == "Delete") { if (p1 == DialogAction.Positive) { // Send Api delete if (Methods.CheckConnectivity()) { var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.PostId == DataInfoObject?.PostId); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.PostId == DataInfoObject?.PostId); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } var dataJob = JobsActivity.GetInstance()?.MAdapter?.JobList?.FirstOrDefault(a => a.Id == DataInfoObject.Id); if (dataJob != null) { JobsActivity.GetInstance()?.MAdapter?.JobList.Remove(dataJob); JobsActivity.GetInstance().MAdapter.NotifyItemRemoved(JobsActivity.GetInstance().MAdapter.JobList.IndexOf(dataJob)); } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short).Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(DataInfoObject.PostId, "delete") }); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Console.WriteLine(e); } }
private void RejectCallButton_Click(object sender, EventArgs e) { try { switch (CallType) { case "Twilio_video_call": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Video) }); break; case "Twilio_audio_call": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Audio) }); break; case "Agora_video_call_recieve": case "Agora_audio_call_recieve": PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => ApiRequest.Send_Agora_Call_Action_Async("decline", CallId) }); break; } if (!string.IsNullOrEmpty(CallId)) { var ckd = TabbedMainActivity.GetInstance().LastCallsTab?.MAdapter?.MCallUser?.FirstOrDefault(a => a.Id == CallId); // id >> Call_Id if (ckd == null) { Classes.CallUser cv = new Classes.CallUser { Id = CallId, UserId = UserId, Avatar = Avatar, Name = Name, AccessToken = TwilioAccessToken, AccessToken2 = TwilioAccessTokenUser2, FromId = FromId, Active = Active, Time = "Missed call", Status = Status, RoomName = RoomName, Type = CallType, TypeIcon = "Cancel", TypeColor = "#FF0000" }; TabbedMainActivity.GetInstance().LastCallsTab.MAdapter?.Insert(cv); SqLiteDatabase dbDatabase = new SqLiteDatabase(); dbDatabase.Insert_CallUser(cv); dbDatabase.Dispose(); } } FinishVideoAudio(); } catch (Exception exception) { FinishVideoAudio(); Console.WriteLine(exception); } }
//Api sent Comment private async void ImgSentOnClick(object sender, EventArgs e) { try { IsRecording = false; if (BtnVoice.Tag?.ToString() == "Audio") { var interTortola = new FastOutSlowInInterpolator(); TopFragment.Animate()?.SetInterpolator(interTortola)?.TranslationY(1200)?.SetDuration(300); SupportFragmentManager.BeginTransaction().Remove(RecordSoundFragment).Commit(); PathVoice = RecorderService.GetRecorded_Sound_Path(); } if (string.IsNullOrEmpty(TxtComment.Text) && string.IsNullOrWhiteSpace(TxtComment.Text) && string.IsNullOrEmpty(PathImage) && string.IsNullOrEmpty(PathVoice)) { return; } if (Methods.CheckConnectivity()) { var dataUser = ListUtils.MyProfileList.FirstOrDefault(); //Comment Code var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); string time2 = unixTimestamp.ToString(CultureInfo.InvariantCulture); CommentObjectExtra comment = new CommentObjectExtra { Id = unixTimestamp.ToString(), PostId = PostObject.Id, UserId = UserDetails.UserId, Text = TxtComment.Text, Time = time2, CFile = PathImage, Record = PathVoice, Publisher = dataUser, Url = dataUser?.Url, Fullurl = PostObject?.PostUrl, Orginaltext = TxtComment.Text, Owner = true, CommentLikes = "0", CommentWonders = "0", IsCommentLiked = false, Replies = "0" }; MAdapter.CommentList.Add(comment); var index = MAdapter.CommentList.IndexOf(comment); if (index > -1) { MAdapter.NotifyItemInserted(index); } MRecycler.Visibility = ViewStates.Visible; var dd = MAdapter.CommentList.FirstOrDefault(); if (dd?.Text == MAdapter.EmptyState) { MAdapter.CommentList.Remove(dd); MAdapter.NotifyItemRemoved(MAdapter.CommentList.IndexOf(dd)); } ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost)); var text = TxtComment.Text; //Hide keyboard TxtComment.Text = ""; (int apiStatus, var respond) = await RequestsAsync.Comment.CreatePostComments(PostObject.PostId, text, PathImage, PathVoice); if (apiStatus == 200) { if (respond is CreateComments result) { var date = MAdapter.CommentList.FirstOrDefault(a => a.Id == comment.Id) ?? MAdapter.CommentList.FirstOrDefault(x => x.Id == result.Data.Id); if (date != null) { var db = ClassMapper.Mapper?.Map <CommentObjectExtra>(result.Data); date = db; date.Id = result.Data.Id; index = MAdapter.CommentList.IndexOf(MAdapter.CommentList.FirstOrDefault(a => a.Id == unixTimestamp.ToString())); if (index > -1) { MAdapter.CommentList[index] = db; //MAdapter.NotifyItemChanged(index); //MRecycler.ScrollToPosition(index); } var postFeedAdapter = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter; var dataGlobal = postFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == PostObject?.PostId).ToList(); if (dataGlobal?.Count > 0) { foreach (var dataClass in from dataClass in dataGlobal let indexCom = postFeedAdapter.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass) { dataClass.PostData.PostComments = MAdapter.CommentList.Count.ToString(); if (dataClass.PostData.GetPostComments?.Count > 0) { var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id); if (dataComment == null) { dataClass.PostData.GetPostComments.Add(date); } } else { dataClass.PostData.GetPostComments = new List <GetCommentObject> { date }; } postFeedAdapter.NotifyItemChanged(postFeedAdapter.ListDiffer.IndexOf(dataClass), "commentReplies"); } } var postFeedAdapter2 = WRecyclerView.GetInstance()?.NativeFeedAdapter; var dataGlobal2 = postFeedAdapter2?.ListDiffer?.Where(a => a.PostData?.Id == PostObject?.PostId).ToList(); if (dataGlobal2?.Count > 0) { foreach (var dataClass in from dataClass in dataGlobal2 let indexCom = postFeedAdapter2.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass) { dataClass.PostData.PostComments = MAdapter.CommentList.Count.ToString(); if (dataClass.PostData.GetPostComments?.Count > 0) { var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id); if (dataComment == null) { dataClass.PostData.GetPostComments.Add(date); } } else { dataClass.PostData.GetPostComments = new List <GetCommentObject> { date }; } postFeedAdapter2.NotifyItemChanged(postFeedAdapter2.ListDiffer.IndexOf(dataClass), "commentReplies"); } } } } } //else Methods.DisplayReportResult(this, respond); //Hide keyboard TxtComment.Text = ""; PathImage = ""; PathVoice = ""; BtnVoice.Tag = "Free"; BtnVoice.SetImageResource(Resource.Drawable.microphone); BtnVoice.ClearColorFilter(); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
public override void OnReceive(Context context, Intent intent) { try { if (intent.Action == DownloadManager.ActionDownloadComplete) { if (ActivityContext == null) { return; } DownloadManager downloadManagerExcuter = (DownloadManager)ActivityContext.GetSystemService(Context.DownloadService); long downloadId = intent.GetLongExtra(DownloadManager.ExtraDownloadId, -1); DownloadManager.Query query = new DownloadManager.Query(); query.SetFilterById(downloadId); ICursor c = downloadManagerExcuter.InvokeQuery(query); var sqlEntity = new SqLiteDatabase(); if (c.MoveToFirst()) { int columnIndex = c.GetColumnIndex(DownloadManager.ColumnStatus); if (c.GetInt(columnIndex) == (int)DownloadStatus.Successful) { string downloadedPath = c.GetString(c.GetColumnIndex(DownloadManager.ColumnLocalUri)); ActivityManager.RunningAppProcessInfo appProcessInfo = new ActivityManager.RunningAppProcessInfo(); ActivityManager.GetMyMemoryState(appProcessInfo); if (appProcessInfo.Importance == Importance.Foreground || appProcessInfo.Importance == Importance.Background) { sqlEntity.Update_WatchOfflineVideos(Video.VideoId, downloadedPath); if (TypeActivity == "Main") { TabbedMainActivity.GetInstance()?.VideoActionsController.DownloadIcon.SetImageResource(Resource.Drawable.ic_checked_red); TabbedMainActivity.GetInstance().VideoActionsController.DownloadIcon.Tag = "Downloaded"; TabbedMainActivity.GetInstance()?.LibrarySynchronizer.AddToWatchOffline(Video); } else if (TypeActivity == "GlobalPlayer") { GlobalPlayerActivity.GetInstance()?.VideoActionsController.DownloadIcon.SetImageResource(Resource.Drawable.ic_checked_red); GlobalPlayerActivity.GetInstance().VideoActionsController.DownloadIcon.Tag = "Downloaded"; GlobalPlayerActivity.GetInstance()?.LibrarySynchronizer.AddToWatchOffline(Video); } else { if (ActivityContext is FullScreenVideoActivity fullScreen) { fullScreen.VideoActionsController.DownloadIcon.SetImageResource(Resource.Drawable.ic_checked_red); fullScreen.VideoActionsController.DownloadIcon.Tag = "Downloaded"; //fullScreen tabbedMain.LibrarySynchronizer.OfflineVideoList.Add(Video); } } } else { sqlEntity.Connect(); sqlEntity.Update_WatchOfflineVideos(Video.VideoId, downloadedPath); sqlEntity.Close(); } } } } } catch (Exception exception) { Console.WriteLine(exception); } }
//Api sent Comment private async void ImgSentOnClick(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(TxtComment.Text) && string.IsNullOrEmpty(PathImage)) { return; } if (Methods.CheckConnectivity()) { CommentObject.Replies ??= "0"; //Comment Code var dataUser = ListUtils.MyProfileList.FirstOrDefault(); var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds(); CommentObjectExtra comment = new CommentObjectExtra { Id = unixTimestamp.ToString(), PostId = CommentObject.PostId, UserId = UserDetails.UserId, Text = TxtComment.Text, Time = unixTimestamp.ToString(), CFile = PathImage, Record = "", Publisher = dataUser, Url = dataUser?.Url, Fullurl = CommentObject?.Fullurl, Orginaltext = TxtComment.Text, Owner = true, CommentLikes = "0", CommentWonders = "0", IsCommentLiked = false, Replies = "0" }; MAdapter.ReplyCommentList.Add(comment); var index = MAdapter.ReplyCommentList.IndexOf(comment); if (index > -1) { MAdapter.NotifyItemInserted(index); } MRecycler.Visibility = ViewStates.Visible; var dd = MAdapter.ReplyCommentList.FirstOrDefault(); if (dd?.Text == MAdapter.EmptyState) { MAdapter.ReplyCommentList.Remove(dd); MAdapter.NotifyItemRemoved(MAdapter.ReplyCommentList.IndexOf(dd)); } //CommentLayout.Visibility = ViewStates.Gone; bool success = int.TryParse(CommentObject.Replies, out var number); if (success) { Console.WriteLine("Converted '{0}' to {1}.", CommentObject.Replies, number); var x = number + 1; ReplyCountTextView.Text = x + " " + GetString(Resource.String.Lbl_Replies); } else { Console.WriteLine("Attempted conversion of '{0}' failed.", CommentObject.Replies ?? "<null>"); ReplyCountTextView.Text = 1 + " " + GetString(Resource.String.Lbl_Replies); } ImgGallery.SetImageDrawable(AppSettings.SetTabDarkTheme ? GetDrawable(Resource.Drawable.ic_action_addpost_Ligth) : GetDrawable(Resource.Drawable.ic_action_AddPost)); var text = TxtComment.Text; //Hide keyboard TxtComment.Text = ""; (int apiStatus, var respond) = await RequestsAsync.Comment.CreatePostComments(CommentId, text, PathImage, "", "create_reply"); if (apiStatus == 200) { if (respond is CreateComments result) { var date = MAdapter.ReplyCommentList.FirstOrDefault(a => a.Id == comment.Id) ?? MAdapter.ReplyCommentList.FirstOrDefault(x => x.Id == result.Data.Id); if (date != null) { var db = Mapper.Map <CommentObjectExtra>(result.Data); date = db; date.Id = result.Data.Id; index = MAdapter.ReplyCommentList.IndexOf(MAdapter.ReplyCommentList.FirstOrDefault(a => a.Id == unixTimestamp.ToString())); if (index > -1) { MAdapter.ReplyCommentList[index] = db; //MAdapter.NotifyItemChanged(index, !string.IsNullOrEmpty(PathImage) ? 1 : 0); //MRecycler.ScrollToPosition(index); } var commentAdapter = CommentActivity.GetInstance()?.MAdapter; var commentObject = commentAdapter?.CommentList?.FirstOrDefault(a => a.Id == CommentId); if (commentObject != null) { commentObject.Replies = commentAdapter.CommentList.Count.ToString(); commentAdapter.NotifyDataSetChanged(); } var postFeedAdapter = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter; var dataGlobal = postFeedAdapter?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject?.PostId).ToList(); if (dataGlobal?.Count > 0) { foreach (var dataClass in from dataClass in dataGlobal let indexCom = postFeedAdapter.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass) { if (dataClass.PostData.GetPostComments?.Count > 0) { var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id); if (dataComment != null) { dataComment.Replies = MAdapter.ReplyCommentList.Count.ToString(); } } postFeedAdapter.NotifyItemChanged(postFeedAdapter.ListDiffer.IndexOf(dataClass), "commentReplies"); } } var postFeedAdapter2 = WRecyclerView.GetInstance()?.NativeFeedAdapter; var dataGlobal1 = postFeedAdapter2?.ListDiffer?.Where(a => a.PostData?.Id == CommentObject?.PostId).ToList(); if (dataGlobal1?.Count > 0) { foreach (var dataClass in from dataClass in dataGlobal1 let indexCom = postFeedAdapter2.ListDiffer.IndexOf(dataClass) where indexCom > -1 select dataClass) { if (dataClass.PostData.GetPostComments?.Count > 0) { var dataComment = dataClass.PostData.GetPostComments.FirstOrDefault(a => a.Id == date.Id); if (dataComment != null) { dataComment.Replies = MAdapter.ReplyCommentList.Count.ToString(); } } postFeedAdapter2.NotifyItemChanged(postFeedAdapter2.ListDiffer.IndexOf(dataClass), "commentReplies"); } } } } } //else Methods.DisplayReportResult(this, respond); //Hide keyboard TxtComment.Text = ""; PathImage = ""; } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
//Result protected override async void OnActivityResult(int requestCode, Result resultCode, Intent data) { try { base.OnActivityResult(requestCode, resultCode, data); if (requestCode == LoadPaymentDataRequestCode) { switch (resultCode) { case Result.Ok: PaymentData paymentData = PaymentData.GetFromIntent(data); // You can get some data on the user's card, such as the brand and last 4 digits CardInfo info = paymentData.CardInfo; // You can also pull the user address from the PaymentData object. UserAddress address = paymentData.ShippingAddress; // This is the raw string version of your Stripe token. string rawToken = paymentData.PaymentMethodToken.Token; // Now that you have a Stripe token object, charge that by using the id Token stripeToken = Token.FromString(rawToken); if (stripeToken != null) { // This chargeToken function is a call to your own server, which should then connect // to Stripe's API to finish the charge. // chargeToken(stripeToken.getId()); //var stripeBankAccount = stripeToken.BankAccount; //var stripeCard = stripeToken.Card; //var stripeCreated = stripeToken.Created; //var stripeId = stripeToken.Id; //var stripeLiveMode = stripeToken.Livemode; //var stripeType = stripeToken.Type; //var stripeUsed = stripeToken.Used; //send api if (PayType == "purchaseVideo") { if (Methods.CheckConnectivity()) { (int apiStatus, var respond) = await RequestsAsync.Global.BuyVideoAsync(Id); if (apiStatus == 200) { if (respond is MessageObject result) { FragmentTransaction ft = SupportFragmentManager.BeginTransaction(); if (GlobalContext.RestrictedVideoPlayerFragment != null && GlobalContext.RestrictedVideoPlayerFragment.IsAdded) { ft.Hide(GlobalContext.RestrictedVideoPlayerFragment); } if (GlobalContext.YouTubeFragment != null) { if (GlobalContext.YouTubeFragment.IsAdded) { if (GlobalContext.YoutubePlayer != null && GlobalContext.YoutubePlayer.IsPlaying) { GlobalContext.YoutubePlayer?.Pause(); } ft.Hide(GlobalContext.YouTubeFragment).AddToBackStack(null).Commit(); GlobalContext.YouTubeFragment.View.Visibility = ViewStates.Gone; if (GlobalContext.VideoActionsController.SimpleExoPlayerView.Visibility == ViewStates.Gone) { GlobalContext.VideoActionsController.SimpleExoPlayerView.Visibility = ViewStates.Visible; } } } GlobalContext.PaymentVideoObject.IsPurchased = "1"; GlobalContext.StartPlayVideo(GlobalContext.PaymentVideoObject); Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show(); StopService(new Intent(this, typeof(PayPalService))); } } else { Methods.DisplayReportResult(this, respond); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else if (PayType == "Subscriber") { if (Methods.CheckConnectivity()) { TabbedMainActivity.GetInstance()?.UserChannelFragment?.SetSubscribeChannelWithPaid(); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else if (PayType == "SubscriberVideo") { if (Methods.CheckConnectivity()) { if (GlobalPlayerActivity.OnOpenPage) { GlobalPlayerActivity.GetInstance()?.SetSubscribeChannelWithPaid(); } else { TabbedMainActivity.GetInstance()?.VideoDataWithEventsLoader.SetSubscribeChannelWithPaid(); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else if (PayType == "RentVideo") { if (Methods.CheckConnectivity()) { (int apiStatus, var respond) = await RequestsAsync.Video.RentVideo_Http(Id).ConfigureAwait(false); if (apiStatus == 200) { RunOnUiThread(() => { Toast.MakeText(this, GetText(Resource.String.Lbl_VideoSuccessfullyPaid), ToastLength.Long).Show(); }); } else { Methods.DisplayReportResult(this, respond); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else if (PayType == "DonateVideo") { Toast.MakeText(this, GetText(Resource.String.Lbl_DonatedSuccessfully), ToastLength.Long).Show(); } else if (PayType == "GoPro") { if (Methods.CheckConnectivity()) { (int apiStatus, var respond) = await RequestsAsync.Global.UpgradeAsync(); if (apiStatus == 200) { var dataUser = ListUtils.MyChannelList.FirstOrDefault(); if (dataUser != null) { dataUser.IsPro = "1"; var sqlEntity = new SqLiteDatabase(); sqlEntity.InsertOrUpdate_DataMyChannel(dataUser); sqlEntity.Dispose(); } Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show(); Finish(); } else { Methods.DisplayReportResult(this, respond); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } } break; case Result.Canceled: Toast.MakeText(this, GetText(Resource.String.Lbl_Canceled), ToastLength.Long).Show(); break; } } } catch (Exception e) { Console.WriteLine(e); } }
public void OnPlayerStateChanged(bool playWhenReady, int playbackState) { try { if (playbackState == Player.StateIdle || playbackState == Player.StateEnded || !playWhenReady) { TabbedMainActivity.GetInstance().SetOffWakeLock(); VideoPlayerController.ToggleExoPlayerKeepScreenOnFeature(false); } else { // STATE_IDLE, STATE_ENDED // This prevents the screen from getting dim/lock TabbedMainActivity.GetInstance().SetOnWakeLock(); VideoPlayerController.ToggleExoPlayerKeepScreenOnFeature(true); } if (VideoResumeButton == null || VideoPlayButton == null || LoadingProgressBar == null) { return; } if (playbackState == Player.StateEnded) { if (VideoPlayerController.ShowRestrictedVideo) { var videoData = VideoPlayerController.VideoData; if (!string.IsNullOrEmpty(videoData.SellVideo) && videoData.SellVideo != "0") { VideoPlayerController.ShowRestrictedVideoFragment(null, VideoPlayerController.ActivityContext, "purchaseVideo"); } else if (!string.IsNullOrEmpty(videoData.RentPrice) && videoData.RentPrice != "0" && AppSettings.RentVideosSystem) { VideoPlayerController.ShowRestrictedVideoFragment(null, VideoPlayerController.ActivityContext, "RentVideo"); } VideoPlayerController.ShowRestrictedVideo = false; return; } else { if (playWhenReady == false) { VideoResumeButton.Visibility = ViewStates.Visible; } else { VideoResumeButton.Visibility = ViewStates.Gone; VideoPlayButton.Visibility = ViewStates.Visible; } } LoadingProgressBar.Visibility = ViewStates.Invisible; VideoPlayerController.ExoTopLayout.Visibility = ViewStates.Visible; VideoPlayerController.ExoEventButton.Visibility = ViewStates.Visible; VideoPlayerController.BtnSkipIntro.Visibility = ViewStates.Gone; VideoPlayerController.ExoTopAds.Visibility = ViewStates.Gone; if (ListUtils.ArrayListPlay.Count > 0 && UserDetails.AutoNext) { var data = ListUtils.ArrayListPlay.FirstOrDefault(); if (data != null) { TabbedMainActivity.GetInstance()?.StartPlayVideo(data); //VideoController.PlayVideo(data.VideoLocation, data,VideoController.RestrictedVideoPlayerFragment, VideoController.ActivityFragment); } } } else if (playbackState == Player.StateReady) { //Allen On Next Update //if (VideoController.Player.VideoFormat.Height > 650) // VideoController.Player.VideoFormat.Height = (int)(VideoController.Player.VideoFormat.Height / 1.8); //float videoRatio = (float)VideoController.Player.VideoFormat.Width / VideoController.Player.VideoFormat.Height ; //var display = ActContext.GetSystemService(Context.WindowService).JavaCast<IWindowManager>().DefaultDisplay; //var size = new Point(); //display.GetSize(size); //float displayRatio = (float)size.X / size.Y; //if (videoRatio > displayRatio) //{ // VideoPlayerController.MainVideoFrameLayout.LayoutParameters.Height = (int)Math.Round(VideoPlayerController.MainVideoFrameLayout.MeasuredWidth / videoRatio); // VideoPlayerController.MainVideoFrameLayout.RequestLayout(); //} //else //{ // LinearLayout.LayoutParams Params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 220); // Params.Gravity = GravityFlags.Center; // VideoPlayerController.MainVideoFrameLayout.LayoutParameters = Params; //} if (playWhenReady == false) { VideoResumeButton.Visibility = ViewStates.Gone; VideoPlayButton.Visibility = ViewStates.Visible; } else { VideoResumeButton.Visibility = ViewStates.Visible; } LoadingProgressBar.Visibility = ViewStates.Invisible; } else if (playbackState == Player.StateBuffering) { LoadingProgressBar.Visibility = ViewStates.Visible; VideoResumeButton.Visibility = ViewStates.Invisible; } } catch (Exception exception) { Console.WriteLine(exception); } }
public async void OnSuccess(Token token) { try { // Send token to your own web service //var stripeBankAccount = token.BankAccount; //var stripeCard = token.Card; //var stripeCreated = token.Created; //var stripeId = token.Id; //var stripeLiveMode = token.Livemode; //var stripeType = token.Type; //var stripeUsed = token.Used; //send api //send api if (PayType == "purchaseVideo") { if (Methods.CheckConnectivity()) { (int apiStatus, var respond) = await RequestsAsync.Global.BuyVideoAsync(Id); if (apiStatus == 200) { if (respond is MessageObject result) { FragmentTransaction ft = SupportFragmentManager.BeginTransaction(); if (GlobalContext.RestrictedVideoPlayerFragment != null && GlobalContext.RestrictedVideoPlayerFragment.IsAdded) { ft.Hide(GlobalContext.RestrictedVideoPlayerFragment); } if (GlobalContext.YouTubeFragment != null) { if (GlobalContext.YouTubeFragment.IsAdded) { if (GlobalContext.YoutubePlayer != null && GlobalContext.YoutubePlayer.IsPlaying) { GlobalContext.YoutubePlayer?.Pause(); } ft.Hide(GlobalContext.YouTubeFragment).AddToBackStack(null).Commit(); GlobalContext.YouTubeFragment.View.Visibility = ViewStates.Gone; if (GlobalContext.VideoActionsController.SimpleExoPlayerView.Visibility == ViewStates.Gone) { GlobalContext.VideoActionsController.SimpleExoPlayerView.Visibility = ViewStates.Visible; } } } GlobalContext.PaymentVideoObject.IsPurchased = "1"; GlobalContext.StartPlayVideo(GlobalContext.PaymentVideoObject); Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show(); StopService(new Intent(this, typeof(PayPalService))); } } else { Methods.DisplayReportResult(this, respond); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else if (PayType == "Subscriber") { if (Methods.CheckConnectivity()) { TabbedMainActivity.GetInstance()?.UserChannelFragment?.SetSubscribeChannelWithPaid(); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else if (PayType == "SubscriberVideo") { if (Methods.CheckConnectivity()) { if (GlobalPlayerActivity.OnOpenPage) { GlobalPlayerActivity.GetInstance()?.SetSubscribeChannelWithPaid(); } else { TabbedMainActivity.GetInstance()?.VideoDataWithEventsLoader.SetSubscribeChannelWithPaid(); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else if (PayType == "RentVideo") { if (Methods.CheckConnectivity()) { (int apiStatus, var respond) = await RequestsAsync.Video.RentVideo_Http(Id).ConfigureAwait(false); if (apiStatus == 200) { RunOnUiThread(() => { Toast.MakeText(this, GetText(Resource.String.Lbl_VideoSuccessfullyPaid), ToastLength.Long).Show(); }); } else { Methods.DisplayReportResult(this, respond); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } else if (PayType == "DonateVideo") { Toast.MakeText(this, GetText(Resource.String.Lbl_DonatedSuccessfully), ToastLength.Long).Show(); } else if (PayType == "GoPro") { if (Methods.CheckConnectivity()) { (int apiStatus, var respond) = await RequestsAsync.Global.UpgradeAsync(); if (apiStatus == 200) { var dataUser = ListUtils.MyChannelList.FirstOrDefault(); if (dataUser != null) { dataUser.IsPro = "1"; var sqlEntity = new SqLiteDatabase(); sqlEntity.InsertOrUpdate_DataMyChannel(dataUser); sqlEntity.Dispose(); } Toast.MakeText(this, GetText(Resource.String.Lbl_Done), ToastLength.Long).Show(); Finish(); } else { Methods.DisplayReportResult(this, respond); } } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Long).Show(); } } AndHUD.Shared.Dismiss(this); Finish(); //ShowFragmentStripe(); } catch (Exception e) { Console.WriteLine(e); AndHUD.Shared.Dismiss(this); } }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); GlobalContext = TabbedMainActivity.GetInstance(); HasOptionsMenu = true; }
private async void SaveDataButtonOnClick() { try { if (Methods.CheckConnectivity()) { //Show a progress AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading)); var(apiResult, respond) = await RequestsAsync.Playlist.Create_Playlist_Http(TxtNewplaylist.Text, TxtDescription.Text, Status); if (apiResult == 200) { if (respond is CreatePlaylistObject result) { PlaylistId = result.PlaylistId.ToString(); int unixTimestamp = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; int time = unixTimestamp; PlayListVideoObject playLists = new PlayListVideoObject { Id = Convert.ToInt32(PlaylistId), ListId = PlaylistId, UserId = Convert.ToInt32(UserDetails.UserId), Name = TxtNewplaylist.Text, Description = TxtDescription.Text, Privacy = Convert.ToInt32(Status), Views = 0, Icon = "", Time = time, StyleTotalSubVideos = "0", StyleImage = "lib_playlists", StyleTypeVideo = "", VideosList = new List <VideoObject>() }; var adapter = TabbedMainActivity.GetInstance()?.LibraryFragment?.PlayListsVideosFragment?.MAdapter; if (adapter != null) { adapter.PlayListsList.Add(playLists); adapter.NotifyItemInserted(adapter.PlayListsList.IndexOf(adapter.PlayListsList.LastOrDefault())); } AndHUD.Shared.Dismiss(this); Toast.MakeText(this, GetText(Resource.String.Lbl_Created_successfully_playlist), ToastLength.Short).Show(); Finish(); } } else { Methods.DisplayReportResult(this, respond); } } else { AndHUD.Shared.Dismiss(this); Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { AndHUD.Shared.Dismiss(this); Console.WriteLine(exception); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (p1 == DialogAction.Positive) { if (TypeDialog == "DeleteComment") { MainContext.RunOnUiThread(() => { try { switch (TypeClass) { case "Comment": { //TypeClass var adapterGlobal = CommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.CommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.CommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.CommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } var dataPost = TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter?.ListDiffer?.Where(a => a.PostData?.PostId == CommentObject?.PostId).ToList(); if (dataPost?.Count > 0) { foreach (var post in dataPost.Where(post => post.TypeView == PostModelType.CommentSection || post.TypeView == PostModelType.AddCommentSection)) { TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView?.RemoveByRowIndex(post); } } var dataPost2 = WRecyclerView.GetInstance()?.NativeFeedAdapter?.ListDiffer?.Where(a => a.PostData?.PostId == CommentObject?.PostId).ToList(); if (dataPost2?.Count > 0) { foreach (var post in dataPost2.Where(post => post.TypeView == PostModelType.CommentSection || post.TypeView == PostModelType.AddCommentSection)) { WRecyclerView.GetInstance()?.RemoveByRowIndex(post); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id) }); break; } case "Reply": { //TypeClass var adapterGlobal = ReplyCommentActivity.GetInstance()?.MAdapter; var dataGlobal = adapterGlobal?.ReplyCommentList?.FirstOrDefault(a => a.Id == CommentObject?.Id); if (dataGlobal != null) { var index = adapterGlobal.ReplyCommentList.IndexOf(dataGlobal); if (index > -1) { adapterGlobal.ReplyCommentList.RemoveAt(index); adapterGlobal.NotifyItemRemoved(index); } } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Comment.DeleteCommentAsync(CommentObject.Id, "delete_reply") }); break; } } Toast.MakeText(MainContext, MainContext.GetText(Resource.String.Lbl_CommentSuccessfullyDeleted), ToastLength.Short)?.Show(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }); } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (TypeDialog == "DeletePost") { try { if (!Methods.CheckConnectivity()) { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); return; } var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.PostId == ProductData?.PostId).ToList(); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.PostId == ProductData?.PostId).ToList(); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } if (TabbedMarketActivity.GetInstance()?.MyProductsTab?.MAdapter?.MarketList != null) { TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.MarketList?.Remove(ProductData); TabbedMarketActivity.GetInstance().MyProductsTab.MAdapter.NotifyDataSetChanged(); } if (TabbedMarketActivity.GetInstance()?.MarketTab?.MAdapter?.MarketList != null) { TabbedMarketActivity.GetInstance().MarketTab.MAdapter.MarketList?.Remove(ProductData); TabbedMarketActivity.GetInstance().MarketTab.MAdapter.NotifyDataSetChanged(); } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short)?.Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Post_Actions(ProductData.PostId, "delete") }); Finish(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (DialogType == "Delete") { if (p1 == DialogAction.Positive) { // Send Api delete if (Methods.CheckConnectivity()) { var adapterGlobal = WRecyclerView.GetInstance()?.NativeFeedAdapter; var diff = adapterGlobal?.ListDiffer; var dataGlobal = diff?.Where(a => a.PostData?.OfferId == DataInfoObject?.Id).ToList(); if (dataGlobal != null) { foreach (var postData in dataGlobal) { WRecyclerView.GetInstance()?.RemoveByRowIndex(postData); } } var recycler = TabbedMainActivity.GetInstance()?.NewsFeedTab?.MainRecyclerView; var dataGlobal2 = recycler?.NativeFeedAdapter.ListDiffer?.Where(a => a.PostData?.OfferId == DataInfoObject?.Id).ToList(); if (dataGlobal2 != null) { foreach (var postData in dataGlobal2) { recycler.RemoveByRowIndex(postData); } } Toast.MakeText(this, GetText(Resource.String.Lbl_postSuccessfullyDeleted), ToastLength.Short)?.Show(); PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Offers.DeleteOffer(DataInfoObject.Id) }); } else { Toast.MakeText(this, GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else { if (p1 == DialogAction.Positive) { } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
//Save and sent data and set new search private void ButtonApplyOnClick(object sender, EventArgs e) { try { if (SortByChecked == Context.GetText(Resource.String.Lbl_Views)) { UserDetails.FilterTypeSortBy = "views"; } else if (SortByChecked == Context.GetText(Resource.String.Lbl_Subscribers)) { UserDetails.FilterTypeSortBy = "subscribers"; } else if (SortByChecked == Context.GetText(Resource.String.Lbl_MostActive)) { UserDetails.FilterTypeSortBy = "most_active"; } else { UserDetails.FilterTypeSortBy = "most_active"; } if (TimeChecked == Context.GetText(Resource.String.Lbl_Today)) { UserDetails.FilterTime = "today"; } else if (TimeChecked == Context.GetText(Resource.String.Lbl_ThisWeek)) { UserDetails.FilterTime = "this_week"; } else if (TimeChecked == Context.GetText(Resource.String.Lbl_ThisMonth)) { UserDetails.FilterTime = "this_month"; } else if (TimeChecked == Context.GetText(Resource.String.Lbl_ThisYear)) { UserDetails.FilterTime = "this_year"; } else if (TimeChecked == Context.GetText(Resource.String.Lbl_AllTime)) { UserDetails.FilterTime = "all_time"; } else { UserDetails.FilterTime = "this_month"; } var channelPopularFragment = TabbedMainActivity.GetInstance().TrendingFragment.AllChannelPopularFragment; if (channelPopularFragment != null) { if (channelPopularFragment.MAdapter != null) { channelPopularFragment.SwipeRefreshLayout.Refreshing = true; channelPopularFragment.SwipeRefreshLayout.Enabled = true; channelPopularFragment.EmptyStateLayout.Visibility = ViewStates.Gone; channelPopularFragment.MRecycler.Visibility = ViewStates.Visible; channelPopularFragment.MAdapter.ChannelList.Clear(); channelPopularFragment.MAdapter.NotifyDataSetChanged(); } channelPopularFragment.StartApiService(); } Dismiss(); } catch (Exception exception) { Console.WriteLine(exception); } }