private void Search(string query)
        {
            System.Diagnostics.Debug.WriteLine("[#] Searh started");
            var progressDialog = ProgressDialog.Show(this, "Pesquisando", "Checando pessoas...", true);

            var t = new Thread(new ThreadStart(delegate
            {
                arrayPessoas = new List <Pessoa>();
                Status status;

                int codigo;
                if (int.TryParse(query, out codigo))
                {
                    var res = Request.GetInstance().Post <Pessoa>("person", "get", user.Token, new HttpParam("person_code", query));
                    status  = res.status;

                    if (status.code == 401)
                    {
                        progressDialog.Hide();
                        StartActivity(new Intent(this, typeof(LogoutActivity)));
                    }
                    else if (status.code == 200)
                    {
                        arrayPessoas.Add(res.data);
                    }
                }
                else
                {
                    var res = Request.GetInstance().Post <List <Pessoa> >("person", "getList", user.Token, new HttpParam("person_name", query));
                    status  = res.status;
                    if (status.code == 401)
                    {
                        progressDialog.Hide();
                        StartActivity(new Intent(this, typeof(LogoutActivity)));
                    }
                    else if (status.code == 200)
                    {
                        arrayPessoas = res.data;
                    }
                }

                RunOnUiThread(() =>
                {
                    progressDialog.Hide();
                    searchView.ClearFocus();

                    listView.Adapter = new CustomerListAdapter(this, arrayPessoas);
                    if (status.code != 200)
                    {
                        Toast.MakeText(this, status.description, ToastLength.Short).Show();
                    }
                    else
                    {
                        Toast.MakeText(this, arrayPessoas.Count + " pessoas encontradas!", ToastLength.Short).Show();
                    }
                });
            }));

            t.Start();
        }
Exemplo n.º 2
0
 private void capturaTexto(object sender, SearchView.QueryTextSubmitEventArgs e)
 {
     e.Handled = true;
     search.ClearFocus();
     ControleMapa.Limpar();
     modoDirecao = false;
     BuscaEstacionamento(e.Query.Trim());
 }
Exemplo n.º 3
0
 protected override void OnResume()
 {
     base.OnResume();
     if (_searchView != null)
     {
         _searchView.SetQuery("", false);
         _searchView.ClearFocus();
     }
 }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.SearchDialog);

            Window.SetSoftInputMode(SoftInput.AdjustNothing);

            if (ActionBar != null)
            {
                this.Title = ActionBar.Title = GetString(Resource.String.search);

                ActionBar.SetDisplayUseLogoEnabled(false);
                ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
                ActionBar.SetHomeButtonEnabled(false);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetDisplayShowHomeEnabled(true);
                ActionBar.SetDisplayShowTitleEnabled(true);
            }

            _ListView = (ListView)FindViewById <ListView>(Resource.Id.pageList);

            _SearchView = (SearchView)FindViewById <SearchView>(Resource.Id.searchView);

            //_SearchView.Background = Resources.GetDrawable(Resource.Drawable.ic_action_refresh);

            int  searchPlateId = _SearchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null);
            View searchPlate   = _SearchView.FindViewById(searchPlateId);

            searchPlate.Background.Colorize(DataManager.Get <ISettingsManager>().Settings.ButtonColor);

            _SearchView.Focusable = true;
            _SearchView.Iconified = false;
            _SearchView.RequestFocusFromTouch();

            _SearchView.QueryTextChange += this.SearchBarTextChanged;            /*(sender, e) =>
                                                                                  * {
                                                                                  * SearchPerform(e.NewText);
                                                                                  * };*/

            _SearchView.QueryTextSubmit += (sender, e) =>
            {
                _SearchView.ClearFocus();
            };

            _ListView.ItemClick += (sender, e) =>
            {
                var item = _Pubblicazioni[e.Position];

                Intent i = new Intent();
                i.SetClass(Application.Context, typeof(ViewerScreen));

                i.PutExtra("pubPath", item.Path);
                StartActivity(i);
                Finish();
            };
        }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Lista);

            lvEspecialidades = FindViewById <ListView>(Resource.Id.lvEspecialidade);
            sv1 = FindViewById <SearchView>(Resource.Id.sv);
            GetListaEspecialidades();
            sv1.QueryTextChange += Sv1_QueryTextChange;
            sv1.ClearFocus();

            lvEspecialidades.ItemClick += LvEspecialidades_ItemClick;
        }
Exemplo n.º 6
0
        void CaixaPesquisa_QueryTextSubmit(object sender, SearchView.QueryTextSubmitEventArgs e)
        {
            caixaPesquisa.ClearFocus();
            if (!e.Query.Trim().Equals(""))
            {
                Console.WriteLine("Pesquisa: " + e.Query);

                // passar a lista
                List <PetiscoModel> lista;
                if (filtro1.Visibility.Equals(ViewStates.Gone))
                {
                    lista = ApiHTTP.GetSugestoes(user.Username, e.Query, null, null, null);
                }
                else
                {
                    int  min, max;
                    bool minB   = Int32.TryParse(editMin.Text, out min);
                    bool maxB   = Int32.TryParse(editMax.Text, out max);
                    int? minRes = null;
                    if (minB)
                    {
                        minRes = min;
                    }
                    int?maxRes = null;
                    if (maxB)
                    {
                        maxRes = max;
                    }
                    lista = ApiHTTP.GetSugestoes(user.Username, e.Query, minRes, maxRes, distSB.Progress);
                }

                if (lista.Count == 0)
                {
                    Toast.MakeText(this, "Não há sugestões para esta pesquisa.", ToastLength.Short).Show();
                    return;
                }

                ((MainApplication)Application.Context).SetPetiscos(lista);
                // mudar para a vista de lista de petiscos
                Intent i = new Intent(this, typeof(PetiscosListActivity));
                StartActivity(i);
            }
            else
            {
                Console.WriteLine("Nenhuma Pesquisa");
                Toast.MakeText(this, "Escreva algo para pesquisar", ToastLength.Short).Show();
            }
        }
