Esempio n. 1
0
 private void MAdapterOnItemLongClick(object sender, ContactsAdapterClickEventArgs e)
 {
     try
     {
         var position = e.Position;
         if (position >= 0)
         {
             var item = MAdapter.GetItem(position);
             if (item == null)
             {
                 return;
             }
             if (item.Avatar == "addImage")
             {
                 return;
             }
             Position = e.Position;
             var dialog = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);
             dialog.Title(GetString(Resource.String.Lbl_Remove) + " " + WoWonderTools.GetNameFinal(item));
             dialog.PositiveText(GetText(Resource.String.Lbl_Yes)).OnPositive(this);
             dialog.NegativeText(GetText(Resource.String.Lbl_No)).OnNegative(this);
             dialog.AlwaysCallSingleChoiceCallback();
             dialog.Build().Show();
         }
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
        private async void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs adapterClickEvents)
        {
            try
            {
                var position = adapterClickEvents.Position;
                if (position >= 0)
                {
                    var item = MAdapter.GetItem(position);
                    if (item != null)
                    {
                        var index = MAdapter.UserList.IndexOf(MAdapter.UserList.FirstOrDefault(a => a.UserId == item.UserId));
                        if (index != -1)
                        {
                            MAdapter.UserList.Remove(item);
                            MAdapter.NotifyItemRemoved(index);
                        }

                        Toast.MakeText(this, GetText(Resource.String.Lbl_Unblock_successfully), ToastLength.Short).Show();

                        await RequestsAsync.User.BlockUnblock(item.UserId.ToString()).ConfigureAwait(false);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Esempio n. 3
0
 private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs e)
 {
     try
     {
         var item = MAdapter.GetItem(e.Position);
         if (item != null)
         {
             WoWonderTools.OpenProfile(this, item.UserId, item);
         }
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
Esempio n. 4
0
 //Open profile
 private void MAdapterOnOnItemClick(object sender, ContactsAdapterClickEventArgs e)
 {
     try
     {
         var item = MAdapter.GetItem(e.Position);
         if (item?.Id != null)
         {
             GlobalContext.OpenProfile(item.Id, item);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
 private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs e)
 {
     try
     {
         var item = MAdapter.GetItem(e.Position);
         if (item != null)
         {
             WoWonderTools.OpenProfile(this, item.UserId, item);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
Esempio n. 6
0
 // Open Profile user
 private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs e)
 {
     try
     {
         if (e.Position >= 0)
         {
             var item = MAdapter.GetItem(e.Position);
             if (item != null)
             {
                 AppTools.OpenProfile(Activity, item.UserId.ToString(), item);
             }
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }
Esempio n. 7
0
        // Open Chat >> Following
        private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs adapterClickEvents)
        {
            try
            {
                var position = adapterClickEvents.Position;
                if (position >= 0)
                {
                    var item = MAdapter.GetItem(position);
                    if (item != null)
                    {
                        UserId = item.UserId.ToString();
                        Intent intent = new Intent(this, typeof(MessagesBoxActivity));
                        intent.PutExtra("UserId", item.UserId.ToString());
                        intent.PutExtra("TypeChat", "following");
                        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);
                        }
                        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);
                            }
                            else
                            {
                                new PermissionsController(this).RequestPermission(100);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
 private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs adapterClickEvents)
 {
     try
     {
         var position = adapterClickEvents.Position;
         if (position >= 0)
         {
             var item = MAdapter.GetItem(position);
             if (item != null)
             {
                 //Pull up dialog
                 var userDialog = new DialogBlockUser(this, item.UserId, item);
                 userDialog.Show(SupportFragmentManager, userDialog.Tag);
                 userDialog.OnBlockUserUpComplete += UserDialogOnOnBlockUserUpComplete;
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Esempio n. 9
0
        private void AdapterFollowersOnItemClick(object sender, ContactsAdapterClickEventArgs e)
        {
            try
            {
                switch (MAdapter)
                {
                case ContactsAdapter adapter:
                {
                    var item = adapter.GetItem(e.Position);
                    if (item != null)
                    {
                        WoWonderTools.OpenProfile(this, item.UserId, item);
                    }

                    break;
                }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
Esempio n. 10
0
 private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs adapterClickEvents)
 {
     try
     {
         var position = adapterClickEvents.Position;
         if (position >= 0)
         {
             var item = MAdapter.GetItem(position);
             if (item == null)
             {
                 return;
             }
             if (item.Avatar != "addImage")
             {
                 return;
             }
             StartActivityForResult(new Intent(this, typeof(MentionActivity)), 3);
         }
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
Esempio n. 11
0
        private void Adapter_ItemClick1(object sender, ContactsAdapterClickEventArgs e)
        {
            FriendDialogFragment friendFragment = new FriendDialogFragment(items[e.Position].Id);

            friendFragment.Show(ChildFragmentManager.BeginTransaction(), "Friends");
        }
        private void MAdapterOnItemClick(object sender, ContactsAdapterClickEventArgs e)
        {
            try
            {
                var position = e.Position;
                if (position >= 0)
                {
                    var itemMes = MAdapter.GetItem(position);
                    if (itemMes != null)
                    {
                        var userid = itemMes.UserId;

                        var item = JsonConvert.DeserializeObject <MessageDataExtra>(Intent.GetStringExtra("SelectedItem"));
                        if (item != null)
                        {
                            if (item.Product?.ProductClass != null && !string.IsNullOrEmpty(item.ProductId) && item.ProductId != "0" && (item.ModelType == MessageModelType.RightProduct || item.ModelType == MessageModelType.LeftProduct))
                            {
                                string imageUrl = item.Product?.ProductClass?.Images[0]?.Image ?? "";
                                Console.WriteLine(imageUrl);
                                //Not have api send Product
                            }
                            else if (!string.IsNullOrEmpty(item.Stickers) && (item.ModelType == MessageModelType.RightGif || item.ModelType == MessageModelType.LeftGif) && item.Stickers.Contains(".gif"))
                            {
                                string imageUrl = "";
                                if (!string.IsNullOrEmpty(item.Stickers))
                                {
                                    imageUrl = item.Stickers;
                                }
                                else if (!string.IsNullOrEmpty(item.Media))
                                {
                                    imageUrl = item.Media;
                                }

                                Task.Factory.StartNew(() => { SendMess(userid, "", "", "", "", "", imageUrl); });
                            }
                            else if (item.ModelType == MessageModelType.RightText || item.ModelType == MessageModelType.LeftText)
                            {
                                Task.Factory.StartNew(() => { SendMess(userid, item.Text); });
                            }
                            else if (item.ModelType == MessageModelType.RightImage || item.ModelType == MessageModelType.LeftImage)
                            {
                                Task.Factory.StartNew(() => { SendMess(userid, "", "", item.Media); });
                            }
                            else if (item.ModelType == MessageModelType.RightAudio || item.ModelType == MessageModelType.LeftAudio)
                            {
                                Task.Factory.StartNew(() => { SendMess(userid, "", "", item.Media); });
                            }
                            else if (item.ModelType == MessageModelType.RightContact || item.ModelType == MessageModelType.LeftContact)
                            {
                                if (string.IsNullOrEmpty(item.ContactName) && string.IsNullOrEmpty(item.ContactName) && item.Text.Contains("{&quot;Key&quot;") || item.Text.Contains("{key:") || item.Text.Contains("{key:^qu") || item.Text.Contains("{^key:^qu") || item.Text.Contains("{Key:") || item.Text.Contains("&quot;"))
                                {
                                    string[] stringSeparators = { "," };
                                    var      name             = item.Text.Split(stringSeparators, StringSplitOptions.None);
                                    var      stringName       = name[0].Replace("{key:", "").Replace("{Key:", "").Replace("Value:", "");
                                    var      stringNumber     = name[1].Replace("{key:", "").Replace("{Key:", "").Replace("Value:", "");
                                    item.ContactName   = stringName;
                                    item.ContactNumber = stringNumber;
                                }

                                var dictionary = new Dictionary <string, string>();
                                if (!dictionary.ContainsKey(item.ContactName))
                                {
                                    dictionary.Add(item.ContactName, item.ContactNumber);
                                }

                                string dataContact = JsonConvert.SerializeObject(dictionary.ToArray().FirstOrDefault(a => a.Key == item.ContactName));

                                Task.Factory.StartNew(() => { SendMess(userid, dataContact, "1"); });
                            }
                            else if (item.ModelType == MessageModelType.RightVideo || item.ModelType == MessageModelType.LeftVideo)
                            {
                                Task.Factory.StartNew(() => { SendMess(userid, "", "", item.Media); });
                            }
                            else if (item.ModelType == MessageModelType.RightSticker || item.ModelType == MessageModelType.LeftSticker)
                            {
                                var fileNameWithoutExtension = item.Media.Split('/').Last().Split('.').First().Replace("sticker", "");
                                Task.Factory.StartNew(() => { SendMess(userid, "", "", "", item.Media, "sticker" + fileNameWithoutExtension); });
                            }
                            else if (item.ModelType == MessageModelType.RightFile || item.ModelType == MessageModelType.LeftFile)
                            {
                                Task.Factory.StartNew(() => { SendMess(userid, "", "", item.Media); });
                            }
                        }

                        Toast.MakeText(this, GetText(Resource.String.Lbl_MessagesSent), ToastLength.Short).Show();
                        Finish();
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }