Esempio n. 1
0
        void ActionBarButtonClicked(int id)
        {
            if (id == OK_BUTTON)
            {
                try
                {
                    HeaderViewListAdapter adapter     = (HeaderViewListAdapter)lvItems.Adapter;
                    CheckableItemsAdapter origAdapter = (CheckableItemsAdapter)adapter.WrappedAdapter;

                    if (origAdapter.CheckedItemIds.Count > 0)
                    {
                        _checkedItems = origAdapter.CheckedItemIds;

                        Dismiss();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("ActionBarButtonClicked SAVE_BUTTON", "ActionBarButtonClicked SAVE_BUTTON " + ex.Message);
                }
            }
            else
            if (id == CANCEL_BUTTON)
            {
                Cancel();
            }
        }
        protected override void OnCreate(Android.OS.Bundle bundle)
        {
            base.OnCreate(bundle);

            listView = FindViewById<ListView>(Resource.Id.items);            
            listView.Scroll += list_Scroll;

            adapter = ((HeaderViewListAdapter)listView.Adapter);
        }
Esempio n. 3
0
        protected override void OnCreate(Android.OS.Bundle bundle)
        {
            base.OnCreate(bundle);

            listView         = FindViewById <ListView>(Resource.Id.items);
            listView.Scroll += list_Scroll;

            adapter = ((HeaderViewListAdapter)listView.Adapter);
        }
Esempio n. 4
0
        private IListAdapter GetAdapter()
        {
            var headerInfo = GetHeaders();

            ICursor cursor = ImageAdapter.CreateCursor(Context);
            IListAdapter adapter = new ImageAdapter(Context, cursor);

            if (headerInfo != null)
            {
                adapter = new HeaderViewListAdapter(headerInfo, null, adapter);
            }

            return adapter;
        }
Esempio n. 5
0
        private IListAdapter GetAdapter()
        {
            var headerInfo = GetHeaders();

            ICursor      cursor  = ImageAdapter.CreateCursor(Context);
            IListAdapter adapter = new ImageAdapter(Context, cursor);

            if (headerInfo != null)
            {
                adapter = new HeaderViewListAdapter(headerInfo, null, adapter);
            }

            return(adapter);
        }
Esempio n. 6
0
        public ItemsSelectDialog(Activity context, int theme, TransHed header) : base(context, theme)
        {
            currentContext = context;
            transHed       = header;
            activity       = context;
            //SetTitle(context.GetString (Resource.String.miItems));
            SetContentView(Resource.Layout.dialog_item_search);

            actionBar = (RetailMobile.Fragments.ItemActionBar)((Android.Support.V4.App.FragmentActivity)activity).SupportFragmentManager.FindFragmentById(Resource.Id.ActionBarDialog1);
            actionBar.ActionButtonClicked += new RetailMobile.Fragments.ItemActionBar.ActionButtonCLickedDelegate(ActionBarButtonClicked);
            actionBar.ClearButtons();
            actionBar.AddButtonRight(OK_BUTTON, currentContext.GetString(Resource.String.btnOK), Resource.Drawable.tick_16);
            actionBar.AddButtonLeft(CANCEL_BUTTON, currentContext.GetString(Resource.String.btnClose), Resource.Drawable.close_icon64);
            actionBar.SetTitle(currentContext.GetString(Resource.String.miItems));

            lvItems         = FindViewById <ListView>(Resource.Id.lvItems);
            tbSearch        = FindViewById <EditText>(Resource.Id.tbSearch);
            tbRetVal        = FindViewById <EditText>(Resource.Id.tbRetVal);
            cbCateg1        = FindViewById <Spinner>(Resource.Id.cbCateg1);
            cbCateg2        = FindViewById <Spinner>(Resource.Id.cbCateg2);
            imgItemSelected = FindViewById <ImageView>(Resource.Id.imgItemSelected);
            btnShowImage    = FindViewById <Button>(Resource.Id.btnShowImage);

            btnShowImage.Click += new EventHandler(btnShowImage_Click);

            tbSearch.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged);
            tbRetVal.AfterTextChanged += new EventHandler <Android.Text.AfterTextChangedEventArgs>(tbSearch_AfterTextChanged);

            List <KeyValuePair <int, string> > categ1List = AddCategoryList(1);
            List <KeyValuePair <int, string> > categ2List = AddCategoryList(2);

            categ1List.Insert(0, new KeyValuePair <int, string>(0, activity.GetString(Resource.String.SpinnerAll)));
            categ2List.Insert(0, new KeyValuePair <int, string>(0, activity.GetString(Resource.String.SpinnerAll)));

            SpinnerAdapter <int, string> categ1Adapter = new SpinnerAdapter <int, string>(activity, categ1List);
            SpinnerAdapter <int, string> categ2Adapter = new SpinnerAdapter <int, string>(activity, categ2List);

            cbCateg1.Adapter       = categ1Adapter;
            cbCateg2.Adapter       = categ2Adapter;
            cbCateg1.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(cbCateg1_ItemSelected);
            cbCateg2.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(cbCateg1_ItemSelected);

            lvItems.FocusChange += new EventHandler <View.FocusChangeEventArgs>(lvItems_FocusChange);
            lvItems.AddHeaderView(context.LayoutInflater.Inflate(Resource.Layout.item_row_checkable_header, null));

            adapterItems = new CheckableItemsAdapter(activity, new ItemInfoList());
            adapterItems.ItemImageSelected += new CheckableItemsAdapter.ItemImageSelectedDelegate(ItemImageSelected);
            lvItems.Adapter = adapterItems;

            adapterItems.SingleItemSelectedEvent += () =>
            {
                _checkedItems = adapterItems.CheckedItemIds;

                Dismiss();
            };
            adapterItems.SingleItemFocusedEvent += (item) =>
            {
                TextView lblItemSelectedInfo = FindViewById <TextView>(Resource.Id.lblItemSelectedInfo);
                //ImageView imgItemSelected = FindViewById<ImageView>(Resource.Id.imgItemSelected);
                lblItemSelectedInfo.Text = item.ItemDesc;
                imgItemSelected.SetImageResource(Resource.Drawable.night);//todo
            };

            lvItems.Scroll += new EventHandler <AbsListView.ScrollEventArgs>((o, e) => {
                if (scrollLoading && e.TotalItemCount > previousTotal)
                {
                    scrollLoading = false;
                    previousTotal = e.TotalItemCount;
                    currentPage++;
                }

                if (!scrollLoading && (e.FirstVisibleItem + e.VisibleItemCount) + 10 >= e.TotalItemCount && e.TotalItemCount >= 10)
                {
//					((IScrollLoadble)lvItems.Adapter).LoadData(currentPage);
                    HeaderViewListAdapter adapter = (HeaderViewListAdapter)lvItems.Adapter;
                    IScrollLoadble origAdapter    = (IScrollLoadble)adapter.WrappedAdapter;
                    origAdapter.LoadData(currentPage);

                    scrollLoading = true;
                }
            });
        }