Exemplo n.º 7
0
        private async Task SearchForSong(object sender, SearchView.QueryTextSubmitEventArgs e)
        {
            var dialog = DisplayHelper.MakeProgressDialog(this, "Searching...");

            dialog.Show();
            var dataService = new DataService();
            var content     = await dataService.GetRequestJson(tag + "Shortest video");

            var items = await DeserializeObjectAsync(content);

            dialog.Hide();
            songSearchView.ClearFocus();
            songListView.Adapter    = new VideoAdapter(Application.Context, items.items);
            songListView.ItemClick += async(s, events) => await StartPlayingSong(s, events);

            Window.SetSoftInputMode(SoftInput.StateHidden);
        }
Exemplo n.º 8
0
        void SetUpScreen()
        {
            _searchLayout.Click += OnSearchLayoutSelected;

            _searchView.QueryTextSubmit += OnQuerySubmit;

            _searchView.QueryTextChange += OnQueryTextChanged;

            _searchView.Focusable = true;

            _searchView.RequestFocusFromTouch();

            _searchView.ClearFocus();

//			_searchView.SetQueryHint(GetString(Resource.String.HomePageSearchBarHint));

            PersonalizeSearchView();
        }
Exemplo n.º 9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.SearchDialog);

            Window.SetSoftInputMode(SoftInput.AdjustNothing);

            if (ActionBar != null)
            {
                this.Title = ActionBar.Title = GetString(Resource.String.search);

                ActionBar.SetDisplayUseLogoEnabled(false);
                ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
                ActionBar.SetHomeButtonEnabled(false);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetDisplayShowHomeEnabled(true);
                ActionBar.SetDisplayShowTitleEnabled(true);
            }

            _ListView   = (ListView)FindViewById <ListView>(Resource.Id.pageList);
            _SearchView = (SearchView)FindViewById <SearchView>(Resource.Id.searchView);
            _Loader     = (ProgressBar)FindViewById <ProgressBar>(Resource.Id.prgLoader);

            int  searchPlateId = _SearchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null);
            View searchPlate   = _SearchView.FindViewById(searchPlateId);

            searchPlate.Background.Colorize(DataManager.Get <ISettingsManager>().Settings.ButtonColor);

            _SearchView.Focusable = true;
            _SearchView.Iconified = false;
            _SearchView.RequestFocusFromTouch();

            _SearchView.QueryTextChange += this.SearchBarTextChanged;

            _SearchView.QueryTextSubmit += (sender, e) =>
            {
                _SearchView.ClearFocus();
            };

            //_SearchView.HapticFeedbackEnabled = false;
            _SearchView.LongClickable = false;
        }
Exemplo n.º 10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            AppContextLiveData.Instance.SetLocale(this);

            if (DeviceDisplay.MainDisplayInfo.Orientation == DisplayOrientation.Portrait)
            {
                SetContentView(Resource.Layout.PhotosActivityPortrait);
            }
            else
            {
                SetContentView(Resource.Layout.PhotosActivityLandscape);
            }

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);

            ActionBar.SetDisplayShowHomeEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowTitleEnabled(true);
            ActionBar.SetTitle(Resource.String.PhotosActivity);

            _photosListView           = FindViewById <ListView>(Resource.Id.listViewPhotos);
            _adapter                  = new PhotosItemAdapter(this, new List <PhotoData>(), this);
            _photosListView.Adapter   = _adapter;
            Context.PhotosItemAdapter = _adapter;

            _searchViewLayout            = FindViewById <LinearLayout>(Resource.Id.searchViewLayout);
            _searchViewLayout.Visibility = ViewStates.Gone;

            _searchViewText           = FindViewById <SearchView>(Resource.Id.searchViewPhotoName);
            _searchViewText.Iconified = false;
            _searchViewText.SetQueryHint(Resources.GetText(Resource.String.Common_Search));
            _searchViewText.SetOnQueryTextListener(this);
            _searchViewText.ClearFocus();

            ShowPhotos(Context.ShowFavoritePicturesOnly, GetSearchText());

            Context.PhotosModel.PhotoAdded   += OnPhotoAdded;
            Context.PhotosModel.PhotoUpdated += OnPhotoUpdated;
            Context.PhotosModel.PhotoDeleted += OnPhotoDeleted;
        }
Exemplo n.º 11
0
        private void SetData(View rootView)
        {
            SearchManager searchManager = (SearchManager)Activity.GetSystemService(Android.Content.Context.SearchService);

            _searchView = rootView.FindViewById <SearchView>(Resource.Id.search);
            _searchView.SetSearchableInfo(searchManager.GetSearchableInfo(Activity.ComponentName));

            _searchView.SetIconifiedByDefault(false);
            _searchView.SetOnQueryTextListener(this);
            _searchView.SetOnCloseListener(this);
            _searchView.ClearFocus();

            Android.Views.InputMethods.InputMethodManager mgr = (Android.Views.InputMethods.InputMethodManager)Activity.GetSystemService(Android.Content.Context.InputMethodService);
            mgr.HideSoftInputFromWindow(_searchView.WindowToken, 0);
            SimpleSelectorItem[] items = (ParcableTest.Dialogs.SimpleSelectorItem[])Arguments.GetParcelableArray(ITEMS);

            _lvSelector = (ListView)rootView.FindViewById(Resource.Id.lvSelector);
            SimpleSelectorListAdapter adapter = new SimpleSelectorListAdapter(Activity, items.ToList());

            _lvSelector.Adapter = adapter;
        }
Exemplo n.º 12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Zoeken);
            ActionBar.Hide();
            m_afvalproduct = MainActivity.m_afvalproduct;

            _Menu = FindViewById <ImageButton>(Resource.Id.Menu);
            _lv   = FindViewById <ListView>(Resource.Id.lv);
            _sv   = FindViewById <SearchView>(Resource.Id.sv);
            _sv.SetIconifiedByDefault(false);
            _sv.ClearFocus();
            _sv.SetQueryHint("Glas, Plastic, Papier, Afval");

            _adapter    = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, DataToList());
            _lv.Adapter = _adapter;

            _sv.QueryTextChange += _sv_QueryTextChange;
            _lv.ItemClick       += _lv_ItemClick;
            _Menu.Click         += _Menu_Click;
        }
