private void SearchView_OnTextSubmit(object sender, SearchView.QueryTextSubmitEventArgs e)
        {
            try
            {
                SearchText = e.NewText;

                SearchView.ClearFocus();

                SwipeRefreshLayout.Refreshing = true;
                SwipeRefreshLayout.Enabled    = true;

                MAdapter.MentionList.Clear();
                MAdapter.NotifyDataSetChanged();

                StartSearchRequest();

                //Hide keyboard programmatically in MonoDroid
                e.Handled = true;

                SearchView.ClearFocus();

                var inputManager = (InputMethodManager)GetSystemService(InputMethodService);
                inputManager.HideSoftInputFromWindow(ToolBar.WindowToken, 0);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
예제 #2
0
        //Refresh
        private void SwipeRefreshLayoutOnRefresh(object sender, EventArgs e)
        {
            try
            {
                MAdapter.MentionList.Clear();
                MAdapter.NotifyDataSetChanged();

                StartApiService();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
        private void Search()
        {
            try
            {
                if (!string.IsNullOrEmpty(SearchText))
                {
                    if (Methods.CheckConnectivity())
                    {
                        MAdapter?.MentionList?.Clear();
                        MAdapter?.NotifyDataSetChanged();

                        if (!SwipeRefreshLayout.Refreshing)
                        {
                            SwipeRefreshLayout.Refreshing = true;
                        }

                        if (EmptyStateLayout != null)
                        {
                            EmptyStateLayout.Visibility = ViewStates.Gone;
                        }

                        StartSearchRequest();
                    }
                }
                else
                {
                    if (Inflated == null)
                    {
                        Inflated = EmptyStateLayout?.Inflate();
                    }

                    EmptyStateInflater x = new EmptyStateInflater();
                    x.InflateLayout(Inflated, EmptyStateInflater.Type.NoSearchResult);
                    if (!x.EmptyStateButton.HasOnClickListeners)
                    {
                        x.EmptyStateButton.Click -= EmptyStateButtonOnClick;
                        x.EmptyStateButton.Click -= TryAgainButton_Click;
                    }

                    x.EmptyStateButton.Click += TryAgainButton_Click;
                    if (EmptyStateLayout != null)
                    {
                        EmptyStateLayout.Visibility = ViewStates.Visible;
                    }

                    if (SwipeRefreshLayout.Refreshing)
                    {
                        SwipeRefreshLayout.Refreshing = false;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #4
0
        public void LoadContacts()
        {
            try
            {
                var dbDatabase = new SqLiteDatabase();
                var localList  = dbDatabase.Get_MyContact(0, 25);
                if (localList != null)
                {
                    var list = localList.Select(user => new Mention
                    {
                        user_id            = user.user_id,
                        username           = user.username,
                        email              = user.email,
                        first_name         = user.first_name,
                        last_name          = user.last_name,
                        avatar             = user.avatar,
                        cover              = user.cover,
                        relationship_id    = user.relationship_id,
                        lastseen_time_text = user.lastseen_time_text,
                        address            = user.address,
                        working            = user.working,
                        working_link       = user.working_link,
                        about              = user.about,
                        school             = user.school,
                        gender             = user.gender,
                        birthday           = user.birthday,
                        website            = user.website,
                        facebook           = user.facebook,
                        google             = user.google,
                        twitter            = user.twitter,
                        linkedin           = user.linkedin,
                        youtube            = user.youtube,
                        vk                      = user.vk,
                        instagram               = user.instagram,
                        language                = user.language,
                        ip_address              = user.ip_address,
                        follow_privacy          = user.follow_privacy,
                        friend_privacy          = user.friend_privacy,
                        post_privacy            = user.post_privacy,
                        message_privacy         = user.message_privacy,
                        confirm_followers       = user.confirm_followers,
                        show_activities_privacy = user.show_activities_privacy,
                        birth_privacy           = user.birth_privacy,
                        visit_privacy           = user.visit_privacy,
                        lastseen                = user.lastseen,
                        showlastseen            = user.showlastseen,
                        e_sentme_msg            = user.e_sentme_msg,
                        e_last_notif            = user.e_last_notif,
                        status                  = user.status,
                        active                  = user.active,
                        admin                   = user.admin,
                        registered              = user.registered,
                        phone_number            = user.phone_number,
                        is_pro                  = user.is_pro,
                        pro_type                = user.pro_type,
                        joined                  = user.joined,
                        timezone                = user.timezone,
                        referrer                = user.referrer,
                        balance                 = user.balance,
                        paypal_email            = user.paypal_email,
                        notifications_sound     = user.notifications_sound,
                        order_posts_by          = user.order_posts_by,
                        social_login            = user.social_login,
                        device_id               = user.device_id,
                        web_device_id           = user.web_device_id,
                        wallet                  = user.wallet,
                        lat                     = user.lat,
                        lng                     = user.lng,
                        last_location_update    = user.last_location_update,
                        share_my_location       = user.share_my_location,
                        url                     = user.url,
                        name                    = user.name,
                        lastseen_unix_time      = user.lastseen_unix_time,
                        user_platform           = user.user_platform,
                        Selected                = false
                    }).ToList();

                    MentionsAdapter = new MentionAdapter(this, new JavaList <Mention>(list));
                    MentionRecylerView.SetLayoutManager(new LinearLayoutManager(this));
                    MentionRecylerView.SetAdapter(MentionsAdapter);

                    if (MentionsAdapter.MentionList.Count > 0)
                    {
                        MentionsAdapter.NotifyDataSetChanged();

                        //Contacts_Empty.Visibility = ViewStates.Gone;
                        //ContactsRecyler.Visibility = ViewStates.Visible;
                    }
                }

                dbDatabase.Dispose();
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }