private void MAdapterOnItemLongClick(object sender, LastChatsAdapterClickEventArgs e) { try { var position = e.Position; if (position >= 0) { var item = MAdapter.GetItem(position); if (item != null) { switch (item.Type) { case Classes.ItemType.LastChatOldV: { OptionsLastMessagesBottomSheet bottomSheet = new OptionsLastMessagesBottomSheet(); Bundle bundle = new Bundle(); bundle.PutString("Type", "user"); bundle.PutString("Page", "Archived"); bundle.PutString("ItemObject", JsonConvert.SerializeObject(item.LastMessagesUser)); bottomSheet.Arguments = bundle; bottomSheet.Show(SupportFragmentManager, bottomSheet.Tag); break; } case Classes.ItemType.LastChatNewV: { OptionsLastMessagesBottomSheet bottomSheet = new OptionsLastMessagesBottomSheet(); Bundle bundle = new Bundle(); bundle.PutString("Page", "Archived"); switch (item.LastChat.ChatType) { case "user": bundle.PutString("Type", "user"); bundle.PutString("ItemObject", JsonConvert.SerializeObject(item.LastChat)); break; case "page": bundle.PutString("Type", "page"); bundle.PutString("ItemObject", JsonConvert.SerializeObject(item.LastChat)); break; case "group": bundle.PutString("Type", "group"); bundle.PutString("ItemObject", JsonConvert.SerializeObject(item.LastChat)); break; } bottomSheet.Arguments = bundle; bottomSheet.Show(SupportFragmentManager, bottomSheet.Tag); break; } } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void MAdapterOnItemClick(object sender, LastChatsAdapterClickEventArgs e) { try { var position = e.Position; if (position >= 0) { var item = MAdapter.GetItem(position); if (item != null) { Intent intent = new Intent(Context, typeof(PageChatWindowActivity)); intent.PutExtra("PageId", item.LastChatPage.PageId); intent.PutExtra("TypeChat", "PageProfile"); intent.PutExtra("ShowEmpty", "no"); intent.PutExtra("PageObject", JsonConvert.SerializeObject(item.LastChatPage)); StartActivity(intent); } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void MAdapterOnItemLongClick(object sender, LastChatsAdapterClickEventArgs e) { try { var position = e.Position; if (position >= 0) { var item = MAdapter.GetItem(position); if (item != null) { OptionsLastMessagesBottomSheet bottomSheet = new OptionsLastMessagesBottomSheet(); Bundle bundle = new Bundle(); bundle.PutString("Type", "page"); bundle.PutString("ItemObject", JsonConvert.SerializeObject(item.LastChatPage)); bottomSheet.Arguments = bundle; bottomSheet.Show(ChildFragmentManager, bottomSheet.Tag); } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void MAdapterOnItemClick(object sender, LastChatsAdapterClickEventArgs e) { try { var position = e.Position; if (position >= 0) { var item = MAdapter.GetItem(position); if (item != null) { switch (item.Type) { case Classes.ItemType.LastChatOldV: { this?.RunOnUiThread(() => { try { if (item.LastMessagesUser.LastMessage != null && item.LastMessagesUser.LastMessage.Seen == "0" && item.LastMessagesUser.LastMessage.ToId == UserDetails.UserId && item.LastMessagesUser.LastMessage.FromId != UserDetails.UserId) { item.LastMessagesUser.LastMessage.Seen = "1"; MAdapter.NotifyItemChanged(position); } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }); item.LastMessagesUser.ChatColor ??= AppSettings.MainColor; var mainChatColor = item.LastMessagesUser.ChatColor.Contains("rgb") ? Methods.FunString.ConvertColorRgBtoHex(item.LastMessagesUser.ChatColor) : item.LastMessagesUser.ChatColor ?? AppSettings.MainColor; Intent intent = new Intent(this, typeof(ChatWindowActivity)); intent.PutExtra("UserID", item.LastMessagesUser.UserId); intent.PutExtra("TypeChat", "LastMessenger"); intent.PutExtra("ShowEmpty", "no"); intent.PutExtra("ColorChat", mainChatColor); intent.PutExtra("UserItem", JsonConvert.SerializeObject(item.LastMessagesUser)); StartActivity(intent); break; } case Classes.ItemType.LastChatNewV: { this?.RunOnUiThread(() => { try { if (item.LastChat.LastMessage.LastMessageClass != null && item.LastChat.LastMessage.LastMessageClass.Seen == "0" && item.LastChat.LastMessage.LastMessageClass.ToId == UserDetails.UserId && item.LastChat.LastMessage.LastMessageClass.FromId != UserDetails.UserId) { item.LastChat.LastMessage.LastMessageClass.Seen = "1"; MAdapter.NotifyItemChanged(position); } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }); Intent intent = null; switch (item.LastChat.ChatType) { case "user": item.LastChat.LastMessage.LastMessageClass.ChatColor ??= AppSettings.MainColor; var mainChatColor = item.LastChat.LastMessage.LastMessageClass.ChatColor.Contains("rgb") ? Methods.FunString.ConvertColorRgBtoHex(item.LastChat.LastMessage.LastMessageClass.ChatColor) : item.LastChat.LastMessage.LastMessageClass.ChatColor ?? AppSettings.MainColor; intent = new Intent(this, typeof(ChatWindowActivity)); intent.PutExtra("UserID", item.LastChat.UserId); intent.PutExtra("TypeChat", "LastMessenger"); intent.PutExtra("ShowEmpty", "no"); intent.PutExtra("ColorChat", mainChatColor); intent.PutExtra("UserItem", JsonConvert.SerializeObject(item.LastChat)); break; case "page": intent = new Intent(this, typeof(PageChatWindowActivity)); intent.PutExtra("PageId", item.LastChat.PageId); intent.PutExtra("ShowEmpty", "no"); intent.PutExtra("TypeChat", ""); intent.PutExtra("PageObject", JsonConvert.SerializeObject(item.LastChat)); break; case "group": intent = new Intent(this, typeof(GroupChatWindowActivity)); intent.PutExtra("GroupObject", JsonConvert.SerializeObject(item.LastChat)); intent.PutExtra("ShowEmpty", "no"); intent.PutExtra("GroupId", item.LastChat.GroupId); break; } StartActivity(intent); break; } } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }
private void MAdapterOnItemClick(object sender, LastChatsAdapterClickEventArgs e) { try { var position = e.Position; if (position >= 0) { var item = MAdapter.GetItem(position); if (item != null) { switch (item.Type) { case Classes.ItemType.LastChatNewV: { Activity?.RunOnUiThread(() => { try { if (item.LastChat.LastMessage.LastMessageClass != null && item.LastChat.LastMessage.LastMessageClass.Seen == "0" && item.LastChat.LastMessage.LastMessageClass.ToId == UserDetails.UserId && item.LastChat.LastMessage.LastMessageClass.FromId != UserDetails.UserId) { item.LastChat.LastMessage.LastMessageClass.Seen = "1"; MAdapter.NotifyItemChanged(position); } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }); Intent intent = new Intent(Context, typeof(GroupChatWindowActivity)); intent.PutExtra("GroupObject", JsonConvert.SerializeObject(item.LastChat)); intent.PutExtra("ShowEmpty", "no"); intent.PutExtra("GroupId", item.LastChat.GroupId); StartActivity(intent); break; } case Classes.ItemType.GroupRequest: { if (item.GroupRequestList.Count > 0) { var intent = new Intent(Context, typeof(GroupRequestActivity)); Context.StartActivity(intent); } break; } case Classes.ItemType.Archive: { var intent = new Intent(Context, typeof(ArchivedActivity)); Context.StartActivity(intent); break; } } } } } catch (Exception exception) { Methods.DisplayReportResultTrack(exception); } }