Exemplo n.º 13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Setting Searchview text colour
            SearchView sv = FindViewById <SearchView>(Resource.Id.sv);
            int        id = sv.Context.Resources.GetIdentifier("android:id/search_src_text", null, null);
            TextView   tv = (TextView)sv.FindViewById(id);

            tv.SetTextColor(Android.Graphics.Color.Black);

            // To dismiss search programatically
            Button dismissSearch = FindViewById <Button>(Resource.Id.button1);

            dismissSearch.Click += delegate
            {
                sv.ClearFocus();
            };
        }
        private void Search(string query)
        {
            var progressDialog = ProgressDialog.Show(this, "Pesquisando", "Checando produtos...", true);

            var t = new Thread(new ThreadStart(delegate
            {
                HttpResponse res;
                List <Produto> array;
                arrayProdutos.Clear();

                long codigo;
                if (long.TryParse(query, out codigo))
                {
                    var response = Request.GetInstance().Post <Produto>("product", "get", user.Token, new HttpParam("product_code", query), new HttpParam("company_id", shop.ERP.Codigo), new HttpParam("get_product_unit", "1"), new HttpParam("get_product_stock", "1"), new HttpParam("get_product_price", "1"));
                    array        = response.data != null ? new List <Produto>(new Produto[] { response.data }) : new List <Produto>();
                    res          = (HttpResponse)response;
                }
                else
                {
                    var response = Request.GetInstance().Post <List <Produto> >("product", "getList", user.Token, new HttpParam("product_name", query), new HttpParam("company_id", shop.ERP.Codigo), new HttpParam("get_product_unit", "1"), new HttpParam("get_product_stock", "1"), new HttpParam("get_product_price", "1"));
                    array        = response.data != null ? new List <Produto>(response.data) : new List <Produto>();
                    res          = (HttpResponse)response;
                }

                RunOnUiThread(() =>
                {
                    progressDialog.Hide();

                    if (res.status == null)
                    {
#if DEBUG
                        AlertDialog.Builder alerta = new AlertDialog.Builder(this);
                        alerta.SetTitle("Debug");
                        alerta.SetMessage(res.debug);
                        alerta.SetPositiveButton("Fechar", (sender, e) => { });
                        alerta.Show();
                        return;
#else
                        Toast.MakeText(this, "Erro no servidor!", ToastLength.Long).Show();
                        return;
#endif
                    }

                    if (res.status.code == 200)
                    {
                        arrayProdutos = new List <Produto>(array);
                        Toast.MakeText(this, arrayProdutos.Count + " produtos encontrados!", ToastLength.Short).Show();
                    }
                    else
                    {
                        if (res.status.code == 401)
                        {
                            StartActivity(new Intent(this, typeof(LogoutActivity)));
                        }

                        Toast.MakeText(this, res.status.description, ToastLength.Short).Show();
                    }

                    searchView.ClearFocus();
                    listView.Adapter = new ProductListAdapter(this, arrayProdutos);
                });
            }));

            t.Start();
        }
Exemplo n.º 15
0
 public bool OnQueryTextSubmit(string query)
 {
     _editTextSearch.ClearFocus();
     return(true);
 }
