示例#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();
        }
示例#2
0
        public static CurrencyChartFragment NewInstance(string currency)
        {
            //Parses the currency to the fragment class
            var currencyChartFrag = new CurrencyChartFragment {
                Arguments = new Bundle()
            };

            currencyChartFrag.Arguments.PutString("currency_string", currency);
            return(currencyChartFrag);
        }