Esempio n. 1
0
        private void _listView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            refreshButton.SetEnabled(true);
            refreshButton.SetVisible(true);
            _listView.Enabled   = false;
            _searchView.Enabled = false;

            isOnCurrencyFragment = true;

            //Hides the keyboard when the fragment changes
            InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            imm.HideSoftInputFromWindow(_searchView.WindowToken, 0);

            //Gets the text of the item selecxted
            var selectedItem = e.Parent.GetItemAtPosition(e.Position).ToString();

            //Creates new fragments and parses the selected currency
            orderFragment = CurrencyFragment.NewInstance(selectedItem);
            chartFragment = CurrencyChartFragment.NewInstance(selectedItem);

            currentFragment = "orders";

            // Execute a transaction, replacing any existing fragment with this one inside the frame.
            var fragmentTransaction = FragmentManager.BeginTransaction();

            fragmentTransaction.Replace(Resource.Id.fragmentContainer, orderFragment, "orderFragment");
            fragmentTransaction.AddToBackStack(null);
            fragmentTransaction.SetTransition(FragmentTransit.FragmentFade);
            fragmentTransaction.Commit();
        }
Esempio n. 2
0
        public static CurrencyFragment NewInstance(string currency)
        {
            //Parses the currency to the fragment class
            var currencyFrag = new CurrencyFragment {
                Arguments = new Bundle()
            };

            currencyFrag.Arguments.PutString("currency_string", currency);
            Currency = currency;
            return(currencyFrag);
        }
Esempio n. 3
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId == Resource.Id.menu_preferences)
            {
                StartActivity(new Android.Content.Intent(this, typeof(SettingsActivity)));
                return(base.OnOptionsItemSelected(item));
            }

            if (item.ItemId == Resource.Id.menu_refresh)
            {
                CurrencyFragment.OnMenuItemClick(this);
            }

            return(base.OnOptionsItemSelected(item));
        }