public VideoDownloadAsyncController(string url, string filename, Activity contextActivity, string fromActivity) { try { if (fromActivity == "Main") { ActivityContext = TabbedMainActivity.GetInstance(); } else if (fromActivity == "GlobalPlayer") { ActivityContext = GlobalPlayerActivity.GetInstance(); } else { ActivityContext = contextActivity; } if (!Directory.Exists(FilePath)) { Directory.CreateDirectory(FilePath); } if (!filename.Contains(".mp4") || !filename.Contains(".Mp4") || !filename.Contains(".MP4")) { Filename = filename + ".mp4"; } Downloadmanager = (DownloadManager)ActivityContext.GetSystemService(Context.DownloadService); Request = new DownloadManager.Request(Android.Net.Uri.Parse(url)); } catch (Exception exception) { Console.WriteLine(exception); } }
private void SetRecyclerViewAdapters() { try { MAdapter = new FriendRequestsAdapter(this) { UserList = new ObservableCollection <UserDataObject>(TabbedMainActivity.GetInstance()?.FriendRequestsList) }; LayoutManager = new LinearLayoutManager(this); MRecycler.SetLayoutManager(LayoutManager); MRecycler.SetAdapter(MAdapter); MRecycler.HasFixedSize = true; MRecycler.SetItemViewCacheSize(50); MRecycler.GetLayoutManager().ItemPrefetchEnabled = true; MRecycler.GetRecycledViewPool().Clear(); var sizeProvider = new FixedPreloadSizeProvider(10, 10); var preLoader = new RecyclerViewPreloader <UserDataObject>(this, MAdapter, sizeProvider, 10); MRecycler.AddOnScrollListener(preLoader); MRecycler.SetAdapter(MAdapter); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); Methods.App.FullScreenApp(this); Window.AddFlags(WindowManagerFlags.KeepScreenOn); // Create your application here SetContentView(Resource.Layout.TwilioVideoCallActivityLayout); SensorManager = (SensorManager)GetSystemService(SensorService); Proximity = SensorManager.GetDefaultSensor(SensorType.Proximity); GlobalContext = TabbedMainActivity.GetInstance(); //Get Value And Set Toolbar InitComponent(); InitTwilioCall(); } catch (Exception e) { Console.WriteLine(e); } }
private void ToggleSelection(int position) { try { MAdapter.ToggleSelection(position); int count = MAdapter.GetSelectedItemCount(); if (count == 0) { TabbedMainActivity.GetInstance()?.SetService(); ToolBar.Visibility = ViewStates.Visible; ActionMode.Finish(); } else { TabbedMainActivity.GetInstance()?.SetService(false); ToolBar.Visibility = ViewStates.Gone; ActionMode.SetTitle(count); ActionMode.Invalidate(); } } catch (Exception e) { Console.WriteLine(e); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); View mContentView = Window.DecorView; var uiOptions = (int)mContentView.SystemUiVisibility; var newUiOptions = uiOptions; newUiOptions |= (int)SystemUiFlags.Fullscreen; newUiOptions |= (int)SystemUiFlags.LayoutStable; mContentView.SystemUiVisibility = (StatusBarVisibility)newUiOptions; Window.AddFlags(WindowManagerFlags.Fullscreen); // Create your application here SetContentView(Resource.Layout.View_Story_Layout); UserId = Intent.GetStringExtra("UserId"); GlobalContext = TabbedMainActivity.GetInstance(); //Get Value And Set Toolbar InitComponent(); InitToolbar(); LoadData(); } catch (Exception e) { Console.WriteLine(e); } }
private void InitComponent() { try { var media = new MediaController(this); media.Show(5000); ProgressBar = FindViewById <ProgressBar>(Resource.Id.progress_bar); ProgressBar.Visibility = ViewStates.Visible; PostVideoView = FindViewById <VideoView>(Resource.Id.videoView); PostVideoView.Completion += PostVideoViewOnCompletion; PostVideoView.SetMediaController(media); PostVideoView.Prepared += PostVideoViewOnPrepared; PostVideoView.CanSeekBackward(); PostVideoView.CanSeekForward(); PostVideoView.SetAudioAttributes(new AudioAttributes.Builder().SetUsage(AudioUsageKind.Media).SetContentType(AudioContentType.Movie).Build()); if (VideoUrl.Contains("http")) { PostVideoView.SetVideoURI(Uri.Parse(VideoUrl)); } else { var file = Uri.FromFile(new File(VideoUrl)); PostVideoView.SetVideoPath(file.Path); } TabbedMainActivity.GetInstance()?.SetOnWakeLock(); } catch (Exception e) { Console.WriteLine(e); } }
private void ResultApi(int apiStatus, dynamic respond) { try { if (apiStatus == 200) { if (respond is SharePostToObject result) { var combine = new FeedCombiner(result.Data, TabbedMainActivity.GetInstance()?.NewsFeedTab?.PostFeedAdapter.ListDiffer, this); combine.CombineDefaultPostSections("Top"); Toast.MakeText(this, GetText(Resource.String.Lbl_PostSuccessfullyShared), ToastLength.Short).Show(); if (UserDetails.SoundControl) { Methods.AudioRecorderAndPlayer.PlayAudioFromAsset("PopNotificationPost.mp3"); } Finish(); } } else { Methods.DisplayReportResult(this, respond); } } catch (Exception e) { Console.WriteLine(e); } }
public async void Run() { try { if (string.IsNullOrEmpty(Current.AccessToken) || !Methods.CheckConnectivity() || IsCanceledHandler) { return; } if (MainRecyclerView?.ApiPostAsync != null) { await MainRecyclerView.ApiPostAsync.FetchNewsFeedApiPosts("0", "Insert"); } var instance = TabbedMainActivity.GetInstance(); if (instance != null) { await instance.NewsFeedTab.LoadStory(); await instance.Get_Notifications(); } //await ApiRequest.Get_MyProfileData_Api(Activity); MainHandler?.PostDelayed(new ApiPostUpdaterHelper(Activity, MainRecyclerView, MainHandler), 30000); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); Methods.App.FullScreenApp(this); // Create your application here SetContentView(Resource.Layout.CreateGroupLayout); string obj = Intent.GetStringExtra("GroupObject") ?? ""; if (!string.IsNullOrEmpty(obj)) { GroupData = JsonConvert.DeserializeObject <ChatObject>(obj); GroupId = GroupData.GroupId; } GlobalContext = TabbedMainActivity.GetInstance(); //Get Value And Set Toolbar InitComponent(); InitToolbar(); SetRecyclerViewAdapters(); LoadContacts(); } catch (Exception e) { Console.WriteLine(e); } }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); Methods.App.FullScreenApp(this, true); // Create your application here SetContentView(Resource.Layout.View_Story_Layout); GlobalContext = TabbedMainActivity.GetInstance(); //Get Value And Set Toolbar InitComponent(); InitToolbar(); if (Intent != null) { UserId = Intent.GetStringExtra("UserId") ?? ""; IndexItem = Intent.GetIntExtra("IndexItem", 0); DataStories = JsonConvert.DeserializeObject <StoryDataObject>(Intent?.GetStringExtra("DataItem") ?? ""); } LoadData(DataStories); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void ShowEmptyPage() { try { if (MAdapter.UserList.Count > 0) { MRecycler.Visibility = ViewStates.Visible; EmptyStateLayout.Visibility = ViewStates.Gone; } else { MRecycler.Visibility = ViewStates.Gone; var trendingTabLayoutFriendRequest = TabbedMainActivity.GetInstance()?.TrendingTab?.LayoutFriendRequest; if (AppSettings.ShowTrendingPage && trendingTabLayoutFriendRequest != null) { trendingTabLayoutFriendRequest.Visibility = ViewStates.Gone; } Inflated ??= EmptyStateLayout.Inflate(); EmptyStateInflater x = new EmptyStateInflater(); x.InflateLayout(Inflated, EmptyStateInflater.Type.NoUsers); if (!x.EmptyStateButton.HasOnClickListeners) { x.EmptyStateButton.Click += null !; } EmptyStateLayout.Visibility = ViewStates.Visible; } } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
private void btnPost_Click(object sender, EventArgs e) { Android.App.AlertDialog.Builder dialog = new Android.App.AlertDialog.Builder(mainContext); Android.App.AlertDialog alert = dialog.Create(); alert.SetTitle("Confirmation"); alert.SetMessage("Are you sure you want to upload this recording?"); alert.SetButton("OK", async(c, ev) => { await videoRecord.UploadRecordedResponse(editDescription.Text); var tabbedActivity = TabbedMainActivity.GetInstance(); if (tabbedActivity != null) { int UnseenResponseCount = API.UserResponseAPI.GetUnseenResponseNotification(); if (UnseenResponseCount > 0) { tabbedActivity.MyChannelFragment.UnSeenReponse = UnseenResponseCount; tabbedActivity.FragmentBottomNavigator.txtUnSeenCount.Visibility = ViewStates.Visible; tabbedActivity.FragmentBottomNavigator.txtUnSeenCount.Text = UnseenResponseCount.ToString(); } else { tabbedActivity.FragmentBottomNavigator.txtUnSeenCount.Visibility = ViewStates.Gone; } } alert.Hide(); this.Dismiss(); }); alert.SetButton2("CANCEL", (c, ev) => { alert.Hide(); }); alert.Show(); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your fragment here GlobalContext = (TabbedMainActivity)Activity; HasOptionsMenu = true; }
protected override void OnCreate(Bundle savedInstanceState) { try { base.OnCreate(savedInstanceState); Methods.App.FullScreenApp(this); SetTheme(AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base); // Create your application here SetContentView(Resource.Layout.PaymentCardDetailsLayout); Id = Intent.GetStringExtra("Id") ?? ""; // VideoObject.Id Price = Intent.GetStringExtra("Price"); PayType = Intent.GetStringExtra("payType"); // GlobalContext = TabbedMainActivity.GetInstance(); //Get Value And Set Toolbar InitComponent(); InitToolbar(); InitWalletStripe(); Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity = this; } catch (Exception e) { Console.WriteLine(e); } }
//========================= Functions ========================= public static async Task SendMessageTask(ChatWindowActivity windowActivity, string userId, string messageHashId, string text = "", string contact = "", string filePath = "", string imageUrl = "", string stickerId = "", string gifUrl = "", string productId = "", string lat = "", string lng = "") { try { WindowActivity = windowActivity; if (windowActivity.DataUser != null) { Datauser = windowActivity.DataUser; } else if (windowActivity.UserData != null) { UserData = windowActivity.UserData; } else if (windowActivity.DataUserChat != null) { DataUserChat = windowActivity.DataUserChat; } GlobalContext = TabbedMainActivity.GetInstance(); StartApiService(userId, messageHashId, text, contact, filePath, imageUrl, stickerId, gifUrl, productId, lat, lng); await Task.Delay(0); } catch (Exception ex) { Console.WriteLine(ex); } }
private void InitComponent() { try { VideoSurfaceView = FindViewById <PlayerView>(Resource.Id.pv_fullscreen); BtFullScreen = FindViewById <ImageView>(Resource.Id.exo_fullscreen_icon); SetPlayer(); BtFullScreen.Click += BtFullScreen_Click; /////////////////////////// ProgressBar = FindViewById <ProgressBar>(Resource.Id.progress_bar); ProgressBar.Visibility = ViewStates.Visible; //===================== Exo Player ======================== // Uri Uri uri = Uri.Parse(VideoUrl); var videoSource = GetMediaSourceFromUrl(uri, uri?.Path?.Split('.').Last(), "normal"); VideoPlayer.Prepare(videoSource); VideoPlayer.PlayWhenReady = true; TabbedMainActivity.GetInstance()?.SetOnWakeLock(); } catch (Exception e) { Methods.DisplayReportResultTrack(e); } }
public override bool ShouldOverrideUrlLoading(WebView view, IWebResourceRequest request) { try { if (request.Url.ToString() == MActivity.Url) { view.LoadUrl(request.Url.ToString()); } else if (request.Url.ToString().Contains("watch")) { var con = TabbedMainActivity.GetInstance()?.MyChannelFragment?.VideosFragment; if (con != null) { con.SwipeRefreshLayout.Refreshing = true; con.MAdapter.VideoList.Clear(); con.MAdapter.NotifyDataSetChanged(); con.MainScrollEvent.IsLoading = false; con.StartApiService(); } MActivity.Finish(); } } catch (Exception e) { Console.WriteLine(e); } return(false); }
public void ReleaseVideo() { try { if (Player != null) { SetStopVideo(); Player?.Release(); Player = null !; //GC Collector GC.Collect(); } TabbedMainActivity.GetInstance()?.SetOffWakeLock(); //var tab = VideoViewerActivity.GetInstance()?.TabVideosAbout; //if (tab != null) //{ // tab.VideoDescriptionLayout.Visibility = ViewStates.Visible; // tab.VideoTittle.Text = VideoData?.Name; //} SimpleExoPlayerView.Player = null !; ReleaseAdsLoader(); } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void MAdapterOnDeleteButtonItemClick(object sender, FriendRequestsAdapterClickEventArgs e) { try { if (e.Position > -1) { var item = MAdapter.GetItem(e.Position); if (item != null) { if (Methods.CheckConnectivity()) { PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Follow_Request_Action(item.UserId, false) }); // false >> Decline TabbedMainActivity.GetInstance()?.FriendRequestsList?.RemoveAt(e.Position); MAdapter.UserList.Remove(item); MAdapter.NotifyItemRemoved(e.Position); RunOnUiThread(ShowEmptyPage); } else { Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short)?.Show(); } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void ShowEmptyPage() { try { if (MAdapter.UserList.Count > 0) { MRecycler.Visibility = ViewStates.Visible; EmptyStateLayout.Visibility = ViewStates.Gone; } else { MRecycler.Visibility = ViewStates.Gone; var trendingTabLayoutFriendRequest = TabbedMainActivity.GetInstance()?.TrendingTab?.LayoutFriendRequest; if (trendingTabLayoutFriendRequest != null) { trendingTabLayoutFriendRequest.Visibility = ViewStates.Gone; } Inflated ??= EmptyStateLayout.Inflate(); EmptyStateInflater x = new EmptyStateInflater(); x.InflateLayout(Inflated, EmptyStateInflater.Type.NoUsers); if (!x.EmptyStateButton.HasOnClickListeners) { x.EmptyStateButton.Click += null; } EmptyStateLayout.Visibility = ViewStates.Visible; } } catch (Exception e) { Console.WriteLine(e); } }
//Event public void OnItemClick(View view, GetChatsObject.Data obj, int pos) { try { if (MAdapter.GetSelectedItemCount() > 0) // Add Select New Item { EnableActionMode(pos); } else { TabbedMainActivity.GetInstance()?.SetService(); if (ToolBar.Visibility != ViewStates.Visible) { ToolBar.Visibility = ViewStates.Visible; } // read the item which removes bold from the row >> event click open ChatBox by user id GetChatsObject.Data item = MAdapter.GetItem(pos); if (item != null) { UserId = item.User.Id; item.GetCountSeen = "0"; Intent intent = new Intent(this, typeof(MessagesBoxActivity)); intent.PutExtra("UserId", item.User.Id); intent.PutExtra("TypeChat", "LastChat"); intent.PutExtra("UserItem", JsonConvert.SerializeObject(item)); // Check if we're running on Android 5.0 or higher if ((int)Build.VERSION.SdkInt < 23) { StartActivity(intent); MAdapter.NotifyItemChanged(pos); } else { //Check to see if any permission in our group is available, if one, then all are if (CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted && CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted) { StartActivity(intent); MAdapter.NotifyItemChanged(pos); } else { new PermissionsController(this).RequestPermission(100); } } } } } catch (Exception e) { Console.WriteLine(e); } }
public void OnClick(MaterialDialog p0, DialogAction p1) { try { if (TypeDialog == "PlayList") { if (p1 == DialogAction.Positive) { ActivityContext.StartActivity(new Intent(ActivityContext, typeof(CreatNewPlaylistActivity))); } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else if (TypeDialog == "Login") { if (p1 == DialogAction.Positive) { TabbedMainActivity.GetInstance()?.StopFragmentVideo(); ActivityContext.StartActivity(new Intent(ActivityContext, typeof(LoginActivity))); } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else if (TypeDialog == "DeleteAcount") { if (p1 == DialogAction.Positive) { ActivityContext.StartActivity(new Intent(ActivityContext, typeof(DeleteAcountActivity))); } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } else if (TypeDialog == "Logout") { if (p1 == DialogAction.Positive) { TabbedMainActivity.GetInstance()?.VideoActionsController.ReleaseVideo(); ApiRequest.Logout(ActivityContext); } else if (p1 == DialogAction.Negative) { p0.Dismiss(); } } } catch (Exception e) { Console.WriteLine(e); } }
private void RejectCallButton_Click(object sender, EventArgs e) { try { if (CallType == "Twilio_video_call") { RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Video).ConfigureAwait(false); } else if (CallType == "Twilio_audio_call") { RequestsAsync.Call.DeclineCallAsync(UserDetails.UserId, CallId, TypeCall.Audio).ConfigureAwait(false); } else if (CallType == "Agora_video_call_recieve" || CallType == "Agora_audio_call_recieve") { ApiRequest.Send_Agora_Call_Action_Async("decline", CallId).ConfigureAwait(false); } 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); } }
protected override void OnStart() { base.OnStart(); var tabActivity = TabbedMainActivity.GetInstance(); if (tabActivity != null) { tabActivity.VideoActionsController.SetStopvideo(); } }
public void OnVideoEnded() { if (ListUtils.ArrayListPlay.Count > 0 && UserDetails.AutoNext) { var data = ListUtils.ArrayListPlay.FirstOrDefault(); if (data != null) { TabbedMainActivity.GetInstance()?.StartPlayVideo(data); } } }
public CustomNavigationController(Activity activity) { MainContext = activity; if (activity is TabbedMainActivity cont) { Context = cont; } Initialize(); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: TabbedMainActivity.GetInstance()?.FragmentNavigatorBack(); return(true); } return(base.OnOptionsItemSelected(item)); }
public static async Task <UserDataObject> GetChannelData(Activity activity, string userId) { if (!Methods.CheckConnectivity()) { return(null); } var(apiStatus, respond) = await RequestsAsync.Global.Get_Channel_Info_HttP(userId); if (apiStatus == 200) { if (respond is GetChannelInfoObject result) { if (userId == UserDetails.UserId) { UserDetails.Avatar = result.DataResult.Avatar; UserDetails.Cover = result.DataResult.Cover; UserDetails.Username = result.DataResult.Username; UserDetails.FullName = AppTools.GetNameFinal(result.DataResult); ListUtils.MyChannelList.Clear(); ListUtils.MyChannelList.Add(result.DataResult); try { var profileImage = TabbedMainActivity.GetInstance()?.FragmentBottomNavigator?.ProfileImage; if (profileImage != null) { GlideImageLoader.LoadImage(activity, UserDetails.Avatar, profileImage, ImageStyle.CircleCrop, ImagePlaceholders.Drawable); } } catch (Exception e) { Console.WriteLine(e); } var sqlEntity = new SqLiteDatabase(); sqlEntity.InsertOrUpdate_DataMyChannel(result.DataResult); sqlEntity.Dispose(); return(result.DataResult); } else { return(result.DataResult); } } } else { Methods.DisplayReportResult(activity, respond); } return(null); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); GlobalContext = (TabbedMainActivity)Activity; HasOptionsMenu = true; if (MAdapter == null) { MAdapter = new LibraryAdapter(Activity); } }
private void ReplyAdapterOnAvatarClick(object sender, AvatarReplyAdapterClickEventArgs e) { try { TabbedMainActivity.GetInstance().ShowUserChannelFragment(e.Class.ReplyUserData, e.Class.UserId.ToString()); } catch (Exception exception) { Console.WriteLine(exception); } }