Beispiel #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            //Loads the assets of the application
            assets = this.Assets;

            //Get the list of currencies
            currencies           = APIMethods.GetMarkets();
            currenciesStringList = new List <string>();

            foreach (var currency in currencies)
            {
                currenciesStringList.Add(currency.MarketName);
            }

            Constants.ApiKey    = LoginData.APIKey;
            Constants.SecretKey = LoginData.SecretKey;

            base.OnCreate(savedInstanceState);

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

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

            toolbar.SetTitleTextColor(Android.Graphics.Color.White);
            SetActionBar(toolbar);
            ActionBar.Title = "Bittrex";

            //Initialise the adapter and search view
            _adapter = new SearchableAdapter(this, currenciesStringList);

            _listView         = this.FindViewById <ListView>(Resource.Id.listView);
            _listView.Adapter = _adapter;

            _listView.ItemClick += _listView_ItemClick;

            var searchView = (SearchView)FindViewById(Resource.Id.searchView);

            _searchView = searchView.JavaCast <SearchView>();

            _searchView.SetIconifiedByDefault(false);
            _searchView.SetBackgroundColor(Android.Graphics.Color.White);
            _searchView.SetQueryHint("Search currencies");

            _searchView.QueryTextChange += (s, e) => _adapter.Filter.InvokeFilter(new Java.Lang.String(e.NewText));
        }
 public CurrenciesFilter(SearchableAdapter adapter)
 {
     _adapter = adapter;
 }