Exemplo n.º 16
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            //OnCreate takes a Bundle parameter, which is a dictionary for storing and passing state information
            //and objects between activities If the bundle is not null, this indicates the activity is restarting
            //and it should restore its state from the previous instance. "https:/docs.microsoft.com/en-us/xamarin/android/app-fundamentals/activity-lifecycle/"
            base.OnCreateView(inflater, container, savedInstanceState);
            //Once on create has finished, android will call OnStart which will start the activity

            //sets the layout of the main menu to the ACFIPage.axml file which is located in Resources/layout/
            View view = inflater.Inflate(Resource.Layout.ACFIPage, container, false);

            //setup lists for acfi funding data
            dataItems    = new List <ACFIFunding>();
            displayItems = new List <ACFIFunding>();
            searchItems  = new List <ACFIFunding>();

            //setup custom list adapter, more info found in ACFIViewAdapter.cs
            dataList = view.FindViewById <ListView>(Resource.Id.DataList);
            adapter  = new ACFIViewAdapter(this.Context, dataItems);

            //Display the number of data items at the bottom of the page
            NumItems = view.FindViewById <TextView>(Resource.Id.txtNumData);

            //AVG income per resident monthly textview
            AvgIncome = view.FindViewById <TextView>(Resource.Id.ACFIAvgValue);

            //setup buttons at the top of the page which are used to sort the list based on the button pushed
            Button ResidentBtn       = view.FindViewById <Button>(Resource.Id.ResidentIDTextACFI);
            Button ScoreBtn          = view.FindViewById <Button>(Resource.Id.ScoreTextACFI);
            Button IncomeBtn         = view.FindViewById <Button>(Resource.Id.IncomeTextACFI);
            Button ExpirationDateBtn = view.FindViewById <Button>(Resource.Id.ExpirationDateTextACFI);

            //setup Spinner to sort facilities
            Spinner spinner = view.FindViewById <Spinner>(Resource.Id.FacilitySpinner);

            spinner.Clickable     = false;
            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_ItemSelected);
            var SpinnerAdapter = ArrayAdapter.CreateFromResource(view.Context, Resource.Array.FacilityArray, Android.Resource.Layout.SimpleSpinnerItem);//array found in Resources/values/

            SpinnerAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = SpinnerAdapter;

            //setup Month Spinner for the AVG income per resident monthly widget
            Spinner MonthSpinner = view.FindViewById <Spinner>(Resource.Id.MonthSpinner);

            MonthSpinner.Clickable     = false;
            MonthSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_MonthItemSelected);
            var MonthSpinnerAdapter = ArrayAdapter.CreateFromResource(view.Context, Resource.Array.MonthArray, Android.Resource.Layout.SimpleSpinnerItem);

            MonthSpinnerAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            MonthSpinner.Adapter = MonthSpinnerAdapter;

            //create new WebClient class object which can provide methods to push and recieve data from an online resource via a url
            client = new WebClient();
            //set the url to push and pull data from, via the a Uri class object
            //the online resource is a php file hosted on heroku, these php files read write and pull database tables
            url = new Uri("https://capstonephpcode198.herokuapp.com/PullData.php");

            //setup toast message which is pop up message which informs the user that data is being pulled
            toastMessage = Toast.MakeText(this.Context, "Fetching data", ToastLength.Long);

            //setup graph button
            Button GraphButton = view.FindViewById <Button>(Resource.Id.GraphButton);

            GraphButton.Enabled = false;//disabled untill data is pulled
            GraphButton.Click  += delegate {
                var       transaction = ChildFragmentManager.BeginTransaction();
                ACFIGraph info        = new ACFIGraph(displayItems);//displayItems to use all data
                info.Show(transaction, "dialog fragment");
            };

            //setup search bar
            SearchView SearchItems = view.FindViewById <SearchView>(Resource.Id.searchData);
            //an X apears next the search upon a submitted query, this X closes the current search, SearchCloseBtn button variable is associated with this
            //find the resource id's associated with the search and close buttons for the search bar widget
            int searchBtnID    = SearchItems.Context.Resources.GetIdentifier("android:id/search_button", null, null);
            int closeBtnID     = SearchItems.Context.Resources.GetIdentifier("android:id/search_close_btn", null, null);
            var SearchOpenBtn  = view.FindViewById <ImageView>(searchBtnID);
            var SearchCloseBtn = view.FindViewById <ImageView>(closeBtnID);

            SearchItems.SetIconifiedByDefault(false); //shows hint
            SearchItems.Enabled          = false;     //disable untill data is pulled
            SearchOpenBtn.Enabled        = false;
            SearchItems.QueryTextSubmit += delegate {
                //this search bar allows the user to search via resident id
                string searchID = SearchItems.Query;
                foreach (ACFIFunding item in dataItems)
                {
                    //use searchItems list to hold all items while items get removed from the dataItems list if they don't match the search credentials
                    if (!searchItems.Contains(item))
                    {
                        searchItems.Add(item);
                    }
                }
                //if search credentials match or don't match, remove or add items from dataItems list
                foreach (ACFIFunding item in searchItems)
                {
                    if (dataItems.Contains(item) && (!String.Equals(item.GetResidentID().ToString(), searchID)))
                    {
                        dataItems.Remove(item);
                    }
                    else if (!dataItems.Contains(item) && (String.Equals(item.GetResidentID().ToString(), searchID)))
                    {
                        dataItems.Add(item);
                    }
                }
                SearchItems.ClearFocus();
                adapter.NotifyDataSetChanged();
            };
            //when the search bar close button is pressed, add all items from searchItems into dataItems
            SearchCloseBtn.Click += delegate {
                foreach (ACFIFunding item in searchItems)
                {
                    if (!dataItems.Contains(item))
                    {
                        dataItems.Add(item);
                    }
                }
                SearchItems.ClearFocus();
                SearchItems.SetQuery(String.Empty, false);
                adapter.NotifyDataSetChanged();
            };

            //setup progress bar for data pulling
            ProgressBar ClientProgress = view.FindViewById <ProgressBar>(Resource.Id.ClientProgress);

            //show progress percentage on the bar
            client.UploadProgressChanged += delegate(object sender, UploadProgressChangedEventArgs e) {
                ClientProgress.Progress += e.ProgressPercentage;
            };

            //refresh button pulls data from database
            Button RefreshBtn = view.FindViewById <Button>(Resource.Id.RefreshButton);

            RefreshBtn.Click += delegate {
                RefreshBtn.SetBackgroundResource(Resource.Drawable.RefreshButtonIconClicked); //change refresh icon colour to lighter shade of green
                toastMessage.Show();                                                          //show toast message
                spinner.SetSelection(0);
                //clear lists, to make way for updated data
                dataItems.Clear();
                displayItems.Clear();
                spinner.Clickable = false;

                NameValueCollection values = new NameValueCollection();
                values.Add("Type", "ACFI");
                //call php file and use UploadValuesAsync with the value of Type=ACFI so the php file knows to pull ACFI data
                client.UploadValuesAsync(url, values);
            };

            client.UploadValuesCompleted += delegate(object sender, UploadValuesCompletedEventArgs e) {
                Activity.RunOnUiThread(() => {
                    string json           = Encoding.UTF8.GetString(e.Result);
                    dataItems             = JsonConvert.DeserializeObject <List <ACFIFunding> >(json);//use json to create a list of data objects from the output of the php file
                    int[] residentIDArray = new int[dataItems.Count];
                    int count             = 0;
                    //put all resident id values into an array
                    foreach (ACFIFunding item in dataItems)
                    {
                        residentIDArray[count] = item.GetResidentID();
                        count++;
                        displayItems.Add(item);//display items holds all of the data objects for safe keeping, for when dataItems objects get removed
                    }
                    //get distinct resident id values in its own array
                    var distinctResidentIDvals = residentIDArray.Distinct();
                    bool isGreen = false;
                    bool isRed   = false;
                    decimal sum  = 0;
                    //foreach distinct resident id value check if the rows for a resident id should be green, yellow or red, this is beacuse some resident id's correspond with multiple rows
                    foreach (int ID in distinctResidentIDvals)
                    {
                        sum = 0;
                        foreach (ACFIFunding item in dataItems.Where(x => x.GetResidentID() == ID))
                        {
                            sum = sum + item.GetIncome();
                        }
                        //if the sum of all acfi income for a resident is above $200
                        if (sum > 200)
                        {
                            isGreen = true;
                            isRed   = false;
                        }
                        else if (sum < 150)
                        { //if the sum of all acfi income for a resident is below $150
                            isGreen = false;
                            isRed   = true;
                        }
                        else    //yellow
                        {
                            isGreen = false;
                            isRed   = false;
                        }
                        foreach (ACFIFunding item in dataItems.Where(x => x.GetResidentID() == ID))
                        {
                            item.SetGreen(isGreen);
                            item.SetRed(isRed);
                        }
                    }
                    adapter          = new ACFIViewAdapter(this.Context, dataItems);//setup adapter
                    NumItems.Text    = dataItems.Count.ToString();
                    dataList.Adapter = adapter;
                    RefreshBtn.SetBackgroundResource(Resource.Drawable.RefreshButtonIcon);
                    spinner.Clickable     = true;
                    GraphButton.Enabled   = true;
                    SearchItems.Enabled   = true;
                    SearchOpenBtn.Enabled = true;
                    toastMessage.Cancel();
                    searchItems.Clear();
                    adapter.NotifyDataSetChanged();
                });
            };

            //sort the items based on residentID
            ResidentBtn.Click += delegate {
                if (clickNumResident == 0)
                {
                    dataItems.Sort(delegate(ACFIFunding one, ACFIFunding two) {
                        return(one.GetResidentID().CompareTo(two.GetResidentID()));
                    });
                    clickNumResident++;
                    clickNumScore       = 0;
                    clickNumIncome      = 0;
                    clickExpirationDate = 0;
                    //reverse list if clicked a second time in a row
                }
                else
                {
                    dataItems.Reverse();
                    clickNumResident = 0;
                }
                adapter.NotifyDataSetChanged();
            };

            //sort the items based on score
            ScoreBtn.Click += delegate {
                if (clickNumScore == 0)
                {
                    dataItems.Sort(delegate(ACFIFunding one, ACFIFunding two) {
                        return(one.GetACFIScore().CompareTo(two.GetACFIScore()));
                    });
                    clickNumScore++;
                    clickNumResident    = 0;
                    clickNumIncome      = 0;
                    clickExpirationDate = 0;
                    //reverse list if clicked a second time in a row
                }
                else
                {
                    dataItems.Reverse();
                    clickNumScore = 0;
                }
                adapter.NotifyDataSetChanged();
            };

            //sort the items based on income
            IncomeBtn.Click += delegate {
                if (clickNumIncome == 0)
                {
                    dataItems.Sort(delegate(ACFIFunding one, ACFIFunding two) {
                        return(one.GetIncome().CompareTo(two.GetIncome()));
                    });
                    clickNumIncome++;
                    clickNumResident    = 0;
                    clickNumScore       = 0;
                    clickExpirationDate = 0;
                    //reverse list if clicked a second time in a row
                }
                else
                {
                    dataItems.Reverse();
                    clickNumIncome = 0;
                }
                adapter.NotifyDataSetChanged();
            };

            //sport the items based on expiration date
            ExpirationDateBtn.Click += delegate {
                if (clickExpirationDate == 0)
                {
                    dataItems.Sort(delegate(ACFIFunding one, ACFIFunding two) {
                        return(DateTime.Compare(one.GetExpirationDate(), two.GetExpirationDate()));
                    });
                    clickExpirationDate++;
                    clickNumResident = 0;
                    clickNumScore    = 0;
                    clickNumIncome   = 0;
                    //reverse list if clicked a second time in a row
                }
                else
                {
                    dataItems.Reverse();
                    clickExpirationDate = 0;
                }
                adapter.NotifyDataSetChanged();
            };

            return(view);
        }
