void OnClickProfilePic(object sender, EventArgs e)
        {
            View view      = sender as View;
            var  extra     = (ExtraInfo <string>)view.Tag;
            var  contactId = extra.Info;

            (Context as MainActivity).SupportFragmentManager.BeginTransaction()
            .Replace(Resource.Id.content_frame, ViewProfileFragment.ViewProfile(contactId))
            .AddToBackStack(null)
            .Commit();
        }
        public static async void ScanFingerprint(MainActivity context)
        {
            var scanner    = new ZXing.Mobile.MobileBarcodeScanner(context);
            var scanResult = await scanner.Scan();

            if (scanResult != null)
            {
                var result = await ChadderApp.UIHelper.ScanFingerprint(scanResult.Text);

                if (result != null)
                {
                    context.SupportFragmentManager.BeginTransaction()
                    .Replace(Resource.Id.content_frame, ViewProfileFragment.ViewProfile(result))
                    .AddToBackStack(null)
                    .CommitAllowingStateLoss();
                }
            }
        }
Example #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.fragment_contact_list, container, false);

            try
            {
                _contactListView = view.FindViewById <Android.Widget.ListView>(Resource.Id.contact_list);

                searchText = view.FindViewById <EditText>(Resource.Id.contact_list_searchview);

                _noEntryText = view.FindViewById <TextView>(Resource.Id.no_friends_textview);
                _noEntryText.TextFormatted = Html.FromHtml("To add friends you can type their name in the search bar and if they have enabled </br>\"Public Name\" they will appear here");

                searchText.TextChanged += (s, e) =>
                {
                    _adapter.Collection.SetSearch(searchText.Text);
                };

                _adapter = new FindFriendAdapter(this.Activity, _noEntryText, new UIHelper.FindContactObservableCollection(ChadderApp.UIHelper.Source));
                _contactListView.Adapter    = _adapter;
                _contactListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                {
                    var contact = _adapter[e.Position];
                    if (contact == null)
                    {
                        return;
                    }
                    if (contact.IsTemporary)
                    {
                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, ViewProfileFragment.ViewProfile(contact))
                        .AddToBackStack(null)
                        .Commit();
                    }
                    else
                    {
                        SupportFragmentManager.PopBackStack();
                        SupportFragmentManager.BeginTransaction()
                        .Replace(Resource.Id.content_frame, ChatFragment.OpenChat(contact))
                        .AddToBackStack(null)
                        .Commit();
                    }
                };

                _menuManager = new ContextMenuManager <ChadderContact>(this, _contactListView);

                _menuManager.InsertItem("View profile", (ChadderContact contact) =>
                {
                    Android.Support.V4.App.FragmentTransaction transaction = this.Activity.SupportFragmentManager.BeginTransaction();
                    transaction.Replace(Resource.Id.content_frame, ViewProfileFragment.ViewProfile(contact));
                    transaction.AddToBackStack(null);
                    transaction.Commit();
                });

                _menuManager.InsertItem(c => c.Type == Chadder.Data.RelationshipType.BLOCKED ? "Unblock" : "Block",
                                        (ChadderContact contact) => ChadderUI.ToggleBlock(contact));

                _menuManager.InsertItem("Report",
                                        (ChadderContact contact) => ChadderUI.ReportContact(contact));
            }
            catch (Exception e)
            {
                Insight.Report(e);
            }

            return(view);
        }