Beispiel #1
0
        //event for when the category dropdown changes
        private void Category_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            Spinner spinner = (Spinner)sender;

            //if the selection contains the text "transfer" clear the type_toaccount dropdown and load it with all accounts besides the current account
            if (spinner.GetItemAtPosition(e.Position).ToString().Contains("Transfer"))
            {
                transactionTypeToAccountAdapter.Clear();
                foreach (Account act in MainActivity.accounts)
                {
                    if (act.PK != accountPK)
                    {
                        transactionTypeToAccountAdapter.Add(act.Name);
                    }
                }
                defaultTypeToAccountLoaded = false;
            }
            //if the selection is anything else besides transfer clear and load the tyep_toaccount dropdown back to default
            else
            {
                if (defaultTypeToAccountLoaded == false)
                {
                    transactionTypeToAccountAdapter.Clear();
                    transactionTypeToAccountAdapter.Add("Withdrawal");
                    transactionTypeToAccountAdapter.Add("Deposit");
                    defaultTypeToAccountLoaded = true;
                }
            }
        }
Beispiel #2
0
        public void OnScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)
        {
            System.Diagnostics.Debug.WriteLine(firstVisibleItem);
            if (firstVisibleItem + visibleItemCount == totalItemCount)               // Clear items, add from current half way to chunk size after last item, scroll back to old last item
            {
                var firstItem = adapter.GetItem(chunksize);
                adapter.Clear();
                for (int i = 0; i < chunksize * 2; i++)
                {
                    adapter.Add(firstItem.AddDays(i));
                }
                adapter.NotifyDataSetChanged();
                view.SetSelection(chunksize - visibleItemCount - 1);
            }
            else if (firstVisibleItem == 0)                     // Clear items, add from chunk size before first item, scroll back to old first item

            {
                var lastItem = adapter.GetItem(chunksize);
                adapter.Clear();
                for (int i = chunksize * 2 - 1; i >= 0; i--)
                {
                    adapter.Add(lastItem.AddDays(-i));
                }
                adapter.NotifyDataSetChanged();
                view.SetSelection(chunksize - 1);
            }
        }
Beispiel #3
0
        void spinner_Itemselected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            _play.Clear();
            if (_players.Count > 0)
            {
                _play.Add("Player");
                _play.Add("Played");
                _play.Add("Points");

                //string [][] values = new string[players.Count] [];

                PointsInfo [] values = new PointsInfo[_players.Count];

                int i = 0;

                foreach (string name in _players)
                {
                    values [i] = new PointsInfo(name, Archive.Instance.GetPlayed(name), Archive.Instance.GetTotalAward(name));
                    ++i;
                }

                switch (e.Id)
                {
                case 0:
                    SortByPointDescend(values, _players.Count);
                    break;

                case 1:
                    SortByPointAscend(values, _players.Count);
                    break;

                case 2:
                    SortByPlayedDescend(values, _players.Count);
                    break;

                case 3:
                    SortByPlayedAscend(values, _players.Count);
                    break;

                case 4:
                    SortByNameDescend(values, 0, _players.Count - 1);
                    break;

                case 5:
                    SortByNameAscend(values, 0, _players.Count - 1);
                    break;
                }
                for (int j = 0; j < _players.Count; j++)
                {
                    PointsInfo val = values [j];
                    _play.Add(val.player);
                    _play.Add(val.played.ToString());
                    _play.Add((val.points > 0 ? "+" : "") + val.points.ToString());
                }
            }
            else
            {
                _play.Add("No match found");
            }
        }
Beispiel #4
0
        public void UpdateView()
        {
            //If the list adds double outcomment the below 2 lines
            RecipeAdapter.Clear();
            RecipeAdapter.AddAll(presenter.RecipeList);

            RecipeAdapter.NotifyDataSetChanged();
        }