Exemplo n.º 17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _currentPage   = Intent.GetIntExtra("currentPage", 0);
            _pubblicazione = (Pubblicazione)ActivitiesBringe.GetObject("pub");
            _documento     = (Documento)ActivitiesBringe.GetObject("doc");
            _pdfCore       = (MuPDFCore)ActivitiesBringe.GetObject("pdfCore");

            SetContentView(Resource.Layout.SearchDialog);

            Window.SetSoftInputMode(SoftInput.AdjustNothing);

            if (ActionBar != null)
            {
                this.Title = ActionBar.Title = GetString(Resource.String.search);

                ActionBar.SetDisplayUseLogoEnabled(false);
                ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
                ActionBar.SetHomeButtonEnabled(false);
                ActionBar.SetDisplayHomeAsUpEnabled(true);
                ActionBar.SetDisplayShowHomeEnabled(true);
                ActionBar.SetDisplayShowTitleEnabled(true);
            }

            _pageList = (ListView)FindViewById <ListView>(Resource.Id.pageList);

            _searchView = (SearchView)FindViewById <SearchView>(Resource.Id.searchView);

            int  searchPlateId = _searchView.Context.Resources.GetIdentifier("android:id/search_plate", null, null);
            View searchPlate   = _searchView.FindViewById(searchPlateId);

            searchPlate.Background.Colorize(DataManager.Get <ISettingsManager>().Settings.ButtonColor);

            _searchView.Focusable = true;
            _searchView.Iconified = false;
            _searchView.RequestFocusFromTouch();

            _searchView.QueryTextChange += (sender, e) =>
            {
                SearchPages(e.NewText);
            };

            _searchView.QueryTextSubmit += (sender, e) =>
            {
                _searchView.ClearFocus();
            };

            _pageList.ItemClick += (sender, e) =>
            {
                var art = _articoli[e.Position];

                Intent myIntent = new Intent(this, typeof(ViewerScreen));
                myIntent.PutExtra("doc", art.IdDocumento);
                myIntent.PutExtra("page", (art.Index - 1).ToString());
                myIntent.PutExtra("action", "page");

                SetResult(Result.Ok, myIntent);
                Finish();
            };

            //paramentro ricerca
            var str = ActivitiesBringe.GetObject("search");

            if (str != null)
            {
                string search = (string)str;

                _searchView.SetQuery(search, true);

                _searchView.RequestFocus();
            }
        }
Exemplo n.º 18
0
 public bool OnQueryTextSubmit(string query)
 {
     _searchViewText.ClearFocus();
     return(true);
 }
