public void GetDataPlayList() { try { PlayListVideoObject = JsonConvert.DeserializeObject <PlayListVideoObject>(Intent.GetStringExtra("Item")); if (PlayListVideoObject != null) { TxtNewplaylist.Text = PlayListVideoObject.Name; TxtDescription.Text = PlayListVideoObject.Description; if (PlayListVideoObject.Privacy == 1) { RbPublic.Checked = true; RbPrivate.Checked = false; Status = "1"; } else { RbPublic.Checked = false; RbPrivate.Checked = true; Status = "0"; } } } catch (Exception e) { Console.WriteLine(e); } }
private void OnMenuRemove_Click(PlayListVideoObject video) { try { var index = PlayListsList.IndexOf(PlayListsList.FirstOrDefault(a => a.Id == video.Id)); if (index != -1) { PlayListsList.Remove(video); NotifyItemRemoved(index); var data = ListUtils.PlayListVideoObjectList.FirstOrDefault(a => a.Id == video.Id); if (data != null) { ListUtils.PlayListVideoObjectList.Remove(data); } PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Playlist.DeletePlaylist_Http(video.ListId) }); Toast.MakeText(ActivityContext, ActivityContext.GetText(Resource.String.Lbl_Done), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
public void EditPlaylist(PlayListVideoObject video) { try { ActivityContext.EditPlaylistOnClick(video); } catch (Exception exception) { Console.WriteLine(exception); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { // Use this to return your custom view for this Fragment View view = inflater.Inflate(Resource.Layout.RecyclerDefaultLayout, container, false); //Get Data NamePlayList = Arguments.GetString("Name_PlayList") ?? ""; var data = Arguments.GetString("ItemPlayList"); if (!string.IsNullOrEmpty(data)) { PlayListVideoObject = JsonConvert.DeserializeObject <PlayListVideoObject>(data); } //Get Value And Set Toolbar InitComponent(view); InitToolbar(view); SetRecyclerViewAdapters(); SwipeRefreshLayout.Refresh += SwipeRefreshLayoutOnRefresh; MAdapter.ItemClick += MAdapterOnItemClick; //Get Data Api StartApiService(); RewardedVideoAd = AdsGoogle.Ad_RewardedVideo(Activity); return(view); } catch (Exception e) { Console.WriteLine(e); return(null); } }
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.EditPlaylist_Http(PlaylistId, TxtNewplaylist.Text, TxtDescription.Text, Status); if (apiResult == 200) { if (respond is MessageObject result) { Console.WriteLine(result.Message); PlayListVideoObject playLists = new PlayListVideoObject { Id = PlayListVideoObject.Id, ListId = PlaylistId, UserId = PlayListVideoObject.UserId, Name = TxtNewplaylist.Text, Description = TxtDescription.Text, Privacy = Convert.ToInt32(Status), Views = PlayListVideoObject.Views, Icon = PlayListVideoObject.Icon, Time = PlayListVideoObject.Time, }; var dataPlayList = ListUtils.PlayListVideoObjectList?.FirstOrDefault(q => q.ListId == PlaylistId); if (dataPlayList != null) { dataPlayList = playLists; } Console.WriteLine(dataPlayList); AndHUD.Shared.Dismiss(this); Toast.MakeText(this, GetText(Resource.String.Lbl_Created_successfully_playlist), ToastLength.Short).Show(); Intent intent = new Intent(); intent.PutExtra("ItemPlaylist", JsonConvert.SerializeObject(playLists)); SetResult(Result.Ok, intent); 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); } }
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); } }