Beispiel #5
0
        private void OnColumnSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            Spinner newSpinner = (Spinner)sender;

            viewModel.SelectedColumn = newSpinner.GetItemAtPosition(e.Position).ToString();

            if (viewModel.SelectedColumn == "All Columns")
            {
                conditionDropdown.Visibility = ViewStates.Gone;
                conditionTextView.Visibility = ViewStates.Gone;
            }
            else
            {
                conditionDropdown.Visibility = ViewStates.Visible;
                conditionTextView.Visibility = ViewStates.Visible;
                foreach (var prop in typeof(BookInfo).GetProperties())
                {
                    if (prop.Name == viewModel.SelectedColumn)
                    {
                        var type = prop.GetType();
                        if (prop.PropertyType == typeof(Java.Lang.String))
                        {
                            condtionAdapter.Clear();
                            condtionAdapter.Add("Equals");
                            condtionAdapter.Add("Contains");
                            if (this.viewModel.SelectedCondition == "Equals")
                            {
                                this.viewModel.SelectedCondition = "Equals";
                            }
                            else
                            {
                                this.viewModel.SelectedCondition = "Contains";
                            }
                        }
                        else
                        {
                            condtionAdapter.Clear();
                            condtionAdapter.Add("Equals");
                            condtionAdapter.Add("NotEquals");
                            if (this.viewModel.SelectedCondition == "Equals")
                            {
                                this.viewModel.SelectedCondition = "Equals";
                            }
                            else
                            {
                                this.viewModel.SelectedCondition = "NotEquals";
                            }
                        }
                    }
                }
            }
            if (filterText.Query != "")
            {
                this.OnFilterChanged();
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            currentSearchResults = new List <List <string> >();

            httpClient = new HttpClient();
            string api_key = "XXX";

            httpClient.DefaultRequestHeaders.Add("api-key", api_key);

            // Get our button from the layout resource,
            // and attach an event to it
            Button   searchButton    = FindViewById <Button>(Resource.Id.searchButton);
            EditText searchTextfield = FindViewById <EditText>(Resource.Id.searchTextField);

            resultLabel = FindViewById <TextView>(Resource.Id.resultLabel);
            resultList  = FindViewById <ListView>(Resource.Id.listView);

            resultLabel.Visibility = Android.Views.ViewStates.Invisible;
            resultList.Visibility  = Android.Views.ViewStates.Invisible;

            searchButton.Click += delegate
            {
                currentSearchResults.Clear();
                myListAdapter.Clear();
                currentSearchTerm = searchTextfield.Text;

                StartSearch();

                InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                imm.HideSoftInputFromWindow(searchTextfield.WindowToken, 0);
            };

            allSearchResults = new List <String> {
                "no results yet..."
            };
            myListAdapter         = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, allSearchResults);
            resultList.Adapter    = myListAdapter;
            resultList.ItemClick += (s, e) =>
            {
                Intent intent     = new Intent(this, typeof(ResultDetailsScreen));
                var    dataToSend = currentSearchResults[e.Position];
                intent.PutStringArrayListExtra("data", dataToSend);
                StartActivity(intent);
            };
        }
        private void TxtExpense_Click(object sender, EventArgs e)
        {
            txtIncome.SetTextColor(Android.Graphics.Color.ParseColor("#B2DFDB"));
            txtExpense.SetTextColor(Android.Graphics.Color.White);
            txtTransfer.SetTextColor(Android.Graphics.Color.ParseColor("#B2DFDB"));

            Type = "Expense";
            spinnerTransactionAccountTransfer.Visibility = ViewStates.Gone;
            adapterCategory.Clear();
            adapterCategory.AddAll(listOfExpenseCategories);
            adapterCategory.NotifyDataSetChanged();
            spinnerTransactionCategory.Visibility = ViewStates.Visible;
            txtTransactionCategory.Text           = "Category";
            txtTransactionAccount.Text            = "Account";
        }
Beispiel #8
0
        private void LoadAll()
        {
            _play.Clear();
            int i = 1;

            Archive.Instance.ForEach(delegate(GameData gd) {
                AggiungiPartita(gd, i);
                ++i;
            });

            if (_play.Count == 0)
            {
                _play.Add("No matches found");
            }
        }
Beispiel #9
0
        private void Button_start_scan_Click(object sender, EventArgs e)
        {
            if (_hrEnumerator == null)
            {
                _progressWorking.Visibility = ViewStates.Visible;

                _hrEnumerator = new HeartRateEnumeratorAndroid();
                _hrEnumerator.DeviceScanUpdate  += _hrEnumerator_DeviceScanUpdate;
                _hrEnumerator.DeviceScanTimeout += _hrEnumerator_DeviceScanTimeout;
                _hrEnumerator.StartDeviceScan();

                listAdapter.Clear();
                listAdapter.Add($"> ble start");
            }
        }
