Exemple #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            accountPK   = Intent.GetIntExtra("AccountPK", 0);
            accountName = Intent.GetStringExtra("AccountName");

            // Get our button from the layout resource and attach an event to it
            mRecyclerView = FindViewById <RecyclerView>(Resource.Id.lstTransactions);

            transactions = new List <Transaction>();

            MainActivity.db.readTransactionRecords(accountPK);

            mLayoutManager = new LinearLayoutManager(this);
            mRecyclerView.SetLayoutManager(mLayoutManager);
            mLayoutManager.ScrollToPosition(transactions.Count - 1);

            transactionAdapter                = new TransactionListViewAdapter(transactions);
            transactionAdapter.ItemClick     += OnItemClick;
            transactionAdapter.ItemLongClick += OnItemLongClick;
            mRecyclerView.SetAdapter(transactionAdapter);

            //top toolbar
            var toolbar = FindViewById <Android.Widget.Toolbar>(Resource.Id.toolbar_top);

            SetActionBar(toolbar);
            ActionBar.Title = accountName;
            ActionBar.SetDisplayHomeAsUpEnabled(true); //enable the "up" button in the toolbar to navigate back

            //bottom toolbar
            var bottomToolbar = FindViewById <Android.Widget.Toolbar>(Resource.Id.toolbar_bottom);

            bottomToolbar.Title = "";
            bottomToolbar.InflateMenu(Resource.Menu.bottom_menu_transaction_list);
            bottomToolbar.MenuItemClick += (sender, e) => {
                if (e.Item.TitleFormatted.ToString() == "Add")
                {
                    var intent = new Intent(this, typeof(Add_Edit_Transaction));
                    intent.PutExtra("Type", "Add");     //inform this is a new transaction
                    intent.PutExtra("AccountPK", accountPK);
                    intent.PutExtra("AccountName", accountName);
                    StartActivity(intent);
                }
            };
        }
Exemple #2
0
        /// <summary>
        /// Provides the data adapter for the RecyclerView
        /// This simple gets all the current tracking numbers and populates the recycler
        /// </summary>
        private void TrackingNumberDataProvider()
        {
            mBarcodeScannerList = new BarcodeScannerList();
            mBarcodeScannerList.FetchUnCollected();
            mRecyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            ScrollView scrollView = FindViewById <ScrollView>(Resource.Id.scroll_view);

            // Plug in the linear layout manager:
            mLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, true);
            mLayoutManager.ScrollToPosition(0);
            mRecyclerView.SetLayoutManager(mLayoutManager);
            mRecyclerView.ScrollToPosition(0);
            // Plug in my adapter:
            mAdapter = new TrackingNumberDataAdapter(mBarcodeScannerList);
            mRecyclerView.SetAdapter(mAdapter);
            mRecyclerView.ScrollToPosition(0);
        }
Exemple #3
0
        private void SetupUI()
        {
            var title = Global.Categories[Global.CategoryScrollPosition].CategoryLbl;

            ideasList = Global.Categories[Global.CategoryScrollPosition].Items;

            Title = title;
            recyclerView.SetLayoutManager(manager);
            adapter            = new IdeaListAdapter(ideasList);
            adapter.ItemClick -= OnItemClick;
            adapter.ItemClick += OnItemClick;
            recyclerView.SetAdapter(adapter);
            manager.ScrollToPosition(Global.IdeaScrollPosition);
            adapter.StateClicked -= Adapter_StateClicked;
            adapter.StateClicked += Adapter_StateClicked;

            ShowProgress();
        }
 void Adapter_ItemsFiltered(object sender, EventArgs e)
 {
     LayoutManager.ScrollToPosition(0);
 }