Exemplo n.º 19
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            System.Console.WriteLine("&Pager view created");

            View view = inflater.Inflate(Resource.Layout.ViewPager, container, false);
            TabLayout tabs = Activity.FindViewById<TabLayout>(Resource.Id.tabs);
            ViewPager pager = view.FindViewById<ViewPager>(Resource.Id.pager);

            ((AppBarLayout.LayoutParams)Activity.FindViewById<CollapsingToolbarLayout>(Resource.Id.collapsingToolbar).LayoutParameters).ScrollFlags = AppBarLayout.LayoutParams.ScrollFlagScroll | AppBarLayout.LayoutParams.ScrollFlagEnterAlways | AppBarLayout.LayoutParams.ScrollFlagSnap;
            tabs.Visibility = ViewStates.Visible;
            tabs.RemoveAllTabs();

            if (type == 0)
            {
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.songs)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.folders)));

                adapter = new ViewPagerAdapter(ChildFragmentManager);
                adapter.AddFragment(Browse.NewInstance(), Resources.GetString(Resource.String.songs));
                adapter.AddFragment(FolderBrowse.NewInstance(), Resources.GetString(Resource.String.folders));

                pager.Adapter = adapter;
                pager.AddOnPageChangeListener(this);
                pager.AddOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabs));

                tabs.SetupWithViewPager(pager);
                tabs.TabReselected += OnTabReselected;

                pager.CurrentItem = pos;
                tabs.TabMode = TabLayout.ModeFixed;
                tabs.SetScrollPosition(pos, 0f, true);
            }
            else if (type == 1)
            {
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.all)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.songs)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.playlists)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.lives)));
                tabs.AddTab(tabs.NewTab().SetText(Resources.GetString(Resource.String.channels)));

                ViewPagerAdapter adapter = new ViewPagerAdapter(ChildFragmentManager);
                Fragment[] fragment = YoutubeSearch.NewInstances(query);
                adapter.AddFragment(fragment[0], Resources.GetString(Resource.String.all));
                adapter.AddFragment(fragment[1], Resources.GetString(Resource.String.songs));
                adapter.AddFragment(fragment[2], Resources.GetString(Resource.String.playlists));
                adapter.AddFragment(fragment[3], Resources.GetString(Resource.String.lives));
                adapter.AddFragment(fragment[4], Resources.GetString(Resource.String.channels));

                pager.Adapter = adapter;
                pager.AddOnPageChangeListener(this);
                pager.AddOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabs));
                tabs.SetupWithViewPager(pager);
                tabs.TabReselected += OnTabReselected;

                pager.CurrentItem = pos;
                tabs.TabMode = TabLayout.ModeScrollable;
                tabs.SetScrollPosition(pos, 0f, true);

                YoutubeSearch.instances[pos].IsFocused = true;
                YoutubeSearch.instances[pos].OnFocus();
                MainActivity.instance.FindViewById<TabLayout>(Resource.Id.tabs).Visibility = ViewStates.Visible;

                IMenuItem searchItem = MainActivity.instance.menu.FindItem(Resource.Id.search);
                SearchView searchView = (SearchView)searchItem.ActionView;
                searchView.Focusable = false;
                searchItem.ExpandActionView();
                searchView.SetQuery(query, false);
                searchView.ClearFocus();
                searchView.Focusable = true;
            }
            return view;
        }
Exemplo n.º 20
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.ax_Search, container, false);

            // _w.RecyclerView rez = view as _w.RecyclerView;

            __view    = view;
            ___view   = view;
            ax_search = this;

            var bar = __view.FindViewById <ProgressBar>(Resource.Id.progressBar1);

            //bar.Visibility = ViewStates.Gone;
            pbar = bar;

            // _w.RecyclerView rez = view as _w.RecyclerView; //inflater.Inflate(Resource.Layout.ax_Search, container, false) as _w.RecyclerView;
            SearchView search = view.FindViewById <SearchView>(Resource.Id.movie_seach);

            _w.RecyclerView re = view.FindViewById <_w.RecyclerView>(Resource.Id.recyclerView_movies);
            _re = re;

            search.SetQueryHint(new Java.Lang.String("Movie Search"));
            //search.SetQuery(new Java.Lang.String("HELLO"), true);

            search.QueryTextSubmit += async(o, e) =>
            {
                search.ClearFocus();

                if (searchDone)
                {
                    searchDone             = false;
                    MainActivity.searchFor = e.Query;
                    // Intent intent = new Intent(search.Context, typeof(SearchResultsActivity));
                    //StartActivity(intent);
                    Action onCompleted = () =>
                    {
                        //print("daaaaaaaaaaaaaaaa")
                        // UpdateList();
                        ChangeBar(100);
                        searchDone = true;
                        //
                    };

                    sThred = new Java.Lang.Thread(
                        () =>
                    {
                        try {
                            Search(e.Query);
                            //Thread.Sleep(1000);
                        }
                        finally {
                            onCompleted();
                            sThred.Join();
                            //invoke(onCompleted);
                        }
                    });
                    sThred.Start();

                    ChangeBar(0);
                }
            };
            re.SetItemClickListener((rv, position, _view) =>
            {
                SelectMovie(rv, position, _view);
            });

            re.LongClickable = true;

            /*
             * re.LongClickable = true;
             * re.SetOnLongClickListener((rv, position, _view) =>
             * {
             *  //An item has been clicked
             *  HistoryPressTitle(movieTitles[wlink[position]]);
             *  movieSelectedID = wlink[position];
             *  Context context = _view.Context;
             *  Intent intent = new Intent(context, typeof(SearchResultsActivity));
             *  // intent.PutExtra(CheeseDetailActivity.EXTRA_NAME, values[position]);
             *
             *  context.StartActivity(intent);
             *
             * });
             */
            /*
             * var buttons = view.FindViewById<LinearLayout>(Resource.Id.s_Buttons);
             *
             * LinearLayout linearLayout = buttons; //new LinearLayout(this);
             * linearLayout.Orientation = (Android.Widget.Orientation.Vertical);
             *
             * for (int i = 0; i < 100; i++) {
             *  var button = new Button(this.Context);
             *  button.Text = "Button " + i;
             *  button.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
             *  button.Click += (o, e) =>
             *  {
             *      //selectedTitle = button.Text;
             *      //ClosePoster(ViewStates.Visible);
             *      Intent intent = new Intent(search.Context, typeof(SearchResultsActivity));
             *      StartActivity(intent);
             *  };
             *  linearLayout.AddView(button);
             *  btts.Add(button);
             * }*/


            // bar.Progress = MainActivity.bar_progress;

            //IRunnable
            // search.SetQuery("test", true);
            //  search.SetFocusable(ViewFocusability.Focusable);
            //search.SetIconifiedByDefault(false);
            search.OnActionViewExpanded();
            search.ClearFocus();
            searchView = view.FindViewById <SearchView>(Resource.Id.movie_seach);

            // imm.HideSoftInputFromInputMethod(search.WindowToken, HideSoftInputFlags.None);
            //search.RequestFocusFromTouch();


            return(view);
        }