Beispiel #10
0
        void InitializeBluetooth()
        {
            _adapter = BluetoothAdapter.DefaultAdapter;
            if (_adapter == null)
            {
                Toast.MakeText(this, "Bluetooth is not available", ToastLength.Long).Show();
                Finish();
                return;
            }

            if (!_adapter.IsEnabled)
            {
                const int REQUEST_ENABLE_BT = 2;
                var       enableBtIntent    = new Intent(BluetoothAdapter.ActionRequestEnable);
                StartActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
            }

            ListView     list        = FindViewById <ListView>(Resource.Id.listGekoppeld);
            ArrayAdapter ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1);

            list.Adapter = ListAdapter;
            ListAdapter.Clear();
            foreach (BluetoothDevice dev in _adapter.BondedDevices)
            {
                ListAdapter.Add(dev.Name);
            }
            bonded.Clear();
            bonded.AddRange(_adapter.BondedDevices);
        }
        private void FlushData()
        {
            try
            {
                if (mbtSocket != null)
                {
                    mbtSocket.Close();
                    mbtSocket = null;
                }

                if (mBluetoothAdapter != null)
                {
                    mBluetoothAdapter.CancelDiscovery();
                }

                if (btDevices != null)
                {
                    btDevices.Clear();
                    btDevices = null;
                }

                if (mArrayAdapter != null)
                {
                    mArrayAdapter.Clear();
                    mArrayAdapter.NotifyDataSetChanged();
                    mArrayAdapter.NotifyDataSetInvalidated();
                    mArrayAdapter = null;
                }

                Finish();
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.SearchItemList);

            adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1);

            listViewFoundGroups = FindViewById <ListView>(Resource.Id.listViewItemList);

            listViewFoundGroups.Adapter = adapter;

            listViewFoundGroups.ItemClick += (object sender, ItemClickEventArgs e) =>
            {
                string selectedJson = JsonConvert.SerializeObject(listViewFoundGroups.GetItemAtPosition(e.Position).Cast <Group>());
                Intent detailIntent = new Intent(this, typeof(GroupDetailsGuestActivity));
                detailIntent.PutExtra("GROUP_JSON", selectedJson);
                StartActivity(detailIntent);
            };

            textToSearch = FindViewById <EditText>(Resource.Id.textToSearch);

            textToSearch.TextChanged += delegate
            {
                if (String.IsNullOrWhiteSpace(textToSearch.Text))
                {
                    adapter.Clear();
                    return;
                }
                searchGroupsByName(textToSearch.Text);
            };
        }
Beispiel #13
0
        private async void ChooseCat()
        {
            adapter.Clear();

            string      text    = Intent.GetStringExtra("user") ?? "Data not available";
            var         user    = JsonConvert.DeserializeObject <List <User> >(text);
            RestClient  client  = new RestClient("http://marichely.me:8099/");
            RestRequest request = new RestRequest("category", Method.GET);

            request.AddHeader("UserApiKey", user[0].ApiKey);
            var odgovor = client.Execute(request);

            try
            {
                await Task.Run(() =>
                {
                    IRestResponse <List <Category> > reponse = client.Execute <List <Category> >(request);
                    foreach (var cat in reponse.Data)
                    {
                        sc.Post(new SendOrPostCallback(o =>
                        {
                            adapter.Add(o as string);
                            adapter.NotifyDataSetChanged();
                            catId = adapter.GetItemId(cat.Categoryid);
                        }), cat.Name);
                    }
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        void UpdateListOfFiles()
        {
            var emptyFileListMessage = View.FindViewById <TextView> (Resource.Id.empty_file_list_message);

            files = CreateListOfFiles();

            if (filesArrayAdapter.Count > 0)
            {
                filesArrayAdapter.Clear();
            }

            foreach (FileInfo file in files)
            {
                filesArrayAdapter.Add(file);
            }

            // Display a message instructing to add files if no files found.
            if (files.Count == 0)
            {
                emptyFileListMessage.Visibility = ViewStates.Visible;
            }
            else
            {
                emptyFileListMessage.Visibility = ViewStates.Gone;
            }
        }
Beispiel #15
0
 // <summary>
 // Init an empty list
 // </summary>
 void InitEmptyLists()
 {
     _devices.Clear();
     _spinnerAdapter.Clear();
     _spinnerAdapter.Add("Kein Sensor ausgewählt");
     _spinnerAdapter.NotifyDataSetChanged();
 }
        private void Search_Click(object sender, EventArgs e)
        {
            adapter.Clear();
            lstsearch.Visibility = ViewStates.Visible;
            try
            {
                if (edtsearch.Text.Length > 0)
                {
                    string response = new WebClient().DownloadString("http://www.planmytrip.net23.net/search.php?ds=" + edtsearch.Text.Trim());
                    try {
                        WebClient client   = new WebClient();
                        Stream    stream   = client.OpenRead("http://www.planmytrip.net23.net/DATA/search.pmt");
                        int       counting = 0;
                        String    content  = "";
                        if (stream != null)
                        {
                            StreamReader reader = new StreamReader(stream);
                            while (!reader.EndOfStream)
                            {
                                content = reader.ReadLine();
                                adapter.Add(content);
                                adapter.NotifyDataSetChanged();
                                counting++;
                            }
                            reader.Close();
                        }
                        stream.Close();

                        if (counting == 0)
                        {
                            adapter.Add("Destination does not exist");
                        }
                        else if (counting > 1)
                        {
                            adapter.Add("Please search exact destination");
                        }
                        if (adapter.Count > 0)
                        {
                            lstsearch.Adapter = adapter;
                        }
                        if (counting == 1 && content != "")
                        {
                            var intent = new Intent(this, typeof(userdataActivity));
                            intent.PutExtra("text", content);
                            StartActivity(intent);
                        }
                    }
                    catch (Exception) {
                        Android.Widget.Toast.MakeText(this, "Error: Cannot find destination file", ToastLength.Short).Show();
                    }
                }
                else
                {
                    Android.Widget.Toast.MakeText(this, "Error: Please fill the field", ToastLength.Short).Show();
                }
            }
            catch (Exception) {
                Android.Widget.Toast.MakeText(this, "Error: Server down", ToastLength.Short).Show();
            }
        }
Beispiel #17
0
        public void SetSimilarArtists(string[] similarArtists)
        {
            similarArtistAdapter.Clear();
            var array = similarArtists.Select(sa => (Java.Lang.Object) new Java.Lang.String(sa)).ToArray();

            similarArtistAdapter.AddAll(array);
        }
Beispiel #18
0
 public static void UpdateListview()
 {
     TempUser.GetContactNames(ref ContactNames);
     MyAdapater.Clear();
     MyAdapater.AddAll(ContactNames);
     MyAdapater.NotifyDataSetChanged();
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            resultList = FindViewById <ListView>(Resource.Id.searchResultView);
            result     = new List <string>()
            {
                "no data yet ..."
            };

            myListAdapter         = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, result);
            resultList.Adapter    = myListAdapter;
            resultList.ItemClick += (s, e) => {
                //if (e.Position <= result.Count)
                //{
                //    var t = result[e.Position];
                //    Android.Widget.Toast.MakeText(this, t, Android.Widget.ToastLength.Long).Show();
                //}
            };

            myListAdapter.Clear();

            var receivedData = Intent.GetStringArrayListExtra("data");

            result = new List <string>(receivedData);

            myListAdapter.AddAll(result);

            RunOnUiThread(() => myListAdapter.NotifyDataSetChanged());
        }
Beispiel #20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            RequestWindowFeature(WindowFeatures.IndeterminateProgress);
            SetContentView(Resource.Layout.main);

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

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.dev_pair);

            permissions();
            CheckBt();

            SetResult(Result.Canceled);

            newDevicesArrayAdapter    = new ArrayAdapter <string>(this, Resource.Layout.device_name);
            pairedDevicesArrayAdapter = new ArrayAdapter <string>(this, Resource.Layout.device_name);

            var DevicesListView = FindViewById <ListView>(Resource.Id.list_devices);

            DevicesListView.ItemClick += DeviceListView_ItemClick;

            devButton        = FindViewById <Button>(Resource.Id.btn_dev);
            devButton.Click += (sender, e) =>
            {
                SupportActionBar.Title  = GetString(Resource.String.dev_pair);
                DevicesListView.Adapter = pairedDevicesArrayAdapter;
                pairedDevicesArrayAdapter.Clear();

                DevicePair();
                (sender as View).Visibility = ViewStates.Gone;
                scanButton.Visibility       = ViewStates.Visible;
            };


            scanButton        = FindViewById <Button>(Resource.Id.btn_scan);
            scanButton.Click += (sender, e) =>
            {
                SupportActionBar.Title  = GetString(Resource.String.dev_search);
                DevicesListView.Adapter = newDevicesArrayAdapter;
                newDevicesArrayAdapter.Clear();

                DoDiscovery();
                (sender as View).Visibility = ViewStates.Gone;
            };

            DevicesListView.Adapter = pairedDevicesArrayAdapter;
            DevicePair();

            receiver = new DeviceDiscoveredReceiver(this, devButton);

            var filter = new IntentFilter(BluetoothDevice.ActionFound);

            RegisterReceiver(receiver, filter);

            filter = new IntentFilter(BluetoothAdapter.ActionDiscoveryFinished);
            RegisterReceiver(receiver, filter);
        }
        private void SetupBankViews(View parent)
        {
            var banksSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank);
            var banksBranchSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank_branch);

            var banks = bankRepository.GetAll().ToList();
            var bankNames = banks.Select(b => b.Name).ToList();
            var banksAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item, bankNames);
            banksSpinner.Adapter = banksAdapter;

            var bankBranchesAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item);
            banksBranchSpinner.Adapter = bankBranchesAdapter;

            banksSpinner.ItemSelected += delegate
            {
                this.bank = banks[banksSpinner.SelectedItemPosition];

                var bankBranchNames = bank.Branches.Select(b => b.Name).ToList();
                bankBranchesAdapter.Clear();
                bankBranchesAdapter.AddAll(bankBranchNames);

                banksBranchSpinner.ItemSelected += delegate
                {
                    this.bankBranch = bank.Branches[banksBranchSpinner.SelectedItemPosition];
                };
            };

            bank = banks.First();
            bankBranch = bank.Branches.First();
        }
        void Initialize()
        {
            _autoCompleteWords = new List <string>
            {
                "apple",
                "pineapple",
                "mikan",
                "ringo",
                "pear",
                "strawberry",
                "blueberry",
                "bananas"
            };

            var view = LayoutInflater.FromContext(Context).Inflate(Resource.Layout.auto_complete_edit_text, this);

            _inputField              = view.FindViewById <EditText>(Resource.Id.inputField);
            _inputField.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                SearchWord(e.Text.ToString());
                _autoCompleteArea.Visibility = ViewStates.Visible;
            };

            _autoCompleteArea = view.FindViewById <ListView>(Resource.Id.autocomplete_area);
            _adapter          = new ArrayAdapter(Context, Resource.Layout.listview_item, new List <string>());
            _adapter.SetNotifyOnChange(true);
            _autoCompleteArea.Adapter    = _adapter;
            _autoCompleteArea.ItemClick += (sender, e) =>
            {
                _inputField.Text = _autoCompleteArea.GetItemAtPosition(e.Position).ToString();
                _adapter.Clear();
                _autoCompleteArea.Visibility = ViewStates.Gone;
            };
        }