Exemplo n.º 21
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            //OnCreate takes a Bundle parameter, which is a dictionary for storing and passing state information
            //and objects between activities If the bundle is not null, this indicates the activity is restarting
            //and it should restore its state from the previous instance. "https:/docs.microsoft.com/en-us/xamarin/android/app-fundamentals/activity-lifecycle/"
            base.OnCreateView(inflater, container, savedInstanceState);
            //Once on create has finished, android will call OnStart which will start the activity

            //sets the layout of the main menu to the HomeCarePackagePage.axml file which is located in Resources/layout/
            View view = inflater.Inflate(Resource.Layout.HomeCarePackagePage, container, false);

            //setup lists for home care package data
            dataItems    = new List <HomeCarePackageData>();
            displayItems = new List <HomeCarePackageData>();
            searchItems  = new List <HomeCarePackageData>();

            //setup custom list adapter, more info found in HomeCarePackageViewAdapter.cs
            dataList = view.FindViewById <ListView>(Resource.Id.DataList);
            adapter  = new HomeCarePackageViewAdapter(this.Context, dataItems);

            //Display the number of items at the bottom of the page
            NumItems = view.FindViewById <TextView>(Resource.Id.txtNumData);

            //setup buttons at the top of the page which are used to sort the list based on the button pushed
            Button FName        = view.FindViewById <Button>(Resource.Id.FirstNameTextHomeCare);
            Button LName        = view.FindViewById <Button>(Resource.Id.LastNameTextHomeCare);
            Button PackageLevel = view.FindViewById <Button>(Resource.Id.PackageLevelText);
            Button IncomeList   = view.FindViewById <Button>(Resource.Id.PackageIncomeText);

            //setup Spinner to sort facilities
            Spinner spinner = view.FindViewById <Spinner>(Resource.Id.FacilitySpinner);

            spinner.Clickable     = false;
            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinner_ItemSelected);
            var SpinnerAdapter = ArrayAdapter.CreateFromResource(view.Context, Resource.Array.FacilityArray, Android.Resource.Layout.SimpleSpinnerItem);//array found in Resources/values/

            SpinnerAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = SpinnerAdapter;

            //create new WebClient class object which can provide methods to push and recieve data from an online resource via a url
            client = new WebClient();
            //set the url to push and pull data from, via the a Uri class object
            //the online resource is a php file hosted on heroku, these php files read write and pull database tables
            url = new Uri("https://capstonephpcode198.herokuapp.com/PullData.php");

            //setup toast message which is pop up message which informs the user that data is being pulled
            toastMessage = Toast.MakeText(this.Context, "Fetching data", ToastLength.Long);

            //setup graph button
            Button GraphButton = view.FindViewById <Button>(Resource.Id.GraphButton);

            GraphButton.Enabled = false;//disabled untill data is pulled
            GraphButton.Click  += delegate {
                var transaction            = ChildFragmentManager.BeginTransaction();
                HomeCarePackagesGraph info = new HomeCarePackagesGraph(displayItems);//displayItems to use all data
                info.Show(transaction, "dialog fragment");
            };

            //setup search bar
            SearchView SearchItems = view.FindViewById <SearchView>(Resource.Id.searchData);
            //an X apears next the search upon a submitted query, this X closes the current search, SearchCloseBtn button variable is associated with this
            //find the resource id's associated with the search and close buttons for the search bar widget
            int searchBtnID    = SearchItems.Context.Resources.GetIdentifier("android:id/search_button", null, null);
            int closeBtnID     = SearchItems.Context.Resources.GetIdentifier("android:id/search_close_btn", null, null);
            var SearchOpenBtn  = view.FindViewById <ImageView>(searchBtnID);
            var SearchCloseBtn = view.FindViewById <ImageView>(closeBtnID);

            SearchItems.SetIconifiedByDefault(false); //shows hint
            SearchItems.Enabled          = false;     //disable untill data is pulled
            SearchOpenBtn.Enabled        = false;
            SearchItems.QueryTextSubmit += delegate {
                //this search bar allows the user to search via first and/or last name
                string searchName = SearchItems.Query;
                //Get same string with first letter uppercase
                char firstUpper = searchName[0];
                firstUpper = Char.ToUpper(firstUpper);
                char[] searchNameLetters = searchName.ToCharArray();
                searchNameLetters[0] = firstUpper;
                string searchNameUpper = new string(searchNameLetters);

                foreach (HomeCarePackageData item in dataItems)
                {
                    //use searchItems list to hold all items while items get removed from the dataItems list if they don't match the search credentials
                    if (!searchItems.Contains(item))
                    {
                        searchItems.Add(item);
                    }
                }
                //if search credentials match or don't match, remove or add items from dataItems list
                foreach (HomeCarePackageData item in searchItems)
                {
                    bool foundFName      = String.Equals(searchName, item.GetResidentFirstName(), StringComparison.OrdinalIgnoreCase);//ignores upper or lower case
                    bool foundLName      = String.Equals(searchName, item.GetResidentLastName(), StringComparison.OrdinalIgnoreCase);
                    bool insideName      = item.GetResidentFirstName().Contains(searchName) || item.GetResidentLastName().Contains(searchName);
                    bool insideNameUpper = item.GetResidentFirstName().Contains(searchNameUpper) || item.GetResidentLastName().Contains(searchNameUpper);
                    if (dataItems.Contains(item) && !foundFName && !foundLName && !insideName && !insideNameUpper)
                    {
                        dataItems.Remove(item);
                    }
                    else if (!dataItems.Contains(item) && (foundFName || foundLName || insideName || insideNameUpper))
                    {
                        dataItems.Add(item);
                    }
                }
                SearchItems.ClearFocus();
                adapter.NotifyDataSetChanged();
            };
            //when the search bar close button is pressed, add all items from searchItems into dataItems
            SearchCloseBtn.Click += delegate {
                foreach (HomeCarePackageData item in searchItems)
                {
                    if (!dataItems.Contains(item))
                    {
                        dataItems.Add(item);
                    }
                }
                SearchItems.ClearFocus();
                SearchItems.SetQuery(String.Empty, false);
                adapter.NotifyDataSetChanged();
            };

            //setup progress bar
            ProgressBar ClientProgress = view.FindViewById <ProgressBar>(Resource.Id.ClientProgress);

            //show progress percentage on the bar
            client.UploadProgressChanged += delegate(object sender, UploadProgressChangedEventArgs e) {
                ClientProgress.Progress += e.ProgressPercentage;
            };
            //refresh button pulls data from database
            Button RefreshBtn = view.FindViewById <Button>(Resource.Id.RefreshButton);

            RefreshBtn.Click += delegate {
                RefreshBtn.SetBackgroundResource(Resource.Drawable.RefreshButtonIconClicked);//change refresh icon colour to lighter shade of green
                toastMessage.Show();
                spinner.SetSelection(0);
                //clear lists, to make way for updated data
                dataItems.Clear();
                displayItems.Clear();
                spinner.Clickable = false;

                NameValueCollection values = new NameValueCollection();
                values.Add("Type", "Home");
                //call php file and use UploadValuesAsync with the value of Type=Home so the php file knows to pull home care package data
                client.UploadValuesAsync(url, values);
            };

            client.UploadValuesCompleted += delegate(object sender, UploadValuesCompletedEventArgs e) {
                Activity.RunOnUiThread(() => {
                    string json = Encoding.UTF8.GetString(e.Result);
                    dataItems   = JsonConvert.DeserializeObject <List <HomeCarePackageData> >(json); //use json to create a list of data objects from the output of the php file
                    adapter     = new HomeCarePackageViewAdapter(this.Context, dataItems);           //setup adapter
                    foreach (HomeCarePackageData item in dataItems)
                    {
                        displayItems.Add(item);//display items holds all of the data objects for safe keeping, for when dataItems objects get removed
                    }
                    NumItems.Text    = dataItems.Count.ToString();
                    dataList.Adapter = adapter;
                    RefreshBtn.SetBackgroundResource(Resource.Drawable.RefreshButtonIcon);
                    spinner.Clickable     = true;
                    GraphButton.Enabled   = true;
                    SearchItems.Enabled   = true;
                    SearchOpenBtn.Enabled = true;
                    toastMessage.Cancel();
                    searchItems.Clear();
                    adapter.NotifyDataSetChanged();
                });
            };

            //setup button for sorting the list based on first names
            FName.Click += delegate {
                if (clickNumFName == 0)
                {
                    dataItems.Sort(delegate(HomeCarePackageData one, HomeCarePackageData two) {
                        return(string.Compare(one.GetResidentFirstName(), two.GetResidentFirstName()));
                    });
                    clickNumFName++;
                    clickNumLName  = 0;
                    clickNumIncome = 0;
                    clcikNumLevel  = 0;
                    //reverse list if clicked a second time in a row
                }
                else
                {
                    dataItems.Reverse();
                    clickNumFName = 0;
                }
                adapter.NotifyDataSetChanged();
            };

            //setup button for sorting the list based on last names
            LName.Click += delegate {
                if (clickNumLName == 0)
                {
                    dataItems.Sort(delegate(HomeCarePackageData one, HomeCarePackageData two) {
                        return(string.Compare(one.GetResidentLastName(), two.GetResidentLastName()));
                    });
                    clickNumLName++;
                    clickNumFName  = 0;
                    clickNumIncome = 0;
                    clcikNumLevel  = 0;
                    //reverse list if clicked a second time in a row
                }
                else
                {
                    dataItems.Reverse();
                    clickNumLName = 0;
                }
                adapter.NotifyDataSetChanged();
            };

            //setup button for sorting the list based on package levels
            PackageLevel.Click += delegate {
                if (clcikNumLevel == 0)
                {
                    dataItems.Sort(delegate(HomeCarePackageData one, HomeCarePackageData two) {
                        return(one.GetPackageLevel().CompareTo(two.GetPackageLevel()));
                    });
                    clcikNumLevel++;
                    clickNumLName  = 0;
                    clickNumFName  = 0;
                    clickNumIncome = 0;
                    //reverse list if clicked a second time in a row
                }
                else
                {
                    dataItems.Reverse();
                    clcikNumLevel = 0;
                }
                adapter.NotifyDataSetChanged();
            };

            //setup button for sorting the list based on incomes
            IncomeList.Click += delegate {
                if (clickNumIncome == 0)
                {
                    dataItems.Sort(delegate(HomeCarePackageData one, HomeCarePackageData two) {
                        return(one.GetPackageIncome().CompareTo(two.GetPackageIncome()));
                    });
                    clickNumIncome++;
                    clickNumLName = 0;
                    clickNumFName = 0;
                    clcikNumLevel = 0;
                    //reverse list if clicked a second time in a row
                }
                else
                {
                    dataItems.Reverse();
                    clickNumIncome = 0;
                }
                adapter.NotifyDataSetChanged();
            };

            return(view);
        }