Beispiel #23
0
 private void ConfigureFilePicker()
 {
     filePicker           = new FilePicker(this);
     filePicker.Finished += (object sender, FilePicker.FinishedEventArgs e) =>
     {
         if (e.PathToFile == null)
         {
             Toast.MakeText(this, "Book adding canceled.", ToastLength.Short);
         }
         else if (e.PathToFile.StartsWith("content://"))
         {
             Toast.MakeText(this, "Couldn't get the file by this path!", ToastLength.Short).Show();
         }
         else if (System.IO.Path.GetExtension(e.PathToFile) == ".epub")
         {
             try
             {
                 library.AddBook(e.PathToFile);
                 adapter.Clear();
                 adapter.AddAll(library.GetAllBookNames());
                 adapter.NotifyDataSetChanged();
                 Toast.MakeText(this, "Parsing the book...", ToastLength.Short).Show();
             }
             catch (Exception)
             {
                 Toast.MakeText(this, "Couldn't parse the file!", ToastLength.Short).Show();
             }
         }
         else
         {
             Toast.MakeText(this, "Not an epub file!", ToastLength.Short).Show();
         }
     };
 }
Beispiel #24
0
        public View GetView(IDictionary <string, object> inputCustomProperties, MyFormHandler myFormHandler)
        {
            this.ItemsList     = new List <TypeaheadItem <object> >();
            this.MyFormHandler = myFormHandler;
            this.CustomeSource = inputCustomProperties.GetCustomProperty <object>("source");
            var adapter = new ArrayAdapter <string>(Application.Context,
                                                    Android.Resource.Layout.SimpleDropDownItem1Line, this.ItemsList.Select(a => a.Label).ToList());

            this.InputText = new MultiAutoCompleteTextView(Application.Context)
            {
                Adapter   = adapter,
                Threshold = 0
            };
            myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("EditText", this.InputText);
            this.InputText.TextChanged += async(sender, args) =>
            {
                adapter.Clear();
                var query = args.Text.ToString().Split(',').Last().Trim();
                this.ItemsList = this.CustomeSource.GetTypeaheadSource(myFormHandler, new TypeaheadRequest <object> {
                    Query = query
                })
                                 .Select(t => t.CastTObject <TypeaheadItem <object> >()).ToList();
                var data = this.ItemsList.Select(t => t.Label).ToList();

                adapter.AddAll(data);
            };

            this.InputText.SetTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
            return(this.InputText);
        }
Beispiel #25
0
        void AddMessageToList(string msg)
        {
            sentMessages.Add(msg);

            adapter.Clear();
            adapter.AddAll(sentMessages);
            adapter.NotifyDataSetChanged();
        }
Beispiel #26
0
 private void UpdateSessions()
 {
     sessionListAdapter.Clear();
     foreach (string s in Directory.GetDirectories(RootPath))
     {
         AddSessionFromDirectory(Path.GetFileName(s));
     }
 }
Beispiel #27
0
 public void LogClear()
 {
     if (_listAdapter != null)
     {
         _listAdapter.Clear();
         _listAdapter.NotifyDataSetChanged();
     }
 }
Beispiel #28
0
 void GoList(string date)
 {
     lst = File.ReadLines(filename).Where(l => l.StartsWith(date))
           .Select(l => { return(l.Substring(11)); }).ToList();
     adapt.Clear();
     adapt.AddAll(lst);
     listView.LayoutParameters.Height = (adapt.Count + 1) * 130;
     adapt.NotifyDataSetChanged();
 }
        protected async override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.NewEditPerscription);


            //intent intent = getIntent();
            //String value = intent.getStringExtra("key") to receive something from activity start
            List <string> PerscriptionNames = await GetPerscriptions();

            AutoCompleteTextView perscription = (AutoCompleteTextView)FindViewById(Resource.Id.autoCompletePerscription);

            perscriptionAdapter  = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, PerscriptionNames);
            perscription.Adapter = perscriptionAdapter;
            perscriptionAdapter.NotifyDataSetChanged();

            // handle cancel and save events they should both return to the perscriptions view
            Button cancel = FindViewById <Button>(Resource.Id.btnPerscriptionCancel);

            cancel.Click += cancelOnClick;

            Button save = FindViewById <Button>(Resource.Id.btnPerscriptionSave);

            save.Click += saveOnClick;

            // needed for interval addition
            // handling all interval logic
            intervalSelection = FindViewById <Spinner>(Resource.Id.intervalselect);
            Button addIntervals = FindViewById <Button>(Resource.Id.btnPerscriptionTime);

            ListIntervals         = FindViewById <ListView>(Resource.Id.add_intervals);
            intervalAdapter       = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, lisIntervals);
            ListIntervals.Adapter = intervalAdapter;
            Button deleteIntervals = FindViewById <Button>(Resource.Id.btnDeleteSelectedPerscriptionTime);

            intervalSelection.ItemSelected += (sender, args) =>
            {
                if ((string)((Spinner)sender).SelectedItem == "Daily")
                {
                    FindViewById <EditText>(Resource.Id.txtIntervalDate).Visibility = ViewStates.Gone;
                }
                else
                {
                    FindViewById <EditText>(Resource.Id.txtIntervalDate).Visibility = ViewStates.Visible;
                }
                intervalAdapter.Clear();
                intervalAdapter.NotifyDataSetChanged();
                FindViewById <Button>(Resource.Id.btnDeleteSelectedPerscriptionTime).Enabled = false;
            };

            ListIntervals.ChoiceMode = ChoiceMode.Multiple;
            ListIntervals.ItemClick += itemSelectedInterval;
            addIntervals.Click      += addIntervalClick;
            deleteIntervals.Click   += deleteIntervalsClick;
        }
        void SearchWord(string word)
        {
            _adapter.Clear();
            if (string.IsNullOrEmpty(word))
            {
                return;
            }

            _adapter.AddAll(_autoCompleteWords.Where(s => IsSimilerWord(word, s)).Take(MaxSuggestCount).ToList());
        }
Beispiel #31
0
        private void processResponse(String json)
        {
            Helpers.JsonMsg jsonMsg = JsonConvert.DeserializeObject <Helpers.JsonMsg>(json);

            adapter.Clear();
            adapter.AddAll(JsonConvert.DeserializeObject <List <Group> >(jsonMsg.msg));
            Toast.MakeText(
                this,
                "Wczytano twoje grupy",
                ToastLength.Long).Show();
        }
Beispiel #32
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            adapter = BluetoothAdapter.DefaultAdapter;

            if (!adapter.IsEnabled) {

                Intent enableIntent = new Intent (BluetoothAdapter.ActionRequestEnable);
                StartActivityForResult (enableIntent, REQUEST_ENABLE_BT);

            }

            SetContentView (Resource.Layout.ConnectView);

            Intent discoverIntent = new Intent (BluetoothAdapter.ActionRequestDiscoverable);
            discoverIntent.PutExtra (BluetoothAdapter.ExtraDiscoverableDuration, 0);
            StartActivity (discoverIntent);

            DoDiscovery ();

            this.pairedDevicesAA = new ArrayAdapter<string>(this, Resource.Layout.BluetoothTextView);
            newDevicesAA = new ArrayAdapter<string>(this, Resource.Layout.BluetoothTextView);

            var pairedListView = FindViewById<ListView> (Resource.Id.PairedListView);
            pairedListView.Adapter = this.pairedDevicesAA;
            pairedListView.ItemClick += DeviceListClick;

            var newListView = FindViewById<ListView> (Resource.Id.NewListView);
            newListView.Adapter = newDevicesAA;
            newListView.ItemClick += DeviceListClick;

            var refreshButton = FindViewById<Button> (Resource.Id.refresh);
            refreshButton.Click += (object sender, EventArgs e) => {

                newDevicesAA.Clear();

                DoDiscovery();
            };

            var doneButton = FindViewById<Button> (Resource.Id.DoneButton);
            doneButton.Click += (object sender, EventArgs e) => {

                Finish();
            };

            receiver = new Receiver (this);
            var filter = new IntentFilter (BluetoothDevice.ActionFound);
            RegisterReceiver (receiver, filter);

            // Register for broadcasts when discovery has finished
            filter = new IntentFilter (BluetoothAdapter.ActionDiscoveryFinished);
            RegisterReceiver (receiver, filter);

            var pairedDevices = adapter.BondedDevices;

            // If there are paired devices, add each one to the ArrayAdapter
            if (pairedDevices.Count > 0) {
                FindViewById<View> (Resource.Id.title).Visibility = ViewStates.Visible;
                foreach (var device in pairedDevices) {
                    this.pairedDevicesAA.Add (device.Name + "\n" + device.Address);
                }
            } else {
                String noDevices = Resources.GetText (Resource.String.none_paired);
                this.pairedDevicesAA.Add (noDevices);
            }
        }
Beispiel #33
0
		public void  appendSpinner (Spinner spinMasterPanel, List<string> spinnerParentItems, ArrayAdapter<string> spinnerArrayAdapter, List<string> First)	//Appending more items in the spinner
		{
			
			spinnerArrayAdapter.Clear ();
			spinnerArrayAdapter.NotifyDataSetChanged ();
			spinnerArrayAdapter.AddAll (First);
			spinnerArrayAdapter.AddAll (spinnerParentItems);
			spinnerArrayAdapter.NotifyDataSetChanged ();
		}